14.1.1-9 baseline

Former-commit-id: ba884f2a27 [formerly a32eadf384] [formerly f8f995b697] [formerly ba884f2a27 [formerly a32eadf384] [formerly f8f995b697] [formerly 5a0a40e67c [formerly f8f995b697 [formerly 0d10fff4b09db0e4b0b8bcf7481f5f13af0943f5]]]]
Former-commit-id: 5a0a40e67c
Former-commit-id: 7977f24d77 [formerly eab5bb1147] [formerly 1abf0e99cad9d8f5d8540c9724d2144a5aab0211 [formerly 8c136f202d]]
Former-commit-id: 7d3151fa65482d7fe7a3ae91e52a20bb86097b97 [formerly ea382798b5]
Former-commit-id: ed58bc7f71
This commit is contained in:
Steve Harris 2013-11-15 12:47:49 -05:00
parent 7facd4fe25
commit e3de9e104e
272 changed files with 7342 additions and 45877 deletions

View file

@ -34,47 +34,47 @@
# This script will kill any running AlertViz and/or Cave
# processes when a user logs off.
if [ ! -f ${HOME}/vizUtility.log ]; then
touch ${HOME}/vizUtility.log
if [ ! -f /tmp/vizUtility.log ]; then
touch /tmp/vizUtility.log
else
echo "" >> ${HOME}/vizUtility.log
echo "" > /tmp/vizUtility.log
fi
date >> ${HOME}/vizUtility.log
date >> /tmp/vizUtility.log
function findAlertvizProcesses {
# Find all the alertviz processes.
echo "Searching for alertviz processes." >> ${HOME}/vizUtility.log
echo "Searching for alertviz processes." >> /tmp/vizUtility.log
zpid=` ps u -u $USER | grep '[a]lertviz' | awk '{print $2}' `
npid=` echo $zpid | wc -w `
if [ $npid -le 0 ]
then
echo "There are no alertviz processes found." >> ${HOME}/vizUtility.log
date >> ${HOME}/vizUtility.log
echo "There are no alertviz processes found." >> /tmp/vizUtility.log
date >> /tmp/vizUtility.log
fi
}
function findAlertvizShProcesses {
# Find all the alertviz.sh processes.
echo "Searching for alertviz.sh processes." >> ${HOME}/vizUtility.log
echo "Searching for alertviz.sh processes." >> /tmp/vizUtility.log
zpid=` ps u -u $USER | grep '[a]lertviz.sh' | awk '{print $2}' `
npid=` echo $zpid | wc -w `
if [ $npid -le 0 ]
then
echo "There are no alertviz.sh processes found." >> ${HOME}/vizUtility.log
date >> ${HOME}/vizUtility.log
echo "There are no alertviz.sh processes found." >> /tmp/vizUtility.log
date >> /tmp/vizUtility.log
fi
}
function findCaveProcesses {
# Find all the Cave processes.
echo "Searching for cave processes." >> ${HOME}/vizUtility.log
echo "Searching for cave processes." >> /tmp/vizUtility.log
zpid=` ps u -u $USER | grep '[c]ave' | awk '{print $2}' `
npid=` echo $zpid | wc -w `
if [ $npid -le 0 ]
then
echo "There are no cave processes found." >> ${HOME}/vizUtility.log
date >> ${HOME}/vizUtility.log
echo "There are no cave processes found." >> /tmp/vizUtility.log
date >> /tmp/vizUtility.log
fi
}
@ -83,22 +83,22 @@ fi
findAlertvizShProcesses
for pid in $zpid
do
echo "Attempting to kill 'alertviz.sh' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'alertviz.sh' process with pid ${pid}." >> /tmp/vizUtility.log
kill ${pid} 2>> /tmp/vizUtility.log
done
findAlertvizProcesses
for pid in $zpid
do
echo "Attempting to kill 'alertviz' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'alertviz' process with pid ${pid}." >> /tmp/vizUtility.log
kill ${pid} 2>> /tmp/vizUtility.log
done
findCaveProcesses
for pid in $zpid
do
echo "Attempting to kill 'cave' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'cave' process with pid ${pid}." >> /tmp/vizUtility.log
kill ${pid} 2>> /tmp/vizUtility.log
done
@ -112,14 +112,14 @@ while [[ $npid -ne 0 && $ntoomany -ne 0 ]]
do
for pid in $zpid
do
echo "Attempting to kill 'alertviz.sh' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill -9 ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'alertviz.sh' process with pid ${pid}." >> /tmp/vizUtility.log
kill -9 ${pid} 2>> /tmp/vizUtility.log
done
npid=0
((ntoomany-=1))
if [ $ntoomany -le 1 ]
then
echo "The kill alertviz portion of this script $0 has been unable preform its duties. 02" >> ${HOME}/vizUtility.log
echo "The kill alertviz portion of this script $0 has been unable preform its duties. 02" >> /tmp/vizUtility.log
break
fi
sleep 1
@ -131,20 +131,20 @@ sleep 1
findAlertvizProcesses
for pid in $zpid
do
echo "Attempting to kill 'alertviz' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill -9 ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'alertviz' process with pid ${pid}." >> /tmp/vizUtility.log
kill -9 ${pid} 2>> /tmp/vizUtility.log
done
findCaveProcesses
for pid in $zpid
do
echo "Attempting to kill 'cave' process with pid ${pid}." >> ${HOME}/vizUtility.log
kill -9 ${pid} 2>> ${HOME}/vizUtility.log
echo "Attempting to kill 'cave' process with pid ${pid}." >> /tmp/vizUtility.log
kill -9 ${pid} 2>> /tmp/vizUtility.log
done
date >> ${HOME}/vizUtility.log
echo >> ${HOME}/vizUtility.log
date >> /tmp/vizUtility.log
echo >> /tmp/vizUtility.log

BIN
cots/org.jep.linux32/libjep.so Normal file → Executable file

Binary file not shown.

BIN
cots/org.jep.linux64/libjep.so Normal file → Executable file

Binary file not shown.

0
nativeLib/build.native/tools/compile.sh Normal file → Executable file
View file

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.so.release.1201809015.1790108260">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.release.1201809015.1790108260" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
@ -20,12 +18,12 @@
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@ -117,12 +115,12 @@
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
@ -21,12 +19,12 @@
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@ -105,12 +103,12 @@
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">

View file

@ -1 +1 @@
a86124ed46f7a16af33a87ae5ba9a1c02b870c80
8fe0a749af6fc67549da23d33fd3d63a094c1466

View file

@ -1 +1 @@
a86124ed46f7a16af33a87ae5ba9a1c02b870c80
8fe0a749af6fc67549da23d33fd3d63a094c1466

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
@ -16,12 +14,12 @@
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@ -53,7 +51,6 @@
<option id="gnu.c.link.option.paths.2097214859" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
<listOptionValue builtIn="false" value="../dependencies/lib"/>
</option>
<option id="gnu.c.link.option.libs.418689217" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
@ -125,16 +122,16 @@
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 64-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" name="Build x86_64" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="Cleanup the dependencies built during the pre-build phase." postbuildStep="rm -f ../dependencies/lib/libgrib2c.a" preannouncebuildStep="Build required libraries - currently, libgrib2c.a." prebuildStep="cd ../dependencies/src/g2clib-1.1.8; make; rm -f *.so; mv libgrib2c.a ../../lib/">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 64-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" name="Build x86_64" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1635104846" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1041170975" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
@ -149,6 +146,7 @@
<option id="gnu.c.compiler.so.debug.option.debugging.level.704921663" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1682607275" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
@ -163,13 +161,13 @@
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1668678480" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.1305955291" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
<listOptionValue builtIn="false" value="../dependencies/lib"/>
</option>
<option id="gnu.c.link.option.libs.637192993" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.1527232910" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
@ -226,6 +224,9 @@
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="grib2.cdt.managedbuild.target.gnu.so.655859878" name="Shared Library" projectType="cdt.managedbuild.target.gnu.so"/>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/ncep_grib2module"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
@ -308,6 +309,172 @@
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154;cdt.managedbuild.tool.gnu.c.compiler.input.1232393584">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410;cdt.managedbuild.tool.gnu.c.compiler.input.561992123">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.1562609919;cdt.managedbuild.tool.gnu.c.compiler.so.release.1675088759;cdt.managedbuild.tool.gnu.c.compiler.input.637960694">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
@ -724,5 +891,4 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>

View file

@ -0,0 +1,904 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 32-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" name="Build x86" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="Cleanup the dependencies built during the pre-build phase." postbuildStep="rm -f ../dependencies/lib/libgrib2c.a" preannouncebuildStep="Build required libraries - currently, libgrib2c.a." prebuildStep="cd ../dependencies/src/g2clib-1.1.8; make; rm -f *.so; mv libgrib2c.a ../../lib/">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1332136152" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1276144234" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.603311816" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1039289505" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1315508462" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.2097580104" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.700283855" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1527725912" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1289452543" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.426315830" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m32" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.1528986146" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.2138840959" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.431036435" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1065944095" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.2097214859" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
</option>
<option id="gnu.c.link.option.libs.418689217" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.838574289" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.748183945" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m32" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1018642525" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.973882586" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.588443614" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1419137420" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.2141053688" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.389950727" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.865436937" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.1039289505"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.263051518" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1547587010" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1922559145" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.426131789" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.935435237" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.591389571" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.3136280" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1432745821" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.42275028" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1329123904" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.364000891" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.1086426174" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1103050375" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" moduleId="org.eclipse.cdt.core.settings" name="Build x86_64">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86_64"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 64-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" name="Build x86_64" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1635104846" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1041170975" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.740531814" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.538901980" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1898983511" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1685387126" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1170644295" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.704921663" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1682607275" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.956488090" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m64" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.739155817" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.93516298" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__64BIT__"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1232393584" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1668678480" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.1305955291" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
</option>
<option id="gnu.c.link.option.libs.637192993" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.1527232910" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.1876692019" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m64" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1193291899" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.1999080199" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.1910881005" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1104298716" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1852675191" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1163201760" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.725616531" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.538901980"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.198452015" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1542254221" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1032550342" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1062366243" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1771133733" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.561992123" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1741389270" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.490805662" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1975699628" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.727399188" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.793619983" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.916034102" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="grib2.cdt.managedbuild.target.gnu.so.655859878" name="Shared Library" projectType="cdt.managedbuild.target.gnu.so"/>
</storageModule>
<<<<<<< HEAD
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/ncep_grib2module"/>
</storageModule>
=======
>>>>>>> master_14.1.1
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<<<<<<< HEAD
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154;cdt.managedbuild.tool.gnu.c.compiler.input.1232393584">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410;cdt.managedbuild.tool.gnu.c.compiler.input.561992123">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
=======
>>>>>>> master_14.1.1
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.1562609919;cdt.managedbuild.tool.gnu.c.compiler.so.release.1675088759;cdt.managedbuild.tool.gnu.c.compiler.input.637960694">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.275887876;cdt.managedbuild.tool.gnu.c.compiler.so.debug.24190383;cdt.managedbuild.tool.gnu.c.compiler.input.2103089487">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.;cdt.managedbuild.tool.gnu.c.compiler.so.release.1529313406;cdt.managedbuild.tool.gnu.c.compiler.input.1468063954">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1420709515;cdt.managedbuild.tool.gnu.c.compiler.input.1764183371">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.619617493;cdt.managedbuild.tool.gnu.c.compiler.so.debug.426221101;cdt.managedbuild.tool.gnu.c.compiler.input.1900393077">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<<<<<<< HEAD
=======
<storageModule moduleId="refreshScope"/>
>>>>>>> master_14.1.1
</cproject>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,894 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 32-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" name="Build x86" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="Cleanup the dependencies built during the pre-build phase." postbuildStep="rm -f ../dependencies/lib/libgrib2c.a" preannouncebuildStep="Build required libraries - currently, libgrib2c.a." prebuildStep="cd ../dependencies/src/g2clib-1.1.8; make; rm -f *.so; mv libgrib2c.a ../../lib/">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1332136152" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1276144234" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.603311816" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1039289505" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1315508462" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.2097580104" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.700283855" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1527725912" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1289452543" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.426315830" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m32" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.1528986146" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.2138840959" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.431036435" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1065944095" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.2097214859" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
</option>
<option id="gnu.c.link.option.libs.418689217" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.838574289" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.748183945" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m32" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1018642525" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.973882586" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.588443614" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1419137420" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.2141053688" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.389950727" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.865436937" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.1039289505"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.263051518" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1547587010" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1922559145" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.426131789" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.935435237" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.591389571" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.3136280" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1432745821" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.42275028" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1329123904" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.364000891" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.1086426174" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1103050375" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" moduleId="org.eclipse.cdt.core.settings" name="Build x86_64">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86_64"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 64-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" name="Build x86_64" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1635104846" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1041170975" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.740531814" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.538901980" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1898983511" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1685387126" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1170644295" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.704921663" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1682607275" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.956488090" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m64" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.739155817" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.93516298" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__64BIT__"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1232393584" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1668678480" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.1305955291" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/rary.cots.g2clib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
</option>
<option id="gnu.c.link.option.libs.637192993" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.1527232910" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.1876692019" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m64" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1193291899" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.1999080199" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.1910881005" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1104298716" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1852675191" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1163201760" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.725616531" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.538901980"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.198452015" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1542254221" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1032550342" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1062366243" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1771133733" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.561992123" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1741389270" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.490805662" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1975699628" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.727399188" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.793619983" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.916034102" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="grib2.cdt.managedbuild.target.gnu.so.655859878" name="Shared Library" projectType="cdt.managedbuild.target.gnu.so"/>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/ncep_grib2module"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154;cdt.managedbuild.tool.gnu.c.compiler.input.1232393584">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077;cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410;cdt.managedbuild.tool.gnu.c.compiler.input.561992123">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.1562609919;cdt.managedbuild.tool.gnu.c.compiler.so.release.1675088759;cdt.managedbuild.tool.gnu.c.compiler.input.637960694">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.275887876;cdt.managedbuild.tool.gnu.c.compiler.so.debug.24190383;cdt.managedbuild.tool.gnu.c.compiler.input.2103089487">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.;cdt.managedbuild.tool.gnu.c.compiler.so.release.1529313406;cdt.managedbuild.tool.gnu.c.compiler.input.1468063954">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1420709515;cdt.managedbuild.tool.gnu.c.compiler.input.1764183371">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.619617493;cdt.managedbuild.tool.gnu.c.compiler.so.debug.426221101;cdt.managedbuild.tool.gnu.c.compiler.input.1900393077">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

View file

@ -0,0 +1,728 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" moduleId="org.eclipse.cdt.core.settings" name="Build x86">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 32-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065" name="Build x86" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="Cleanup the dependencies built during the pre-build phase." postbuildStep="rm -f ../dependencies/lib/libgrib2c.a" preannouncebuildStep="Build required libraries - currently, libgrib2c.a." prebuildStep="cd ../dependencies/src/g2clib-1.1.8; make; rm -f *.so; mv libgrib2c.a ../../lib/">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1332136152" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1276144234" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.603311816" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1039289505" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1315508462" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.2097580104" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.700283855" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1527725912" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1289452543" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.426315830" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m32" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.1528986146" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.2138840959" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.431036435" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1065944095" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.2097214859" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
<listOptionValue builtIn="false" value="../dependencies/lib"/>
</option>
<option id="gnu.c.link.option.libs.418689217" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.838574289" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.748183945" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m32" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1018642525" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.973882586" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.588443614" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1419137420" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.2141053688" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.389950727" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.865436937" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.1039289505"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.263051518" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.279181418">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1547587010" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1922559145" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.426131789" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1353738802">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.935435237" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.591389571" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.3136280" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1432745821" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.1356804857">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.42275028" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1329123904" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1237850726">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.364000891" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.1086426174" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.601461730">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1103050375" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" moduleId="org.eclipse.cdt.core.settings" name="Build x86_64">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/grib2"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ncep_grib2module"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/grib2/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ncep_grib2module/Build x86_64"/>
<entry flags="RESOLVED" kind="libraryFile" name="grib2"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="grib2" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="Build the 64-bit version of grib2 and dependencies." id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077" name="Build x86_64" parent="cdt.managedbuild.config.gnu.so.debug" postannouncebuildStep="Cleanup the dependencies built during the pre-build phase." postbuildStep="rm -f ../dependencies/lib/libgrib2c.a" preannouncebuildStep="Build required libraries - currently, libgrib2c.a." prebuildStep="cd ../dependencies/src/g2clib-1.1.8; make; rm -f *.so; mv libgrib2c.a ../../lib/">
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1635104846" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1041170975" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<builder buildPath="${workspace_loc:/grib2/Debug}" id="cdt.managedbuild.target.gnu.builder.so.debug.740531814" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.538901980" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1898983511" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1685387126" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1170644295" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.704921663" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1682607275" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../dependencies/include"/>
<listOptionValue builtIn="false" value="/awips2/python/include/python2.7"/>
<listOptionValue builtIn="false" value="/awips2/python/lib/python2.7/site-packages/numpy/core/include"/>
</option>
<option id="gnu.c.compiler.option.misc.other.956488090" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fPIC -m64" valueType="string"/>
<option id="gnu.c.compiler.option.include.files.739155817" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.93516298" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__64BIT__"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1232393584" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.1668678480" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.paths.1305955291" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/build.native/i386-pc-linux-gnu/lib}&quot;"/>
<listOptionValue builtIn="false" value="/awips2/python/lib"/>
<listOptionValue builtIn="false" value="../dependencies/lib"/>
</option>
<option id="gnu.c.link.option.libs.637192993" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="python2.7"/>
<listOptionValue builtIn="false" value="jasper"/>
<listOptionValue builtIn="false" value="grib2c"/>
<listOptionValue builtIn="false" value="png"/>
</option>
<option id="gnu.c.link.option.noshared.1527232910" name="No shared libraries (-static)" superClass="gnu.c.link.option.noshared" value="false" valueType="boolean"/>
<option id="gnu.c.link.option.ldflags.1876692019" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-m64" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1193291899" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output.1999080199" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.output"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.1910881005" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1104298716" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1670804518.380995065.712907077.dependencies" name="/" resourcePath="dependencies">
<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.1852675191" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug" unusedChildren="">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.1163201760" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.725616531" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.538901980"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.198452015" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.2030849818">
<option id="gnu.cpp.compiler.so.debug.option.optimization.level.1542254221" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1032550342" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1068884410" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1072327154">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.1062366243" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.so.debug.option.debugging.level.1771133733" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.561992123" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1741389270" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug.805777003">
<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.490805662" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1975699628" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.761169598">
<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.727399188" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.793619983" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug.1720235927">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.916034102" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="dependencies" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="grib2.cdt.managedbuild.target.gnu.so.655859878" name="Shared Library" projectType="cdt.managedbuild.target.gnu.so"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.1562609919;cdt.managedbuild.tool.gnu.c.compiler.so.release.1675088759;cdt.managedbuild.tool.gnu.c.compiler.input.637960694">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.275887876;cdt.managedbuild.tool.gnu.c.compiler.so.debug.24190383;cdt.managedbuild.tool.gnu.c.compiler.input.2103089487">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.517334012;cdt.managedbuild.config.gnu.so.release.517334012.;cdt.managedbuild.tool.gnu.c.compiler.so.release.1529313406;cdt.managedbuild.tool.gnu.c.compiler.input.1468063954">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.1420709515;cdt.managedbuild.tool.gnu.c.compiler.input.1764183371">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.1670804518;cdt.managedbuild.config.gnu.so.debug.1670804518.619617493;cdt.managedbuild.tool.gnu.c.compiler.so.debug.426221101;cdt.managedbuild.tool.gnu.c.compiler.input.1900393077">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>

View file

@ -1 +1,2 @@
/Build x86
/Build x86_64

View file

@ -3,7 +3,7 @@
<name>ncep_grib2module</name>
<comment></comment>
<projects>
<project>rary.cots.jasper</project>
<project>rary.cots.g2clib</project>
</projects>
<buildSpec>
<buildCommand>

View file

@ -1,75 +0,0 @@
cnvgrib-1.0 - August 2003 - Original version
cnvgrib-1.0.1 - October 2003 - Corrected error converting level info for
"depth below land surface" from GRIB1 to GRIB2.
- Removed statement that set GRIB1 local table
version to "2".
cnvgrib-1.0.2 - May 2004 - Changed Master Table Version Number from 1 to the
current "operational" value of 2, when converting
from GRIB1 to GRIB2.
- Added support for Gaussian grids.
- Few minor bug fixes relating to:
1) ensemble params 191 and 192 (grib1 table ver 2)
2) negative pv surface values
3) radius of earth
4) # of missing values in PDS/PDT
cnvgrib-1.1.0 - January 2005 - WMO approved the JPEG2000 and PNG Data
Representation Templates ( 5.40000 and 5.40010,
respectively ) for operational use. The
templates were assigned WMO values of 5.40 and
5.41, respectively. Changes were made to the
source and to acceptable program options to
recognize either template number.
- Added new option "-m" to support encoding of
"Missing" data values within the data field when
using Data Representation Templates 5.2
(option -p2) and 5.3 (options -p31 and -p32 ).
Missing value management is an alternative to
encoding a bitmap when using DRTs 5.2 and 5.3.
- Fixed bug passing null pointers to routines
expecting a valid target. Thanks to Jaakko
Hyvatti and Portland Group.
- Added fix for bug that caused seg faults on some
systems when generating GRIB1 messages. Thanks
to Robert Shectman for this one.
cnvgrib-1.1.1 - April 2005 - Corrected the scaling factor used when converting
potential vorticity surface values.
cnvgrib-1.1.2 - January 2006
- Added a new option "-nv" to cause vector quantities
to be stored in individual GRIB messages versus
being bundled together which is the default.
cnvgrib-1.1.4 - May 2007
- Added a new Grid Definition Template number 204
- Corrected the sale factor for probabilities
- Added more parameters
- Added the Time Range indicator 51
cnvgrib-1.1.5 - Dec 2007
- Added new local parameters conversion entries
- Declared the variable rmin,rmax in routine (jpcpack.f
and pngpack.f) with double precision to fix for bug
that caused seg fault on NAM tile files
- Added a check for the length of KPDS to determine
the grib is ensemble.
- Added new level (Nominal top of the Atmosphere
cnvgrib-1.1.6 - Jan 2008
- Added new local parameters conversion entries
- Added new grid id 195 and 196
- Fixed the V-GRD By setting the LPDS(22)=-1
cnvgrib-1.1.7 - May 2008
- Add missing management value option 0 : No explicit
missing values included within data values
Note: Valid only with complex packing:
1. Complex packing
2. Complex packing and spatial differencing
cnvgrib-1.1.8 - Aug 2008
- Added new local parameters conversion entries
and table 131
- Added a new Grid Definition Template number
3.32768 (Added Rotate Lat/Lon E-grid)

View file

@ -1,56 +0,0 @@
Mar 24, 2008
W/NP11:SAG
cnvgrib utility.
This command line utility program converts every GRIB
message in the input file from one GRIB edition to another.
It currently converts GRIB1 to GRIB2, and GRIB2 to GRIB1
using WMO master tables as well as various NCEP local tables.
The cnvgrib utility requires both the w3lib and g2lib
libraries.
We have added support for PNG and JPEG2000 image compression
algorithms within the GRIB2 standard. If you would like
this converter to be able to utilize these new GRIB2 Templates,
then the g2lib must be compiled with this support enabled.
The README file included with the "g2lib" library
describes how to compile that library to support PNG and
JPEG2000, and it also lists the external libraries that
are required. These libraries, if desired, will have to linked
in when creating the cnvgrib executable.
Usage: cnvgrib [-h] {-g12|-g21|-g22} [-m|-m0] [-nv]
[{-p0|-p2|-p31|-p32|-p40|-p41}] ingribfile outgribfile
Usage: cnvgrib -h For helps and shows all options
cnvgrib: version cnvgrib-1.1.7
Must use one of the following options:
-g12 converts GRIB1 to GRIB2
-g21 converts GRIB2 to GRIB1
-g22 converts GRIB2 to GRIB2 (used to change packing option)
Optional packing options: (for use with -g12 and -g22 only)
-p0 simple packing
-p2 complex packing
-p31 complex pack with 1st order diffs
-p32 complex pack with 2nd order diffs
-p40 JPEG2000 encoding
-p41 PNG encoding
Other Optional options:
-nv Do not combine U, V wind components
Use missing value management instead of bitmap
(ONLY valid with Complex Packing options: -p2, -p31 or -p32 )
-m Primary missing values included within the data values
-m0 No explicit missing values included within the data values

View file

@ -1,377 +0,0 @@
subroutine cnv12(ifl1,ifl2,ipack,usemiss,imiss,uvvect)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: cnv12
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-11
C
C ABSTRACT: This subroutine converts every GRIB1 field in a file
C to a GRIB2 field. U and V wind component fields are combined
C into a single GRIB2 message.
C
C PROGRAM HISTORY LOG:
C 2003-06-11 Gilbert
C 2003-05-19 Gilbert - Changed Master Table Version Number from 1 to 2.
C - Added check for grib1 table version with params 191
C and 192 for ensemble probs.
C 2007-03-26 Gordon - Added check for ECMWF data to reference ECMWF
C Conversion tables.
C 2007-10-11 Vuong - Added check for ensemble probs if the kpds > 28
C 2008-01-28 Vuong - Fixed the V-GRD BY SETTING THE LPDS(22)=-1 and
C increase the array size MAXPTS
C 2008-05-14 Vuong - Add option -m0 No explicit missing values included
C within data values
C
C USAGE: CALL cnv12(ifl1,ifl2,ipack)
C INPUT ARGUMENT LIST:
C ifl1 - Fortran unit number of input GRIB1 file
C ifl2 - Fortran unit number of output GRIB2 file
C ipack - GRIB2 packing option:
C 0 = simple packing
C 2 = group packing
C 31 = group pack with 1st order differencing
C 32 = group pack with 2nd order differencing
C 40 = JPEG2000 encoding
C 40000 = JPEG2000 encoding (obsolete)
C 41 = PNG encoding
C 40010 = PNG encoding (obsolete)
C if ipack .ne. one of the values above, 31 is used as a default.
C usemiss - uses missing value management (instead of bitmaps), for use
C ipack options 2, 31, and 32.
C imiss - Missing value management:
C 0 = No explicit missing values included within data values
C 1 = Primary missing values included within data values
C uvvect - .true. = combine U and V wind components into one GRIB2 msg.
C .flase. = does not combine U and V wind components
C
C INPUT FILES: See ifl1
C
C OUTPUT FILES: See ifl2
C
C REMARKS: None
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use params
use params_ecmwf
integer,intent(in) :: ifl1,ifl2,ipack
logical,intent(in) :: usemiss,uvvect
PARAMETER (MAXPTS=40000000,msk1=32000)
CHARACTER(len=1),allocatable,dimension(:) :: cgrib,cgribin
integer KPDS(200),KGDS(200),KPTR(200)
integer LPDS(200),LGDS(200),KENS(200),LENS(200)
integer KPROB(2),KCLUST(16),KMEMBR(80)
real XPROB(2)
real,allocatable,dimension(:) :: FLD
real,allocatable,dimension(:) :: FLDV
real,allocatable,dimension(:) :: coordlist
integer :: listsec0(2)=(/0,2/),imiss
integer :: listsec1(13)=(/7,0,2,1,1,0,0,0,0,0,0,0,0/)
integer :: ideflist(MAXPTS),idefnum
integer :: igds(5)=(/0,0,0,0,0/),igdstmpl(200),ipdstmpl(200)
integer :: ipdstmplv(200)
integer :: idrstmpl(200),idrstmplv(200)
integer :: currlen=0
integer,parameter :: mingrib=500
logical :: ensemble,ecmwf
Logical*1,allocatable,dimension(:) :: bmp,bmpv
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
ICND=0
IFLI1=0
allocate(fld(maxpts))
allocate(coordlist(maxpts))
allocate(bmp(maxpts))
!
iseek=0
currlen=0
do
call skgb(ifl1,iseek,msk1,lskip,lgrib)
if (lgrib.eq.0) exit ! end loop at EOF or problem
if (lgrib.gt.currlen) then
if (allocated(cgribin)) deallocate(cgribin)
allocate(cgribin(lgrib),stat=is)
currlen=lgrib
lcgrib=lgrib*2
if (lcgrib .lt. mingrib) lcgrib=mingrib
if (allocated(cgrib)) deallocate(cgrib)
allocate(cgrib(lcgrib),stat=is)
endif
call baread(ifl1,lskip,lgrib,lengrib,cgribin)
if (lgrib.eq.lengrib) then
call w3fi63(cgribin,KPDS,KGDS,BMP,FLD,KPTR,IRET)
numpts=KPTR(10)
if (iret.ne.0) then
print *,' cnvgrib: Error unpacking GRIB field.',iret
iseek=lskip+lgrib
cycle
endif
else
print *,' cnvgrib: IO Error on input GRIB file.'
stop
cycle
endif
iseek=lskip+lgrib
!print *,'kpds:',kpds(1:28)
!print *,'kpds:',kpds(1:45)
if ((kpds(5).eq.34).AND.uvvect) cycle ! V-comp already processed with U
listsec1(1)=kpds(1)
listsec1(2)=kpds(23)
listsec1(5)=1
if (kpds(16).eq.1) listsec1(5)=0
listsec1(6)=((kpds(21)-1)*100)+kpds(8)
listsec1(7)=kpds(9)
listsec1(8)=kpds(10)
listsec1(9)=kpds(11)
listsec1(10)=kpds(12)
listsec1(13)=1
if (kpds(16).eq.1) listsec1(13)=0
ensemble=.false.
if ( (kpds(23).eq.2) .or.
& (kptr(3).gt.28 .and. kpds(19).eq.2 .and.
& (kpds(5).eq.191.or.kpds(5).eq.192) ) ) then ! ensemble forecast
ensemble=.true.
endif
if (ensemble) then ! ensemble forecast
call gbyte(cgribin(9),ilast,0,24)
call pdseup(kens,kprob,xprob,kclust,kmembr,ilast,cgribin(9))
if (kens(2).eq.1) listsec1(13)=3
if (kens(2).eq.2.OR.kens(2).eq.3) listsec1(13)=4
if (kens(2).eq.5) listsec1(13)=5
endif
ecmwf=.false.
if (kpds(1).eq.98) ecmwf=.true.
if (ecmwf) then ! treat ecmwf data conversion seperately
call param_ecmwf_g1_to_g2(kpds(5),kpds(19),listsec0(1),idum,
& jdum) ! set discipline
else
if (ensemble.and.(kpds(5).eq.191.or.kpds(5).eq.192)) then
!kprob(1)=61
call param_g1_to_g2(kprob(1),kpds(19),listsec0(1),idum,
& jdum) ! set discipline
else
call param_g1_to_g2(kpds(5),kpds(19),listsec0(1),idum,
& jdum) ! set discipline
endif
endif
call gribcreate(cgrib,lcgrib,listsec0,listsec1,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR creating new GRIB2 field = ',ierr
cycle
endif
!
!-----------------------------------------------------------------------
! convert grid info
call gds2gdt(kgds,igds,igdstmpl,idefnum,ideflist,ierr)
if (ierr.ne.0) then
cycle
endif
if (listsec1(1) .eq. 7 ) igdstmpl(1)=6 ! FOR NWS/NCEP
call addgrid(cgrib,lcgrib,igds,igdstmpl,200,ideflist,
& idefnum,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR adding GRIB2 grid = ',ierr
cycle
endif
!-----------------------------------------------------------------------
! set PDS Template
if (ensemble) then ! ensemble forecast
call pds2pdtens(kpds,kens,kprob,xprob,kclust,kmembr,
& ipdsnum,ipdstmpl,numcoord,coordlist,ierr)
else
call pds2pdt(kpds,ipdsnum,ipdstmpl,numcoord,coordlist,ierr)
endif
if (ierr.ne.0) then
cycle
endif
!-----------------------------------------------------------------------
! set bitmap flag
idrstmpl=0
if (btest(kpds(4),6)) then
ibmap=0
!fld=pack(fld,mask=bmp(1:numpts))
!itemp=count(bmp(1:numpts))
!numpts=itemp
!
! convert bitmap to "missing" values, if requested.
!
if ( (usemiss) .AND. (ipack.eq.2 .OR. ipack.eq.31 .OR.
& ipack.eq.32) ) then
ibmap=255
rmiss=minval(fld(1:numpts))
if ( rmiss .lt. -9999.0 ) then
rmiss=rmiss*10.0
else
rmiss=-9999.0
endif
do i=1,numpts
if ( .NOT. bmp(i) ) then
fld(i)=rmiss
bmp(i)=.true.
endif
enddo
idrstmpl(7)=imiss ! Missing value management
call mkieee(rmiss,idrstmpl(8),1)
endif
else
ibmap=255
idrstmpl(7)=0 ! No missing values
endif
!-----------------------------------------------------------------------
! Set DRT info ( packing info )
if ( ipack.eq.0 ) then
idrsnum=0
elseif ( ipack.eq.2 ) then
idrsnum=2
idrstmpl(6)=1 ! general group split
elseif ( ipack.eq.31.OR.ipack.eq.32 ) then
idrsnum=ipack/10
idrstmpl(6)=1 ! general group split
idrstmpl(17)=mod(ipack,10) ! order of s.d.
elseif ( ipack.eq.40 .OR. ipack.eq.41 .OR.
& ipack.eq.40000 .OR. ipack.eq.40010 ) then
idrsnum=ipack
idrstmpl(6)=0
idrstmpl(7)=255
!idrstmpl(6)=1
!idrstmpl(7)=15
else
idrsnum=3
idrstmpl(17)=1 ! order of s.d.
idrstmpl(6)=1 ! general group split
if (kpds(5).eq.61) idrsnum=2
endif
idrstmpl(2)=KPTR(19) ! binary scale
idrstmpl(3)=kpds(22) ! decimal scale
!idrstmpl(2)=-4 ! binary scale
!idrstmpl(3)=0 ! decimal scale
call addfield(cgrib,lcgrib,ipdsnum,ipdstmpl,200,
& coordlist,numcoord,idrsnum,idrstmpl,200,
& fld,numpts,ibmap,bmp,ierr)
c print *,'done with addfield'
if (ierr.ne.0) then
write(6,*) ' ERROR adding GRIB2 field = ',ierr
cycle
endif
if ((kpds(5).eq.33) .AND. uvvect) then
if (.not.allocated(fldv)) allocate(fldv(maxpts))
if (.not.allocated(bmpv)) allocate(bmpv(maxpts))
LGDS=KGDS
LENS=KENS
LPDS=KPDS
LPDS(22)=-1
LPDS(5)=34
jsrch=0
CALL GETGBE(IFL1,IFLI1,MAXPTS,jsrch,LPDS,LGDS,LENS,NUMPTSO,
* jsrch,KPDS,KGDS,KENS,BMPV,FLDV,ICND)
if (icnd.ne.0) then
write(6,*) ' ERROR READING/UNPACKING GRIB1 V = ',icnd
exit
endif
ipdstmplv=ipdstmpl
if (ecmwf) then ! treat ecmwf data conversion seperately
c print *,' param_ecmwf call 2'
call param_ecmwf_g1_to_g2(kpds(5),kpds(19),idum,
& ipdstmplv(1),ipdstmplv(2))
c print *,' done with call 2'
else
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmplv(1),
& ipdstmplv(2))
endif
! set bitmap flag
idrstmplv=0
if (btest(kpds(4),6)) then
!fldv=pack(fldv,mask=bmpv(1:numpts))
if ( ANY(bmp(1:igds(2)) .NEQV. bmpv(1:igds(2))) ) then
!print *,'SAGT: BITMAP different'
ibmap=0
! convert bitmap to "missing" values, if requested.
if ( (usemiss) .AND. (ipack.eq.2 .OR. ipack.eq.31 .OR.
& ipack.eq.32) ) then
ibmap=255
rmiss=minval(fldv(1:numpts))
if ( rmiss .lt. -9999.0 ) then
rmiss=rmiss*10.0
else
rmiss=-9999.0
endif
do i=1,numpts
if ( .NOT. bmpv(i) ) then
fldv(i)=rmiss
bmpv(i)=.true.
endif
enddo
idrstmplv(7)=imiss ! Missing values management
call mkieee(rmiss,idrstmplv(8),1)
endif
else
!print *,'SAGT: BITMAP SAME'
ibmap=254
endif
else
ibmap=255
idrstmplv(7)=0 ! No missing values
endif
! Set DRT info ( packing info )
if ( ipack.eq.0 ) then
idrsnum=0
elseif ( ipack.eq.2 ) then
idrsnum=2
idrstmplv(6)=1 ! general group split
elseif ( ipack.eq.31.OR.ipack.eq.32 ) then
idrsnum=ipack/10
idrstmplv(6)=1 ! general group split
idrstmplv(17)=mod(ipack,10) ! order of s.d.
elseif ( ipack.eq.40 .OR. ipack.eq.41 .OR.
& ipack.eq.40000 .OR. ipack.eq.40010 ) then
idrsnum=ipack
idrstmplv(6)=0
idrstmplv(7)=255
!idrstmplv(6)=1
!idrstmplv(7)=15
else
idrsnum=3
idrstmplv(17)=1 ! order of s.d.
idrstmplv(6)=1 ! general group split
if (kpds(5).eq.61) idrsnum=2
endif
idrstmplv(2)=KPTR(19) ! binary scale
idrstmplv(3)=kpds(22) ! decimal scale
!idrstmplv(2)=-4 ! binary scale
!idrstmplv(3)=0 ! decimal scale
call addfield(cgrib,lcgrib,ipdsnum,ipdstmplv,200,
& coordlist,numcoord,idrsnum,idrstmplv,200,
& fldv,numpts,ibmap,bmpv,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR adding second GRIB2 field = ',ierr
cycle
endif
endif
! End GRIB2 field
call gribend(cgrib,lcgrib,lengrib,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR ending new GRIB2 message = ',ierr
cycle
endif
! print *,' writing ',lengrib,' bytes...'
call wryte(ifl2,lengrib,cgrib)
enddo
if (allocated(cgribin)) deallocate(cgribin)
if (allocated(cgrib)) deallocate(cgrib)
if (allocated(fld)) deallocate(fld)
if (allocated(fldv)) deallocate(fldv)
if (allocated(coordlist)) deallocate(coordlist)
if (allocated(bmp)) deallocate(bmp)
if (allocated(bmpv)) deallocate(bmpv)
return
end

View file

@ -1,206 +0,0 @@
subroutine cnv21(ifl1,ifl2)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: cnv21
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-11
C
C ABSTRACT: This subroutine converts every GRIB2 field in a file
C to a GRIB1 field. If a GRIB2 message contains more than one
C data field, then each field is saved in individual GRIB1
C messages.
C
C PROGRAM HISTORY LOG:
C 2003-06-11 Gilbert
C 2008-05-14 Vuong - Add option -m0 No explicit missing values included
C within data values
C
C USAGE: CALL cnv21(ifl1,ifl2)
C INPUT ARGUMENT LIST:
C ifl1 - Fortran unit number of input GRIB2 file
C ifl2 - Fortran unit number of output GRIB1 file
C
C INPUT FILES: See ifl1
C
C OUTPUT FILES: See ifl2
C
C REMARKS: None
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use grib_mod
use params
integer,intent(in) :: ifl1,ifl2
CHARACTER(len=1),allocatable,dimension(:) :: cgrib
CHARACTER(len=8) :: ctemp
type(gribfield) :: gfld
integer,dimension(200) :: jids,jpdt,jgdt
integer :: kpds(200),kgds(200),kens(200),kprob(2)
integer :: kclust(16),kmembr(80)
integer :: currlen=0
integer :: igds(5)=(/0,0,0,0,0/)
real :: xprob(2)
logical*1,target,dimension(1) :: dummy
logical :: unpack=.true.
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
IFLI1=0
jdisc=-1
jids=-9999
jpdt=-9999
jgdt=-9999
jpdtn=-1
jgdtn=-1
!
icount=0
jskp=0
do
call getgb2(ifl1,ifli1,jskp,jdisc,jids,jpdtn,jpdt,jgdtn,jgdt,
& unpack,jskp,gfld,iret)
if ( iret.ne.0) then
if ( iret.eq.99 ) exit
print *,' getgb2 error = ',iret
cycle
!call errexit(17)
endif
icount=icount+1
!
! Ensure that cgrib array is large enough
!
newlen=4*gfld%ngrdpts
if ( newlen.gt.currlen ) then
if (allocated(cgrib)) deallocate(cgrib)
allocate(cgrib(newlen),stat=is)
currlen=newlen
endif
!
! Construct GDS
!
igds(1)=gfld%griddef
igds(2)=gfld%ngrdpts
igds(3)=gfld%numoct_opt
igds(4)=gfld%interp_opt
igds(5)=gfld%igdtnum
if ( .NOT. associated(gfld%list_opt) )
& allocate(gfld%list_opt(1))
call gdt2gds(igds,gfld%igdtmpl,gfld%num_opt,gfld%list_opt,
& kgds,igrid,iret)
if (iret.ne.0) then
print *,'cnv21: could not create gds'
cycle
endif
!print *,' SAGT: NCEP GRID: ',igrid
!
! Construct PDS
!
call makepds(gfld%discipline,gfld%idsect,gfld%ipdtnum,
& gfld%ipdtmpl,gfld%ibmap,gfld%idrtnum,
& gfld%idrtmpl,kpds,iret)
if (iret.ne.0) then
print *,'cnv21: could not create pds'
cycle
endif
kpds(3)=igrid
C
C Check for Coastal Ocean circulation and UKMET grib grid id.
C ON 388 defined grid id 238 same as grid 244
C If the process model is 45, and UK Met(74), the grid id is 2 or 45
C If the process model is 121, the grid id is 238
C If the process model is 123, the grid id is 244
C
if (kpds(1).eq.7.AND.kpds(2).eq.121) kpds(3)=238
if (kpds(1).eq.7.AND.kpds(2).eq.123) kpds(3)=244
if (kpds(1).eq.74) then
if (kpds(2).eq.45.AND.kpds(3).eq.2) kpds(3)=2
if (kpds(2).eq.15.AND.kpds(3).eq.45) kpds(3)=45
if (kpds(2).eq.45.AND.kpds(3).eq.45) kpds(3)=45
end if
!
! Construct Ensemble info, if necessary
!
if ( (gfld%ipdtnum.ge.1.AND.gfld%ipdtnum.le.6).OR.
& (gfld%ipdtnum.ge.9.AND.gfld%ipdtnum.le.14) ) then
call makepdsens(gfld%ipdtnum,gfld%ipdtmpl,kpds,kens,kprob,
& xprob,kclust,kmembr,iret)
endif
!
! If not using bit-map, must assign dummy bit-map
!
if (gfld%ibmap.ne.0 .AND. gfld%ibmap.ne.254) then
!gfld%bmap => dummy
if ( (gfld%idrtnum.eq.2 .OR. gfld%idrtnum.eq.3) .AND.
& gfld%idrtmpl(7).ne.0 ) then ! convert missings to bitmap
allocate(gfld%bmap(gfld%ngrdpts))
kpds(4)=ior(kpds(4),64)
if ( gfld%idrtmpl(7).eq.1 ) then
call rdieee(gfld%idrtmpl(8),rmiss1,1)
do i=1,gfld%ngrdpts
if ( gfld%fld(i) .eq. rmiss1 ) then
gfld%bmap(i)=.false.
else
gfld%bmap(i)=.true.
endif
enddo
endif
if ( gfld%idrtmpl(7).eq.2 ) then
call rdieee(gfld%idrtmpl(8),rmiss1,1)
call rdieee(gfld%idrtmpl(9),rmiss2,1)
do i=1,gfld%ngrdpts
if ( gfld%fld(i).eq.rmiss1 .OR.
& gfld%fld(i).eq.rmiss2) then
gfld%bmap(i)=.false.
else
gfld%bmap(i)=.true.
endif
enddo
endif
endif
if ( (gfld%idrtnum.eq.2 .OR. gfld%idrtnum.eq.3) .AND.
& gfld%idrtmpl(7).eq.0 ) then ! convert missings to bitmap
allocate(gfld%bmap(gfld%ngrdpts))
kpds(4)=ior(kpds(4),64)
call rdieee(gfld%idrtmpl(8),rmiss1,1)
if ( rmiss1 .lt. -9999.0 ) then
rmiss1=rmiss1*10.0
else
rmiss1=-9999.0
endif
do i=1,gfld%ngrdpts
if ( gfld%fld(i) .eq. rmiss1 ) then
gfld%bmap(i)=.false.
else
gfld%bmap(i)=.true.
endif
enddo
endif
endif
!
! Pack and write GRIB 1 field
!
ibs=gfld%idrtmpl(2)
!print *,'SAGT:before putgbexn'
if ( .NOT. associated(gfld%bmap) ) allocate(gfld%bmap(1))
imug=0
call putgbexn(ifl2,gfld%ngrdpts,kpds,kgds,kens,kprob,
& xprob,kclust,kmembr,ibs,imug,gfld%bmap,
& gfld%fld,iret)
!print *,'SAGT:after putgbexn'
if ( iret.ne.0) then
print *,' putgbexn error = ',iret
cycle
!call errexit(17)
endif
call gf_free(gfld)
enddo
if (allocated(cgrib)) deallocate(cgrib)
return
end

View file

@ -1,290 +0,0 @@
subroutine cnv22(ifl1,ifl2,ipack,usemiss,imiss)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: cnv22
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-11
C
C ABSTRACT: This subroutine converts every GRIB2 field in a file
C to another GRIB2 field, most likely one using a different
C packing option.
C
C PROGRAM HISTORY LOG:
C 2003-06-11 Gilbert
C 2008-05-14 Vuong - Add missing value management option 0
C
C USAGE: CALL cnv22(ifl1,ifl2,ipack,usemiss,imiss)
C INPUT ARGUMENT LIST:
C ifl1 - Fortran unit number of input GRIB2 file
C ifl2 - Fortran unit number of output GRIB2 file
C ipack - GRIB2 packing option:
C 0 = simple packing
C 2 = group packing
C 31 = group pack with 1st order differencing
C 32 = group pack with 2nd order differencing
C 40 = JPEG2000 encoding
C 40000 = JPEG2000 encoding (obsolete)
C 41 = PNG encoding
C 40010 = PNG encoding (obsolete)
C if ipack .ne. one of the values above, 31 is used as a default.
C usemiss - uses missing value management (instead of bitmaps), for use
C ipack options 2, 31, and 32.
C imiss - Missing value management:
C 0 = No explicit missing values included within data values
C 1 = Primary missing values included within data values
C
C INPUT FILES: See ifl1
C
C OUTPUT FILES: See ifl2
C
C REMARKS: None
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use grib_mod
use params
use re_alloc
integer,intent(in) :: ifl1,ifl2,ipack
logical,intent(in) :: usemiss
CHARACTER(len=1),pointer,dimension(:) :: cgrib
CHARACTER(len=8) :: ctemp
type(gribfield) :: gfld,prevfld
integer,dimension(200) :: jids,jpdt,jgdt
integer :: listsec0(2)=(/0,2/)
integer :: igds(5)=(/0,0,0,0,0/),previgds(5)
integer :: idrstmpl(200)
integer :: currlen=1000000
logical :: unpack=.true.
logical :: open_grb=.false.
logical*1,target,dimension(1) :: dummy
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
allocate(cgrib(currlen))
IFLI1=0
jdisc=-1
jids=-9999
jpdt=-9999
jgdt=-9999
jpdtn=-1
jgdtn=-1
!
npoints=0
icount=0
jskp=0
do
prevfld=gfld
call getgb2(ifl1,ifli1,jskp,jdisc,jids,jpdtn,jpdt,jgdtn,jgdt,
& unpack,jskp,gfld,iret)
if ( iret.ne.0) then
if ( iret.eq.99 ) exit
print *,' getgb2 error = ',iret
cycle
!call errexit(17)
endif
icount=icount+1
!
! Ensure that cgrib array is large enough
!
if (gfld%ifldnum == 1 ) then ! start new GRIB2 message
npoints=gfld%ngrdpts
else
npoints=npoints+gfld%ngrdpts
endif
newlen=npoints*4
if ( newlen.gt.currlen ) then
!if (allocated(cgrib)) deallocate(cgrib)
!allocate(cgrib(newlen),stat=is)
call realloc(cgrib,currlen,newlen,is)
currlen=newlen
endif
!
! Start new GRIB2 message, if necessary.
! May have to finish the current message though.
!
if (gfld%ifldnum == 1 ) then ! start new GRIB2 message
if (open_grb) then ! close previous GRIB2 message first
call gribend(cgrib,lcgrib,lengrib,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR ending new GRIB2 message = ',ierr
cycle
endif
open_grb=.false.
call wryte(ifl2,lengrib,cgrib)
endif
!
! Create new GRIB Message
!
listsec0(1)=gfld%discipline
listsec0(2)=gfld%version
call gribcreate(cgrib,lcgrib,listsec0,gfld%idsect,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR creating new GRIB2 field = ',ierr
cycle
endif
open_grb=.true.
endif
!
! Add grid to GRIB message, if previous grid in same
! message is not the same.
!
previgds=igds
igds(1)=gfld%griddef
igds(2)=gfld%ngrdpts
igds(3)=gfld%numoct_opt
igds(4)=gfld%interp_opt
igds(5)=gfld%igdtnum
if ( .NOT. associated(gfld%list_opt) )
& allocate(gfld%list_opt(1))
if (gfld%ifldnum == 1 ) then ! add grid to GRIB2 message
call addgrid(cgrib,lcgrib,igds,gfld%igdtmpl,gfld%igdtlen,
& gfld%list_opt,gfld%num_opt,ierr)
else ! check if previous grid is the same as the current
if ( gfld%igdtlen.ne.prevfld%igdtlen .OR.
& gfld%num_opt.ne.prevfld%num_opt .OR.
& any(igds.ne.previgds) .OR.
& any(gfld%igdtmpl(1:gfld%igdtlen).NE.
& prevfld%igdtmpl(1:prevfld%igdtlen)) .OR.
& any(gfld%list_opt(1:gfld%num_opt).NE.
& prevfld%list_opt(1:prevfld%num_opt)) ) then
call addgrid(cgrib,lcgrib,igds,gfld%igdtmpl,gfld%igdtlen,
& gfld%list_opt,gfld%num_opt,ierr)
endif
endif
if (ierr.ne.0) then
write(6,*) ' ERROR adding GRIB2 grid = ',ierr
cycle
endif
call gf_free(prevfld)
idrstmpl=0
!
! if usemiss is specified, change any bitmaps to
! missing value management for DRTs 5.2 and 5.3.
! OR carry on missing value management for fields
! already using it.
!
if ( usemiss .AND.
& (ipack.eq.2 .OR. ipack.eq.31 .OR. ipack.eq.32) ) then
if ( gfld%ibmap.eq.0 .OR. gfld%ibmap.eq.254) then
! change bit-map to missing value mngmt.
gfld%ibmap=255
rmiss=minval(gfld%fld(1:gfld%ngrdpts))
if ( rmiss .lt. -9999.0 ) then
rmiss=rmiss*10.0
else
rmiss=-9999.0
endif
do i=1,gfld%ngrdpts
if ( .NOT. gfld%bmap(i) ) then
gfld%fld(i)=rmiss
gfld%bmap(i)=.true.
endif
enddo
idrstmpl(7)=imiss ! Primary missing values
call mkieee(rmiss,idrstmpl(8),1)
elseif ( gfld%idrtnum.EQ.2 .OR. gfld%idrtnum.EQ.3 ) then
idrstmpl(7)=gfld%idrtmpl(7) ! Missing value mgmt
idrstmpl(8)=gfld%idrtmpl(8) ! Primary missing value
idrstmpl(9)=gfld%idrtmpl(9) ! Secondary missing value
endif
endif
!
! If converting from a field using missing value management
! in DRTs 5.2 and 5.3 to a DRT that does not support missing
! values, convert missings to a bitmap.
!
if ( (.NOT. usemiss) .AND.
& ( gfld%idrtnum.EQ.2 .OR. gfld%idrtnum.EQ.3 ) .AND.
& ( gfld%idrtmpl(7).EQ.1 .OR. gfld%idrtmpl(7).EQ.2) ) then
call rdieee(gfld%idrtmpl(8),rmissp,1)
if ( gfld%idrtmpl(7) .EQ. 2) then
call rdieee(gfld%idrtmpl(9),rmisss,1)
else
rmisss=rmissp
endif
allocate(gfld%bmap(gfld%ngrdpts))
do j=1,gfld%ngrdpts
if ( gfld%fld(j).EQ.rmissp .OR.
& gfld%fld(j).EQ.rmisss ) then
gfld%bmap(j)=.false.
else
gfld%bmap(j)=.true.
endif
enddo
gfld%ibmap=0
idrstmpl(7)=0
idrstmpl(8)=0
idrstmpl(9)=0
endif
!
! Add field to GRIB message
!
! Set DRT info ( packing info )
if ( ipack.eq.0 ) then
idrsnum=0
elseif ( ipack.eq.2 ) then
idrsnum=2
idrstmpl(6)=1
elseif ( ipack.eq.31.OR.ipack.eq.32 ) then
idrsnum=ipack/10
idrstmpl(6)=1
idrstmpl(17)=mod(ipack,10) ! order of s.d.
elseif ( ipack.eq.40 .OR. ipack.eq.41 .OR.
& ipack.eq.40000 .OR. ipack.eq.40010 ) then
idrsnum=ipack
idrstmpl(6)=0
idrstmpl(7)=255
else
idrsnum=3
idrstmpl(17)=1 ! order of s.d.
idrstmpl(6)=1 ! general group split
ctemp=param_get_abbrev(gfld%discipline,gfld%ipdtmpl(1),
& gfld%ipdtmpl(2))
if (ctemp.eq.'A PCP ') idrsnum=2
endif
idrstmpl(2)=gfld%idrtmpl(2)
idrstmpl(3)=gfld%idrtmpl(3)
if ( .NOT. associated(gfld%coord_list) )
& allocate(gfld%coord_list(1))
if ( gfld%ibmap.ne.0 .AND. gfld%ibmap.ne.254) then
if ( .NOT. associated(gfld%bmap) ) allocate(gfld%bmap(1))
endif
!
! Add field to GRIB message
!
call addfield(cgrib,lcgrib,gfld%ipdtnum,gfld%ipdtmpl,
& gfld%ipdtlen,gfld%coord_list,gfld%num_coord,
& idrsnum,idrstmpl,200,
& gfld%fld,gfld%ngrdpts,gfld%ibmap,gfld%bmap,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR adding GRIB2 field = ',ierr
cycle
endif
enddo
if (open_grb) then ! close last GRIB2 message
call gribend(cgrib,lcgrib,lengrib,ierr)
if (ierr.ne.0) then
write(6,*) ' ERROR ending new GRIB2 message = ',ierr
if (associated(cgrib)) deallocate(cgrib)
call gf_free(gfld)
call gf_free(prevfld)
return
endif
open_grb=.false.
call wryte(ifl2,lengrib,cgrib)
endif
if (associated(cgrib)) deallocate(cgrib)
call gf_free(gfld)
call gf_free(prevfld)
return
end

View file

@ -1,157 +0,0 @@
subroutine cnvgrib(gfilein, gfileout)
C$$$ MAIN PROGRAM DOCUMENTATION BLOCK
C
C MAIN PROGRAM: cnvgrib
C PRGMMR: Gilbert ORG: NP11 DATE: 2003-06-06
C
C ABSTRACT: This program converts every GRIB field in a file from
C (1) GRIB1 to GRIB2 (2) GRIB2 to GRIB1 or (3) GRIB2 to GRIB2.
C
C PROGRAM HISTORY LOG:
C 2003-06-06 Gilbert
C 2008-05-14 Vuong Added the option -m0 (No explicit missing values
C included within the datavalues, modified the options
C and help messages
C
C USAGE: CALL usage(gfilein, gfileout)
C INPUT ARGUMENT LIST:
C gfilein - ouput option:
C 1 = print description of arguments
C otherwise, print command usage summary
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
integer :: inver=0,outver=0,ipack=-1
character(len=500) :: gfilein,gfileout,copt
INTEGER(4) NARG,IARGC
logical :: usemiss=.false., uvvect=.true.
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inver=1
outver=2
ipack=0
uvvect=.false.
imiss=0
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! Open input and output grib files
!
IFL1=10
IFL2=50
NCGB=LEN_TRIM(gfilein)
CALL BAOPENR(ifl1,gfilein(1:NCGB),IOS)
if (IOS.NE.0) then
call errmsg('cnvgrib: cannot open input GRIB file '//
& gfilein(1:NCGB))
call errexit(3)
endif
NCGB=LEN_TRIM(gfileout)
CALL BAOPENW(ifl2,gfileout(1:NCGB),IOS)
if (IOS.NE.0) then
call errmsg('cnvgrib: cannot open output GRIB file '//
& gfileout(1:NCGB))
call errexit(4)
endif
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! convert grib file
!
if ((inver.eq.1).AND.(outver.eq.2)) then
call cnv12(ifl1,ifl2,ipack,usemiss,imiss,uvvect)
elseif ((inver.eq.2).AND.(outver.eq.1)) then
call cnv21(ifl1,ifl2)
elseif ((inver.eq.2).AND.(outver.eq.2)) then
call cnv22(ifl1,ifl2,ipack,usemiss,imiss)
else
print *,' Unknown conversion option.'
call errexit(5)
endif
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! close grib files
!
CALL BACLOSE(ifl1,IOS)
CALL BACLOSE(ifl2,IOS)
end
subroutine usage(iopt)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: usage
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-06
C
C ABSTRACT: This routine prints out the command "usage"
C or a brief description of the command line options.
C
C PROGRAM HISTORY LOG:
C 2003-06-06 Gilbert
C 2007-04-25 Vuong - Changed the cnvgrib_ver
C 2008-08-12 Vuong - Changed the cnvgrib_ver
C
C USAGE: CALL usage(iopt)
C INPUT ARGUMENT LIST:
C iopt - ouput option:
C 1 = print description of arguments
C otherwise, print command usage summary
C
C REMARKS: None
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
character(len=15) :: cnvgrib_ver="cnvgrib-1.1.8"
integer,intent(in) :: iopt
if ( iopt.eq.0 ) then
call errmsg (' ')
call errmsg('Usage: cnvgrib [-h] {-g12|-g21|-g22} [-m|-m0]'//
& ' [-nv]')
call errmsg(' [{-p0|-p2|-p31|-p32|-p40'//
& '|-p41}] ingribfile outgribfile')
call errmsg (' ')
call errmsg('Usage: cnvgrib -h For helps and shows all'//
& ' options')
call errmsg (' ')
endif
if ( iopt.eq.1 ) then
call errmsg (' ')
call errmsg('cnvgrib: version '//cnvgrib_ver)
call errmsg (' ')
call errmsg('Must use one of the following options:')
call errmsg(' -g12 converts GRIB1 to GRIB2')
call errmsg(' -g21 converts GRIB2 to GRIB1')
call errmsg(' -g22 converts GRIB2 to GRIB2 '//
& ' (used to change packing option)')
call errmsg (' ')
call errmsg('Optional packing options: (for use with '//
& ' -g12 and -g22 only)')
call errmsg(' -p0 simple packing')
call errmsg(' -p2 complex packing')
call errmsg(' -p31 complex pack with 1st order diffs')
call errmsg(' -p32 complex pack with 2nd order diffs')
call errmsg(' -p40 JPEG2000 encoding')
call errmsg(' -p41 PNG encoding')
call errmsg (' ')
call errmsg('Other Optional options: ')
call errmsg(' -nv Do not combine U, V wind components')
call errmsg (' ')
call errmsg(' Use missing value management'//
& ' instead of bitmap')
call errmsg(' (ONLY valid with Complex Packing options:'//
& ' -p2, -p31 or -p32 )')
call errmsg (' ')
call errmsg(' -m Primary missing values'//
& ' included within the data values')
call errmsg(' -m0 No explicit missing values'//
& ' included within the data values')
call errmsg (' ')
endif
return
end

View file

@ -1,360 +0,0 @@
subroutine gds2gdt(kgds,igds,igdstmpl,idefnum,ideflist,iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: gds2gdt
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-17
C
C ABSTRACT: This routine converts a GRIB1 GDS ( in format specfied in
C w3fi63.f) to necessary info for a GRIB2 Grid Definition Section.
C
C PROGRAM HISTORY LOG:
C 2003-06-17 Gilbert
C 2004-04-27 Gilbert - Added support for Gaussian grids.
C 2007-04-16 Vuong - Added Curvilinear Orthogonal grids.
C 2007-05-29 Vuong - Added Rotate Lat/Lon E-grid (203)
C
C USAGE: CALL gds2gdt(kgds,igds,igdstmpl,idefnum,ideflist,iret)
C INPUT ARGUMENT LIST:
C kgds() - GRIB1 GDS info as returned by w3fi63.f
C
C OUTPUT ARGUMENT LIST: (INCLUDING WORK ARRAYS)
C igds() - Contains information read from the appropriate GRIB Grid
C Definition Section 3 for the field being returned.
C Must be dimensioned >= 5.
C igds(1)=Source of grid definition (see Code Table 3.0)
C igds(2)=Number of grid points in the defined grid.
C igds(3)=Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C igds(4)=Interpretation of list for optional points
C definition. (Code Table 3.11)
C igds(5)=Grid Definition Template Number (Code Table 3.1)
C igdstmpl() - Grid Definition Template values for GDT 3.igds(5)
C idefnum - The number of entries in array ideflist.
C i.e. number of rows ( or columns )
C for which optional grid points are defined.
C ideflist() - Optional integer array containing
C the number of grid points contained in each row (or column).
C iret - Error return value:
C 0 = Successful
C 1 = Unrecognized GRIB1 grid data representation type
C
C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION
C
C ATTRIBUTES:
C LANGUAGE: INDICATE EXTENSIONS, COMPILER OPTIONS
C MACHINE: IBM SP
C
C$$$
!
integer,intent(in) :: kgds(*)
integer,intent(out) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: idefnum,iret
iret=0
if (kgds(1).eq.0) then ! Lat/Lon grid
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=0 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) !Ni
igdstmpl(9)=kgds(3) !Nj
igdstmpl(10)=0
igdstmpl(11)=0
igdstmpl(12)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(13)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(13)=kgds(5)*1000
endif
igdstmpl(14)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(14)=48
if ( btest(kgds(6),3) ) igdstmpl(14)=igdstmpl(14)+8
igdstmpl(15)=kgds(7)*1000 ! Lat of last grid point
if ( kgds(8).lt.0 ) then ! Lon of last grid point
igdstmpl(16)=(360000+kgds(8))*1000 ! convert W to E
else
igdstmpl(16)=kgds(8)*1000
endif
igdstmpl(17)=kgds(9)*1000 ! Di
igdstmpl(18)=kgds(10)*1000 ! Dj
igdstmpl(19)=kgds(11) ! Scanning mode
if (kgds(20).ne.255) then ! irregular grid (eg WAFS)
igds(2)=kgds(21) ! num of grid points
!idefnum=kgds(19)
if (kgds(2).eq.65535) idefnum=kgds(3)
if (kgds(3).eq.65535) idefnum=kgds(2)
imax=0
do j=1,idefnum
ideflist(j)=kgds(21+j)
if (ideflist(j).gt.imax) imax=ideflist(j)
enddo
igds(3)=1 ! octets for further grid definition
if (imax.gt.255) igds(3)=2
if (imax.gt.65535) igds(3)=3
if (imax.gt.16777215) igds(3)=4
igds(4)=1 ! interpretation of optional list
igdstmpl(8)=-1
igdstmpl(17)=-1
endif
elseif (kgds(1).eq.1) then ! Mercator grid
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=10 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) ! Ni
igdstmpl(9)=kgds(3) ! Nj
igdstmpl(10)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(11)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(11)=kgds(5)*1000
endif
igdstmpl(12)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(12)=48
if ( btest(kgds(6),3) ) igdstmpl(12)=igdstmpl(12)+8
igdstmpl(13)=kgds(9)*1000 ! Lat intersects earth
igdstmpl(14)=kgds(7)*1000 ! Lat of last grid point
if ( kgds(8).lt.0 ) then ! Lon of last grid point
igdstmpl(15)=(360000+kgds(8))*1000 ! convert W to E
else
igdstmpl(15)=kgds(8)*1000
endif
igdstmpl(16)=kgds(11) ! Scanning mode
igdstmpl(17)=0 ! Orientation of grid
igdstmpl(18)=kgds(12)*1000 ! Di
igdstmpl(19)=kgds(13)*1000 ! Dj
elseif (kgds(1).eq.3) then ! Lambert Conformal Grid
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=30 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) ! Nx
igdstmpl(9)=kgds(3) ! Ny
igdstmpl(10)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(11)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(11)=kgds(5)*1000
endif
igdstmpl(12)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(12)=48
if ( btest(kgds(6),3) ) igdstmpl(12)=igdstmpl(12)+8
igdstmpl(13)=kgds(12)*1000 ! Lat where Dx and Dy specified
if ( kgds(7).lt.0 ) then ! Lon of orientation
igdstmpl(14)=(360000+kgds(7))*1000 ! convert W to E
else
igdstmpl(14)=kgds(7)*1000
endif
igdstmpl(15)=kgds(8)*1000 ! Dx
igdstmpl(16)=kgds(9)*1000 ! Dy
igdstmpl(17)=kgds(10) ! Projection Center Flag
igdstmpl(18)=kgds(11) ! Scanning mode
igdstmpl(19)=kgds(12)*1000 ! Latin 1
igdstmpl(20)=kgds(13)*1000 ! Latin 2
igdstmpl(21)=kgds(14)*1000 ! Lat of S. Pole of projection
if ( kgds(15).lt.0 ) then ! Lon of S. Pole of projection
igdstmpl(22)=(360000+kgds(15))*1000 ! convert W to E
else
igdstmpl(22)=kgds(15)*1000
endif
elseif (kgds(1).eq.4) then ! Gaussian Lat/Lon grid
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=40 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) !Ni
igdstmpl(9)=kgds(3) !Nj
igdstmpl(10)=0
igdstmpl(11)=0
igdstmpl(12)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(13)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(13)=kgds(5)*1000
endif
igdstmpl(14)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(14)=48
if ( btest(kgds(6),3) ) igdstmpl(14)=igdstmpl(14)+8
igdstmpl(15)=kgds(7)*1000 ! Lat of last grid point
if ( kgds(8).lt.0 ) then ! Lon of last grid point
igdstmpl(16)=(360000+kgds(8))*1000 ! convert W to E
else
igdstmpl(16)=kgds(8)*1000
endif
igdstmpl(17)=kgds(9)*1000 ! Di
igdstmpl(18)=kgds(10) ! D - Number of parallels
igdstmpl(19)=kgds(11) ! Scanning mode
elseif (kgds(1).eq.5) then ! Polar Stereographic Grid
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=20 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) ! Nx
igdstmpl(9)=kgds(3) ! Ny
igdstmpl(10)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(11)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(11)=kgds(5)*1000
endif
igdstmpl(12)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(12)=48
if ( btest(kgds(6),3) ) igdstmpl(12)=igdstmpl(12)+8
igdstmpl(13)=60000000 ! Lat where Dx and Dy specified
if ( btest(kgds(10),7) ) igdstmpl(13)=-60000000
if ( kgds(7).lt.0 ) then ! Lon of orientation
igdstmpl(14)=(360000+kgds(7))*1000 ! convert W to E
else
igdstmpl(14)=kgds(7)*1000
endif
igdstmpl(15)=kgds(8)*1000 ! Dx
igdstmpl(16)=kgds(9)*1000 ! Dy
igdstmpl(17)=kgds(10) ! Projection Center Flag
igdstmpl(18)=kgds(11) ! Scanning mode
elseif (kgds(1).eq.204) then ! Curivilinear Orthogonal Grid (Used by RTOFS)
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=204 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) !Ni - No of points along x-grid direction
igdstmpl(9)=kgds(3) !Nj - No of points along y-grid direction
igdstmpl(10)=0
igdstmpl(11)=0
igdstmpl(12)=0
igdstmpl(13)=0
igdstmpl(14)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(14)=48
if ( btest(kgds(6),3) ) igdstmpl(14)=igdstmpl(14)+8
igdstmpl(15)=0
igdstmpl(16)=0
igdstmpl(17)=0
igdstmpl(18)=0
igdstmpl(19)=kgds(11) ! Scanning mode
elseif (kgds(1).eq.203) then ! Rot Lat/Lon grid (Arakawa)
idefnum=0
igds(1)=0 ! grid def specfied in template
igds(2)=kgds(2)*kgds(3) ! num of grid points
igds(3)=0 ! octets for further grid definition
igds(4)=0 ! interpretation of optional list
igds(5)=32768 ! Grid Definition Template number
if ( btest(kgds(6),6) ) then ! shape of Earth
igdstmpl(1)=2
else
igdstmpl(1)=0
endif
igdstmpl(2)=0
igdstmpl(3)=0
igdstmpl(4)=0
igdstmpl(5)=0
igdstmpl(6)=0
igdstmpl(7)=0
igdstmpl(8)=kgds(2) !Ni
igdstmpl(9)=kgds(3) !Nj
igdstmpl(10)=0
igdstmpl(11)=0
igdstmpl(12)=kgds(4)*1000 ! Lat of 1st grid point
if ( kgds(5).lt.0 ) then ! Lon of 1st grid point
igdstmpl(13)=(360000+kgds(5))*1000 ! convert W to E
else
igdstmpl(13)=kgds(5)*1000
endif
igdstmpl(14)=0 ! Resolution and Component flags
if ( btest(kgds(6),7) ) igdstmpl(14)=48
if ( btest(kgds(6),3) ) igdstmpl(14)=igdstmpl(14)+8
igdstmpl(15)=kgds(7)*1000 ! Lat of last grid point
if ( kgds(8).lt.0 ) then ! Lon of last grid point
igdstmpl(16)=(360000+kgds(8))*1000 ! convert W to E
else
igdstmpl(16)=kgds(8)*1000
endif
igdstmpl(17)=kgds(9)*1000 ! Di
igdstmpl(18)=kgds(10)*1000 ! Dj
igdstmpl(19)=kgds(11) ! Scanning mode
else
Print *,'gds2gdt: Unrecognized GRIB1 Grid type = ',kgds(1)
iret=1
endif
return
end

View file

@ -1,362 +0,0 @@
subroutine gdt2gds(igds,igdstmpl,idefnum,ideflist,kgds,
& igrid,iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: gdt2gds
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-17
C
C ABSTRACT: This routine converts grid information from a GRIB2
C Grid Description Section as well as its
C Grid Definition Template to GRIB1 GDS info. In addition,
C a check is made to determine if the grid is an NCEP
C predefined grid.
C
C PROGRAM HISTORY LOG:
C 2003-06-17 Gilbert
C 2004-04-27 Gilbert - Added support for gaussian grids.
C 2007-04-16 Vuong - Added Curvilinear Orthogonal grids.
C 2007-05-29 Vuong - Added Rotate Lat/Lon E-grid (203)
C
C USAGE: CALL gdt2gds(igds,igdstmpl,idefnum,ideflist,kgds,igrid,iret)
C INPUT ARGUMENT LIST:
C igds() - Contains information read from the appropriate GRIB Grid
C Definition Section 3 for the field being returned.
C Must be dimensioned >= 5.
C igds(1)=Source of grid definition (see Code Table 3.0)
C igds(2)=Number of grid points in the defined grid.
C igds(3)=Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C igds(4)=Interpretation of list for optional points
C definition. (Code Table 3.11)
C igds(5)=Grid Definition Template Number (Code Table 3.1)
C igdstmpl() - Grid Definition Template values for GDT 3.igds(5)
C idefnum - The number of entries in array ideflist.
C i.e. number of rows ( or columns )
C for which optional grid points are defined.
C ideflist() - Optional integer array containing
C the number of grid points contained in each row (or column).
C
C OUTPUT ARGUMENT LIST: (INCLUDING WORK ARRAYS)
C kgds() - GRIB1 GDS as described in w3fi63 format.
C igrid - NCEP predefined GRIB1 grid number
C set to 255, if not NCEP grid
C iret - Error return value:
C 0 = Successful
C 1 = Unrecognized GRIB2 GDT number 3.igds(5)
C
C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION
C
C ATTRIBUTES:
C LANGUAGE: INDICATE EXTENSIONS, COMPILER OPTIONS
C MACHINE: IBM SP
C
C$$$
!
integer,intent(in) :: idefnum
integer,intent(in) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: kgds(*),igrid,iret
integer :: kgds72(200),kgds71(200),idum(200),jdum(200)
iret=0
if (igds(5).eq.0) then ! Lat/Lon grid
kgds(1)=0
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18)/1000 ! Dj
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
elseif (igds(5).eq.10) then ! Mercator grid
kgds(1)=1 ! Grid Definition Template number
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(15)/1000 ! Long of last grid point
kgds(9)=igdstmpl(13)/1000 ! Lat intersects earth
kgds(10)=0
kgds(11)=igdstmpl(16) ! Scanning mode
kgds(12)=igdstmpl(18)/1000 ! Di
kgds(13)=igdstmpl(19)/1000 ! Dj
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.30) then ! Lambert Conformal Grid
kgds(1)=3
kgds(2)=igdstmpl(8) ! Nx
kgds(3)=igdstmpl(9) ! Ny
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lon of orientation
kgds(8)=igdstmpl(15)/1000 ! Dx
kgds(9)=igdstmpl(16)/1000 ! Dy
kgds(10)=igdstmpl(17) ! Projection Center Flag
kgds(11)=igdstmpl(18) ! Scanning mode
kgds(12)=igdstmpl(19)/1000 ! Lat in 1
kgds(13)=igdstmpl(20)/1000 ! Lat in 2
kgds(14)=igdstmpl(21)/1000 ! Lat of S. Pole of projection
kgds(15)=igdstmpl(22)/1000 ! Lon of S. Pole of projection
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.40) then ! Gaussian Lat/Lon grid
kgds(1)=4
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18) ! N - Number of parallels
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.20) then ! Polar Stereographic Grid
kgds(1)=5
kgds(2)=igdstmpl(8) ! Nx
kgds(3)=igdstmpl(9) ! Ny
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lon of orientation
kgds(8)=igdstmpl(15)/1000 ! Dx
kgds(9)=igdstmpl(16)/1000 ! Dy
kgds(10)=igdstmpl(17) ! Projection Center Flag
kgds(11)=igdstmpl(18) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.204) then ! Curvilinear Orthogonal
kgds(1)=204
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=0
kgds(5)=0
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=0
kgds(8)=0
kgds(9)=0
kgds(10)=0
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
elseif (igds(5).eq.32768) then ! Rotate Lat/Lon grid
kgds(1)=0 ! Arakawa Staggerred E/B grid
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18)/1000 ! Dj
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
else
Print *,'gdt2gds: Unrecognized GRIB2 GDT = 3.',igds(5)
iret=1
kgds(1:22)=0
return
endif
!
! Can we determine NCEP grid number ?
!
igrid=255
do j=254,1,-1
!do j=225,225
kgds71=0
kgds72=0
call w3fi71(j,kgds71,ierr)
if ( ierr.ne.0 ) cycle
! convert W to E for longitudes
if ( kgds71(3).eq.0 ) then ! lat/lon
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.1 ) then ! mercator
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.3 ) then ! lambert conformal
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(9).lt.0 ) kgds71(9)=360000+kgds71(9)
if ( kgds71(18).lt.0 ) kgds71(18)=360000+kgds71(18)
elseif ( kgds71(3).eq.4 ) then ! Guassian lat/lon
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.5 ) then ! polar stereographic
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(9).lt.0 ) kgds71(9)=360000+kgds71(9)
endif
call r63w72(idum,kgds,jdum,kgds72)
if ( kgds72(3).eq.3 ) kgds72(14)=0 ! lambert conformal fix
if ( kgds72(3).eq.1 ) kgds72(15:18)=0 ! mercator fix
if ( kgds72(3).eq.5 ) kgds72(14:18)=0 ! polar str fix
c print *,' kgds71(',j,')= ', kgds71(1:30)
c print *,' kgds72 = ', kgds72(1:30)
if ( all(kgds71.eq.kgds72) ) then
igrid=j
return
endif
enddo
return
end

View file

@ -1,59 +0,0 @@
SHELL=/bin/sh
#
SRCS= gds2gdt.f pds2pdt.f pds2pdtens.f cnvgrib.f cnv12.f cnv22.f \
cnv21.f gdt2gds.f makepds.f putgbexn.f makepdsens.f setbit.f
OBJS= gds2gdt.o pds2pdt.o pds2pdtens.o cnvgrib.o cnv12.o cnv22.o \
cnv21.o gdt2gds.o makepds.o putgbexn.o makepdsens.o setbit.o
# Tunable parameters
#
# FC Name of the fortran compiling system to use
# LDFLAGS Flags to the loader
# LIBS List of libraries
# CMD Name of the executable
# PROFLIB Library needed for profiling
#
FC = gfortran
LDFLAGS =
#LDFLAGS = -pg
INC = -I . -I/home/brockwoo/workspace/ncepLib/org.ncep.grib/include -I/home/brockwoo/workspace/ncepLib/org.ncep.grib/src/g2lib-1.1.8
LIBS = -L/home/brockwoo/workspace/ncepLib/org.ncep.grib/lib -L/common/brockwoo/awips/lib -lg2 -lw3 -ljasper -lpng -lz
CMD = libcnvgrib.so
PROFLIB = -lprof
# To perform the default compilation, use the first line
# To compile with flowtracing turned on, use the second line
# To compile giving profile additonal information, use the third line
# WARNING: SIMULTANEOUSLY PROFILING AND FLOWTRACING IS NOT RECOMMENDED
#FFLAGS = -O3 -pg -qrealsize=4 $(INC)
FFLAGS = -g $(INC) -O2 -fPIC
#FFLAGS = -F
#FFLAGS = -Wf"-ez"
# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build a.out.
#
all: $(CMD)
$(CMD): $(OBJS)
$(FC) $(LDFLAGS) -shared -fPIC -o $(@) $(OBJS) $(LIBS)
#$(CMD): $(OBJS)
# $(FC) $(LDFLAGS) -shared -o lib$(@).so $(OBJS) $(LIBS)
# Make the profiled version of the command and call it a.out.prof
#
$(CMD).prof: $(OBJS)
$(FC) $(LDFLAGS) -shared -o lib$(@).so $(OBJS) $(PROFLIB) $(LIBS)
clean:
-rm -f $(OBJS)
clobber: clean
-rm -f $(CMD) $(CMD).prof
void: clobber
-rm -f $(SRCS) makefile

View file

@ -1,59 +0,0 @@
SHELL=/bin/sh
#
SRCS= gds2gdt.f pds2pdt.f pds2pdtens.f cnvgrib.f cnv12.f cnv22.f \
cnv21.f gdt2gds.f makepds.f putgbexn.f makepdsens.f setbit.f
OBJS= gds2gdt.o pds2pdt.o pds2pdtens.o cnvgrib.o cnv12.o cnv22.o \
cnv21.o gdt2gds.o makepds.o putgbexn.o makepdsens.o setbit.o
# Tunable parameters
#
# FC Name of the fortran compiling system to use
# LDFLAGS Flags to the loader
# LIBS List of libraries
# CMD Name of the executable
# PROFLIB Library needed for profiling
#
FC = gfortran
LDFLAGS =
#LDFLAGS = -pg
INC = -I . -I/home/brockwoo/workspace/ncepLib/org.ncep.grib/include -I/home/brockwoo/workspace/ncepLib/org.ncep.grib/src/g2lib-1.1.8
LIBS = -L/home/brockwoo/workspace/ncepLib/org.ncep.grib/lib -lg2 -lw3 -ljasper -lpng -lz
CMD = cnvgrib
PROFLIB = -lprof
# To perform the default compilation, use the first line
# To compile with flowtracing turned on, use the second line
# To compile giving profile additonal information, use the third line
# WARNING: SIMULTANEOUSLY PROFILING AND FLOWTRACING IS NOT RECOMMENDED
#FFLAGS = -O3 -pg -qrealsize=4 $(INC)
FFLAGS = -g $(INC) -O2
#FFLAGS = -F
#FFLAGS = -Wf"-ez"
# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build a.out.
#
all: $(CMD)
$(CMD): $(OBJS)
$(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
#$(CMD): $(OBJS)
# $(FC) $(LDFLAGS) -shared -o lib$(@).so $(OBJS) $(LIBS)
# Make the profiled version of the command and call it a.out.prof
#
$(CMD).prof: $(OBJS)
$(FC) $(LDFLAGS) -shared -o lib$(@).so $(OBJS) $(PROFLIB) $(LIBS)
clean:
-rm -f $(OBJS)
clobber: clean
-rm -f $(CMD) $(CMD).prof
void: clobber
-rm -f $(SRCS) makefile

View file

@ -1,399 +0,0 @@
subroutine makepds(idisc,idsect,ipdsnum,ipdstmpl,ibmap,
& idrsnum,idrstmpl,kpds,iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: makepds
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: This routine creates a GRIB1 PDS (Section 1)
C from appropriate information from a GRIB2 Product Definition Template.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C 2005-04-19 Gilbert - Changed scaling factor used with potential
C vorticity surfaces.
C 2007-05-08 VUONG - Add Product Definition Template entries
C 120 - Ice Concentration Analysis
C 121 - Western North Atlantic Regional Wave Model
C 122 - Alaska Waters Regional Wave Model
C 123 - North Atlantic Hurricane Wave Model
C 124 - Eastern North Pacific Regional Wave Model
C 131 - Great Lake Wave Model
C 88 - NOAA Wave Watch III (NWW3)
C 45 - Coastal Ocean Circulation
C 47 - HYCOM - North Pacific basin
C 2007-05-14 Boi Vuong - Added Time Range Indicator 51 (Climatological
C Mean Value)
C 2007-10-24 Boi Vuong - Added level 8 (Nominal top of atmosphere)
C
C USAGE: CALL makepds(idisc,idsect,ipdsnum,ipdstmpl,ibmap,
C idrsnum,idrstmpl,kpds,iret)
C INPUT ARGUMENT LIST:
C idisc - GRIB2 discipline from Section 0.
C idsect() - GRIB2 Section 1 info.
C idsect(1)=Id of orginating centre (Common Code Table C-1)
C idsect(2)=Id of orginating sub-centre (local table)
C idsect(3)=GRIB Master Tables Version Number (Code Table 1.0)
C idsect(4)=GRIB Local Tables Version Number (Code Table 1.1)
C idsect(5)=Significance of Reference Time (Code Table 1.2)
C idsect(6)=Reference Time - Year (4 digits)
C idsect(7)=Reference Time - Month
C idsect(8)=Reference Time - Day
C idsect(9)=Reference Time - Hour
C idsect(10)=Reference Time - Minute
C idsect(11)=Reference Time - Second
C idsect(12)=Production status of data (Code Table 1.3)
C idsect(13)=Type of processed data (Code Table 1.4)
C ipdsnum - GRIB2 Product Definition Template Number
C ipdstmpl() - GRIB2 Product Definition Template entries for PDT 4.ipdsnum
C ibmap - GRIB2 bitmap indicator from octet 6, Section 6.
C idrsnum - GRIB2 Data Representation Template Number
C idrstmpl() - GRIB2 Data Representation Template entries
C
C OUTPUT ARGUMENT LIST:
C kpds() - GRIB1 PDS info as specified in W3FI63.
C (1) - ID OF CENTER
C (2) - GENERATING PROCESS ID NUMBER
C (3) - GRID DEFINITION
C (4) - GDS/BMS FLAG (RIGHT ADJ COPY OF OCTET 8)
C (5) - INDICATOR OF PARAMETER
C (6) - TYPE OF LEVEL
C (7) - HEIGHT/PRESSURE , ETC OF LEVEL
C (8) - YEAR INCLUDING (CENTURY-1)
C (9) - MONTH OF YEAR
C (10) - DAY OF MONTH
C (11) - HOUR OF DAY
C (12) - MINUTE OF HOUR
C (13) - INDICATOR OF FORECAST TIME UNIT
C (14) - TIME RANGE 1
C (15) - TIME RANGE 2
C (16) - TIME RANGE FLAG
C (17) - NUMBER INCLUDED IN AVERAGE
C (18) - VERSION NR OF GRIB SPECIFICATION
C (19) - VERSION NR OF PARAMETER TABLE
C (20) - NR MISSING FROM AVERAGE/ACCUMULATION
C (21) - CENTURY OF REFERENCE TIME OF DATA
C (22) - UNITS DECIMAL SCALE FACTOR
C (23) - SUBCENTER NUMBER
C iret - Error return value:
C 0 = Successful
C 1 = Don't know what to do with pre-defined bitmap.
C 2 = Unrecognized GRIB2 PDT 4.ipdsnum
C
C REMARKS: Use pds2pdtens for ensemble related PDS
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use params
integer,intent(in) :: idsect(*),ipdstmpl(*),idrstmpl(*)
integer,intent(in) :: ipdsnum,idisc,idrsnum,ibmap
integer,intent(out) :: kpds(*)
integer,intent(out) :: iret
iret=0
kpds(1:24)=0
if ( (ipdsnum.lt.0).OR.(ipdsnum.gt.14) ) then
print *,'makepds: Don:t know GRIB2 PDT 4.',ipdsnum
iret=2
return
endif
kpds(1)=idsect(1)
kpds(2)=ipdstmpl(5)
kpds(3)=255
kpds(4)=128
if ( ibmap.ne.255 ) kpds(4)=kpds(4)+64
if ( ibmap.ge.1.AND.ibmap.le.253 ) then
print *,'makepds: Don:t know about predefined bit-map ',ibmap
iret=1
return
endif
call param_g2_to_g1(idisc,ipdstmpl(1),ipdstmpl(2),kpds(5),
& kpds(19))
call levelcnv(ipdstmpl,kpds(6),kpds(7)) ! level
kpds(8)=mod(idsect(6),100)
if ( kpds(8).eq.0 ) kpds(8)=100
kpds(9)=idsect(7) ! Year
kpds(10)=idsect(8) ! Month
kpds(11)=idsect(9) ! Day
kpds(12)=idsect(10) ! Hour
if ( ipdstmpl(8).ne.13 ) then
kpds(13)=ipdstmpl(8) ! Time Unit
else
kpds(13)=254
endif
kpds(14)=ipdstmpl(9) ! P1
if ( ipdsnum.le.7 ) then ! P2
kpds(15)=0
kpds(16)=0
kpds(20)=0
if ( kpds(14).eq.0 ) kpds(16)=1
if ( kpds(14).gt.255 ) kpds(16)=10
if ( ipdstmpl(5).eq.77.OR.ipdstmpl(5).eq.81.OR.
& ipdstmpl(5).eq.96.OR.ipdstmpl(5).eq.80.OR.
& ipdstmpl(5).eq.82.OR.ipdstmpl(5).eq.120.OR.
& ipdstmpl(5).eq.47.OR.ipdstmpl(5).eq.11 ) then
kpds(16)=10
end if
if (ipdstmpl(5).eq.84.AND.kpds(5).eq.154)kpds(16) = 10
C
C NOAA Wave Watch III and Coastal Ocean Circulation
C and Alaska Waters Regional Wave Model
C
if ( ipdstmpl(5).eq.88.OR.ipdstmpl(5).eq.121
& .OR.ipdstmpl(5).eq.122.OR.ipdstmpl(5).eq.123
& .OR.ipdstmpl(5).eq.124.OR.ipdstmpl(5).eq.125
& .OR.ipdstmpl(5).eq.131.OR.ipdstmpl(5).eq.45
& .OR.ipdstmpl(5).eq.11 ) then
kpds(16) = 0
C
C Level Surface set to 1
C
if (kpds(5).eq.80.OR.kpds(5).eq.82.OR.
& kpds(5).eq.88.OR.kpds(5).eq.49.OR.
& kpds(5).eq.50) kpds(7)=1 ! Level Surface
if (ipdstmpl(5).eq.122.OR.ipdstmpl(5).eq.124.OR.
& ipdstmpl(5).eq.131.OR.ipdstmpl(5).eq.123.OR.
& ipdstmpl(5).eq.125.OR.ipdstmpl(5).eq.88.OR.
& ipdstmpl(5).eq.121) kpds(7)=1
if (idsect(1).eq.54.AND.ipdstmpl(5).eq.45) kpds(16) = 10
endif
else
selectcase (ipdsnum)
case(8)
ipos=24
case(9)
ipos=31
case(10)
ipos=25
case(11)
ipos=27
case(12)
ipos=26
case(13)
ipos=40
case(14)
ipos=39
end select
kpds(15)=ipdstmpl(ipos+3)+kpds(14)
selectcase (ipdstmpl(ipos))
case (255)
kpds(16)=2
case (0)
kpds(16)=3
case (1)
kpds(16)=4
case (2)
kpds(16)=2
case (3)
kpds(16)=2
case (4)
kpds(16)=5
case (51)
kpds(16)=51
end select
kpds(20)=ipdstmpl(ipos-1)
endif
kpds(17)=0
kpds(18)=1 ! GRIB edition
kpds(21)=(idsect(6)/100)+1 ! Century
if ( kpds(8).eq.100 ) kpds(21)=idsect(6)/100
kpds(22)=idrstmpl(3) ! Decimal scale factor
kpds(23)=idsect(2) ! Sub-center
return
end
subroutine levelcnv(ipdstmpl,ltype,lval)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: levelcnv
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: this routine converts Level/layer information
C from a GRIB2 Product Definition Template to GRIB1
C Level type and Level value.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C 2007-10-24 Boi Vuong - Added level 8 (Nominal top of atmosphere)
C
C USAGE: CALL levelcnv(ipdstmpl,ltype,lval)
C INPUT ARGUMENT LIST:
C ipdstmpl() - GRIB2 Product Definition Template values
C
C OUTPUT ARGUMENT LIST: (INCLUDING WORK ARRAYS)
C ltype - GRIB1 level type (PDS octet 10)
C lval - GRIB1 level/layer value(s) (PDS octets 11 and 12)
C
C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
integer,intent(in) :: ipdstmpl(*)
integer,intent(out) :: ltype,lval
ltype=255
lval=0
ltype1=ipdstmpl(10)
ltype2=ipdstmpl(13)
if ( ltype1.lt.100.AND.ltype2.eq.255 ) then
ltype=ltype1
lval=0
elseif ( ltype1.eq.1.AND.ltype2.eq.8 ) then
ltype=ltype1
lval=0
elseif ( ltype1.ge.200.AND.ltype2.eq.255 ) then
ltype=ltype1
lval=0
elseif (ltype1.eq.100.AND.ltype2.eq.255 ) then
ltype=100
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1/100.)
elseif (ltype1.eq.100.AND.ltype2.eq.100 ) then
ltype=101
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1/1000.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2/1000.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.101.AND.ltype2.eq.255 ) then
ltype=102
lval=0
elseif (ltype1.eq.102.AND.ltype2.eq.255 ) then
ltype=103
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1)
elseif (ltype1.eq.102.AND.ltype2.eq.102 ) then
ltype=104
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2)
lval=(lval1*256)+lval2
elseif (ltype1.eq.103.AND.ltype2.eq.255 ) then
ltype=105
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1)
elseif (ltype1.eq.103.AND.ltype2.eq.103 ) then
ltype=106
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1/100.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2/100.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.104.AND.ltype2.eq.255 ) then
ltype=107
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1*10000.)
elseif (ltype1.eq.104.AND.ltype2.eq.104 ) then
ltype=108
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1*100.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2*100.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.105.AND.ltype2.eq.255 ) then
ltype=109
lval=ipdstmpl(12)
elseif (ltype1.eq.105.AND.ltype2.eq.105 ) then
ltype=110
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2)
lval=(lval1*256)+lval2
elseif (ltype1.eq.106.AND.ltype2.eq.255 ) then
ltype=111
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1*100.)
elseif (ltype1.eq.106.AND.ltype2.eq.106 ) then
ltype=112
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1*100.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2*100.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.107.AND.ltype2.eq.255 ) then
ltype=113
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1)
elseif (ltype1.eq.107.AND.ltype2.eq.107 ) then
ltype=114
rscal1=10.**(-ipdstmpl(11))
lval1=475-nint(real(ipdstmpl(12))*rscal1)
rscal2=10.**(-ipdstmpl(14))
lval2=475-nint(real(ipdstmpl(15))*rscal2)
lval=(lval1*256)+lval2
elseif (ltype1.eq.108.AND.ltype2.eq.255 ) then
ltype=115
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1/100.)
elseif (ltype1.eq.108.AND.ltype2.eq.108 ) then
ltype=116
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1/100.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2/100.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.109.AND.ltype2.eq.255 ) then
ltype=117
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1*1000000000.)
elseif (ltype1.eq.111.AND.ltype2.eq.255 ) then
ltype=119
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1*10000.)
elseif (ltype1.eq.111.AND.ltype2.eq.111 ) then
ltype=120
rscal1=10.**(-ipdstmpl(11))
lval1=nint(real(ipdstmpl(12))*rscal1*100.)
rscal2=10.**(-ipdstmpl(14))
lval2=nint(real(ipdstmpl(15))*rscal2*100.)
lval=(lval1*256)+lval2
elseif (ltype1.eq.160.AND.ltype2.eq.255 ) then
ltype=160
rscal1=10.**(-ipdstmpl(11))
lval=nint(real(ipdstmpl(12))*rscal1)
else
print *,'levelcnv: GRIB2 Levels ',ltype1,ltype2,
& ' not recognized.'
ltype=255
endif
! High resolution stuff
! elseif (ltype.eq.121) then
! ipdstmpl(10)=100
! ipdstmpl(12)=(1100+(lval/256))*100
! ipdstmpl(13)=100
! ipdstmpl(15)=(1100+mod(lval,256))*100
! elseif (ltype.eq.125) then
! ipdstmpl(10)=103
! ipdstmpl(11)=-2
! ipdstmpl(12)=lval
! elseif (ltype.eq.128) then
! ipdstmpl(10)=104
! ipdstmpl(11)=-3
! ipdstmpl(12)=1100+(lval/256)
! ipdstmpl(13)=104
! ipdstmpl(14)=-3
! ipdstmpl(15)=1100+mod(lval,256)
! elseif (ltype.eq.141) then
! ipdstmpl(10)=100
! ipdstmpl(12)=(lval/256)*100
! ipdstmpl(13)=100
! ipdstmpl(15)=(1100+mod(lval,256))*100
return
end

View file

@ -1,182 +0,0 @@
subroutine makepdsens(ipdsnum,ipdstmpl,kpds,kens,kprob,
& xprob,kclust,kmembr,iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: makepdsens
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: This routine creates the GRIB1 NCEP Ensemble PDS
C extension information from appropriate information from a GRIB2
C Product Definition Template.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C 2007-05-14 Boi Vuong -Corrected scale factor probabilities
C
C USAGE: CALL makepdsens(ipdsnum,ipdstmpl,kpds,kens,kprob,
C xprob,kclust,kmembr,iret)
C INPUT ARGUMENT LIST:
C ipdsnum - GRIB2 Product Definition Template Number
C ipdstmpl() - GRIB2 Product Definition Template entries for PDT 4.ipdsnum
C kpds() - GRIB1 PDS info as specified in W3FI63.
C (1) - ID OF CENTER
C (2) - GENERATING PROCESS ID NUMBER
C (3) - GRID DEFINITION
C (4) - GDS/BMS FLAG (RIGHT ADJ COPY OF OCTET 8)
C (5) - INDICATOR OF PARAMETER
C (6) - TYPE OF LEVEL
C (7) - HEIGHT/PRESSURE , ETC OF LEVEL
C (8) - YEAR INCLUDING (CENTURY-1)
C (9) - MONTH OF YEAR
C (10) - DAY OF MONTH
C (11) - HOUR OF DAY
C (12) - MINUTE OF HOUR
C (13) - INDICATOR OF FORECAST TIME UNIT
C (14) - TIME RANGE 1
C (15) - TIME RANGE 2
C (16) - TIME RANGE FLAG
C (17) - NUMBER INCLUDED IN AVERAGE
C (18) - VERSION NR OF GRIB SPECIFICATION
C (19) - VERSION NR OF PARAMETER TABLE
C (20) - NR MISSING FROM AVERAGE/ACCUMULATION
C (21) - CENTURY OF REFERENCE TIME OF DATA
C (22) - UNITS DECIMAL SCALE FACTOR
C (23) - SUBCENTER NUMBER
C
C OUTPUT ARGUMENT LIST:
C kpds() - GRIB1 PDS info as specified in W3FI63.
C (1) - ID OF CENTER
C (2) - GENERATING PROCESS ID NUMBER
C (3) - GRID DEFINITION
C (4) - GDS/BMS FLAG (RIGHT ADJ COPY OF OCTET 8)
C (5) - INDICATOR OF PARAMETER
C (6) - TYPE OF LEVEL
C (7) - HEIGHT/PRESSURE , ETC OF LEVEL
C (8) - YEAR INCLUDING (CENTURY-1)
C (9) - MONTH OF YEAR
C (10) - DAY OF MONTH
C (11) - HOUR OF DAY
C (12) - MINUTE OF HOUR
C (13) - INDICATOR OF FORECAST TIME UNIT
C (14) - TIME RANGE 1
C (15) - TIME RANGE 2
C (16) - TIME RANGE FLAG
C (17) - NUMBER INCLUDED IN AVERAGE
C (18) - VERSION NR OF GRIB SPECIFICATION
C (19) - VERSION NR OF PARAMETER TABLE
C (20) - NR MISSING FROM AVERAGE/ACCUMULATION
C (21) - CENTURY OF REFERENCE TIME OF DATA
C (22) - UNITS DECIMAL SCALE FACTOR
C (23) - SUBCENTER NUMBER
C kens() - Ensemble identification for PDS octets 41-45
C kprob() - Ensemble probability info for PDS octets 46 & 47
C xprob() - Ensemble probability info for PDS octets 48-55
C kclust() - Ensemble cluster info for PDS octets 61-76
C kmembr() - Ensemble membership info for PDS octest 77-86
C iret - Error return value:
C 0 = Successful
C 2 = Unrecognized GRIB2 PDT 4.ipdsnum
C
C REMARKS: Use pds2pdtens for ensemble related PDS
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use params
integer,intent(in) :: ipdstmpl(*)
integer,intent(in) :: ipdsnum
integer,intent(inout) :: kpds(*)
integer,intent(out) :: kens(5),kprob(2)
integer,intent(out) :: kclust(16),kmembr(80)
real,intent(out) :: xprob(2)
integer,intent(out) :: iret
iret=0
kpds(23)=2 ! subcenter = ensemble
kens(1:5)=0
kprob(1:2)=0
xprob(1:2)=0.
kclust(1:16)=0
kmembr(1:80)=0
!
! Individual Ensemble Fcst
!
if ( ipdsnum.eq.1.OR.ipdsnum.eq.11 ) then
kens(1)=1
selectcase ( ipdstmpl(16) )
case(0)
kens(2)=1
kens(3)=1
case(1)
kens(2)=1
kens(3)=2
case(2)
kens(2)=2
kens(3)=ipdstmpl(17)
case(3)
kens(2)=3
kens(3)=ipdstmpl(17)
end select
kens(4)=1
kens(5)=255
!
! Probability Fcst
!
elseif ( ipdsnum.eq.5.OR.ipdsnum.eq.9 ) then
kens(1)=1
kens(2)=5
kens(3)=0
kens(4)=0
kens(5)=255
kprob(1)=kpds(5)
kpds(5)=191
kprob(2)=ipdstmpl(18)+1
if ( kprob(2).eq.1 ) then
rscale=10.**ipdstmpl(19)
xprob(1)=real(ipdstmpl(20))/rscale
xprob(2)=0.0
elseif ( kprob(2).eq.2 ) then
xprob(1)=0.0
rscale=10.**ipdstmpl(21)
xprob(2)=real(ipdstmpl(22))/rscale
elseif ( kprob(2).eq.3 ) then
rscale=10.**ipdstmpl(19)
xprob(1)=real(ipdstmpl(20))/rscale
rscale=10.**ipdstmpl(21)
xprob(2)=real(ipdstmpl(22))/rscale
endif
kclust(1)=ipdstmpl(17)
!
! Derived Ensemble Fcst
!
elseif ( ipdsnum.eq.2.OR.ipdsnum.eq.12 ) then
kens(1)=1
kens(2)=5
kens(3)=0
selectcase ( ipdstmpl(16) )
case(0)
kens(4)=1
case(1)
kens(4)=2
case(2)
kens(4)=11
case(3)
kens(4)=12
end select
!kens(5)=89
kens(5)=0
kclust(1)=ipdstmpl(17)
else
print *,'makepdsens: Don:t know GRIB2 PDT 4.',ipdsnum
iret=2
endif
return
end

View file

@ -1,385 +0,0 @@
subroutine pds2pdt(kpds,ipdsnum,ipdstmpl,numcoord,coordlist,
& iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: pds2pdt
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: This routine converts a GRIB1 PDS (Section 1) info
C to a GRIB2 PDS (Section 4) info with appropriate Product Definition
C Template.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C 2005-04-19 Gilbert - Changed scaling factor used with potential
C vorticity surfaces.
C 2007-02-07 Gilbert - fixed end date calculation
C 2007-03-26 Gordon - Added check for ECMWF data to reference ECMWF
C Conversion tables.
C 2007-05-14 Boi Vuong - Added Time Range Indicator 51 (Climatological
C Mean Value)
C
C USAGE: CALL pds2pdt(kpds,ipdsnum,ipdstmpl,numcoord,coordlist,iret)
C INPUT ARGUMENT LIST:
C kpds() - GRIB1 PDS info as specified in W3FI63.
C
C OUTPUT ARGUMENT LIST:
C ipdsnum - GRIB2 Product Definition Template Number
C ipdstmpl() - GRIB2 Product Definition Template entries for PDT 4.ipdsnum
C numcoord - number of vertical discretisation values ( not implemented )
C coordlist()- vertical discretisation values ( not implemented )
C iret - Error return value:
C 0 = Successful
C 1 = Unrecognized GRIB1 Time Range Indicator
C
C REMARKS: Use pds2pdtens for ensemble related PDS
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use params
use params_ecmwf
integer,intent(in) :: kpds(*)
integer,intent(out) :: ipdstmpl(*)
real,intent(out) :: coordlist(*)
integer,intent(out) :: ipdsnum,numcoord,iret
integer :: idat(8),jdat(8)
real :: rinc(5)
logical :: ecmwf
iret=0
numcoord=0
ecmwf=.false.
if (kpds(1).eq.98) ecmwf=.true.
if (kpds(16).eq.0.or.kpds(16).eq.1.or.kpds(16).eq.10) then
ipdsnum=0
! get GRIB2 parameter category and number from GRIB1
! parameter number
if (ecmwf) then ! treat ecmwf data conversion seperately
call param_ecmwf_g1_to_g2(kpds(5),kpds(19),idum,
& ipdstmpl(1),ipdstmpl(2))
else
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
endif
if (kpds(16).eq.1) then
ipdstmpl(3)=0
else
ipdstmpl(3)=2
endif
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
!if (kpds(16).eq.10) then
! ipdstmpl(9)=(kpds(14)*256)+kpds(15)
!else
ipdstmpl(9)=kpds(14)
!endif
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
elseif (kpds(16).ge.2.AND.kpds(16).le.5) then
ipdsnum=8
! get GRIB2 parameter category and number from GRIB1
! parameter number
if (ecmwf) then ! treat ecmwf data conversion seperately
call param_ecmwf_g1_to_g2(kpds(5),kpds(19),idum,
& ipdstmpl(1),ipdstmpl(2))
else
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
endif
ipdstmpl(3)=2
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0.0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(16)=jdat(1) ! year of end time
ipdstmpl(17)=jdat(2) ! month of end time
ipdstmpl(18)=jdat(3) ! day of end time
ipdstmpl(19)=jdat(5) ! hour of end time
ipdstmpl(20)=jdat(6) ! minute of end time
ipdstmpl(21)=jdat(7) ! second of end time
ipdstmpl(22)=1 ! # of time ranges
ipdstmpl(23)=kpds(20) ! # of values missing
if (kpds(16).eq.2) then ! statistical process
ipdstmpl(24)=255
elseif (kpds(16).eq.3) then
ipdstmpl(24)=0
elseif (kpds(16).eq.4) then
ipdstmpl(24)=1
elseif (kpds(16).eq.5) then
ipdstmpl(24)=4
endif
ipdstmpl(25)=2
ipdstmpl(26)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(26)=13
ipdstmpl(27)=kpds(15)-kpds(14)
ipdstmpl(28)=255
ipdstmpl(29)=0
elseif (kpds(16).eq.51) then
ipdsnum=8
! get GRIB2 parameter category and number from GRIB1
! parameter number
if (ecmwf) then ! treat ecmwf data conversion seperately
call param_ecmwf_g1_to_g2(kpds(5),kpds(19),idum,
& ipdstmpl(1),ipdstmpl(2))
else
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
endif
ipdstmpl(3)=2
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0.0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(16)=jdat(1) ! year of end time
ipdstmpl(17)=jdat(2) ! month of end time
ipdstmpl(18)=jdat(3) ! day of end time
ipdstmpl(19)=jdat(5) ! hour of end time
ipdstmpl(20)=jdat(6) ! minute of end time
ipdstmpl(21)=jdat(7) ! second of end time
ipdstmpl(22)=1 ! # of time ranges
ipdstmpl(23)=kpds(20) ! # of values missing
ipdstmpl(24)=51 ! Climatological Mean
ipdstmpl(25)=2
ipdstmpl(26)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(26)=13
ipdstmpl(27)=kpds(15)-kpds(14)
ipdstmpl(28)=255
ipdstmpl(29)=0
else
Print *,' Unrecognized Time Range Indicator = ',kpds(16)
Print *,'pds2pdt: Couldn:t construct PDS Template '
iret=1
endif
return
end
subroutine cnvlevel(ltype,lval,ipdstmpl)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: cnvlevel
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: this routine converts a GRIB1 Level type and Level value
C to GRIB2 values and fills in the appropriate PDT values for the
C level/layer information.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C
C USAGE: CALL cnvlevel(ltype,lval,ipdstmpl)
C INPUT ARGUMENT LIST:
C ltype - GRIB1 level type (PDS octet 10)
C lval - GRIB1 level/layer value(s) (PDS octets 11 and 12)
C
C OUTPUT ARGUMENT LIST: (INCLUDING WORK ARRAYS)
C ipdstmpl() - GRIB2 Product Definition Template values
C
C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
integer,intent(in) :: ltype,lval
integer,intent(inout) :: ipdstmpl(*)
ipdstmpl(10)=ltype
ipdstmpl(11)=0
ipdstmpl(12)=0
ipdstmpl(13)=255
ipdstmpl(14)=0
ipdstmpl(15)=0
if (ltype.eq.100) then
ipdstmpl(12)=lval*100
elseif (ltype.eq.101) then
ipdstmpl(10)=100
ipdstmpl(12)=(lval/256)*1000
ipdstmpl(13)=100
ipdstmpl(15)=mod(lval,256)*1000
elseif (ltype.eq.102) then
ipdstmpl(10)=101
elseif (ltype.eq.103) then
ipdstmpl(10)=102
ipdstmpl(12)=lval
elseif (ltype.eq.104) then
ipdstmpl(10)=102
ipdstmpl(12)=lval/256
ipdstmpl(13)=102
ipdstmpl(15)=mod(lval,256)
elseif (ltype.eq.105) then
ipdstmpl(10)=103
ipdstmpl(12)=lval
elseif (ltype.eq.106) then
ipdstmpl(10)=103
ipdstmpl(12)=(lval/256)*100
ipdstmpl(13)=103
ipdstmpl(15)=mod(lval,256)*100
elseif (ltype.eq.107) then
ipdstmpl(10)=104
ipdstmpl(11)=4
ipdstmpl(12)=lval
elseif (ltype.eq.108) then
ipdstmpl(10)=104
ipdstmpl(11)=2
ipdstmpl(12)=lval/256
ipdstmpl(13)=104
ipdstmpl(14)=2
ipdstmpl(15)=mod(lval,256)
elseif (ltype.eq.109) then
ipdstmpl(10)=105
ipdstmpl(12)=lval
elseif (ltype.eq.110) then
ipdstmpl(10)=105
ipdstmpl(12)=lval/256
ipdstmpl(13)=105
ipdstmpl(15)=mod(lval,256)
elseif (ltype.eq.111) then
ipdstmpl(10)=106
ipdstmpl(11)=2
ipdstmpl(12)=lval
elseif (ltype.eq.112) then
ipdstmpl(10)=106
ipdstmpl(11)=2
ipdstmpl(12)=lval/256
ipdstmpl(13)=106
ipdstmpl(14)=2
ipdstmpl(15)=mod(lval,256)
elseif (ltype.eq.113) then
ipdstmpl(10)=107
ipdstmpl(12)=lval
elseif (ltype.eq.114) then
ipdstmpl(10)=107
ipdstmpl(12)=475+(lval/256)
ipdstmpl(13)=107
ipdstmpl(15)=475+mod(lval,256)
elseif (ltype.eq.115) then
ipdstmpl(10)=108
ipdstmpl(12)=lval*100
elseif (ltype.eq.116) then
ipdstmpl(10)=108
ipdstmpl(12)=(lval/256)*100
ipdstmpl(13)=108
ipdstmpl(15)=mod(lval,256)*100
elseif (ltype.eq.117) then
ipdstmpl(10)=109
ipdstmpl(11)=9
ipdstmpl(12)=lval
if ( btest(lval,15) ) then
ipdstmpl(12)=-1*mod(lval,32768)
endif
elseif (ltype.eq.119) then
ipdstmpl(10)=111
ipdstmpl(11)=4
ipdstmpl(12)=lval
elseif (ltype.eq.120) then
ipdstmpl(10)=111
ipdstmpl(11)=2
ipdstmpl(12)=lval/256
ipdstmpl(13)=111
ipdstmpl(14)=2
ipdstmpl(15)=mod(lval,256)
elseif (ltype.eq.121) then
ipdstmpl(10)=100
ipdstmpl(12)=(1100+(lval/256))*100
ipdstmpl(13)=100
ipdstmpl(15)=(1100+mod(lval,256))*100
elseif (ltype.eq.125) then
ipdstmpl(10)=103
ipdstmpl(11)=2
ipdstmpl(12)=lval
elseif (ltype.eq.128) then
ipdstmpl(10)=104
ipdstmpl(11)=3
ipdstmpl(12)=1100+(lval/256)
ipdstmpl(13)=104
ipdstmpl(14)=3
ipdstmpl(15)=1100+mod(lval,256)
elseif (ltype.eq.141) then
ipdstmpl(10)=100
ipdstmpl(12)=(lval/256)*100
ipdstmpl(13)=100
ipdstmpl(15)=(1100+mod(lval,256))*100
elseif (ltype.eq.160) then
ipdstmpl(10)=160
ipdstmpl(12)=lval
elseif (ltype.gt.99.AND.ltype.lt.200) then
print *,'cnvlevel: GRIB1 Level ',ltype,' not recognized.'
ipdstmpl(10)=255
endif
return
end

View file

@ -1,649 +0,0 @@
subroutine pds2pdtens(kpds,kens,kprob,xprob,kclust,kmember,
& ipdsnum,ipdstmpl,numcoord,coordlist,
& iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: pds2pdtens
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-12
C
C ABSTRACT: This routine converts a GRIB1 PDS (Section 1) that includes
C NCEP ensemble PDS extensions
C to a GRIB2 PDS (Section 4) info with appropriate Product Definition
C Template.
C
C PROGRAM HISTORY LOG:
C 2003-06-12 Gilbert
C 2007-02-07 Gilbert - fixed end date calculation
C 2007-05-14 Boi Vuong - Added Time Range Indicator 51 (Climatological
C Mean Value)
C
C USAGE: CALL pds2pdtens(kpds,kens,kprob,xprob,kclust,kmember,
C ipdsnum,ipdstmpl,numcoord,coordlist,iret)
C INPUT ARGUMENT LIST:
C kpds() - GRIB1 PDS info as specified in W3FI63.
C kens() - Ensemble identification from PDS octets 41-45
C kprob() - Ensemble probability info from PDS octets 46 & 47
C xprob() - Ensemble probability info from PDS octets 48-55
C kclust() - Ensemble cluster info from PDS octets 61-76
C kmember()- Ensemble membership info from PDS octest 77-86
C
C OUTPUT ARGUMENT LIST:
C ipdsnum - GRIB2 Product Definition Template Number
C ipdstmpl() - GRIB2 Product Definition Template entries for PDT 4.ipdsnum
C numcoord - number of vertical discretisation values ( not implemented )
C coordlist()- vertical discretisation values ( not implemented )
C iret - Error return value:
C 0 = Successful
C 1 = Unrecognized GRIB1 Time Range Indicator for ensembles
C 2 = Unrecognized GRIB1 Ensemble type
C 10 = Unrecognized GRIB1 Time Range Indicator for probabilities
C
C REMARKS: Use routine pds2pdt for non ensemble related PDS.
C
C ATTRIBUTES:
C LANGUAGE: Fortran 90
C MACHINE: IBM SP
C
C$$$
use params
integer,intent(in) :: kpds(*),kens(*),kprob(*),kclust(*)
integer,intent(in) :: kmember(*)
real,intent(in) :: xprob(*)
integer,intent(out) :: ipdstmpl(*)
real,intent(out) :: coordlist(*)
integer,intent(out) :: ipdsnum,numcoord,iret
integer :: idat(8),jdat(8)
real :: rinc(5)
iret=0
numcoord=0
if (kens(2).eq.1.or.kens(2).eq.2.or.kens(2).eq.3) then
! individual ensemble fcst...
if (kpds(16).eq.0.or.kpds(16).eq.1.or.kpds(16).eq.10) then
! At specific point in time...
ipdsnum=1
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
!if (kpds(16).eq.10) then
! ipdstmpl(9)=(kpds(14)*256)+kpds(15)
!else
ipdstmpl(9)=kpds(14)
!endif
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
if (kens(2).eq.1) then
! if (kens(3).eq.1) ipdstmpl(16)=0
! if (kens(3).eq.2) ipdstmpl(16)=1
ipdstmpl(16)=kens(3)-1
ipdstmpl(17)=0
elseif (kens(2).eq.2) then
ipdstmpl(16)=2
ipdstmpl(17)=kens(3)
elseif (kens(2).eq.3) then
ipdstmpl(16)=3
ipdstmpl(17)=kens(3)
endif
ipdstmpl(18)=10
elseif (kpds(16).ge.2.AND.kpds(16).le.5) then
! over time range...
ipdsnum=11
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
if (kens(2).eq.1) then
! if (kens(3).eq.1) ipdstmpl(16)=0
! if (kens(3).eq.2) ipdstmpl(16)=1
ipdstmpl(16)=kens(3)-1
ipdstmpl(17)=0
elseif (kens(2).eq.2) then
ipdstmpl(16)=2
ipdstmpl(17)=kens(3)
elseif (kens(2).eq.3) then
ipdstmpl(16)=3
ipdstmpl(17)=kens(3)
endif
ipdstmpl(18)=10
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(19)=jdat(1) ! year of end time
ipdstmpl(20)=jdat(2) ! month of end time
ipdstmpl(21)=jdat(3) ! day of end time
ipdstmpl(22)=jdat(5) ! hour of end time
ipdstmpl(23)=jdat(6) ! minute of end time
ipdstmpl(24)=jdat(7) ! second of end time
ipdstmpl(25)=1
ipdstmpl(26)=0
if (kpds(16).eq.2) then
ipdstmpl(27)=255
if (kpds(5).eq.15) ipdstmpl(27)=2
if (kpds(5).eq.16) ipdstmpl(27)=3
elseif (kpds(16).eq.3) then
ipdstmpl(27)=0
elseif (kpds(16).eq.4) then
ipdstmpl(27)=1
elseif (kpds(16).eq.5) then
ipdstmpl(27)=4
endif
ipdstmpl(28)=2
ipdstmpl(29)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(29)=13
ipdstmpl(30)=kpds(15)-kpds(14)
ipdstmpl(31)=255
ipdstmpl(32)=0
elseif (kpds(16).eq.51) then
! over time range...
ipdsnum=11
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
if (kens(2).eq.1) then
! if (kens(3).eq.1) ipdstmpl(16)=0
! if (kens(3).eq.2) ipdstmpl(16)=1
ipdstmpl(16)=kens(3)-1
ipdstmpl(17)=0
elseif (kens(2).eq.2) then
ipdstmpl(16)=2
ipdstmpl(17)=kens(3)
elseif (kens(2).eq.3) then
ipdstmpl(16)=3
ipdstmpl(17)=kens(3)
endif
ipdstmpl(18)=10
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(19)=jdat(1) ! year of end time
ipdstmpl(20)=jdat(2) ! month of end time
ipdstmpl(21)=jdat(3) ! day of end time
ipdstmpl(22)=jdat(5) ! hour of end time
ipdstmpl(23)=jdat(6) ! minute of end time
ipdstmpl(24)=jdat(7) ! second of end time
ipdstmpl(25)=1
ipdstmpl(26)=0
ipdstmpl(27)=51
ipdstmpl(28)=2
ipdstmpl(29)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(29)=13
ipdstmpl(30)=kpds(15)-kpds(14)
ipdstmpl(31)=255
ipdstmpl(32)=0
else
Print *,' Unrecognized Time Range Ind for ensembles = ',
& kpds(16),kens(2)
Print *,'pds2pdtens: Couldn:t construct PDS Template '
iret=1
endif
elseif (kens(2).eq.5) then ! WHOLE or CLUSTERENSEMBLE type
if (kpds(5).eq.191.OR.kpds(5).eq.192) then ! probs
if (kpds(16).eq.0.or.kpds(16).eq.1.or.kpds(16).eq.10) then
! At specific point in time...
ipdsnum=5
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kprob(1),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=5
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
!if (kpds(16).eq.10) then
! ipdstmpl(9)=(kpds(14)*256)+kpds(15)
!else
ipdstmpl(9)=kpds(14)
!endif
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
ipdstmpl(16)=0 !?
ipdstmpl(17)=kclust(1) !?
ipdstmpl(18)=kprob(2)-1
if (ipdstmpl(18).eq.0.OR.ipdstmpl(18).eq.2) then
ipdstmpl(19)=3
ipdstmpl(20)=nint(xprob(1)*1000.0)
else
ipdstmpl(19)=0
ipdstmpl(20)=0
endif
if (ipdstmpl(18).eq.1.OR.ipdstmpl(18).eq.2) then
ipdstmpl(21)=3
ipdstmpl(22)=nint(xprob(2)*1000.0)
else
ipdstmpl(21)=0
ipdstmpl(22)=0
endif
elseif (kpds(16).ge.2.AND.kpds(16).le.5) then
! over time range...
ipdsnum=9
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kprob(1),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=5
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
ipdstmpl(16)=0 !?
ipdstmpl(17)=kclust(1) !?
ipdstmpl(18)=kprob(2)-1
if (ipdstmpl(18).eq.0.OR.ipdstmpl(18).eq.2) then
ipdstmpl(19)=3
ipdstmpl(20)=nint(xprob(1)*1000.0)
else
ipdstmpl(19)=0
ipdstmpl(20)=0
endif
if (ipdstmpl(18).eq.1.OR.ipdstmpl(18).eq.2) then
ipdstmpl(21)=3
ipdstmpl(22)=nint(xprob(2)*1000.0)
else
ipdstmpl(21)=0
ipdstmpl(22)=0
endif
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(23)=jdat(1) ! year of end time
ipdstmpl(24)=jdat(2) ! month of end time
ipdstmpl(25)=jdat(3) ! day of end time
ipdstmpl(26)=jdat(5) ! hour of end time
ipdstmpl(27)=jdat(6) ! minute of end time
ipdstmpl(28)=jdat(7) ! second of end time
ipdstmpl(29)=1
ipdstmpl(30)=0
if (kpds(16).eq.2) then
ipdstmpl(31)=255
if (kpds(5).eq.15) ipdstmpl(31)=2
if (kpds(5).eq.16) ipdstmpl(31)=3
elseif (kpds(16).eq.3) then
ipdstmpl(31)=0
elseif (kpds(16).eq.4) then
ipdstmpl(31)=1
elseif (kpds(16).eq.5) then
ipdstmpl(31)=4
endif
ipdstmpl(32)=2
ipdstmpl(33)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(33)=13
ipdstmpl(34)=kpds(15)-kpds(14)
ipdstmpl(35)=255
ipdstmpl(36)=0
elseif (kpds(16).eq.51) then
! over time range...
ipdsnum=9
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kprob(1),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=5
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
ipdstmpl(16)=0 !?
ipdstmpl(17)=kclust(1) !?
ipdstmpl(18)=kprob(2)-1
if (ipdstmpl(18).eq.0.OR.ipdstmpl(18).eq.2) then
ipdstmpl(19)=3
ipdstmpl(20)=nint(xprob(1)*1000.0)
else
ipdstmpl(19)=0
ipdstmpl(20)=0
endif
if (ipdstmpl(18).eq.1.OR.ipdstmpl(18).eq.2) then
ipdstmpl(21)=3
ipdstmpl(22)=nint(xprob(2)*1000.0)
else
ipdstmpl(21)=0
ipdstmpl(22)=0
endif
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(23)=jdat(1) ! year of end time
ipdstmpl(24)=jdat(2) ! month of end time
ipdstmpl(25)=jdat(3) ! day of end time
ipdstmpl(26)=jdat(5) ! hour of end time
ipdstmpl(27)=jdat(6) ! minute of end time
ipdstmpl(28)=jdat(7) ! second of end time
ipdstmpl(29)=1
ipdstmpl(30)=0
ipdstmpl(31)=51
ipdstmpl(32)=2
ipdstmpl(33)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(33)=13
ipdstmpl(34)=kpds(15)-kpds(14)
ipdstmpl(35)=255
ipdstmpl(36)=0
else
Print *,' Unrecognized Time Range Ind for Probs = ',
& kpds(16),kens(2)
Print *,'pds2pdtens: Couldn:t construct PDS Template '
iret=10
endif
else ! Non-probablility Whole Ens Fcst
if (kpds(16).eq.0.or.kpds(16).eq.1.or.kpds(16).eq.10) then
! At specific point in time...
ipdsnum=2
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
!if (kpds(16).eq.10) then
! ipdstmpl(9)=(kpds(14)*256)+kpds(15)
!else
ipdstmpl(9)=kpds(14)
!endif
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
if (kens(4).eq.1) then
ipdstmpl(16)=0
elseif (kens(4).eq.2) then
ipdstmpl(16)=1
elseif (kens(4).eq.11) then
ipdstmpl(16)=2
elseif (kens(4).eq.12) then
ipdstmpl(16)=3
endif
ipdstmpl(17)=kclust(1)
elseif (kpds(16).ge.2.AND.kpds(16).le.5) then
! over time range...
ipdsnum=12
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
if (kens(4).eq.1) then
ipdstmpl(16)=0
elseif (kens(4).eq.2) then
ipdstmpl(16)=1
elseif (kens(4).eq.11) then
ipdstmpl(16)=2
elseif (kens(4).eq.12) then
ipdstmpl(16)=3
endif
ipdstmpl(17)=kclust(1)
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(18)=jdat(1) ! year of end time
ipdstmpl(19)=jdat(2) ! month of end time
ipdstmpl(20)=jdat(3) ! day of end time
ipdstmpl(21)=jdat(5) ! hour of end time
ipdstmpl(22)=jdat(6) ! minute of end time
ipdstmpl(23)=jdat(7) ! second of end time
ipdstmpl(24)=1
ipdstmpl(25)=0
if (kpds(16).eq.2) then
ipdstmpl(26)=255
if (kpds(5).eq.15) ipdstmpl(26)=2
if (kpds(5).eq.16) ipdstmpl(26)=3
elseif (kpds(16).eq.3) then
ipdstmpl(26)=0
elseif (kpds(16).eq.4) then
ipdstmpl(26)=1
elseif (kpds(16).eq.5) then
ipdstmpl(26)=4
endif
ipdstmpl(27)=2
ipdstmpl(28)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(28)=13
ipdstmpl(29)=kpds(15)-kpds(14)
ipdstmpl(30)=255
ipdstmpl(31)=0
elseif (kpds(16).eq.51) then
! over time range...
ipdsnum=12
! get GRIB2 parameter category and number from GRIB1
! parameter number
call param_g1_to_g2(kpds(5),kpds(19),idum,ipdstmpl(1),
& ipdstmpl(2))
ipdstmpl(3)=4
ipdstmpl(4)=0
ipdstmpl(5)=kpds(2)
ipdstmpl(6)=0
ipdstmpl(7)=0
ipdstmpl(8)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(8)=13
ipdstmpl(9)=kpds(14)
call cnvlevel(kpds(6),kpds(7),ipdstmpl)
!ipdstmpl(9)=kpds(15)
if (kens(4).eq.1) then
ipdstmpl(16)=0
elseif (kens(4).eq.2) then
ipdstmpl(16)=1
elseif (kens(4).eq.11) then
ipdstmpl(16)=2
elseif (kens(4).eq.12) then
ipdstmpl(16)=3
endif
ipdstmpl(17)=kclust(1)
! calculate ending time using initial ref-time, idat,
! and increment rinc.
idat=0
idat(1)=((kpds(21)-1)*100)+kpds(8)
idat(2)=kpds(9)
idat(3)=kpds(10)
idat(4)=-500 ! EST
idat(5)=kpds(11)
idat(6)=kpds(12)
rinc=0
if ( ipdstmpl(8).eq.0 ) then
rinc(3)=kpds(15)
elseif ( ipdstmpl(8).eq.1 ) then
rinc(2)=kpds(15)
elseif ( ipdstmpl(8).eq.2 ) then
rinc(1)=kpds(15)
elseif ( ipdstmpl(8).eq.10 ) then
rinc(2)=kpds(15) * 3
elseif ( ipdstmpl(8).eq.11 ) then
rinc(2)=kpds(15) * 6
elseif ( ipdstmpl(8).eq.12 ) then
rinc(2)=kpds(15) * 12
elseif ( ipdstmpl(8).eq.13 ) then
rinc(4)=kpds(15)
endif
call w3movdat(rinc,idat,jdat) ! calculate end date/time
ipdstmpl(18)=jdat(1) ! year of end time
ipdstmpl(19)=jdat(2) ! month of end time
ipdstmpl(20)=jdat(3) ! day of end time
ipdstmpl(21)=jdat(5) ! hour of end time
ipdstmpl(22)=jdat(6) ! minute of end time
ipdstmpl(23)=jdat(7) ! second of end time
ipdstmpl(24)=1
ipdstmpl(25)=0
ipdstmpl(26)=51
ipdstmpl(27)=2
ipdstmpl(28)=kpds(13)
if (kpds(13).eq.254) ipdstmpl(28)=13
ipdstmpl(29)=kpds(15)-kpds(14)
ipdstmpl(30)=255
ipdstmpl(31)=0
endif
endif
else
Print *,' Unrecognized Ensemble type = ',kens(2)
Print *,'pds2pdtens: Couldn:t construct PDS Template '
iret=2
endif
return
end

View file

@ -1,249 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE PUTGBEXN(LUGB,KF,KPDS,KGDS,KENS,
& KPROB,XPROB,KCLUST,KMEMBR,IBS,NBITS,LB,F,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: PUTGBEXN PACKS AND WRITES A GRIB MESSAGE
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 94-04-01
C
C ABSTRACT: PACK AND WRITE A GRIB MESSAGE.
C THIS SUBPROGRAM IS NEARLY THE INVERSE OF GETGBE.
C
C PROGRAM HISTORY LOG:
C 94-04-01 IREDELL
C 95-10-31 IREDELL REMOVED SAVES AND PRINTS
C 97-02-11 Y.ZHU INCLUDED PROBABILITY AND CLUSTER ARGUMENTS
C 2002-03-18 GILBERT MODIFIED FROM PUTGBEX TO ACCOUNT FOR
C BINARY SCALE FACTORS.
C
C USAGE: CALL PUTGBEXN(LUGB,KF,KPDS,KGDS,KENS,
C & KPROB,XPROB,KCLUST,KMEMBR,IBS,NBITS,LB,F,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE
C KF INTEGER NUMBER OF DATA POINTS
C KPDS INTEGER (200) PDS PARAMETERS
C (1) - ID OF CENTER
C (2) - GENERATING PROCESS ID NUMBER
C (3) - GRID DEFINITION
C (4) - GDS/BMS FLAG (RIGHT ADJ COPY OF OCTET 8)
C (5) - INDICATOR OF PARAMETER
C (6) - TYPE OF LEVEL
C (7) - HEIGHT/PRESSURE , ETC OF LEVEL
C (8) - YEAR INCLUDING (CENTURY-1)
C (9) - MONTH OF YEAR
C (10) - DAY OF MONTH
C (11) - HOUR OF DAY
C (12) - MINUTE OF HOUR
C (13) - INDICATOR OF FORECAST TIME UNIT
C (14) - TIME RANGE 1
C (15) - TIME RANGE 2
C (16) - TIME RANGE FLAG
C (17) - NUMBER INCLUDED IN AVERAGE
C (18) - VERSION NR OF GRIB SPECIFICATION
C (19) - VERSION NR OF PARAMETER TABLE
C (20) - NR MISSING FROM AVERAGE/ACCUMULATION
C (21) - CENTURY OF REFERENCE TIME OF DATA
C (22) - UNITS DECIMAL SCALE FACTOR
C (23) - SUBCENTER NUMBER
C (24) - PDS BYTE 29, FOR NMC ENSEMBLE PRODUCTS
C 128 IF FORECAST FIELD ERROR
C 64 IF BIAS CORRECTED FCST FIELD
C 32 IF SMOOTHED FIELD
C WARNING: CAN BE COMBINATION OF MORE THAN 1
C (25) - PDS BYTE 30, NOT USED
C KGDS INTEGER (200) GDS PARAMETERS
C (1) - DATA REPRESENTATION TYPE
C (19) - NUMBER OF VERTICAL COORDINATE PARAMETERS
C (20) - OCTET NUMBER OF THE LIST OF VERTICAL COORDINATE
C PARAMETERS
C OR
C OCTET NUMBER OF THE LIST OF NUMBERS OF POINTS
C IN EACH ROW
C OR
C 255 IF NEITHER ARE PRESENT
C (21) - FOR GRIDS WITH PL, NUMBER OF POINTS IN GRID
C (22) - NUMBER OF WORDS IN EACH ROW
C LATITUDE/LONGITUDE GRIDS
C (2) - N(I) NR POINTS ON LATITUDE CIRCLE
C (3) - N(J) NR POINTS ON LONGITUDE MERIDIAN
C (4) - LA(1) LATITUDE OF ORIGIN
C (5) - LO(1) LONGITUDE OF ORIGIN
C (6) - RESOLUTION FLAG (RIGHT ADJ COPY OF OCTET 17)
C (7) - LA(2) LATITUDE OF EXTREME POINT
C (8) - LO(2) LONGITUDE OF EXTREME POINT
C (9) - DI LONGITUDINAL DIRECTION OF INCREMENT
C (10) - DJ LATITUDINAL DIRECTION INCREMENT
C (11) - SCANNING MODE FLAG (RIGHT ADJ COPY OF OCTET 28)
C GAUSSIAN GRIDS
C (2) - N(I) NR POINTS ON LATITUDE CIRCLE
C (3) - N(J) NR POINTS ON LONGITUDE MERIDIAN
C (4) - LA(1) LATITUDE OF ORIGIN
C (5) - LO(1) LONGITUDE OF ORIGIN
C (6) - RESOLUTION FLAG (RIGHT ADJ COPY OF OCTET 17)
C (7) - LA(2) LATITUDE OF EXTREME POINT
C (8) - LO(2) LONGITUDE OF EXTREME POINT
C (9) - DI LONGITUDINAL DIRECTION OF INCREMENT
C (10) - N - NR OF CIRCLES POLE TO EQUATOR
C (11) - SCANNING MODE FLAG (RIGHT ADJ COPY OF OCTET 28)
C (12) - NV - NR OF VERT COORD PARAMETERS
C (13) - PV - OCTET NR OF LIST OF VERT COORD PARAMETERS
C OR
C PL - LOCATION OF THE LIST OF NUMBERS OF POINTS IN
C EACH ROW (IF NO VERT COORD PARAMETERS
C ARE PRESENT
C OR
C 255 IF NEITHER ARE PRESENT
C POLAR STEREOGRAPHIC GRIDS
C (2) - N(I) NR POINTS ALONG LAT CIRCLE
C (3) - N(J) NR POINTS ALONG LON CIRCLE
C (4) - LA(1) LATITUDE OF ORIGIN
C (5) - LO(1) LONGITUDE OF ORIGIN
C (6) - RESOLUTION FLAG (RIGHT ADJ COPY OF OCTET 17)
C (7) - LOV GRID ORIENTATION
C (8) - DX - X DIRECTION INCREMENT
C (9) - DY - Y DIRECTION INCREMENT
C (10) - PROJECTION CENTER FLAG
C (11) - SCANNING MODE (RIGHT ADJ COPY OF OCTET 28)
C SPHERICAL HARMONIC COEFFICIENTS
C (2) - J PENTAGONAL RESOLUTION PARAMETER
C (3) - K " " "
C (4) - M " " "
C (5) - REPRESENTATION TYPE
C (6) - COEFFICIENT STORAGE MODE
C MERCATOR GRIDS
C (2) - N(I) NR POINTS ON LATITUDE CIRCLE
C (3) - N(J) NR POINTS ON LONGITUDE MERIDIAN
C (4) - LA(1) LATITUDE OF ORIGIN
C (5) - LO(1) LONGITUDE OF ORIGIN
C (6) - RESOLUTION FLAG (RIGHT ADJ COPY OF OCTET 17)
C (7) - LA(2) LATITUDE OF LAST GRID POINT
C (8) - LO(2) LONGITUDE OF LAST GRID POINT
C (9) - LATIT - LATITUDE OF PROJECTION INTERSECTION
C (10) - RESERVED
C (11) - SCANNING MODE FLAG (RIGHT ADJ COPY OF OCTET 28)
C (12) - LONGITUDINAL DIR GRID LENGTH
C (13) - LATITUDINAL DIR GRID LENGTH
C LAMBERT CONFORMAL GRIDS
C (2) - NX NR POINTS ALONG X-AXIS
C (3) - NY NR POINTS ALONG Y-AXIS
C (4) - LA1 LAT OF ORIGIN (LOWER LEFT)
C (5) - LO1 LON OF ORIGIN (LOWER LEFT)
C (6) - RESOLUTION (RIGHT ADJ COPY OF OCTET 17)
C (7) - LOV - ORIENTATION OF GRID
C (8) - DX - X-DIR INCREMENT
C (9) - DY - Y-DIR INCREMENT
C (10) - PROJECTION CENTER FLAG
C (11) - SCANNING MODE FLAG (RIGHT ADJ COPY OF OCTET 28)
C (12) - LATIN 1 - FIRST LAT FROM POLE OF SECANT CONE INTER
C (13) - LATIN 2 - SECOND LAT FROM POLE OF SECANT CONE INTER
C KENS INTEGER (200) ENSEMBLE PDS PARMS
C (1) - APPLICATION IDENTIFIER
C (2) - ENSEMBLE TYPE
C (3) - ENSEMBLE IDENTIFIER
C (4) - PRODUCT IDENTIFIER
C (5) - SMOOTHING FLAG
C KPROB INTEGER (2) PROBABILITY ENSEMBLE PARMS
C XPROB REAL (2) PROBABILITY ENSEMBLE PARMS
C KCLUST INTEGER (16) CLUSTER ENSEMBLE PARMS
C KMEMBR INTEGER (8) CLUSTER ENSEMBLE PARMS
C IBS INTEGER BINARY SCALE FACTOR (0 TO IGNORE)
C NBITS INTEGER NUMBER OF BITS IN WHICH TO PACK (0 TO IGNORE)
C LB LOGICAL*1 (KF) BITMAP IF PRESENT
C F REAL (KF) DATA
C OUTPUT ARGUMENTS:
C IRET INTEGER RETURN CODE
C 0 ALL OK
C OTHER W3FI72 GRIB PACKER RETURN CODE
C
C SUBPROGRAMS CALLED:
C R63W72 MAP W3FI63 PARAMETERS ONTO W3FI72 PARAMETERS
C GETBIT GET NUMBER OF BITS AND ROUND DATA
C W3FI72 PACK GRIB
C WRYTE WRITE DATA
C
C REMARKS: SUBPROGRAM CAN BE CALLED FROM A MULTIPROCESSING ENVIRONMENT.
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 77
C MACHINE: CRAY, WORKSTATIONS
C
C$$$
INTEGER KPDS(200),KGDS(200),KENS(200)
INTEGER KPROB(2),KCLUST(16),KMEMBR(80)
REAL XPROB(2)
LOGICAL*1 LB(KF)
REAL F(KF)
C PARAMETER(MAXBIT=16)
PARAMETER(MAXBIT=24)
INTEGER IBM(KF),IPDS(200),IGDS(200),IBDS(200)
CHARACTER PDS(400),GRIB(1000+KF*(MAXBIT+1)/8)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C GET W3FI72 PARAMETERS
!print *,'SAGT: start putgbexn'
CALL R63W72(KPDS,KGDS,IPDS,IGDS)
IBDS=0
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C COUNT VALID DATA
KBM=KF
IF(IPDS(7).NE.0) THEN
KBM=0
DO I=1,KF
IF(LB(I)) THEN
IBM(I)=1
KBM=KBM+1
ELSE
IBM(I)=0
ENDIF
ENDDO
IF(KBM.EQ.KF) IPDS(7)=0
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C GET NUMBER OF BITS AND ROUND DATA
IF(NBITS.GT.0) THEN
NBIT=NBITS
ELSE
IF(KBM.EQ.0) THEN
DO I=1,KF
F(I)=0.
ENDDO
NBIT=0
ELSE
!print *,'SAGT:',IPDS(7),IBS,IPDS(25),KF
!print *,'SAGT:',count(ibm.eq.0),count(ibm.eq.1)
CALL SETBIT(IPDS(7),-IBS,IPDS(25),KF,IBM,F,FMIN,FMAX,NBIT)
NBIT=MIN(NBIT,MAXBIT)
ENDIF
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C CREATE PRODUCT DEFINITION SECTION
CALL W3FI68(IPDS,PDS)
IF(IPDS(24).EQ.2) THEN
ILAST=45
IF ( IPDS(8).EQ.191.OR.IPDS(8).EQ.192 ) ILAST=55
IF ( KENS(2).EQ.5) ILAST=76
IF ( KENS(2).EQ.5) ILAST=86
IF ( KENS(2).EQ.4) ILAST=86
CALL PDSENS(KENS,KPROB,XPROB,KCLUST,KMEMBR,ILAST,PDS)
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C PACK AND WRITE GRIB DATA
igflag=1
igrid=kpds(3)
if ( igrid.ne.255 ) igflag=0
!print *,minval(f(1:kf)),maxval(f(1:kf))
!print *,nbit,kf
!print *,(ipds(j),j=1,28)
!write(6,fmt='(28z2)') (pds(j),j=1,28)
!print *,(kgds(j),j=1,28)
!print *,(igds(j),j=1,28)
icomp=0
CALL W3FI72(0,F,0,NBIT,1,IPDS,PDS,
& igflag,igrid,IGDS,ICOMP,0,IBM,KF,IBDS,
& KFO,GRIB,LGRIB,IRET)
IF(IRET.EQ.0) CALL WRYTE(LUGB,LGRIB,GRIB)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,80 +0,0 @@
SUBROUTINE SETBIT(IBM,IBS,IDS,LEN,MG,G,GMIN,GMAX,NBIT)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: SETBIT COMPUTE NUMBER OF BITS TO PACK FIELD
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 92-10-31
C
C ABSTRACT: THE NUMBER OF BITS REQUIRED TO PACK A GIVEN FIELD
C FOR PARTICULAR BINARY AND DECIMAL SCALINGS IS COMPUTED.
C THE MINIMUM AND MAXIMUM ROUNDED FIELD VALUES ARE ALSO RETURNED.
C GRIB BITMAP MASKING FOR VALID DATA IS OPTIONALLY USED.
C
C PROGRAM HISTORY LOG:
C 96-09-16 IREDELL
C
C USAGE: CALL SETBIT(IBM,IBS,IDS,LEN,MG,G,GMIN,GMAX,NBIT)
C INPUT ARGUMENT LIST:
C IBM - INTEGER BITMAP FLAG (=0 FOR NO BITMAP)
C IBS - INTEGER BINARY SCALING
C (E.G. IBS=3 TO ROUND FIELD TO NEAREST EIGHTH VALUE)
C IDS - INTEGER DECIMAL SCALING
C (E.G. IDS=3 TO ROUND FIELD TO NEAREST MILLI-VALUE)
C (NOTE THAT IDS AND IBS CAN BOTH BE NONZERO,
C E.G. IDS=1 AND IBS=1 ROUNDS TO THE NEAREST TWENTIETH)
C LEN - INTEGER LENGTH OF THE FIELD AND BITMAP
C MG - INTEGER (LEN) BITMAP IF IBM=1 (0 TO SKIP, 1 TO KEEP)
C G - REAL (LEN) FIELD
C
C OUTPUT ARGUMENT LIST:
C GMIN - REAL MINIMUM VALID ROUNDED FIELD VALUE
C GMAX - REAL MAXIMUM VALID ROUNDED FIELD VALUE
C NBIT - INTEGER NUMBER OF BITS TO PACK
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
DIMENSION MG(LEN),G(LEN)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C ROUND FIELD AND DETERMINE EXTREMES WHERE BITMAP IS ON
S=2.**IBS*10.**IDS
IF(IBM.EQ.0) THEN
GMAX=G(1)
GMIN=G(1)
DO I=2,LEN
GMAX=MAX(GMAX,G(I))
GMIN=MIN(GMIN,G(I))
ENDDO
ELSE
I1=1
DOWHILE(I1.LE.LEN.AND.MG(I1).EQ.0)
I1=I1+1
ENDDO
IF(I1.LE.LEN) THEN
DO I=1,I1-1
G(I)=0.
ENDDO
GMAX=G(I1)
GMIN=G(I1)
DO I=I1+1,LEN
IF(MG(I).NE.0) THEN
GMAX=MAX(GMAX,G(I))
GMIN=MIN(GMIN,G(I))
ELSE
G(I)=0.
ENDIF
ENDDO
ELSE
DO I=1,LEN
G(I)=0.
ENDDO
GMAX=0.
GMIN=0.
ENDIF
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C COMPUTE NUMBER OF BITS
NBIT=LOG((GMAX-GMIN)*S+0.9)/LOG(2.)+1.
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,16 +0,0 @@
CHANGES
cnv12.f
cnv21.f
cnv22.f
cnvgrib.f
gds2gdt.f
gdt2gds.f
grbCnv.so
makefile
makepdsens.f
makepds.f
pds2pdtens.f
pds2pdt.f
putgbexn.f
README
setbit.f

View file

@ -1,249 +0,0 @@
#ifndef _grib2_H
#define _grib2_H
#include<stdio.h>
#define G2_VERSION "g2clib-1.1.8"
/* . . . .
// PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-10-25
//
// PROGRAM HISTORY LOG:
// 2002-10-25 Gilbert
// 2009-01-14 Vuong Changed struct template to gtemplate
//
// Each element of structure gribfield is defined as:
//
// gribfield gfld;
//
// gfld->version = GRIB edition number ( currently 2 )
// gfld->discipline = Message Discipline ( see Code Table 0.0 )
// gfld->idsect = Contains the entries in the Identification
// Section ( Section 1 )
// This element is a pointer to an array
// that holds the data.
// gfld->idsect[0] = Identification of originating Centre
// ( see Common Code Table C-1 )
// 7 - US National Weather Service
// gfld->idsect[1] = Identification of originating Sub-centre
// gfld->idsect[2] = GRIB Master Tables Version Number
// ( see Code Table 1.0 )
// 0 - Experimental
// 1 - Initial operational version number
// gfld->idsect[3] = GRIB Local Tables Version Number
// ( see Code Table 1.1 )
// 0 - Local tables not used
// 1-254 - Number of local tables version used
// gfld->idsect[4] = Significance of Reference Time (Code Table 1.2)
// 0 - Analysis
// 1 - Start of forecast
// 2 - Verifying time of forecast
// 3 - Observation time
// gfld->idsect[5] = Year ( 4 digits )
// gfld->idsect[6] = Month
// gfld->idsect[7) = Day
// gfld->idsect[8] = Hour
// gfld->idsect[9] = Minute
// gfld->idsect[10] = Second
// gfld->idsect[11] = Production status of processed data
// ( see Code Table 1.3 )
// 0 - Operational products
// 1 - Operational test products
// 2 - Research products
// 3 - Re-analysis products
// gfld->idsect[12] = Type of processed data ( see Code Table 1.4 )
// 0 - Analysis products
// 1 - Forecast products
// 2 - Analysis and forecast products
// 3 - Control forecast products
// 4 - Perturbed forecast products
// 5 - Control and perturbed forecast products
// 6 - Processed satellite observations
// 7 - Processed radar observations
// gfld->idsectlen = Number of elements in gfld->idsect[].
// gfld->local = Pointer to character array containing contents
// of Local Section 2, if included
// gfld->locallen = length of array gfld->local[]
// gfld->ifldnum = field number within GRIB message
// gfld->griddef = Source of grid definition (see Code Table 3.0)
// 0 - Specified in Code table 3.1
// 1 - Predetermined grid Defined by originating centre
// gfld->ngrdpts = Number of grid points in the defined grid.
// gfld->numoct_opt = Number of octets needed for each
// additional grid points definition.
// Used to define number of
// points in each row ( or column ) for
// non-regular grids.
// = 0, if using regular grid.
// gfld->interp_opt = Interpretation of list for optional points
// definition. (Code Table 3.11)
// gfld->igdtnum = Grid Definition Template Number (Code Table 3.1)
// gfld->igdtmpl = Contains the data values for the specified Grid
// Definition Template ( NN=gfld->igdtnum ). Each
// element of this integer array contains an entry (in
// the order specified) of Grid Defintion Template 3.NN
// This element is a pointer to an array
// that holds the data.
// gfld->igdtlen = Number of elements in gfld->igdtmpl[]. i.e. number of
// entries in Grid Defintion Template 3.NN
// ( NN=gfld->igdtnum ).
// gfld->list_opt = (Used if gfld->numoct_opt .ne. 0) This array
// contains the number of grid points contained in
// each row ( or column ). (part of Section 3)
// This element is a pointer to an array
// that holds the data. This pointer is nullified
// if gfld->numoct_opt=0.
// gfld->num_opt = (Used if gfld->numoct_opt .ne. 0) The number of entries
// in array ideflist. i.e. number of rows ( or columns )
// for which optional grid points are defined. This value
// is set to zero, if gfld->numoct_opt=0.
// gfdl->ipdtnum = Product Definition Template Number (see Code Table 4.0)
// gfld->ipdtmpl = Contains the data values for the specified Product
// Definition Template ( N=gfdl->ipdtnum ). Each element
// of this integer array contains an entry (in the
// order specified) of Product Defintion Template 4.N.
// This element is a pointer to an array
// that holds the data.
// gfld->ipdtlen = Number of elements in gfld->ipdtmpl[]. i.e. number of
// entries in Product Defintion Template 4.N
// ( N=gfdl->ipdtnum ).
// gfld->coord_list = Real array containing floating point values
// intended to document the vertical discretisation
// associated to model data on hybrid coordinate
// vertical levels. (part of Section 4)
// This element is a pointer to an array
// that holds the data.
// gfld->num_coord = number of values in array gfld->coord_list[].
// gfld->ndpts = Number of data points unpacked and returned.
// gfld->idrtnum = Data Representation Template Number
// ( see Code Table 5.0)
// gfld->idrtmpl = Contains the data values for the specified Data
// Representation Template ( N=gfld->idrtnum ). Each
// element of this integer array contains an entry
// (in the order specified) of Product Defintion
// Template 5.N.
// This element is a pointer to an array
// that holds the data.
// gfld->idrtlen = Number of elements in gfld->idrtmpl[]. i.e. number
// of entries in Data Representation Template 5.N
// ( N=gfld->idrtnum ).
// gfld->unpacked = logical value indicating whether the bitmap and
// data values were unpacked. If false,
// gfld->bmap and gfld->fld pointers are nullified.
// gfld->expanded = Logical value indicating whether the data field
// was expanded to the grid in the case where a
// bit-map is present. If true, the data points in
// gfld->fld match the grid points and zeros were
// inserted at grid points where data was bit-mapped
// out. If false, the data values in gfld->fld were
// not expanded to the grid and are just a consecutive
// array of data points corresponding to each value of
// "1" in gfld->bmap.
// gfld->ibmap = Bitmap indicator ( see Code Table 6.0 )
// 0 = bitmap applies and is included in Section 6.
// 1-253 = Predefined bitmap applies
// 254 = Previously defined bitmap applies to this field
// 255 = Bit map does not apply to this product.
// gfld->bmap = integer array containing decoded bitmap,
// if gfld->ibmap=0 or gfld->ibap=254. Otherwise nullified.
// This element is a pointer to an array
// that holds the data.
// gfld->fld = Array of gfld->ndpts unpacked data points.
// This element is a pointer to an array
// that holds the data.
*/
#ifdef __64BIT__
typedef int g2int;
typedef unsigned int g2intu;
#else
typedef long g2int;
typedef unsigned long g2intu;
#endif
typedef float g2float;
struct gtemplate {
g2int type; /* 3=Grid Defintion Template. */
/* 4=Product Defintion Template. */
/* 5=Data Representation Template. */
g2int num; /* template number. */
g2int maplen; /* number of entries in the static part */
/* of the template. */
g2int *map; /* num of octets of each entry in the */
/* static part of the template. */
g2int needext; /* indicates whether or not the template needs */
/* to be extended. */
g2int extlen; /* number of entries in the template extension. */
g2int *ext; /* num of octets of each entry in the extension */
/* part of the template. */
};
typedef struct gtemplate gtemplate;
struct gribfield {
g2int version,discipline;
g2int *idsect;
g2int idsectlen;
unsigned char *local;
g2int locallen;
g2int ifldnum;
g2int griddef,ngrdpts;
g2int numoct_opt,interp_opt,num_opt;
g2int *list_opt;
g2int igdtnum,igdtlen;
g2int *igdtmpl;
g2int ipdtnum,ipdtlen;
g2int *ipdtmpl;
g2int num_coord;
g2float *coord_list;
g2int ndpts,idrtnum,idrtlen;
g2int *idrtmpl;
g2int unpacked;
g2int expanded;
g2int ibmap;
g2int *bmap;
g2float *fld;
};
typedef struct gribfield gribfield;
/* Prototypes for unpacking API */
void seekgb(FILE *,g2int ,g2int ,g2int *,g2int *);
g2int g2_info(unsigned char *,g2int *,g2int *,g2int *,g2int *);
g2int g2_getfld(unsigned char *,g2int ,g2int ,g2int ,gribfield **);
void g2_free(gribfield *);
/* Prototypes for packing API */
g2int g2_create(unsigned char *,g2int *,g2int *);
g2int g2_addlocal(unsigned char *,unsigned char *,g2int );
g2int g2_addgrid(unsigned char *,g2int *,g2int *,g2int *,g2int );
g2int g2_addfield(unsigned char *,g2int ,g2int *,
g2float *,g2int ,g2int ,g2int *,
g2float *,g2int ,g2int ,g2int *);
g2int g2_gribend(unsigned char *);
/* Prototypes for supporting routines */
extern double int_power(double, g2int );
extern void mkieee(g2float *,g2int *,g2int);
void rdieee(g2int *,g2float *,g2int );
extern gtemplate *getpdstemplate(g2int);
extern gtemplate *extpdstemplate(g2int,g2int *);
extern gtemplate *getdrstemplate(g2int);
extern gtemplate *extdrstemplate(g2int,g2int *);
extern gtemplate *getgridtemplate(g2int);
extern gtemplate *extgridtemplate(g2int,g2int *);
extern void simpack(g2float *,g2int,g2int *,unsigned char *,g2int *);
extern void compack(g2float *,g2int,g2int,g2int *,unsigned char *,g2int *);
void misspack(g2float *,g2int ,g2int ,g2int *, unsigned char *, g2int *);
void gbit(unsigned char *,g2int *,g2int ,g2int );
void sbit(unsigned char *,g2int *,g2int ,g2int );
void gbits(unsigned char *,g2int *,g2int ,g2int ,g2int ,g2int );
void sbits(unsigned char *,g2int *,g2int ,g2int ,g2int ,g2int );
int pack_gp(g2int *, g2int *, g2int *,
g2int *, g2int *, g2int *, g2int *, g2int *,
g2int *, g2int *, g2int *, g2int *,
g2int *, g2int *, g2int *, g2int *, g2int *,
g2int *, g2int *, g2int *);
#endif /* _grib2_H */

View file

@ -1,89 +0,0 @@
g2lib-1.0 - August 2003 - Original version
g2lib-1.0.1 - October 2003 - Added support for Grid Definition Template 3.31
Albers Equal Area.
- Added new parameters to the Parameter list in
params.f
- Minor documentation updates.
g2lib-1.0.2 - February 2004 - Added new parameters in params.f for use with
Quickscat data and Ozone (Air Quality)
g2lib-1.0.3 - May 2004 - Changed most PDT templates in module pdstemplates to
allow negative surface values.
- Added new routine to gridtemplates and pdstemplates
modules to return number of entries in a specified
template.
- Added New routines, getgb2p getgb2rp, used to request
a packed GRIB2 message from a file.
- New module g2grids can be used to return GDT entries
for a specific grid from a file containing a list of
predefined grids.
g2lib-1.0.4 - August 2004 - Added functionality to support encoding of
"Missing" data values within the data field when
using Data Representation Templates 5.2
(complex packing) and 5.3 (complex packing and
spatial differencing). See octets 23 - 31 in DRTs
5.2 and 5.3 for more info on missing value
management.
- Increased the packing efficiency of Data
Representation Templates 5.2 and 5.3 by adding
MDL/Glahn algorithm for determining effective
groupings.
g2lib-1.0.5 - December 2004 - WMO approved the JPEG2000 and PNG Data
Representation Templates ( 5.40000 and 5.40010,
respectively ) for operational use. The templates
were assigned WMO values of 5.40 and 5.41,
respectively. Changes were made to the source to
recognize either template number.
- Fixed bug encountered when packing a near constant
field with DRT 5.40 or 5.40000 (JPEG2000).
- Added consistency check, provided by
Arthur Taylor/MDL, used when unpacking Data
Templates 7.2 and 7.3.
- Corrected the documentation for subroutine
addfield in the grib2.doc file. Incorrect
arguments were specified for this routine.
- Corrected bug when packing Secondary missing
values in Data Representation Templates 5.2 and
5.3.
g2lib-1.0.6 - April 2005 - Modified the way GETGB2 manages the GRIB2 file
indexes, so that it can be more efficient and
flexible when reading from multiple
GRIB2 files.
- Fixed bug in PUTGB2 that caused data fields to be
encoded incorrectly.
- Added routine gdt2gds that converts grid information
from a GRIB2 Grid Description Section (GDS) and
Grid Definition Template to GRIB1 GDS info.
g2lib-1.0.7 - April 2005 - Fixed bug causing seg fault when using JPEG2000
encoding algorithm on a grid with an insanely large
number of data points bitmapped out.
g2lib-1.0.8 - October 2006 - Modified Product Definition Templates 4.5 and 4.9
to allow negative scale factors and limits.
- Fixed several rounding error bugs during encoding.
- Added new local parameter conversion entries
g2lib-1.0.9 - MAY 2007 - Modified Grid Definition Template 3.igds(5)(3.204)
to add Curvilinear Orthogonal grids.
- Added new local parameter conversion entries
g2lib-1.1.0 -December 2007 - Added new local parameters conversion entries
- Declared the variable rmin,rmax in routine (jpcpack.f
and pngpack.f) with double precision fix bug causing
seg fault when using JPEG2000 encoding algorithm.
g2lib-1.1.1 -January 2008 - Added new local parameters conversion entries
g2lib-1.1.7 -August 2008 - Added new local parameters conversion entries
and table 131
- Added a new Grid Definition Template number
3.32768 (Added Rotate Lat/Lon E-grid)
g2lib-1.1.8 -November 2008 - Added new local parameters conversion entries

View file

@ -1,84 +0,0 @@
Sep 04, 2008
g2lib Library.
This library contains Fortran 90 decoder/encoder
routines for GRIB edition 2, as well as indexing/searching
utility routines. The user API for the GRIB2 routines
is described in file "grib2.doc".
Some Fortran routines call "C" functions, which must
follow a specific symbol naming convention used by your
machine/loader to be linked successfully.
If you are having trouble linking to the C routines
in this library, please make sure the appropriate
machine is defined as an option in the CFLAGS
variable in the makefile. See the first few lines
of the makefile for valid options.
Recompile the library.
We have added support for PNG and JPEG2000 image compression
algorithms within the GRIB2 standard. If you would like
to compile this library to utilize these GRIB2 Templates,
make sure that -DUSE_PNG and -DUSE_JPEG2000 are specified
in the FDEFS variable in the makefile. You will also need
to download and install the external libraries listed below,
if they are not already installed on your system.
If you do not wish to bother with the external libs and
don't need PNG and JPEG2000 support, you can remove the
-DUSE_PNG and -DUSE_JPEG2000 flags from the FDEFS variable
in the makefile.
-------------------------------------------------------------------------------
External Libraries:
libjasper.a - This library is a C implementation of the JPEG-2000 Part-1
standard (i.e., ISO/IEC 15444-1). This library is required
if JPEG2000 support in GRIB2 is desired. If not, remove
the -DUSE_JPEG2000 option from the FDEFS variable
in the makefile.
Download version jasper-1.700.2 from the link belows:
http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/
More information about JPEG2000 can be found at
http://www.jpeg.org/JPEG2000.html.
libpng.a This library is a C implementation of the Portable Network
Graphics PNG image compression format. This library is required
if PNG support in GRIB2 is desired. If not, remove
the -DUSE_PNG option from the FDEFS variable
in the makefile.
If not already installed on your system, download version
libpng-1.2.5 from http://www.libpng.org/pub/png/libpng.html.
More information about PNG can be found at
http://www.libpng.org/pub/png/.
libz.a This library contains compression/decompression routines
used by libpng.a for PNG image compression support.
This library is required if PNG support in GRIB2 is desired.
If not, remove the -DUSE_PNG option from the FDEFS variable
in g2lib/makefile.
If not already installed on your system, download version
zlib-1.1.4 from http://www.gzip.org/zlib/.
-------------------------------------------------------------------------------
A note about routine MOVA2I:
Some routines in this library call subroutine MOVA2I, which is included in
our W3LIB library containing the GRIB1 decoder/encoder routines. If you
are using this library without libw3.a, you will need to compile mova2i.c
(included in this distribution) so it can be added to libg2.a. Just add
the line:
$(LIB)(mova2i.o) \
to the list of routines in the makefile.

View file

@ -1,482 +0,0 @@
subroutine addfield(cgrib,lcgrib,ipdsnum,ipdstmpl,ipdstmplen,
& coordlist,numcoord,idrsnum,idrstmpl,
& idrstmplen,fld,ngrdpts,ibmap,bmap,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: addfield
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-02
!
! ABSTRACT: This subroutine packs up Sections 4 through 7 for a given field
! and adds them to a GRIB2 message. They are Product Definition Section,
! Data Representation Section, Bit-Map Section and Data Section,
! respectively.
! This routine is used with routines "gribcreate", "addlocal", "addgrid",
! and "gribend" to create a complete GRIB2 message. Subroutine
! gribcreate must be called first to initialize a new GRIB2 message.
! Also, subroutine addgrid must be called after gribcreate and
! before this routine to add the appropriate grid description to
! the GRIB2 message. Also, a call to gribend is required to complete
! GRIB2 message after all fields have been added.
!
! PROGRAM HISTORY LOG:
! 2000-05-02 Gilbert
! 2002-12-17 Gilbert - Added support for new templates using
! PNG and JPEG2000 algorithms/templates.
! 2004-06-22 Gilbert - Added check to determine if packing algorithm failed.
!
! USAGE: CALL addfield(cgrib,lcgrib,ipdsnum,ipdstmpl,ipdstmplen,
! coordlist,numcoord,idrsnum,idrstmpl,
! idrstmplen,fld,ngrdpts,ibmap,bmap,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lcgrib - Maximum length (bytes) of array cgrib.
! ipdsnum - Product Definition Template Number ( see Code Table 4.0)
! ipdstmpl - Contains the data values for the specified Product Definition
! Template ( N=ipdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 4.N
! ipdstmplen - Max dimension of ipdstmpl()
! coordlist- Array containg floating point values intended to document
! the vertical discretisation associated to model data
! on hybrid coordinate vertical levels.
! numcoord - number of values in array coordlist.
! idrsnum - Data Representation Template Number ( see Code Table 5.0 )
! idrstmpl - Contains the data values for the specified Data Representation
! Template ( N=idrsnum ). Each element of this integer
! array contains an entry (in the order specified) of Data
! Representation Template 5.N
! Note that some values in this template (eg. reference
! values, number of bits, etc...) may be changed by the
! data packing algorithms.
! Use this to specify scaling factors and order of
! spatial differencing, if desired.
! idrstmplen - Max dimension of idrstmpl()
! fld() - Array of data points to pack.
! ngrdpts - Number of data points in grid.
! i.e. size of fld and bmap.
! ibmap - Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! bmap() - Logical*1 array containing bitmap to be added.
! ( if ibmap=0 or ibmap=254)
!
! OUTPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! ierr - Error return code.
! 0 = no error
! 1 = GRIB message was not initialized. Need to call
! routine gribcreate first.
! 2 = GRIB message already complete. Cannot add new section.
! 3 = Sum of Section byte counts does not add to total
! byte count.
! 4 = Previous Section was not 3 or 7.
! 5 = Could not find requested Product Definition Template.
! 6 = Section 3 (GDS) not previously defined in message
! 7 = Tried to use unsupported Data Representationi Template
! 8 = Specified use of a previously defined bitmap, but one
! does not exist in the GRIB message.
! 9 = GDT of one of 5.50 through 5.53 required to pack
! using DRT 5.51
! 10 = Error packing data field.
!
! REMARKS: Note that the Local Use Section ( Section 2 ) can only follow
! Section 1 or Section 7 in a GRIB2 message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use pdstemplates
use drstemplates
character(len=1),intent(inout) :: cgrib(lcgrib)
integer,intent(in) :: ipdsnum,ipdstmpl(*)
integer,intent(in) :: idrsnum,numcoord,ipdstmplen,idrstmplen
integer,intent(in) :: lcgrib,ngrdpts,ibmap
real,intent(in) :: coordlist(numcoord)
real,target,intent(in) :: fld(ngrdpts)
integer,intent(out) :: ierr
integer,intent(inout) :: idrstmpl(*)
logical*1,intent(in) :: bmap(ngrdpts)
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4):: ctemp
character(len=1),allocatable :: cpack(:)
real,pointer,dimension(:) :: pfld
real(4) :: coordieee(numcoord),re00
integer(4) :: ire00,allones
integer :: mappds(ipdstmplen),intbmap(ngrdpts),mapdrs(idrstmplen)
integer,parameter :: zero=0,one=1,four=4,five=5,six=6,seven=7
integer,parameter :: minsize=50000
integer iofst,ibeg,lencurr,len,mappdslen,mapdrslen,lpos3
integer width,height,ndpts
integer lensec3,lensec4,lensec5,lensec6,lensec7
logical issec3,needext,isprevbmap
ierr=0
do jj=0,31
allones=ibset(allones,jj)
enddo
!
! Check to see if beginning of GRIB message exists
!
ctemp=cgrib(1)//cgrib(2)//cgrib(3)//cgrib(4)
if ( ctemp.ne.grib ) then
print *,'addfield: GRIB not found in given message.'
print *,'addfield: Call to routine gribcreate required',
& ' to initialize GRIB messge.'
ierr=1
return
endif
!
! Get current length of GRIB message
!
call gbyte(cgrib,lencurr,96,32)
!
! Check to see if GRIB message is already complete
!
ctemp=cgrib(lencurr-3)//cgrib(lencurr-2)//cgrib(lencurr-1)
& //cgrib(lencurr)
if ( ctemp.eq.c7777 ) then
print *,'addfield: GRIB message already complete. Cannot',
& ' add new section.'
ierr=2
return
endif
!
! Loop through all current sections of the GRIB message to
! find the last section number.
!
issec3=.false.
isprevbmap=.false.
len=16 ! length of Section 0
do
! Get number and length of next section
iofst=len*8
call gbyte(cgrib,ilen,iofst,32)
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8)
iofst=iofst+8
! Check if previous Section 3 exists and save location of
! the section 3 in case needed later.
if (isecnum.eq.3) then
issec3=.true.
lpos3=len+1
lensec3=ilen
endif
! Check if a previous defined bitmap exists
if (isecnum.eq.6) then
call gbyte(cgrib,ibmprev,iofst,8)
iofst=iofst+8
if ((ibmprev.ge.0).and.(ibmprev.le.253)) isprevbmap=.true.
endif
len=len+ilen
! Exit loop if last section reached
if ( len.eq.lencurr ) exit
! If byte count for each section does not match current
! total length, then there is a problem.
if ( len.gt.lencurr ) then
print *,'addfield: Section byte counts don''t add to total.'
print *,'addfield: Sum of section byte counts = ',len
print *,'addfield: Total byte count in Section 0 = ',lencurr
ierr=3
return
endif
enddo
!
! Sections 4 through 7 can only be added after section 3 or 7.
!
if ( (isecnum.ne.3) .and. (isecnum.ne.7) ) then
print *,'addfield: Sections 4-7 can only be added after',
& ' Section 3 or 7.'
print *,'addfield: Section ',isecnum,' was the last found in',
& ' given GRIB message.'
ierr=4
return
!
! Sections 4 through 7 can only be added if section 3 was previously defined.
!
elseif (.not.issec3) then
print *,'addfield: Sections 4-7 can only be added if Section',
& ' 3 was previously included.'
print *,'addfield: Section 3 was not found in',
& ' given GRIB message.'
print *,'addfield: Call to routine addgrid required',
& ' to specify Grid definition.'
ierr=6
return
endif
!
! Add Section 4 - Product Definition Section
!
ibeg=lencurr*8 ! Calculate offset for beginning of section 4
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,four,iofst,8) ! Store section number ( 4 )
iofst=iofst+8
call sbyte(cgrib,numcoord,iofst,16) ! Store num of coordinate values
iofst=iofst+16
call sbyte(cgrib,ipdsnum,iofst,16) ! Store Prod Def Template num.
iofst=iofst+16
!
! Get Product Definition Template
!
call getpdstemplate(ipdsnum,mappdslen,mappds,needext,iret)
if (iret.ne.0) then
ierr=5
return
endif
!
! Extend the Product Definition Template, if necessary.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extpdstemplate(ipdsnum,ipdstmpl,mappdslen,mappds)
endif
!
! Pack up each input value in array ipdstmpl into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mappds.
!
do i=1,mappdslen
nbits=iabs(mappds(i))*8
if ( (mappds(i).ge.0).or.(ipdstmpl(i).ge.0) ) then
call sbyte(cgrib,ipdstmpl(i),iofst,nbits)
else
call sbyte(cgrib,one,iofst,1)
call sbyte(cgrib,iabs(ipdstmpl(i)),iofst+1,nbits-1)
endif
iofst=iofst+nbits
enddo
!
! Add Optional list of vertical coordinate values
! after the Product Definition Template, if necessary.
!
if ( numcoord .ne. 0 ) then
call mkieee(coordlist,coordieee,numcoord)
call sbytes(cgrib,coordieee,iofst,32,0,numcoord)
iofst=iofst+(32*numcoord)
endif
!
! Calculate length of section 4 and store it in octets
! 1-4 of section 4.
!
lensec4=(iofst-ibeg)/8
call sbyte(cgrib,lensec4,ibeg,32)
!
! Pack Data using appropriate algorithm
!
!
! Get Data Representation Template
!
call getdrstemplate(idrsnum,mapdrslen,mapdrs,needext,iret)
if (iret.ne.0) then
ierr=5
return
endif
!
! contract data field, removing data at invalid grid points,
! if bit-map is provided with field.
!
if ( ibmap.eq.0 .OR. ibmap.eq.254 ) then
allocate(pfld(ngrdpts))
ndpts=0;
do jj=1,ngrdpts
intbmap(jj)=0
if ( bmap(jj) ) then
intbmap(jj)=1
ndpts=ndpts+1
pfld(ndpts)=fld(jj);
endif
enddo
else
ndpts=ngrdpts;
pfld=>fld;
endif
lcpack=0
nsize=ndpts*4
if (nsize .lt. minsize) nsize=minsize
allocate(cpack(nsize),stat=istat)
if (idrsnum.eq.0) then ! Simple Packing
call simpack(pfld,ndpts,idrstmpl,cpack,lcpack)
elseif (idrsnum.eq.2.or.idrsnum.eq.3) then ! Complex Packing
call cmplxpack(pfld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
elseif (idrsnum.eq.50) then ! Sperical Harmonic Simple Packing
call simpack(pfld(2),ndpts-1,idrstmpl,cpack,lcpack)
call mkieee(real(pfld(1)),re00,1) ! ensure RE(0,0) value is IEEE format
!call gbyte(re00,idrstmpl(5),0,32)
ire00=transfer(re00,ire00)
idrstmpl(5)=ire00
elseif (idrsnum.eq.51) then ! Sperical Harmonic Complex Packing
call getpoly(cgrib(lpos3),lensec3,jj,kk,mm)
if (jj.ne.0 .AND. kk.ne.0 .AND. mm.ne.0) then
call specpack(pfld,ndpts,jj,kk,mm,idrstmpl,cpack,lcpack)
else
print *,'addfield: Cannot pack DRT 5.51.'
ierr=9
return
endif
#ifdef USE_JPEG2000
elseif (idrsnum.eq.40 .OR. idrsnum.eq.40000) then ! JPEG2000 encoding
if (ibmap.eq.255) then
call getdim(cgrib(lpos3),lensec3,width,height,iscan)
if ( width.eq.0 .OR. height.eq.0 ) then
width=ndpts
height=1
elseif ( width.eq.allones .OR. height.eq.allones ) then
width=ndpts
height=1
elseif ( ibits(iscan,5,1) .eq. 1) then ! Scanning mode: bit 3
itemp=width
width=height
height=itemp
endif
else
width=ndpts
height=1
endif
lcpack=nsize
call jpcpack(pfld,width,height,idrstmpl,cpack,lcpack)
#endif /* USE_JPEG2000 */
#ifdef USE_PNG
elseif (idrsnum.eq.41 .OR. idrsnum.eq.40010) then ! PNG encoding
if (ibmap.eq.255) then
call getdim(cgrib(lpos3),lensec3,width,height,iscan)
if ( width.eq.0 .OR. height.eq.0 ) then
width=ndpts
height=1
elseif ( width.eq.allones .OR. height.eq.allones ) then
width=ndpts
height=1
elseif ( ibits(iscan,5,1) .eq. 1) then ! Scanning mode: bit 3
itemp=width
width=height
height=itemp
endif
else
width=ndpts
height=1
endif
call pngpack(pfld,width,height,idrstmpl,cpack,lcpack)
#endif /* USE_PNG */
else
print *,'addfield: Data Representation Template 5.',idrsnum,
* ' not yet implemented.'
ierr=7
return
endif
if ( ibmap.eq.0 .OR. ibmap.eq.254 ) then
deallocate(pfld)
endif
if ( lcpack .lt. 0 ) then
if( allocated(cpack) )deallocate(cpack)
ierr=10
return
endif
!
! Add Section 5 - Data Representation Section
!
ibeg=iofst ! Calculate offset for beginning of section 5
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,five,iofst,8) ! Store section number ( 5 )
iofst=iofst+8
call sbyte(cgrib,ndpts,iofst,32) ! Store num of actual data points
iofst=iofst+32
call sbyte(cgrib,idrsnum,iofst,16) ! Store Data Repr. Template num.
iofst=iofst+16
!
! Pack up each input value in array idrstmpl into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapdrs.
!
do i=1,mapdrslen
nbits=iabs(mapdrs(i))*8
if ( (mapdrs(i).ge.0).or.(idrstmpl(i).ge.0) ) then
call sbyte(cgrib,idrstmpl(i),iofst,nbits)
else
call sbyte(cgrib,one,iofst,1)
call sbyte(cgrib,iabs(idrstmpl(i)),iofst+1,nbits-1)
endif
iofst=iofst+nbits
enddo
!
! Calculate length of section 5 and store it in octets
! 1-4 of section 5.
!
lensec5=(iofst-ibeg)/8
call sbyte(cgrib,lensec5,ibeg,32)
!
! Add Section 6 - Bit-Map Section
!
ibeg=iofst ! Calculate offset for beginning of section 6
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,six,iofst,8) ! Store section number ( 6 )
iofst=iofst+8
call sbyte(cgrib,ibmap,iofst,8) ! Store Bit Map indicator
iofst=iofst+8
!
! Store bitmap, if supplied
!
if (ibmap.eq.0) then
call sbytes(cgrib,intbmap,iofst,1,0,ngrdpts) ! Store BitMap
iofst=iofst+ngrdpts
endif
!
! If specifying a previously defined bit-map, make sure
! one already exists in the current GRIB message.
!
if ((ibmap.eq.254).and.(.not.isprevbmap)) then
print *,'addfield: Requested previously defined bitmap, ',
& ' but one does not exist in the current GRIB message.'
ierr=8
return
endif
!
! Calculate length of section 6 and store it in octets
! 1-4 of section 6. Pad to end of octect, if necessary.
!
left=8-mod(iofst,8)
if (left.ne.8) then
call sbyte(cgrib,zero,iofst,left) ! Pad with zeros to fill Octet
iofst=iofst+left
endif
lensec6=(iofst-ibeg)/8
call sbyte(cgrib,lensec6,ibeg,32)
!
! Add Section 7 - Data Section
!
ibeg=iofst ! Calculate offset for beginning of section 7
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,seven,iofst,8) ! Store section number ( 7 )
iofst=iofst+8
! Store Packed Binary Data values, if non-constant field
if (lcpack.ne.0) then
ioctet=iofst/8
cgrib(ioctet+1:ioctet+lcpack)=cpack(1:lcpack)
iofst=iofst+(8*lcpack)
endif
!
! Calculate length of section 7 and store it in octets
! 1-4 of section 7.
!
lensec7=(iofst-ibeg)/8
call sbyte(cgrib,lensec7,ibeg,32)
if( allocated(cpack) )deallocate(cpack)
!
! Update current byte total of message in Section 0
!
newlen=lencurr+lensec4+lensec5+lensec6+lensec7
call sbyte(cgrib,newlen,96,32)
return
end

View file

@ -1,228 +0,0 @@
subroutine addgrid(cgrib,lcgrib,igds,igdstmpl,igdstmplen,
& ideflist,idefnum,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: addgrid
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-01
!
! ABSTRACT: This subroutine packs up a Grid Definition Section (Section 3)
! and adds it to a GRIB2 message.
! This routine is used with routines "gribcreate", "addlocal", "addfield",
! and "gribend" to create a complete GRIB2 message. Subroutine
! gribcreate must be called first to initialize a new GRIB2 message.
!
! PROGRAM HISTORY LOG:
! 2000-05-01 Gilbert
!
! USAGE: CALL addgrid(cgrib,lcgrib,igds,igdstmpl,igdstmplen,
! ideflist,idefnum,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lcgrib - Maximum length (bytes) of array cgrib.
! igds - Contains information needed for GRIB Grid Definition Section 3.
! Must be dimensioned >= 5.
! igds(1)=Source of grid definition (see Code Table 3.0)
! igds(2)=Number of grid points in the defined grid.
! igds(3)=Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! igds(4)=Interpretation of list for optional points
! definition. (Code Table 3.11)
! igds(5)=Grid Definition Template Number (Code Table 3.1)
! igdstmpl - Contains the data values for the specified Grid Definition
! Template ( NN=igds(5) ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Defintion Template 3.NN
! igdstmplen - Max dimension of igdstmpl()
! ideflist - (Used if igds(3) .ne. 0) This array contains the
! number of grid points contained in each row ( or column )
! idefnum - (Used if igds(3) .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined.
!
! OUTPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! ierr - Error return code.
! 0 = no error
! 1 = GRIB message was not initialized. Need to call
! routine gribcreate first.
! 2 = GRIB message already complete. Cannot add new section.
! 3 = Sum of Section byte counts doesn't add to total byte count.
! 4 = Previous Section was not 1, 2 or 7.
! 5 = Could not find requested Grid Definition Template.
!
! REMARKS: Note that the Local Use Section ( Section 2 ) can only follow
! Section 1 or Section 7 in a GRIB2 message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use gridtemplates
character(len=1),intent(inout) :: cgrib(lcgrib)
integer,intent(in) :: igds(*),igdstmpl(*),ideflist(idefnum)
integer,intent(in) :: lcgrib,idefnum,igdstmplen
integer,intent(out) :: ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4):: ctemp
integer:: mapgrid(igdstmplen)
integer,parameter :: one=1,three=3
integer lensec3,iofst,ibeg,lencurr,len,mapgridlen
logical needext
ierr=0
!
! Check to see if beginning of GRIB message exists
!
ctemp=cgrib(1)//cgrib(2)//cgrib(3)//cgrib(4)
if ( ctemp.ne.grib ) then
print *,'addgrid: GRIB not found in given message.'
print *,'addgrid: Call to routine gribcreate required',
& ' to initialize GRIB messge.'
ierr=1
return
endif
!
! Get current length of GRIB message
!
call gbyte(cgrib,lencurr,96,32)
!
! Check to see if GRIB message is already complete
!
ctemp=cgrib(lencurr-3)//cgrib(lencurr-2)//cgrib(lencurr-1)
& //cgrib(lencurr)
if ( ctemp.eq.c7777 ) then
print *,'addgrid: GRIB message already complete. Cannot',
& ' add new section.'
ierr=2
return
endif
!
! Loop through all current sections of the GRIB message to
! find the last section number.
!
len=16 ! length of Section 0
do
! Get section number and length of next section
iofst=len*8
call gbyte(cgrib,ilen,iofst,32)
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8)
len=len+ilen
! Exit loop if last section reached
if ( len.eq.lencurr ) exit
! If byte count for each section doesn't match current
! total length, then there is a problem.
if ( len.gt.lencurr ) then
print *,'addgrid: Section byte counts don''t add to total.'
print *,'addgrid: Sum of section byte counts = ',len
print *,'addgrid: Total byte count in Section 0 = ',lencurr
ierr=3
return
endif
enddo
!
! Section 3 can only be added after sections 1, 2 and 7.
!
if ( (isecnum.ne.1) .and. (isecnum.ne.2) .and.
& (isecnum.ne.7) ) then
print *,'addgrid: Section 3 can only be added after Section',
& ' 1, 2 or 7.'
print *,'addgrid: Section ',isecnum,' was the last found in',
& ' given GRIB message.'
ierr=4
return
endif
!
! Add Section 3 - Grid Definition Section
!
ibeg=lencurr*8 ! Calculate offset for beginning of section 3
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,three,iofst,8) ! Store section number ( 3 )
iofst=iofst+8
call sbyte(cgrib,igds(1),iofst,8) ! Store source of Grid def.
iofst=iofst+8
call sbyte(cgrib,igds(2),iofst,32) ! Store number of data pts.
iofst=iofst+32
call sbyte(cgrib,igds(3),iofst,8) ! Store number of extra octets.
iofst=iofst+8
call sbyte(cgrib,igds(4),iofst,8) ! Store interp. of extra octets.
iofst=iofst+8
! if Octet 6 is not equal to zero, Grid Definition Template may
! not be supplied.
if ( igds(1).eq.0 ) then
call sbyte(cgrib,igds(5),iofst,16) ! Store Grid Def Template num.
else
call sbyte(cgrib,65535,iofst,16) ! Store missing value as Grid Def Template num.
endif
iofst=iofst+16
!
! Get Grid Definition Template
!
if (igds(1).eq.0) then
call getgridtemplate(igds(5),mapgridlen,mapgrid,needext,
& iret)
if (iret.ne.0) then
ierr=5
return
endif
!
! Extend the Grid Definition Template, if necessary.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extgridtemplate(igds(5),igdstmpl,mapgridlen,mapgrid)
endif
else
mapgridlen=0
endif
!
! Pack up each input value in array igdstmpl into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapgrid.
!
do i=1,mapgridlen
nbits=iabs(mapgrid(i))*8
if ( (mapgrid(i).ge.0).or.(igdstmpl(i).ge.0) ) then
call sbyte(cgrib,igdstmpl(i),iofst,nbits)
else
call sbyte(cgrib,one,iofst,1)
call sbyte(cgrib,iabs(igdstmpl(i)),iofst+1,nbits-1)
endif
iofst=iofst+nbits
enddo
!
! If requested,
! Insert optional list of numbers defining number of points
! in each row or column. This is used for non regular
! grids.
!
if ( igds(3).ne.0 ) then
nbits=igds(3)*8
call sbytes(cgrib,ideflist,iofst,nbits,0,idefnum)
iofst=iofst+(nbits*idefnum)
endif
!
! Calculate length of section 3 and store it in octets
! 1-4 of section 3.
!
lensec3=(iofst-ibeg)/8
call sbyte(cgrib,lensec3,ibeg,32)
!
! Update current byte total of message in Section 0
!
call sbyte(cgrib,lencurr+lensec3,96,32)
return
end

View file

@ -1,138 +0,0 @@
subroutine addlocal(cgrib,lcgrib,csec2,lcsec2,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: addlocal
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-01
!
! ABSTRACT: This subroutine adds a Local Use Section (Section 2) to
! a GRIB2 message.
! This routine is used with routines "gribcreate", "addgrid", "addfield",
! and "gribend" to create a complete GRIB2 message. Subroutine
! gribcreate must be called first to initialize a new GRIB2 message.
!
! PROGRAM HISTORY LOG:
! 2000-05-01 Gilbert
!
! USAGE: CALL addlocal(cgrib,lcgrib,csec2,lcsec2,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lcgrib - Maximum length (bytes) of array cgrib.
! csec2 - Character array containing information to be added to
! Section 2.
! lcsec2 - Number of bytes of character array csec2 to be added to
! Section 2.
!
! OUTPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! ierr - Error return code.
! 0 = no error
! 1 = GRIB message was not initialized. Need to call
! routine gribcreate first.
! 2 = GRIB message already complete. Cannot add new section.
! 3 = Sum of Section byte counts doesn't add to total byte count.
! 4 = Previous Section was not 1 or 7.
!
! REMARKS: Note that the Local Use Section ( Section 2 ) can only follow
! Section 1 or Section 7 in a GRIB2 message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(inout) :: cgrib(lcgrib)
character(len=1),intent(in) :: csec2(lcsec2)
integer,intent(in) :: lcgrib,lcsec2
integer,intent(out) :: ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4):: ctemp
integer,parameter :: two=2
integer lensec2,iofst,ibeg,lencurr,len
ierr=0
!
! Check to see if beginning of GRIB message exists
!
ctemp=cgrib(1)//cgrib(2)//cgrib(3)//cgrib(4)
if ( ctemp.ne.grib ) then
print *,'addlocal: GRIB not found in given message.'
print *,'addlocal: Call to routine gribcreate required',
& ' to initialize GRIB messge.'
ierr=1
return
endif
!
! Get current length of GRIB message
!
call gbyte(cgrib,lencurr,96,32)
!
! Check to see if GRIB message is already complete
!
ctemp=cgrib(lencurr-3)//cgrib(lencurr-2)//cgrib(lencurr-1)
& //cgrib(lencurr)
if ( ctemp.eq.c7777 ) then
print *,'addlocal: GRIB message already complete. Cannot',
& ' add new section.'
ierr=2
return
endif
!
! Loop through all current sections of the GRIB message to
! find the last section number.
!
len=16 ! length of Section 0
do
! Get section number and length of next section
iofst=len*8
call gbyte(cgrib,ilen,iofst,32)
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8)
len=len+ilen
! Exit loop if last section reached
if ( len.eq.lencurr ) exit
! If byte count for each section doesn't match current
! total length, then there is a problem.
if ( len.gt.lencurr ) then
print *,'addlocal: Section byte counts don''t add to total.'
print *,'addlocal: Sum of section byte counts = ',len
print *,'addlocal: Total byte count in Section 0 = ',lencurr
ierr=3
return
endif
enddo
!
! Section 2 can only be added after sections 1 and 7.
!
if ( (isecnum.ne.1) .and. (isecnum.ne.7) ) then
print *,'addlocal: Section 2 can only be added after Section',
& ' 1 or Section 7.'
print *,'addlocal: Section ',isecnum,' was the last found in',
& ' given GRIB message.'
ierr=4
return
endif
!
! Add Section 2 - Local Use Section
!
ibeg=lencurr*8 ! Calculate offset for beginning of section 2
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,two,iofst,8) ! Store section number ( 2 )
istart=lencurr+5
cgrib(istart+1:istart+lcsec2)=csec2(1:lcsec2)
!
! Calculate length of section 2 and store it in octets
! 1-4 of section 2.
!
lensec2=lcsec2+5 ! bytes
call sbyte(cgrib,lensec2,ibeg,32)
!
! Update current byte total of message in Section 0
!
call sbyte(cgrib,lencurr+lensec2,96,32)
return
end

View file

@ -1,76 +0,0 @@
subroutine cmplxpack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: cmplxpack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-08-27
!
! ABSTRACT: This subroutine packs up a data field using a complex
! packing algorithm as defined in the GRIB2 documention. It
! supports GRIB2 complex packing templates with or without
! spatial differences (i.e. DRTs 5.2 and 5.3).
! It also fills in GRIB2 Data Representation Template 5.2 or 5.3
! with the appropriate values.
!
! PROGRAM HISTORY LOG:
! 2004-08-27 Gilbert
!
! USAGE: CALL cmplxpack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
! INPUT ARGUMENT LIST:
! fld() - Contains the data values to pack
! ndpts - The number of data values in array fld()
! idrsnum - Data Representation Template number 5.N
! Must equal 2 or 3.
! idrstmpl - Contains the array of values for Data Representation
! Template 5.2 or 5.3
! (1) = Reference value - ignored on input
! (2) = Binary Scale Factor
! (3) = Decimal Scale Factor
! .
! .
! (7) = Missing value management
! (8) = Primary missing value
! (9) = Secondary missing value
! .
! .
! (17) = Order of Spatial Differencing ( 1 or 2 )
! .
! .
!
! OUTPUT ARGUMENT LIST:
! idrstmpl - Contains the array of values for Data Representation
! Template 5.3
! (1) = Reference value - set by compack routine.
! (2) = Binary Scale Factor - unchanged from input
! (3) = Decimal Scale Factor - unchanged from input
! .
! .
! cpack - The packed data field (character*1 array)
! lcpack - length of packed field cpack().
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: ndpts,idrsnum
real,intent(in) :: fld(ndpts)
character(len=1),intent(out) :: cpack(*)
integer,intent(inout) :: idrstmpl(*)
integer,intent(out) :: lcpack
if ( idrstmpl(7) .eq. 0 ) then ! No internal missing values
call compack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
elseif ( idrstmpl(7).eq.1 .OR. idrstmpl(7).eq.2) then
call misspack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
else
print *,'cmplxpack: Don:t recognize Missing value option.'
lcpack=-1
endif
return
end

View file

@ -1,408 +0,0 @@
subroutine compack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: compack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-06-21
!
! ABSTRACT: This subroutine packs up a data field using a complex
! packing algorithm as defined in the GRIB2 documention. It
! supports GRIB2 complex packing templates with or without
! spatial differences (i.e. DRTs 5.2 and 5.3).
! It also fills in GRIB2 Data Representation Template 5.2 or 5.3
! with the appropriate values.
!
! PROGRAM HISTORY LOG:
! 2000-06-21 Gilbert
!
! USAGE: CALL compack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
! INPUT ARGUMENT LIST:
! fld() - Contains the data values to pack
! ndpts - The number of data values in array fld()
! idrsnum - Data Representation Template number 5.N
! Must equal 2 or 3.
! idrstmpl - Contains the array of values for Data Representation
! Template 5.2 or 5.3
! (1) = Reference value - ignored on input
! (2) = Binary Scale Factor
! (3) = Decimal Scale Factor
! .
! .
! (7) = Missing value management
! (8) = Primary missing value
! (9) = Secondary missing value
! .
! .
! (17) = Order of Spatial Differencing ( 1 or 2 )
! .
! .
!
! OUTPUT ARGUMENT LIST:
! idrstmpl - Contains the array of values for Data Representation
! Template 5.3
! (1) = Reference value - set by compack routine.
! (2) = Binary Scale Factor - unchanged from input
! (3) = Decimal Scale Factor - unchanged from input
! .
! .
! cpack - The packed data field (character*1 array)
! lcpack - length of packed field cpack().
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: ndpts,idrsnum
real,intent(in) :: fld(ndpts)
character(len=1),intent(out) :: cpack(*)
integer,intent(inout) :: idrstmpl(*)
integer,intent(out) :: lcpack
real(4) :: ref
integer(4) :: iref
integer,allocatable :: ifld(:)
integer,allocatable :: jmin(:),jmax(:),lbit(:)
integer,parameter :: zero=0
integer,allocatable :: gref(:),gwidth(:),glen(:)
integer :: glength,grpwidth
logical :: simple_alg = .false.
alog2=alog(2.0)
bscale=2.0**real(-idrstmpl(2))
dscale=10.0**real(idrstmpl(3))
!
! Find max and min values in the data
!
rmax=fld(1)
rmin=fld(1)
do j=2,ndpts
if (fld(j).gt.rmax) rmax=fld(j)
if (fld(j).lt.rmin) rmin=fld(j)
enddo
!
! If max and min values are not equal, pack up field.
! If they are equal, we have a constant field, and the reference
! value (rmin) is the value for each point in the field and
! set nbits to 0.
!
if (rmin.ne.rmax) then
iofst=0
allocate(ifld(ndpts))
allocate(gref(ndpts))
allocate(gwidth(ndpts))
allocate(glen(ndpts))
!
! Scale original data
!
if (idrstmpl(2).eq.0) then ! No binary scaling
imin=nint(rmin*dscale)
!imax=nint(rmax*dscale)
rmin=real(imin)
do j=1,ndpts
ifld(j)=nint(fld(j)*dscale)-imin
enddo
else ! Use binary scaling factor
rmin=rmin*dscale
!rmax=rmax*dscale
do j=1,ndpts
ifld(j)=nint(((fld(j)*dscale)-rmin)*bscale)
enddo
endif
!
! Calculate Spatial differences, if using DRS Template 5.3
!
if (idrsnum.eq.3) then ! spatial differences
if (idrstmpl(17).ne.1.and.idrstmpl(17).ne.2) idrstmpl(17)=2
if (idrstmpl(17).eq.1) then ! first order
ival1=ifld(1)
do j=ndpts,2,-1
ifld(j)=ifld(j)-ifld(j-1)
enddo
ifld(1)=0
elseif (idrstmpl(17).eq.2) then ! second order
ival1=ifld(1)
ival2=ifld(2)
do j=ndpts,3,-1
ifld(j)=ifld(j)-(2*ifld(j-1))+ifld(j-2)
enddo
ifld(1)=0
ifld(2)=0
endif
!
! subtract min value from spatial diff field
!
isd=idrstmpl(17)+1
minsd=minval(ifld(isd:ndpts))
do j=isd,ndpts
ifld(j)=ifld(j)-minsd
enddo
!
! find num of bits need to store minsd and add 1 extra bit
! to indicate sign
!
temp=alog(real(abs(minsd)+1))/alog2
nbitsd=ceiling(temp)+1
!
! find num of bits need to store ifld(1) ( and ifld(2)
! if using 2nd order differencing )
!
maxorig=ival1
if (idrstmpl(17).eq.2.and.ival2.gt.ival1) maxorig=ival2
temp=alog(real(maxorig+1))/alog2
nbitorig=ceiling(temp)+1
if (nbitorig.gt.nbitsd) nbitsd=nbitorig
! increase number of bits to even multiple of 8 ( octet )
if (mod(nbitsd,8).ne.0) nbitsd=nbitsd+(8-mod(nbitsd,8))
!
! Store extra spatial differencing info into the packed
! data section.
!
if (nbitsd.ne.0) then
! pack first original value
if (ival1.ge.0) then
call sbyte(cpack,ival1,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(ival1),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
if (idrstmpl(17).eq.2) then
! pack second original value
if (ival2.ge.0) then
call sbyte(cpack,ival2,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(ival2),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
endif
! pack overall min of spatial differences
if (minsd.ge.0) then
call sbyte(cpack,minsd,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(minsd),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
endif
!print *,'SDp ',ival1,ival2,minsd,nbitsd
endif ! end of spatial diff section
!
! Determine Groups to be used.
!
if ( simple_alg ) then
! set group length to 10 : calculate number of groups
! and length of last group
ngroups=ndpts/10
glen(1:ngroups)=10
itemp=mod(ndpts,10)
if (itemp.ne.0) then
ngroups=ngroups+1
glen(ngroups)=itemp
endif
else
! Use Dr. Glahn's algorithm for determining grouping.
!
kfildo=6
minpk=10
inc=1
maxgrps=(ndpts/minpk)+1
allocate(jmin(maxgrps))
allocate(jmax(maxgrps))
allocate(lbit(maxgrps))
missopt=0
call pack_gp(kfildo,ifld,ndpts,missopt,minpk,inc,miss1,miss2,
& jmin,jmax,lbit,glen,maxgrps,ngroups,ibit,jbit,
& kbit,novref,lbitref,ier)
!print *,'SAGier = ',ier,ibit,jbit,kbit,novref,lbitref
do ng=1,ngroups
glen(ng)=glen(ng)+novref
enddo
deallocate(jmin)
deallocate(jmax)
deallocate(lbit)
endif
!
! For each group, find the group's reference value
! and the number of bits needed to hold the remaining values
!
n=1
do ng=1,ngroups
! find max and min values of group
gref(ng)=ifld(n)
imax=ifld(n)
j=n+1
do lg=2,glen(ng)
if (ifld(j).lt.gref(ng)) gref(ng)=ifld(j)
if (ifld(j).gt.imax) imax=ifld(j)
j=j+1
enddo
! calc num of bits needed to hold data
if ( gref(ng).ne.imax ) then
temp=alog(real(imax-gref(ng)+1))/alog2
gwidth(ng)=ceiling(temp)
else
gwidth(ng)=0
endif
! Subtract min from data
j=n
do lg=1,glen(ng)
ifld(j)=ifld(j)-gref(ng)
j=j+1
enddo
! increment fld array counter
n=n+glen(ng)
enddo
!
! Find max of the group references and calc num of bits needed
! to pack each groups reference value, then
! pack up group reference values
!
!write(77,*)'GREFS: ',(gref(j),j=1,ngroups)
igmax=maxval(gref(1:ngroups))
if (igmax.ne.0) then
temp=alog(real(igmax+1))/alog2
nbitsgref=ceiling(temp)
call sbytes(cpack,gref,iofst,nbitsgref,0,ngroups)
itemp=nbitsgref*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsgref=0
endif
!
! Find max/min of the group widths and calc num of bits needed
! to pack each groups width value, then
! pack up group width values
!
!write(77,*)'GWIDTHS: ',(gwidth(j),j=1,ngroups)
iwmax=maxval(gwidth(1:ngroups))
ngwidthref=minval(gwidth(1:ngroups))
if (iwmax.ne.ngwidthref) then
temp=alog(real(iwmax-ngwidthref+1))/alog2
nbitsgwidth=ceiling(temp)
do i=1,ngroups
gwidth(i)=gwidth(i)-ngwidthref
enddo
call sbytes(cpack,gwidth,iofst,nbitsgwidth,0,ngroups)
itemp=nbitsgwidth*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsgwidth=0
gwidth(1:ngroups)=0
endif
!
! Find max/min of the group lengths and calc num of bits needed
! to pack each groups length value, then
! pack up group length values
!
!write(77,*)'GLENS: ',(glen(j),j=1,ngroups)
ilmax=maxval(glen(1:ngroups-1))
nglenref=minval(glen(1:ngroups-1))
nglenlast=glen(ngroups)
if (ilmax.ne.nglenref) then
temp=alog(real(ilmax-nglenref+1))/alog2
nbitsglen=ceiling(temp)
do i=1,ngroups-1
glen(i)=glen(i)-nglenref
enddo
call sbytes(cpack,glen,iofst,nbitsglen,0,ngroups)
itemp=nbitsglen*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsglen=0
glen(1:ngroups)=0
endif
!
! For each group, pack data values
!
!write(77,*)'IFLDS: ',(ifld(j),j=1,ndpts)
n=1
ij=0
do ng=1,ngroups
glength=glen(ng)+nglenref
if (ng.eq.ngroups ) glength=nglenlast
grpwidth=gwidth(ng)+ngwidthref
!write(77,*)'NGP ',ng,grpwidth,glength,gref(ng)
if ( grpwidth.ne.0 ) then
call sbytes(cpack,ifld(n),iofst,grpwidth,0,glength)
iofst=iofst+(grpwidth*glength)
endif
do kk=1,glength
ij=ij+1
!write(77,*)'SAG ',ij,fld(ij),ifld(ij),gref(ng),bscale,rmin,dscale
enddo
n=n+glength
enddo
! Pad last octet with Zeros, if necessary,
if (mod(iofst,8).ne.0) then
left=8-mod(iofst,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
lcpack=iofst/8
!
if ( allocated(ifld) ) deallocate(ifld)
if ( allocated(gref) ) deallocate(gref)
if ( allocated(gwidth) ) deallocate(gwidth)
if ( allocated(glen) ) deallocate(glen)
else ! Constant field ( max = min )
nbits=0
lcpack=0
nbitsgref=0
ngroups=0
endif
!
! Fill in ref value and number of bits in Template 5.2
!
call mkieee(rmin,ref,1) ! ensure reference value is IEEE format
! call gbyte(ref,idrstmpl(1),0,32)
iref=transfer(ref,iref)
idrstmpl(1)=iref
idrstmpl(4)=nbitsgref
idrstmpl(5)=0 ! original data were reals
idrstmpl(6)=1 ! general group splitting
idrstmpl(7)=0 ! No internal missing values
idrstmpl(8)=0 ! Primary missing value
idrstmpl(9)=0 ! secondary missing value
idrstmpl(10)=ngroups ! Number of groups
idrstmpl(11)=ngwidthref ! reference for group widths
idrstmpl(12)=nbitsgwidth ! num bits used for group widths
idrstmpl(13)=nglenref ! Reference for group lengths
idrstmpl(14)=1 ! length increment for group lengths
idrstmpl(15)=nglenlast ! True length of last group
idrstmpl(16)=nbitsglen ! num bits used for group lengths
if (idrsnum.eq.3) then
idrstmpl(18)=nbitsd/8 ! num bits used for extra spatial
! differencing values
endif
return
end

View file

@ -1,336 +0,0 @@
subroutine comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts,
& fld,ier)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: comunpack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-06-21
!
! ABSTRACT: This subroutine unpacks a data field that was packed using a
! complex packing algorithm as defined in the GRIB2 documention,
! using info from the GRIB2 Data Representation Template 5.2 or 5.3.
! Supports GRIB2 complex packing templates with or without
! spatial differences (i.e. DRTs 5.2 and 5.3).
!
! PROGRAM HISTORY LOG:
! 2000-06-21 Gilbert
! 2004-12-29 Gilbert - Added test ( provided by Arthur Taylor/MDL )
! to verify that group widths and lengths are
! consistent with section length.
!
! USAGE: CALL comunpack(cpack,len,lensec,idrsnum,idrstmpl,ndpts,fld,ier)
! INPUT ARGUMENT LIST:
! cpack - The packed data field (character*1 array)
! len - length of packed field cpack().
! lensec - length of section 7 (used for error checking).
! idrsnum - Data Representation Template number 5.N
! Must equal 2 or 3.
! idrstmpl - Contains the array of values for Data Representation
! Template 5.2 or 5.3
! ndpts - The number of data values to unpack
!
! OUTPUT ARGUMENT LIST:
! fld() - Contains the unpacked data values
! ier - Error return:
! 0 = OK
! 1 = Problem - inconsistent group lengths of widths.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cpack(len)
integer,intent(in) :: ndpts,len
integer,intent(in) :: idrstmpl(*)
real,intent(out) :: fld(ndpts)
integer,allocatable :: ifld(:),ifldmiss(:)
integer(4) :: ieee
integer,allocatable :: gref(:),gwidth(:),glen(:)
real :: ref,bscale,dscale,rmiss1,rmiss2
! real :: fldo(6045)
integer :: totBit, totLen
ier=0
!print *,'IDRSTMPL: ',(idrstmpl(j),j=1,16)
ieee = idrstmpl(1)
call rdieee(ieee,ref,1)
bscale = 2.0**real(idrstmpl(2))
dscale = 10.0**real(-idrstmpl(3))
nbitsgref = idrstmpl(4)
itype = idrstmpl(5)
ngroups = idrstmpl(10)
nbitsgwidth = idrstmpl(12)
nbitsglen = idrstmpl(16)
if (idrsnum.eq.3) then
nbitsd=idrstmpl(18)*8
endif
! Constant field
if (ngroups.eq.0) then
do j=1,ndpts
fld(j)=ref
enddo
return
endif
iofst=0
allocate(ifld(ndpts),stat=is)
!print *,'ALLOC ifld: ',is,ndpts
allocate(gref(ngroups),stat=is)
!print *,'ALLOC gref: ',is
allocate(gwidth(ngroups),stat=is)
!print *,'ALLOC gwidth: ',is
!
! Get missing values, if supplied
!
if ( idrstmpl(7).eq.1 ) then
if (itype.eq.0) then
call rdieee(idrstmpl(8),rmiss1,1)
else
rmiss1=real(idrstmpl(8))
endif
elseif ( idrstmpl(7).eq.2 ) then
if (itype.eq.0) then
call rdieee(idrstmpl(8),rmiss1,1)
call rdieee(idrstmpl(9),rmiss2,1)
else
rmiss1=real(idrstmpl(8))
rmiss2=real(idrstmpl(9))
endif
endif
!print *,'RMISSs: ',rmiss1,rmiss2,ref
!
! Extract Spatial differencing values, if using DRS Template 5.3
!
if (idrsnum.eq.3) then
if (nbitsd.ne.0) then
call gbyte(cpack,isign,iofst,1)
iofst=iofst+1
call gbyte(cpack,ival1,iofst,nbitsd-1)
iofst=iofst+nbitsd-1
if (isign.eq.1) ival1=-ival1
if (idrstmpl(17).eq.2) then
call gbyte(cpack,isign,iofst,1)
iofst=iofst+1
call gbyte(cpack,ival2,iofst,nbitsd-1)
iofst=iofst+nbitsd-1
if (isign.eq.1) ival2=-ival2
endif
call gbyte(cpack,isign,iofst,1)
iofst=iofst+1
call gbyte(cpack,minsd,iofst,nbitsd-1)
iofst=iofst+nbitsd-1
if (isign.eq.1) minsd=-minsd
else
ival1=0
ival2=0
minsd=0
endif
!print *,'SDu ',ival1,ival2,minsd,nbitsd
endif
!
! Extract Each Group's reference value
!
!print *,'SAG1: ',nbitsgref,ngroups,iofst
if (nbitsgref.ne.0) then
call gbytes(cpack,gref,iofst,nbitsgref,0,ngroups)
itemp=nbitsgref*ngroups
iofst=iofst+(itemp)
if (mod(itemp,8).ne.0) iofst=iofst+(8-mod(itemp,8))
else
gref(1:ngroups)=0
endif
!write(78,*)'GREFs: ',(gref(j),j=1,ngroups)
!
! Extract Each Group's bit width
!
!print *,'SAG2: ',nbitsgwidth,ngroups,iofst,idrstmpl(11)
if (nbitsgwidth.ne.0) then
call gbytes(cpack,gwidth,iofst,nbitsgwidth,0,ngroups)
itemp=nbitsgwidth*ngroups
iofst=iofst+(itemp)
if (mod(itemp,8).ne.0) iofst=iofst+(8-mod(itemp,8))
else
gwidth(1:ngroups)=0
endif
do j=1,ngroups
gwidth(j)=gwidth(j)+idrstmpl(11)
enddo
!write(78,*)'GWIDTHs: ',(gwidth(j),j=1,ngroups)
!
! Extract Each Group's length (number of values in each group)
!
allocate(glen(ngroups),stat=is)
!print *,'ALLOC glen: ',is
!print *,'SAG3: ',nbitsglen,ngroups,iofst,idrstmpl(14),idrstmpl(13)
if (nbitsglen.ne.0) then
call gbytes(cpack,glen,iofst,nbitsglen,0,ngroups)
itemp=nbitsglen*ngroups
iofst=iofst+(itemp)
if (mod(itemp,8).ne.0) iofst=iofst+(8-mod(itemp,8))
else
glen(1:ngroups)=0
endif
do j=1,ngroups
glen(j)=(glen(j)*idrstmpl(14))+idrstmpl(13)
enddo
glen(ngroups)=idrstmpl(15)
!write(78,*)'GLENs: ',(glen(j),j=1,ngroups)
!print *,'GLENsum: ',sum(glen)
!
! Test to see if the group widths and lengths are consistent with number of
! values, and length of section 7.
!
totBit = 0
totLen = 0
do j=1,ngroups
totBit = totBit + (gwidth(j)*glen(j));
totLen = totLen + glen(j);
enddo
if (totLen .NE. ndpts) then
ier=1
return
endif
if ( (totBit/8) .GT. lensec) then
ier=1
return
endif
!
! For each group, unpack data values
!
if ( idrstmpl(7).eq.0 ) then ! no missing values
n=1
do j=1,ngroups
!write(78,*)'NGP ',j,gwidth(j),glen(j),gref(j)
if (gwidth(j).ne.0) then
call gbytes(cpack,ifld(n),iofst,gwidth(j),0,glen(j))
do k=1,glen(j)
ifld(n)=ifld(n)+gref(j)
n=n+1
enddo
else
ifld(n:n+glen(j)-1)=gref(j)
n=n+glen(j)
endif
iofst=iofst+(gwidth(j)*glen(j))
enddo
elseif ( idrstmpl(7).eq.1.OR.idrstmpl(7).eq.2 ) then
! missing values included
allocate(ifldmiss(ndpts))
!ifldmiss=0
n=1
non=1
do j=1,ngroups
!print *,'SAGNGP ',j,gwidth(j),glen(j),gref(j)
if (gwidth(j).ne.0) then
msng1=(2**gwidth(j))-1
msng2=msng1-1
call gbytes(cpack,ifld(n),iofst,gwidth(j),0,glen(j))
iofst=iofst+(gwidth(j)*glen(j))
do k=1,glen(j)
if (ifld(n).eq.msng1) then
ifldmiss(n)=1
elseif (idrstmpl(7).eq.2.AND.ifld(n).eq.msng2) then
ifldmiss(n)=2
else
ifldmiss(n)=0
ifld(non)=ifld(n)+gref(j)
non=non+1
endif
n=n+1
enddo
else
msng1=(2**nbitsgref)-1
msng2=msng1-1
if (gref(j).eq.msng1) then
ifldmiss(n:n+glen(j)-1)=1
!ifld(n:n+glen(j)-1)=0
elseif (idrstmpl(7).eq.2.AND.gref(j).eq.msng2) then
ifldmiss(n:n+glen(j)-1)=2
!ifld(n:n+glen(j)-1)=0
else
ifldmiss(n:n+glen(j)-1)=0
ifld(non:non+glen(j)-1)=gref(j)
non=non+glen(j)
endif
n=n+glen(j)
endif
enddo
endif
!write(78,*)'IFLDs: ',(ifld(j),j=1,ndpts)
if ( allocated(gref) ) deallocate(gref)
if ( allocated(gwidth) ) deallocate(gwidth)
if ( allocated(glen) ) deallocate(glen)
!
! If using spatial differences, add overall min value, and
! sum up recursively
!
if (idrsnum.eq.3) then ! spatial differencing
if (idrstmpl(17).eq.1) then ! first order
ifld(1)=ival1
if ( idrstmpl(7).eq.0 ) then ! no missing values
itemp=ndpts
else
itemp=non-1
endif
do n=2,itemp
ifld(n)=ifld(n)+minsd
ifld(n)=ifld(n)+ifld(n-1)
enddo
elseif (idrstmpl(17).eq.2) then ! second order
ifld(1)=ival1
ifld(2)=ival2
if ( idrstmpl(7).eq.0 ) then ! no missing values
itemp=ndpts
else
itemp=non-1
endif
do n=3,itemp
ifld(n)=ifld(n)+minsd
ifld(n)=ifld(n)+(2*ifld(n-1))-ifld(n-2)
enddo
endif
!write(78,*)'IFLDs: ',(ifld(j),j=1,ndpts)
endif
!
! Scale data back to original form
!
!print *,'SAGT: ',ref,bscale,dscale
if ( idrstmpl(7).eq.0 ) then ! no missing values
do n=1,ndpts
fld(n)=((real(ifld(n))*bscale)+ref)*dscale
!write(78,*)'SAG ',n,fld(n),ifld(n),bscale,ref,1./dscale
enddo
elseif ( idrstmpl(7).eq.1.OR.idrstmpl(7).eq.2 ) then
! missing values included
non=1
do n=1,ndpts
if ( ifldmiss(n).eq.0 ) then
fld(n)=((real(ifld(non))*bscale)+ref)*dscale
!print *,'SAG ',n,fld(n),ifld(non),bscale,ref,dscale
non=non+1
elseif ( ifldmiss(n).eq.1 ) then
fld(n)=rmiss1
elseif ( ifldmiss(n).eq.2 ) then
fld(n)=rmiss2
endif
enddo
if ( allocated(ifldmiss) ) deallocate(ifldmiss)
endif
if ( allocated(ifld) ) deallocate(ifld)
!open(10,form='unformatted',recl=24180,access='direct')
!read(10,rec=1) (fldo(k),k=1,6045)
!do i =1,6045
! print *,i,fldo(i),fld(i),fldo(i)-fld(i)
!enddo
return
end

View file

@ -1,155 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jasper/jasper.h"
#define JAS_1_700_2
#ifdef __64BIT__
typedef int g2int;
#else
typedef long g2int;
#endif
#if defined CRAY90
#include <fortran.h>
#define SUB_NAME DEC_JPEG2000
#elif defined LINUXF90
#define SUB_NAME DEC_JPEG2000
#elif defined LINUXG95
#define SUB_NAME dec_jpeg2000__
#elif defined HP || defined AIX
#define SUB_NAME dec_jpeg2000
#elif defined SGI || defined LINUX || defined VPP5000
#define SUB_NAME dec_jpeg2000_
#endif
int SUB_NAME(char *injpc,g2int *bufsize,g2int *outfld)
/*$$$ SUBPROGRAM DOCUMENTATION BLOCK
* . . . .
* SUBPROGRAM: dec_jpeg2000 Decodes JPEG2000 code stream
* PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-02
*
* ABSTRACT: This Function decodes a JPEG2000 code stream specified in the
* JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer
* Software version 1.500.4 (or 1.700.2) written by the University of British
* Columbia and Image Power Inc, and others.
* JasPer is available at http://www.ece.uvic.ca/~mdadams/jasper/.
*
* PROGRAM HISTORY LOG:
* 2002-12-02 Gilbert
*
* USAGE: int dec_jpeg2000(char *injpc,g2int *bufsize,g2int *outfld)
*
* INPUT ARGUMENTS:
* injpc - Input JPEG2000 code stream.
* bufsize - Length (in bytes) of the input JPEG2000 code stream.
*
* INPUT ARGUMENTS:
* outfld - Output matrix of grayscale image values.
*
* RETURN VALUES :
* 0 = Successful decode
* -3 = Error decode jpeg2000 code stream.
* -5 = decoded image had multiple color components.
* Only grayscale is expected.
*
* REMARKS:
*
* Requires JasPer Software version 1.500.4 or 1.700.2
*
* ATTRIBUTES:
* LANGUAGE: C
* MACHINE: IBM SP
*
*$$$*/
{
int ier;
g2int i,j,k,n;
jas_image_t *image=0;
jas_stream_t *jpcstream,*istream;
jas_image_cmpt_t cmpt,*pcmpt;
char *opts=0;
jas_matrix_t *data;
// jas_init();
//
// Create jas_stream_t containing input JPEG200 codestream in memory.
//
jpcstream=jas_stream_memopen(injpc,*bufsize);
//
// Decode JPEG200 codestream into jas_image_t structure.
//
image=jpc_decode(jpcstream,opts);
if ( image == 0 ) {
printf(" jpc_decode return = %d \n",ier);
return -3;
}
pcmpt=image->cmpts_[0];
/*
printf(" SAGOUT DECODE:\n");
printf(" tlx %d \n",image->tlx_);
printf(" tly %d \n",image->tly_);
printf(" brx %d \n",image->brx_);
printf(" bry %d \n",image->bry_);
printf(" numcmpts %d \n",image->numcmpts_);
printf(" maxcmpts %d \n",image->maxcmpts_);
#ifdef JAS_1_500_4
printf(" colormodel %d \n",image->colormodel_);
#endif
#ifdef JAS_1_700_2
printf(" colorspace %d \n",image->clrspc_);
#endif
printf(" inmem %d \n",image->inmem_);
printf(" COMPONENT:\n");
printf(" tlx %d \n",pcmpt->tlx_);
printf(" tly %d \n",pcmpt->tly_);
printf(" hstep %d \n",pcmpt->hstep_);
printf(" vstep %d \n",pcmpt->vstep_);
printf(" width %d \n",pcmpt->width_);
printf(" height %d \n",pcmpt->height_);
printf(" prec %d \n",pcmpt->prec_);
printf(" sgnd %d \n",pcmpt->sgnd_);
printf(" cps %d \n",pcmpt->cps_);
#ifdef JAS_1_700_2
printf(" type %d \n",pcmpt->type_);
#endif
*/
// Expecting jpeg2000 image to be grayscale only.
// No color components.
//
if (image->numcmpts_ != 1 ) {
printf("dec_jpeg2000: Found color image. Grayscale expected.\n");
return (-5);
}
//
// Create a data matrix of grayscale image values decoded from
// the jpeg2000 codestream.
//
data=jas_matrix_create(jas_image_height(image), jas_image_width(image));
jas_image_readcmpt(image,0,0,0,jas_image_width(image),
jas_image_height(image),data);
//
// Copy data matrix to output integer array.
//
k=0;
for (i=0;i<pcmpt->height_;i++)
for (j=0;j<pcmpt->width_;j++)
outfld[k++]=data->rows_[i][j];
//
// Clean up JasPer work structures.
//
jas_matrix_destroy(data);
ier=jas_stream_close(jpcstream);
jas_image_destroy(image);
return 0;
}

View file

@ -1,151 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#ifdef __64BIT__
typedef int g2int;
#else
typedef long g2int;
#endif
#if defined CRAY90
#include <fortran.h>
#define SUB_NAME DEC_PNG
#elif defined LINUXF90
#define SUB_NAME DEC_PNG
#elif defined LINUXG95
#define SUB_NAME dec_png__
#elif defined HP || defined AIX
#define SUB_NAME dec_png
#elif defined SGI || defined LINUX || defined VPP5000
#define SUB_NAME dec_png_
#endif
struct png_stream {
unsigned char *stream_ptr; /* location to write PNG stream */
g2int stream_len; /* number of bytes written */
};
typedef struct png_stream png_stream;
void user_read_data(png_structp , png_bytep , png_uint_32 );
void user_read_data(png_structp png_ptr,png_bytep data, png_uint_32 length)
/*
Custom read function used so that libpng will read a PNG stream
from memory instead of a file on disk.
*/
{
char *ptr;
g2int offset;
png_stream *mem;
mem=(png_stream *)png_get_io_ptr(png_ptr);
ptr=(void *)mem->stream_ptr;
offset=mem->stream_len;
/* printf("SAGrd %ld %ld %x\n",offset,length,ptr); */
memcpy(data,ptr+offset,length);
mem->stream_len += length;
}
int SUB_NAME(unsigned char *pngbuf,g2int *width,g2int *height,char *cout)
{
int interlace,color,compres,filter,bit_depth;
g2int j,k,n,bytes,clen;
png_structp png_ptr;
png_infop info_ptr,end_info;
png_bytepp row_pointers;
png_stream read_io_ptr;
/* check if stream is a valid PNG format */
if ( png_sig_cmp(pngbuf,0,8) != 0)
return (-3);
/* create and initialize png_structs */
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
NULL, NULL);
if (!png_ptr)
return (-1);
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr,(png_infopp)NULL,(png_infopp)NULL);
return (-2);
}
end_info = png_create_info_struct(png_ptr);
if (!end_info)
{
png_destroy_read_struct(&png_ptr,(png_infopp)info_ptr,(png_infopp)NULL);
return (-2);
}
/* Set Error callback */
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,&end_info);
return (-3);
}
/* Initialize info for reading PNG stream from memory */
read_io_ptr.stream_ptr=(png_voidp)pngbuf;
read_io_ptr.stream_len=0;
/* Set new custom read function */
png_set_read_fn(png_ptr,(voidp)&read_io_ptr,(png_rw_ptr)user_read_data);
/* png_init_io(png_ptr, fptr); */
/* Read and decode PNG stream */
png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
/* Get pointer to each row of image data */
row_pointers = png_get_rows(png_ptr, info_ptr);
/* Get image info, such as size, depth, colortype, etc... */
/*printf("SAGT:png %d %d %d\n",info_ptr->width,info_ptr->height,info_ptr->bit_depth);*/
(void)png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *)width, (png_uint_32 *)height,
&bit_depth, &color, &interlace, &compres, &filter);
/* Check if image was grayscale */
/*
if (color != PNG_COLOR_TYPE_GRAY ) {
fprintf(stderr,"dec_png: Grayscale image was expected. \n");
}
*/
if ( color == PNG_COLOR_TYPE_RGB ) {
bit_depth=24;
}
else if ( color == PNG_COLOR_TYPE_RGB_ALPHA ) {
bit_depth=32;
}
/* Copy image data to output string */
n=0;
bytes=bit_depth/8;
clen=(*width)*bytes;
for (j=0;j<*height;j++) {
for (k=0;k<clen;k++) {
cout[n]=*(row_pointers[j]+k);
n++;
}
}
/* Clean up */
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return 0;
}

View file

@ -1,277 +0,0 @@
module drstemplates
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: drstemplates
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-04-03
!
! ABSTRACT: This Fortran Module contains info on all the available
! GRIB2 Data Representation Templates used in Section 5 (DRS).
! Each Template has three parts: The number of entries in the template
! (mapgridlen); A map of the template (mapgrid), which contains the
! number of octets in which to pack each of the template values; and
! a logical value (needext) that indicates whether the Template needs
! to be extended. In some cases the number of entries in a template
! can vary depending upon values specified in the "static" part of
! the template. ( See Template 5.1 as an example )
!
! This module also contains two subroutines. Subroutine getdrstemplate
! returns the octet map for a specified Template number, and
! subroutine extdrstemplate will calculate the extended octet map
! of an appropriate template given values for the "static" part of the
! template. See docblocks below for the arguments and usage of these
! routines.
!
! NOTE: Array mapgrid contains the number of octets in which the
! corresponding template values will be stored. A negative value in
! mapgrid is used to indicate that the corresponding template entry can
! contain negative values. This information is used later when packing
! (or unpacking) the template data values. Negative data values in GRIB
! are stored with the left most bit set to one, and a negative number
! of octets value in mapgrid() indicates that this possibility should
! be considered. The number of octets used to store the data value
! in this case would be the absolute value of the negative value in
! mapgrid().
!
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
! 2002-12-11 Gilbert - Added templates for JPEG2000 and PNG encoding
!
! USAGE: use drstemplates
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXLEN=200,MAXTEMP=9
type drstemplate
integer :: template_num
integer :: mapdrslen
integer,dimension(MAXLEN) :: mapdrs
logical :: needext
end type drstemplate
type(drstemplate),dimension(MAXTEMP) :: templates
data templates(1)%template_num /0/ ! Simple Packing
data templates(1)%mapdrslen /5/
data templates(1)%needext /.false./
data (templates(1)%mapdrs(j),j=1,5)
& /4,-2,-2,1,1/
data templates(2)%template_num /2/ ! Complex Packing
data templates(2)%mapdrslen /16/
data templates(2)%needext /.false./
data (templates(2)%mapdrs(j),j=1,16)
& /4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1/
data templates(3)%template_num /3/ ! Complex Packing - Spatial Diff
data templates(3)%mapdrslen /18/
data templates(3)%needext /.false./
data (templates(3)%mapdrs(j),j=1,18)
& /4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1,1,1/
data templates(4)%template_num /50/ ! Simple Packing - Spectral Data
data templates(4)%mapdrslen /5/
data templates(4)%needext /.false./
data (templates(4)%mapdrs(j),j=1,5)
& /4,-2,-2,1,4/
data templates(5)%template_num /51/ ! Complex Packing - Spectral Data
data templates(5)%mapdrslen /10/
data templates(5)%needext /.false./
data (templates(5)%mapdrs(j),j=1,10)
& /4,-2,-2,1,-4,2,2,2,4,1/
data templates(6)%template_num /40000/ ! JPEG2000 Encoding
data templates(6)%mapdrslen /7/
data templates(6)%needext /.false./
data (templates(6)%mapdrs(j),j=1,7)
& /4,-2,-2,1,1,1,1/
data templates(7)%template_num /40010/ ! PNG Encoding
data templates(7)%mapdrslen /5/
data templates(7)%needext /.false./
data (templates(7)%mapdrs(j),j=1,5)
& /4,-2,-2,1,1/
data templates(8)%template_num /40/ ! JPEG2000 Encoding
data templates(8)%mapdrslen /7/
data templates(8)%needext /.false./
data (templates(8)%mapdrs(j),j=1,7)
& /4,-2,-2,1,1,1,1/
data templates(9)%template_num /41/ ! PNG Encoding
data templates(9)%mapdrslen /5/
data templates(9)%needext /.false./
data (templates(9)%mapdrs(j),j=1,5)
& /4,-2,-2,1,1/
! data templates(5)%template_num /1/ ! Simple Packing - Matrix
! data templates(5)%mapdrslen /15/
! data templates(5)%needext /.true./
! data (templates(5)%mapdrs(j),j=1,15)
! & /4,-2,-2,1,1,1,4,2,2,1,1,1,1,1,1/
contains
integer function getdrsindex(number)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getdrsindex
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-28
!
! ABSTRACT: This function returns the index of specified Data
! Representation Template 5.NN (NN=number) in array templates.
!
! PROGRAM HISTORY LOG:
! 2001-06-28 Gilbert
!
! USAGE: index=getdrsindex(number)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Data Representation
! Template 5.NN that is being requested.
!
! RETURNS: Index of DRT 5.NN in array templates, if template exists.
! = -1, otherwise.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
getdrsindex=-1
do j=1,MAXTEMP
if (number.eq.templates(j)%template_num) then
getdrsindex=j
return
endif
enddo
end function
subroutine getdrstemplate(number,nummap,map,needext,iret)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getdrstemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-11
!
! ABSTRACT: This subroutine returns DRS template information for a
! specified Data Representation Template 5.NN.
! The number of entries in the template is returned along with a map
! of the number of octets occupied by each entry. Also, a flag is
! returned to indicate whether the template would need to be extended.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL getdrstemplate(number,nummap,map,needext,iret)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Data Representation
! Template 5.NN that is being requested.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the DRS.
! needext - Logical variable indicating whether the Data Representation
! Template has to be extended.
! ierr - Error return code.
! 0 = no error
! 1 = Undefined Data Representation Template number.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
integer,intent(out) :: nummap,map(*),iret
logical,intent(out) :: needext
iret=0
index=getdrsindex(number)
if (index.ne.-1) then
nummap=templates(index)%mapdrslen
needext=templates(index)%needext
map(1:nummap)=templates(index)%mapdrs(1:nummap)
else
nummap=0
needext=.false.
print *,'getdrstemplate: DRS Template ',number,
& ' not defined.'
iret=1
endif
end subroutine
subroutine extdrstemplate(number,list,nummap,map)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: extdrstemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-11
!
! ABSTRACT: This subroutine generates the remaining octet map for a
! given Data Representation Template, if required. Some Templates can
! vary depending on data values given in an earlier part of the
! Template, and it is necessary to know some of the earlier entry
! values to generate the full octet map of the Template.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL extdrstemplate(number,list,nummap,map)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Data Representation
! Template 5.NN that is being requested.
! list() - The list of values for each entry in the
! the Data Representation Template 5.NN.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the GDS.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number,list(*)
integer,intent(out) :: nummap,map(*)
index=getdrsindex(number)
if (index.eq.-1) return
if ( .not. templates(index)%needext ) return
nummap=templates(index)%mapdrslen
map(1:nummap)=templates(index)%mapdrs(1:nummap)
if ( number.eq.1 ) then
N=list(11)+list(13)
do i=1,N
map(nummap+i)=4
enddo
nummap=nummap+N
endif
end subroutine
end module

View file

@ -1,65 +0,0 @@
GFORTRAN module created from drstemplates.f on Mon Nov 16 16:42:53 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'drstemplates' 'drstemplates' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 () ())
3 'drstemplate' 'drstemplates' 1 ((DERIVED UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 ((4 'template_num' (INTEGER 4 ()) ()
0 0 ()) (5 'mapdrslen' (INTEGER 4 ()) () 0 0 ()) (6 'mapdrs' (INTEGER 4
()) (1 EXPLICIT (CONSTANT (INTEGER 4 ()) 0 '1') (CONSTANT (INTEGER 4 ())
0 '200')) 1 0 ()) (7 'needext' (LOGICAL 4 ()) () 0 0 ())) PUBLIC ())
8 'getdrsindex' 'drstemplates' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL FUNCTION) (INTEGER 4 ()) 9 0 (10) () 8 () ())
11 'extdrstemplate' 'drstemplates' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 12 0 (13 14 15 16) () 0 () ())
17 'maxlen' 'drstemplates' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '200') () 0 ()
())
18 'templates' 'drstemplates' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN DIMENSION DATA) (DERIVED 3 ()) 0 0 () (1 EXPLICIT (CONSTANT (
INTEGER 4 ()) 0 '1') (CONSTANT (INTEGER 4 ()) 0 '9')) 0 () ())
19 'maxtemp' 'drstemplates' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '9') () 0 () ())
20 'j' 'drstemplates' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(INTEGER 4 ()) 0 0 () () 0 () ())
21 'getdrstemplate' 'drstemplates' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 22 0 (23 24 25 26 27) () 0 ()
())
10 'number' '' 9 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
23 'number' '' 22 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
25 'map' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
26 'needext' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (LOGICAL 4
()) 0 0 () () 0 () ())
14 'list' '' 12 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
13 'number' '' 12 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
15 'nummap' '' 12 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4
()) 0 0 () () 0 () ())
16 'map' '' 12 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
27 'iret' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
24 'nummap' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4
()) 0 0 () () 0 () ())
)
('getdrstemplate' 0 21 'extdrstemplate' 0 11 'drstemplate' 0 3
'drstemplates' 0 2 'getdrsindex' 0 8 'j' 0 20 'maxtemp' 0 19 'maxlen' 0
17 'templates' 0 18)

View file

@ -1,196 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jasper/jasper.h"
#define JAS_1_700_2
#ifdef __64BIT__
typedef int g2int;
#else
typedef long g2int;
#endif
#if defined CRAY90
#include <fortran.h>
#define SUB_NAME ENC_JPEG2000
#elif defined LINUXF90
#define SUB_NAME ENC_JPEG2000
#elif defined LINUXG95
#define SUB_NAME enc_jpeg2000__
#elif defined HP || defined AIX
#define SUB_NAME enc_jpeg2000
#elif defined SGI || defined LINUX || defined VPP5000
#define SUB_NAME enc_jpeg2000_
#endif
int SUB_NAME(unsigned char *cin,g2int *pwidth,g2int *pheight,g2int *pnbits,
g2int *ltype, g2int *ratio, g2int *retry, char *outjpc,
g2int *jpclen)
/*$$$ SUBPROGRAM DOCUMENTATION BLOCK
* . . . .
* SUBPROGRAM: enc_jpeg2000 Encodes JPEG2000 code stream
* PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-02
*
* ABSTRACT: This Function encodes a grayscale image into a JPEG2000 code stream
* specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1)
* using JasPer Software version 1.500.4 (or 1.700.2 ) written by the
* University of British Columbia, Image Power Inc, and others.
* JasPer is available at http://www.ece.uvic.ca/~mdadams/jasper/.
*
* PROGRAM HISTORY LOG:
* 2002-12-02 Gilbert
* 2004-07-20 GIlbert - Added retry argument/option to allow option of
* increasing the maximum number of guard bits to the
* JPEG2000 algorithm.
*
* USAGE: int enc_jpeg2000(unsigned char *cin,g2int *pwidth,g2int *pheight,
* g2int *pnbits, g2int *ltype, g2int *ratio,
* g2int *retry, char *outjpc, g2int *jpclen)
*
* INPUT ARGUMENTS:
* cin - Packed matrix of Grayscale image values to encode.
* pwidth - Pointer to width of image
* pheight - Pointer to height of image
* pnbits - Pointer to depth (in bits) of image. i.e number of bits
* used to hold each data value
* ltype - Pointer to indicator of lossless or lossy compression
* = 1, for lossy compression
* != 1, for lossless compression
* ratio - Pointer to target compression ratio. (ratio:1)
* Used only when *ltype == 1.
* retry - Pointer to option type.
* 1 = try increasing number of guard bits
* otherwise, no additional options
* jpclen - Number of bytes allocated for new JPEG2000 code stream in
* outjpc.
*
* INPUT ARGUMENTS:
* outjpc - Output encoded JPEG2000 code stream
*
* RETURN VALUES :
* > 0 = Length in bytes of encoded JPEG2000 code stream
* -3 = Error decode jpeg2000 code stream.
* -5 = decoded image had multiple color components.
* Only grayscale is expected.
*
* REMARKS:
*
* Requires JasPer Software version 1.500.4 or 1.700.2
*
* ATTRIBUTES:
* LANGUAGE: C
* MACHINE: IBM SP
*
*$$$*/
{
int ier,rwcnt;
jas_image_t image;
jas_stream_t *jpcstream,*istream;
jas_image_cmpt_t cmpt,*pcmpt;
#define MAXOPTSSIZE 1024
char opts[MAXOPTSSIZE];
g2int width,height,nbits;
width=*pwidth;
height=*pheight;
nbits=*pnbits;
/*
printf(" enc_jpeg2000:width %ld\n",width);
printf(" enc_jpeg2000:height %ld\n",height);
printf(" enc_jpeg2000:nbits %ld\n",nbits);
printf(" enc_jpeg2000:jpclen %ld\n",*jpclen);
*/
// jas_init();
//
// Set lossy compression options, if requested.
//
if ( *ltype != 1 ) {
opts[0]=(char)0;
}
else {
snprintf(opts,MAXOPTSSIZE,"mode=real\nrate=%f",1.0/(float)*ratio);
}
if ( *retry == 1 ) { // option to increase number of guard bits
strcat(opts,"\nnumgbits=4");
}
//printf("SAGopts: %s\n",opts);
//
// Initialize the JasPer image structure describing the grayscale
// image to encode into the JPEG2000 code stream.
//
image.tlx_=0;
image.tly_=0;
#ifdef JAS_1_500_4
image.brx_=(uint_fast32_t)width;
image.bry_=(uint_fast32_t)height;
#endif
#ifdef JAS_1_700_2
image.brx_=(jas_image_coord_t)width;
image.bry_=(jas_image_coord_t)height;
#endif
image.numcmpts_=1;
image.maxcmpts_=1;
#ifdef JAS_1_500_4
image.colormodel_=JAS_IMAGE_CM_GRAY; /* grayscale Image */
#endif
#ifdef JAS_1_700_2
image.clrspc_=JAS_CLRSPC_SGRAY; /* grayscale Image */
image.cmprof_=0;
#endif
image.inmem_=1;
cmpt.tlx_=0;
cmpt.tly_=0;
cmpt.hstep_=1;
cmpt.vstep_=1;
#ifdef JAS_1_500_4
cmpt.width_=(uint_fast32_t)width;
cmpt.height_=(uint_fast32_t)height;
#endif
#ifdef JAS_1_700_2
cmpt.width_=(jas_image_coord_t)width;
cmpt.height_=(jas_image_coord_t)height;
cmpt.type_=JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y);
#endif
cmpt.prec_=nbits;
cmpt.sgnd_=0;
cmpt.cps_=(nbits+7)/8;
pcmpt=&cmpt;
image.cmpts_=&pcmpt;
//
// Open a JasPer stream containing the input grayscale values
//
istream=jas_stream_memopen((char *)cin,height*width*cmpt.cps_);
cmpt.stream_=istream;
//
// Open an output stream that will contain the encoded jpeg2000
// code stream.
//
jpcstream=jas_stream_memopen(outjpc,(int)(*jpclen));
//
// Encode image.
//
ier=jpc_encode(&image,jpcstream,opts);
if ( ier != 0 ) {
printf(" jpc_encode return = %d \n",ier);
return -3;
}
//
// Clean up JasPer work structures.
//
rwcnt=jpcstream->rwcnt_;
ier=jas_stream_close(istream);
ier=jas_stream_close(jpcstream);
//
// Return size of jpeg2000 code stream
//
return (rwcnt);
}

View file

@ -1,145 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#ifdef __64BIT__
typedef int g2int;
#else
typedef long g2int;
#endif
#if defined CRAY90
#include <fortran.h>
#define SUB_NAME ENC_PNG
#elif defined LINUXF90
#define SUB_NAME ENC_PNG
#elif defined LINUXG95
#define SUB_NAME enc_png__
#elif defined HP || defined AIX
#define SUB_NAME enc_png
#elif defined SGI || defined LINUX || defined VPP5000
#define SUB_NAME enc_png_
#endif
struct png_stream {
unsigned char *stream_ptr; /* location to write PNG stream */
g2int stream_len; /* number of bytes written */
};
typedef struct png_stream png_stream;
void user_write_data(png_structp ,png_bytep , png_uint_32 );
void user_flush_data(png_structp );
void user_write_data(png_structp png_ptr,png_bytep data, png_uint_32 length)
/*
Custom write function used to that libpng will write
to memory location instead of a file on disk
*/
{
unsigned char *ptr;
g2int offset;
png_stream *mem;
mem=(png_stream *)png_get_io_ptr(png_ptr);
ptr=mem->stream_ptr;
offset=mem->stream_len;
/* printf("SAGwr %ld %ld %x\n",offset,length,ptr); */
/*for (j=offset,k=0;k<length;j++,k++) ptr[j]=data[k];*/
memcpy(ptr+offset,data,length);
mem->stream_len += length;
}
void user_flush_data(png_structp png_ptr)
/*
Dummy Custom flush function
*/
{
int *do_nothing=NULL;
}
int SUB_NAME(char *data,g2int *width,g2int *height,g2int *nbits,char *pngbuf)
{
int color_type;
g2int j,bytes,pnglen,bit_depth;
png_structp png_ptr;
png_infop info_ptr;
// png_bytep *row_pointers[*height];
png_bytep **row_pointers;
png_stream write_io_ptr;
/* create and initialize png_structs */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
NULL, NULL);
if (!png_ptr)
return (-1);
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_write_struct(&png_ptr,(png_infopp)NULL);
return (-2);
}
/* Set Error callback */
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr);
return (-3);
}
/* Initialize info for writing PNG stream to memory */
write_io_ptr.stream_ptr=(png_voidp)pngbuf;
write_io_ptr.stream_len=0;
/* Set new custom write functions */
png_set_write_fn(png_ptr,(voidp)&write_io_ptr,(png_rw_ptr)user_write_data,
(png_flush_ptr)user_flush_data);
/* png_init_io(png_ptr, fptr); */
/* png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); */
/* Set the image size, colortype, filter type, etc... */
/* printf("SAGTsettingIHDR %d %d %d\n",*width,*height,bit_depth); */
bit_depth=*nbits;
color_type=PNG_COLOR_TYPE_GRAY;
if (*nbits == 24 ) {
bit_depth=8;
color_type=PNG_COLOR_TYPE_RGB;
}
else if (*nbits == 32 ) {
bit_depth=8;
color_type=PNG_COLOR_TYPE_RGB_ALPHA;
}
png_set_IHDR(png_ptr, info_ptr, *width, *height,
bit_depth, color_type, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
/* Put image data into the PNG info structure */
/*bytes=bit_depth/8;*/
bytes=*nbits/8;
row_pointers=malloc((*height)*sizeof(png_bytep));
for (j=0;j<*height;j++) row_pointers[j]=(png_bytep *)(data+(j*(*width)*bytes));
png_set_rows(png_ptr, info_ptr, (png_bytepp)row_pointers);
/* Do the PNG encoding, and write out PNG stream */
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
/* Clean up */
png_destroy_write_struct(&png_ptr, &info_ptr);
free(row_pointers);
pnglen=write_io_ptr.stream_len;
return pnglen;
}

View file

@ -1,320 +0,0 @@
module g2grids
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: g2grids
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-04-27
!
! ABSTRACT: This Fortran Module allows access to predefined GRIB2 Grid
! Definition Templates stored in a file. The GDTs are represented by
! a predefined number or a character abbreviation.
!
! At the first request, all the grid GDT entries in the file associated
! with input Fortran file unit number, lunit, are read into a linked list
! named gridlist. This list is searched for the requested entry.
!
! Users of this Fortran module should only call routines getgridbynum
! and getgridbyname.
!
! The format of the file scanned by routines in this module is as follows.
! Each line contains one Grid entry containing five fields, each separated
! by a colon, ":". The fields are:
! 1) - predefined grid number
! 2) - Up to an 8 character abbreviation
! 3) - Grid Definition Template number
! 4) - Number of entries in the Grid Definition Template
! 5) - A list of values for each entry in the Grid Definition Template.
!
! As an example, this is the entry for the 1x1 GFS global grid
! 3:gbl_1deg: 0:19: 0 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0
!
! Comments can be included in the file by specifying the symbol "#" as the
! first character on the line. These lines are ignored.
!
!
! PROGRAM HISTORY LOG:
! 2004-04-27 Gilbert
!
! USAGE: use g2grids
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXTEMP=200
type,private :: g2grid
integer :: grid_num
integer :: gdt_num
integer :: gdt_len
integer,dimension(MAXTEMP) :: gridtmpl
character(len=8) :: cdesc
type(g2grid),pointer :: next
end type g2grid
type(g2grid),pointer,private :: gridlist
integer :: num_grids=0
contains
integer function readgrids(lunit)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: readgrids
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-28
!
! ABSTRACT: This function reads the list of GDT entries in the file
! associated with fortran unit, lunit. All the entries are stored in a
! linked list called gridlist.
!
! PROGRAM HISTORY LOG:
! 2001-06-28 Gilbert
!
! USAGE: number=readgrids(lunit)
! INPUT ARGUMENT LIST:
! lunit - Fortran unit number associated the the GDT file.
!
! RETURNS: The number of Grid Definition Templates read in.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: lunit
integer,parameter :: linelen=1280
character(len=8) :: desc
character(len=linelen) :: cline
integer ient,igdtn,igdtmpl(200),igdtlen
integer :: pos1,pos2,pos3,pos4
type(g2grid),pointer :: gtemp
type(g2grid),pointer :: prev
integer count
count=0
! For each line in the file....
DO
! Read line into buffer
!
cline(1:linelen)=' '
read(lunit,end=999,fmt='(a)') cline
!
! Skip line if commented out
!
if (cline(1:1).eq.'#') cycle
!
! find positions of delimiters, ":"
!
pos1=index(cline,':')
cline(pos1:pos1)=';'
pos2=index(cline,':')
cline(pos2:pos2)=';'
pos3=index(cline,':')
cline(pos3:pos3)=';'
pos4=index(cline,':')
if ( pos1.eq.0 .or. pos2.eq.0 .or. pos3.eq.0 .or.
& pos4.eq.0) cycle
!
! Read each of the five fields.
!
read(cline(1:pos1-1),*) ient
read(cline(pos1+1:pos2-1),*) desc
read(cline(pos2+1:pos3-1),*) igdtn
read(cline(pos3+1:pos4-1),*) igdtlen
read(cline(pos4+1:linelen),*) (igdtmpl(j),j=1,igdtlen)
!
! Allocate new type(g2grid) variable to store the GDT
!
allocate(gtemp,stat=iom)
count=count+1
gtemp%grid_num=ient
gtemp%gdt_num=igdtn
gtemp%gdt_len=igdtlen
gtemp%gridtmpl=igdtmpl
gtemp%cdesc=desc
nullify(gtemp%next) ! defines end of linked list.
if ( count .eq. 1 ) then
gridlist => gtemp
else ! make sure previous entry in list
prev%next => gtemp ! points to the new entry,
endif
prev => gtemp
enddo
999 readgrids=count
return
end function
subroutine getgridbynum(lunit,number,igdtn,igdtmpl,iret)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getgridbynum
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-04-26
!
! ABSTRACT: This subroutine searches a file referenced by fortran unit lunit
! for a Grid Definition Template assigned to the requested number.
! The input file format is described at the top of this module.
!
! PROGRAM HISTORY LOG:
! 2004-04-26 Gilbert
!
! USAGE: CALL getgridbynum(lunit,number,igdtn,igdtmpl,iret)
! INPUT ARGUMENT LIST:
! lunit - Unit number of file containing Grid definitions
! number - Grid number of the requested Grid definition
!
! OUTPUT ARGUMENT LIST:
! igdtn - NN, indicating the number of the Grid Definition
! Template 3.NN
! igdtmpl()- An array containing the values of each entry in
! the Grid Definition Template.
! iret - Error return code.
! 0 = no error
! -1 = Undefined Grid number.
! 3 = Could not read any grids from file.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: lunit,number
integer,intent(out) :: igdtn,igdtmpl(*),iret
type(g2grid),pointer :: tempgrid
iret=0
igdtn=-1
!igdtmpl=0
!
! If no grids in list, try reading them from the file.
!
if ( num_grids .eq. 0 ) then
num_grids=readgrids(lunit)
endif
if ( num_grids .eq. 0 ) then
iret=3 ! problem reading file
return
endif
tempgrid => gridlist
!
! Search through list
!
do while ( associated(tempgrid) )
if ( number .eq. tempgrid%grid_num ) then
igdtn=tempgrid%gdt_num
igdtmpl(1:tempgrid%gdt_len)=
& tempgrid%gridtmpl(1:tempgrid%gdt_len)
return
else
tempgrid => tempgrid%next
endif
enddo
iret=-1
return
end subroutine
subroutine getgridbyname(lunit,name,igdtn,igdtmpl,iret)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getgridbyname
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-04-26
!
! ABSTRACT: This subroutine searches a file referenced by fortran unit lunit
! for a Grid Definition Template assigned to the requested name.
! The input file format is described at the top of this module.
!
! PROGRAM HISTORY LOG:
! 2004-04-26 Gilbert
!
! USAGE: CALL getgridbyname(lunit,name,igdtn,igdtmpl,iret)
! INPUT ARGUMENT LIST:
! lunit - Unit number of file containing Grid definitions
! name - Grid name of the requested Grid definition
!
! OUTPUT ARGUMENT LIST:
! igdtn - NN, indicating the number of the Grid Definition
! Template 3.NN
! igdtmpl()- An array containing the values of each entry in
! the Grid Definition Template.
! iret - Error return code.
! 0 = no error
! -1 = Undefined Grid number.
! 3 = Could not read any grids from file.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: lunit
character(len=8),intent(in) :: name
integer,intent(out) :: igdtn,igdtmpl(*),iret
type(g2grid),pointer :: tempgrid
iret=0
igdtn=-1
!igdtmpl=0
!
! If no grids in list, try reading them from the file.
!
if ( num_grids .eq. 0 ) then
num_grids=readgrids(lunit)
endif
if ( num_grids .eq. 0 ) then
iret=3 ! problem reading file
return
endif
tempgrid => gridlist
!
! Search through list
!
do while ( associated(tempgrid) )
if ( name .eq. tempgrid%cdesc ) then
igdtn=tempgrid%gdt_num
igdtmpl(1:tempgrid%gdt_len)=
& tempgrid%gridtmpl(1:tempgrid%gdt_len)
return
else
tempgrid => tempgrid%next
endif
enddo
iret=-1
return
end subroutine
end

View file

@ -1,53 +0,0 @@
GFORTRAN module created from g2grids.f on Mon Nov 16 16:43:03 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'g2grids' 'g2grids' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN) (
UNKNOWN 0 ()) 0 0 () () 0 () ())
3 'getgridbyname' 'g2grids' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL SUBROUTINE) (UNKNOWN 0 ()) 4 0 (5 6 7 8 9) () 0 () ())
10 'getgridbynum' 'g2grids' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL SUBROUTINE) (UNKNOWN 0 ()) 11 0 (12 13 14 15 16) () 0 () ())
17 'readgrids' 'g2grids' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC DECL
FUNCTION) (INTEGER 4 ()) 18 0 (19) () 17 () ())
20 'num_grids' 'g2grids' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () () 0 () ())
21 'maxtemp' 'g2grids' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '200') () 0 () ())
12 'lunit' '' 11 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
14 'igdtn' '' 11 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
15 'igdtmpl' '' 11 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY)
(INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
7 'igdtn' '' 4 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
8 'igdtmpl' '' 4 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
6 'name' '' 4 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (CHARACTER 1 ((
CONSTANT (INTEGER 4 ()) 0 '8'))) 0 0 () () 0 () ())
16 'iret' '' 11 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
13 'number' '' 11 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
19 'lunit' '' 18 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
9 'iret' '' 4 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
5 'lunit' '' 4 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
)
('getgridbynum' 0 10 'getgridbyname' 0 3 'g2grids' 0 2 'maxtemp' 0 21
'num_grids' 0 20 'readgrids' 0 17)

View file

@ -1,194 +0,0 @@
subroutine gb_info(cgrib,lcgrib,listsec0,listsec1,
& numfields,numlocal,maxlocal,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gb_info
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-25
!
! ABSTRACT: This subroutine searches through a GRIB2 message and
! returns the number of gridded fields found in the message and
! the number (and maximum size) of Local Use Sections.
! Also various checks are performed
! to see if the message is a valid GRIB2 message.
!
! PROGRAM HISTORY LOG:
! 2000-05-25 Gilbert
!
! USAGE: CALL gb_info(cgrib,lcgrib,listsec0,listsec1,
! & numfields,numlocal,maxlocal,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message in array cgrib.
!
! OUTPUT ARGUMENT LIST:
! listsec0 - Contains information decoded from GRIB Indicator Section 0.
! Must be dimensioned >= 2.
! listsec0(1)=Discipline-GRIB Master Table Number
! (see Code Table 0.0)
! listsec0(2)=GRIB Edition Number (currently 2)
! listsec0(3)=Length of GRIB message
! listsec1 - Contains information read from GRIB Identification Section 1.
! Must be dimensioned >= 13.
! listsec1(1)=Id of orginating centre (Common Code Table C-1)
! listsec1(2)=Id of orginating sub-centre (local table)
! listsec1(3)=GRIB Master Tables Version Number (Code Table 1.0)
! listsec1(4)=GRIB Local Tables Version Number
! listsec1(5)=Significance of Reference Time (Code Table 1.1)
! listsec1(6)=Reference Time - Year (4 digits)
! listsec1(7)=Reference Time - Month
! listsec1(8)=Reference Time - Day
! listsec1(9)=Reference Time - Hour
! listsec1(10)=Reference Time - Minute
! listsec1(11)=Reference Time - Second
! listsec1(12)=Production status of data (Code Table 1.2)
! listsec1(13)=Type of processed data (Code Table 1.3)
! numfields- The number of gridded fieldse found in the GRIB message.
! numlocal - The number of Local Use Sections ( Section 2 ) found in
! the GRIB message.
! maxlocal- The size of the largest Local Use Section ( Section 2 ).
! Can be used to ensure that the return array passed
! to subroutine getlocal is dimensioned large enough.
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = Could not find Section 1, where expected.
! 4 = End string "7777" found, but not where expected.
! 5 = End string "7777" not found at end of message.
! 6 = Invalid section number found.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(out) :: listsec0(3),listsec1(13)
integer,intent(out) :: numlocal,numfields,maxlocal,ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
integer,parameter :: zero=0,one=1
integer,parameter :: mapsec1len=13
integer,parameter ::
& mapsec1(mapsec1len)=(/ 2,2,1,1,1,2,1,1,1,1,1,1,1 /)
integer iofst,ibeg,istart
ierr=0
numlocal=0
numfields=0
maxlocal=0
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'gb_info: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
listsec0(3)=lengrib
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'gb_info: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Unpack Section 1 - Identification Section
!
call gbyte(cgrib,lensec1,iofst,32) ! Length of Section 1
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Section number ( 1 )
iofst=iofst+8
if (isecnum.ne.1) then
print *,'gb_info: Could not find section 1.'
ierr=3
return
endif
!
! Unpack each input value in array listsec1 into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapsec1.
!
do i=1,mapsec1len
nbits=mapsec1(i)*8
call gbyte(cgrib,listsec1(i),iofst,nbits)
iofst=iofst+nbits
enddo
ipos=ipos+lensec1
!
! Loop through the remaining sections to see if they are valid.
! Also count the number of times Section 2
! and Section 4 appear.
!
do
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
if (ipos.ne.(istart+lengrib)) then
print *,'gb_info: "7777" found, but not where expected.'
ierr=4
return
endif
exit
endif
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'gb_info: "7777" not found at end of GRIB message.'
ierr=5
return
endif
if ( isecnum.ge.2.AND.isecnum.le.7 ) then
if (isecnum.eq.2) then ! Local Section 2
! increment counter for total number of local sections found
numlocal=numlocal+1
lenposs=lensec-5
if ( lenposs.gt.maxlocal ) maxlocal=lenposs
elseif (isecnum.eq.4) then
! increment counter for total number of fields found
numfields=numfields+1
endif
else
print *,'gb_info: Invalid section number found in GRIB',
& ' message: ',isecnum
ierr=6
return
endif
enddo
return
end

View file

@ -1,127 +0,0 @@
SUBROUTINE GBYTE(IN,IOUT,ISKIP,NBYTE)
character*1 in(*)
integer iout(*)
CALL GBYTES(IN,IOUT,ISKIP,NBYTE,0,1)
RETURN
END
SUBROUTINE SBYTE(OUT,IN,ISKIP,NBYTE)
character*1 out(*)
integer in(*)
CALL SBYTES(OUT,IN,ISKIP,NBYTE,0,1)
RETURN
END
SUBROUTINE GBYTES(IN,IOUT,ISKIP,NBYTE,NSKIP,N)
C Get bytes - unpack bits: Extract arbitrary size values from a
C packed bit string, right justifying each value in the unpacked
C array.
C IN = character*1 array input
C IOUT = unpacked array output
C ISKIP = initial number of bits to skip
C NBYTE = number of bits to take
C NSKIP = additional number of bits to skip on each iteration
C N = number of iterations
C v1.1
C
character*1 in(*)
integer iout(*)
integer ones(8), tbit, bitcnt
save ones
data ones/1,3,7,15,31,63,127,255/
c nbit is the start position of the field in bits
nbit = iskip
do i = 1, n
bitcnt = nbyte
index=nbit/8+1
ibit=mod(nbit,8)
nbit = nbit + nbyte + nskip
c first byte
tbit = min(bitcnt,8-ibit)
itmp = iand(mova2i(in(index)),ones(8-ibit))
if (tbit.ne.8-ibit) itmp = ishft(itmp,tbit-8+ibit)
index = index + 1
bitcnt = bitcnt - tbit
c now transfer whole bytes
do while (bitcnt.ge.8)
itmp = ior(ishft(itmp,8),mova2i(in(index)))
bitcnt = bitcnt - 8
index = index + 1
enddo
c get data from last byte
if (bitcnt.gt.0) then
itmp = ior(ishft(itmp,bitcnt),iand(ishft(mova2i(in(index)),
1 -(8-bitcnt)),ones(bitcnt)))
endif
iout(i) = itmp
enddo
RETURN
END
SUBROUTINE SBYTES(OUT,IN,ISKIP,NBYTE,NSKIP,N)
C Store bytes - pack bits: Put arbitrary size values into a
C packed bit string, taking the low order bits from each value
C in the unpacked array.
C IOUT = packed array output
C IN = unpacked array input
C ISKIP = initial number of bits to skip
C NBYTE = number of bits to pack
C NSKIP = additional number of bits to skip on each iteration
C N = number of iterations
C v1.1
C
character*1 out(*)
integer in(N), bitcnt, ones(8), tbit
save ones
data ones/ 1, 3, 7, 15, 31, 63,127,255/
c number bits from zero to ...
c nbit is the last bit of the field to be filled
nbit = iskip + nbyte - 1
do i = 1, n
itmp = in(i)
bitcnt = nbyte
index=nbit/8+1
ibit=mod(nbit,8)
nbit = nbit + nbyte + nskip
c make byte aligned
if (ibit.ne.7) then
tbit = min(bitcnt,ibit+1)
imask = ishft(ones(tbit),7-ibit)
itmp2 = iand(ishft(itmp,7-ibit),imask)
itmp3 = iand(mova2i(out(index)), 255-imask)
out(index) = char(ior(itmp2,itmp3))
bitcnt = bitcnt - tbit
itmp = ishft(itmp, -tbit)
index = index - 1
endif
c now byte aligned
c do by bytes
do while (bitcnt.ge.8)
out(index) = char(iand(itmp,255))
itmp = ishft(itmp,-8)
bitcnt = bitcnt - 8
index = index - 1
enddo
c do last byte
if (bitcnt.gt.0) then
itmp2 = iand(itmp,ones(bitcnt))
itmp3 = iand(mova2i(out(index)), 255-ones(bitcnt))
out(index) = char(ior(itmp2,itmp3))
endif
enddo
return
end

View file

@ -1,362 +0,0 @@
subroutine gdt2gds(igds,igdstmpl,idefnum,ideflist,kgds,
& igrid,iret)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: gdt2gds
C PRGMMR: Gilbert ORG: W/NP11 DATE: 2003-06-17
C
C ABSTRACT: This routine converts grid information from a GRIB2
C Grid Description Section as well as its
C Grid Definition Template to GRIB1 GDS info. In addition,
C a check is made to determine if the grid is an NCEP
C predefined grid.
C
C PROGRAM HISTORY LOG:
C 2003-06-17 Gilbert
C 2004-04-27 Gilbert - Added support for gaussian grids.
C 2007-04-16 Vuong - Added Curvilinear Orthogonal grids.
C 2007-05-29 Vuong - Added Rotate Lat/Lon E-grid (203)
C
C USAGE: CALL gdt2gds(igds,igdstmpl,idefnum,ideflist,kgds,igrid,iret)
C INPUT ARGUMENT LIST:
C igds() - Contains information read from the appropriate GRIB Grid
C Definition Section 3 for the field being returned.
C Must be dimensioned >= 5.
C igds(1)=Source of grid definition (see Code Table 3.0)
C igds(2)=Number of grid points in the defined grid.
C igds(3)=Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C igds(4)=Interpretation of list for optional points
C definition. (Code Table 3.11)
C igds(5)=Grid Definition Template Number (Code Table 3.1)
C igdstmpl() - Grid Definition Template values for GDT 3.igds(5)
C idefnum - The number of entries in array ideflist.
C i.e. number of rows ( or columns )
C for which optional grid points are defined.
C ideflist() - Optional integer array containing
C the number of grid points contained in each row (or column).
C
C OUTPUT ARGUMENT LIST: (INCLUDING WORK ARRAYS)
C kgds() - GRIB1 GDS as described in w3fi63 format.
C igrid - NCEP predefined GRIB1 grid number
C set to 255, if not NCEP grid
C iret - Error return value:
C 0 = Successful
C 1 = Unrecognized GRIB2 GDT number 3.igds(5)
C
C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION
C
C ATTRIBUTES:
C LANGUAGE: INDICATE EXTENSIONS, COMPILER OPTIONS
C MACHINE: IBM SP
C
C$$$
!
integer,intent(in) :: idefnum
integer,intent(in) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: kgds(*),igrid,iret
integer :: kgds72(200),kgds71(200),idum(200),jdum(200)
iret=0
if (igds(5).eq.0) then ! Lat/Lon grid
kgds(1)=0
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18)/1000 ! Dj
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
elseif (igds(5).eq.10) then ! Mercator grid
kgds(1)=1 ! Grid Definition Template number
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(15)/1000 ! Long of last grid point
kgds(9)=igdstmpl(13)/1000 ! Lat intersects earth
kgds(10)=0
kgds(11)=igdstmpl(16) ! Scanning mode
kgds(12)=igdstmpl(18)/1000 ! Di
kgds(13)=igdstmpl(19)/1000 ! Dj
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.30) then ! Lambert Conformal Grid
kgds(1)=3
kgds(2)=igdstmpl(8) ! Nx
kgds(3)=igdstmpl(9) ! Ny
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lon of orientation
kgds(8)=igdstmpl(15)/1000 ! Dx
kgds(9)=igdstmpl(16)/1000 ! Dy
kgds(10)=igdstmpl(17) ! Projection Center Flag
kgds(11)=igdstmpl(18) ! Scanning mode
kgds(12)=igdstmpl(19)/1000 ! Lat in 1
kgds(13)=igdstmpl(20)/1000 ! Lat in 2
kgds(14)=igdstmpl(21)/1000 ! Lat of S. Pole of projection
kgds(15)=igdstmpl(22)/1000 ! Lon of S. Pole of projection
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.40) then ! Gaussian Lat/Lon grid
kgds(1)=4
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18) ! N - Number of parallels
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.20) then ! Polar Stereographic Grid
kgds(1)=5
kgds(2)=igdstmpl(8) ! Nx
kgds(3)=igdstmpl(9) ! Ny
kgds(4)=igdstmpl(10)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(11)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(12),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(14)/1000 ! Lon of orientation
kgds(8)=igdstmpl(15)/1000 ! Dx
kgds(9)=igdstmpl(16)/1000 ! Dy
kgds(10)=igdstmpl(17) ! Projection Center Flag
kgds(11)=igdstmpl(18) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
elseif (igds(5).eq.204) then ! Curvilinear Orthogonal
kgds(1)=204
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=0
kgds(5)=0
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=0
kgds(8)=0
kgds(9)=0
kgds(10)=0
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
elseif (igds(5).eq.32768) then ! Rotate Lat/Lon grid
kgds(1)=0 ! Arakawa Staggerred E/B grid
kgds(2)=igdstmpl(8) ! Ni
kgds(3)=igdstmpl(9) ! Nj
kgds(4)=igdstmpl(12)/1000 ! Lat of 1st grid point
kgds(5)=igdstmpl(13)/1000 ! Long of 1st grid point
kgds(6)=0 ! resolution and component flags
if (igdstmpl(1)==2 ) kgds(6)=64
if ( btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5) )
& kgds(6)=kgds(6)+128
if ( btest(igdstmpl(14),3) ) kgds(6)=kgds(6)+8
kgds(7)=igdstmpl(15)/1000 ! Lat of last grid point
kgds(8)=igdstmpl(16)/1000 ! Long of last grid point
kgds(9)=igdstmpl(17)/1000 ! Di
kgds(10)=igdstmpl(18)/1000 ! Dj
kgds(11)=igdstmpl(19) ! Scanning mode
kgds(12)=0
kgds(13)=0
kgds(14)=0
kgds(15)=0
kgds(16)=0
kgds(17)=0
kgds(18)=0
kgds(19)=0
kgds(20)=255
kgds(21)=0
kgds(22)=0
!
! Process irreg grid stuff, if necessary
!
if ( idefnum.ne.0 ) then
if ( igdstmpl(8).eq.-1 ) then
kgds(2)=65535
kgds(9)=65535
endif
if ( igdstmpl(9).eq.-1 ) then
kgds(3)=65535
kgds(10)=65535
endif
kgds(19)=0
kgds(20)=33
if ( kgds(1).eq.1.OR.kgds(1).eq.3 ) kgds(20)=43
kgds(21)=igds(2) ! num of grid points
do j=1,idefnum
kgds(21+j)=ideflist(j)
enddo
endif
else
Print *,'gdt2gds: Unrecognized GRIB2 GDT = 3.',igds(5)
iret=1
kgds(1:22)=0
return
endif
!
! Can we determine NCEP grid number ?
!
igrid=255
do j=254,1,-1
!do j=225,225
kgds71=0
kgds72=0
call w3fi71(j,kgds71,ierr)
if ( ierr.ne.0 ) cycle
! convert W to E for longitudes
if ( kgds71(3).eq.0 ) then ! lat/lon
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.1 ) then ! mercator
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.3 ) then ! lambert conformal
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(9).lt.0 ) kgds71(9)=360000+kgds71(9)
if ( kgds71(18).lt.0 ) kgds71(18)=360000+kgds71(18)
elseif ( kgds71(3).eq.4 ) then ! Guassian lat/lon
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(10).lt.0 ) kgds71(10)=360000+kgds71(10)
elseif ( kgds71(3).eq.5 ) then ! polar stereographic
if ( kgds71(7).lt.0 ) kgds71(7)=360000+kgds71(7)
if ( kgds71(9).lt.0 ) kgds71(9)=360000+kgds71(9)
endif
call r63w72(idum,kgds,jdum,kgds72)
if ( kgds72(3).eq.3 ) kgds72(14)=0 ! lambert conformal fix
if ( kgds72(3).eq.1 ) kgds72(15:18)=0 ! mercator fix
if ( kgds72(3).eq.5 ) kgds72(14:18)=0 ! polar str fix
c print *,' kgds71(',j,')= ', kgds71(1:30)
c print *,' kgds72 = ', kgds72(1:30)
if ( all(kgds71.eq.kgds72) ) then
igrid=j
return
endif
enddo
return
end

View file

@ -1,102 +0,0 @@
subroutine getdim(csec3,lcsec3,width,height,iscan)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getdim
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-11
!
! ABSTRACT: This subroutine returns the dimensions and scanning mode of
! a grid definition packed in GRIB2 Grid Definition Section 3 format.
!
! PROGRAM HISTORY LOG:
! 2002-12-11 Gilbert
!
! USAGE: CALL getdim(csec3,lcsec3,width,height,iscan)
! INPUT ARGUMENT LIST:
! csec3 - Character array that contains the packed GRIB2 GDS
! lcsec3 - Length (in octets) of section 3
!
! OUTPUT ARGUMENT LIST:
! width - x (or i) dimension of the grid.
! height - y (or j) dimension of the grid.
! iscan - Scanning mode ( see Code Table 3.4 )
!
! REMARKS: Returns width and height set to zero, if grid template
! not recognized.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
! use grib_mod
character(len=1),intent(in) :: csec3(*)
integer,intent(in) :: lcsec3
integer,intent(out) :: width,height,iscan
integer,pointer,dimension(:) :: igdstmpl,list_opt
integer :: igds(5)
integer iofst,igdtlen,num_opt,jerr
interface
subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,ideflist
integer,intent(out) :: igds(5)
integer,intent(out) :: ierr,idefnum
end subroutine gf_unpack3
end interface
nullify(igdstmpl,list_opt)
!
iofst=0 ! set offset to beginning of section
call gf_unpack3(csec3,lcsec3,iofst,igds,igdstmpl,
& igdtlen,list_opt,num_opt,jerr)
if (jerr.eq.0) then
selectcase( igds(5) ) ! Template number
case (0:3) ! Lat/Lon
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(19)
case (10) ! Mercator
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(16)
case (20) ! Polar Stereographic
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(18)
case (30) ! Lambert Conformal
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(18)
case (40:43) ! Gaussian
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(19)
case (90) ! Space View/Orthographic
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(17)
case (110) ! Equatorial Azimuthal
width=igdstmpl(8)
height=igdstmpl(9)
iscan=igdstmpl(16)
case default
width=0
height=0
iscan=0
end select
else
width=0
height=0
endif
!
if (associated(igdstmpl)) deallocate(igdstmpl)
if (associated(list_opt)) deallocate(list_opt)
return
end

View file

@ -1,823 +0,0 @@
subroutine getfield(cgrib,lcgrib,ifldnum,igds,igdstmpl,igdslen,
& ideflist,idefnum,ipdsnum,ipdstmpl,ipdslen,
& coordlist,numcoord,ndpts,idrsnum,idrstmpl,
& idrslen,ibmap,bmap,fld,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getfield
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine returns the Grid Definition, Product Definition,
! Bit-map ( if applicable ), and the unpacked data for a given data
! field. Since there can be multiple data fields packed into a GRIB2
! message, the calling routine indicates which field is being requested
! with the ifldnum argument.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL getfield(cgrib,lcgrib,ifldnum,igds,igdstmpl,igdslen,
! & ideflist,idefnum,ipdsnum,ipdstmpl,ipdslen,
! & coordlist,numcoord,ndpts,idrsnum,idrstmpl,
! & idrslen,ibmap,bmap,fld,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! ifldnum - Specifies which field in the GRIB2 message to return.
!
! OUTPUT ARGUMENT LIST:
! igds - Contains information read from the appropriate GRIB Grid
! Definition Section 3 for the field being returned.
! Must be dimensioned >= 5.
! igds(1)=Source of grid definition (see Code Table 3.0)
! igds(2)=Number of grid points in the defined grid.
! igds(3)=Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! igds(4)=Interpretation of list for optional points
! definition. (Code Table 3.11)
! igds(5)=Grid Definition Template Number (Code Table 3.1)
! igdstmpl - Contains the data values for the specified Grid Definition
! Template ( NN=igds(5) ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Defintion Template 3.NN
! A safe dimension for this array can be obtained in advance
! from maxvals(2), which is returned from subroutine gribinfo.
! igdslen - Number of elements in igdstmpl(). i.e. number of entries
! in Grid Defintion Template 3.NN ( NN=igds(5) ).
! ideflist - (Used if igds(3) .ne. 0) This array contains the
! number of grid points contained in each row ( or column ).
! (part of Section 3)
! A safe dimension for this array can be obtained in advance
! from maxvals(3), which is returned from subroutine gribinfo.
! idefnum - (Used if igds(3) .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined.
! ipdsnum - Product Definition Template Number ( see Code Table 4.0)
! ipdstmpl - Contains the data values for the specified Product Definition
! Template ( N=ipdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 4.N
! A safe dimension for this array can be obtained in advance
! from maxvals(4), which is returned from subroutine gribinfo.
! ipdslen - Number of elements in ipdstmpl(). i.e. number of entries
! in Product Defintion Template 4.N ( N=ipdsnum ).
! coordlist- Array containg floating point values intended to document
! the vertical discretisation associated to model data
! on hybrid coordinate vertical levels. (part of Section 4)
! The dimension of this array can be obtained in advance
! from maxvals(5), which is returned from subroutine gribinfo.
! numcoord - number of values in array coordlist.
! ndpts - Number of data points unpacked and returned.
! idrsnum - Data Representation Template Number ( see Code Table 5.0)
! idrstmpl - Contains the data values for the specified Data Representation
! Template ( N=idrsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 5.N
! A safe dimension for this array can be obtained in advance
! from maxvals(6), which is returned from subroutine gribinfo.
! idrslen - Number of elements in idrstmpl(). i.e. number of entries
! in Data Representation Template 5.N ( N=idrsnum ).
! ibmap - Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! bmap() - Logical*1 array containing decoded bitmap. ( if ibmap=0 )
! The dimension of this array can be obtained in advance
! from maxvals(7), which is returned from subroutine gribinfo.
! fld() - Array of ndpts unpacked data points.
! A safe dimension for this array can be obtained in advance
! from maxvals(7), which is returned from subroutine gribinfo.
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = The data field request number was not positive.
! 4 = End string "7777" found, but not where expected.
! 6 = GRIB message did not contain the requested number of
! data fields.
! 7 = End string "7777" not found at end of message.
! 9 = Data Representation Template 5.NN not yet implemented.
! 10 = Error unpacking Section 3.
! 11 = Error unpacking Section 4.
! 12 = Error unpacking Section 5.
! 13 = Error unpacking Section 6.
! 14 = Error unpacking Section 7.
!
! REMARKS: Note that subroutine gribinfo can be used to first determine
! how many data fields exist in a given GRIB message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ifldnum
integer,intent(out) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: ipdsnum,ipdstmpl(*)
integer,intent(out) :: idrsnum,idrstmpl(*)
integer,intent(out) :: ndpts,ibmap,idefnum,numcoord
integer,intent(out) :: ierr
logical*1,intent(out) :: bmap(*)
real,intent(out) :: fld(*),coordlist(*)
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
integer:: listsec0(2)
integer iofst,ibeg,istart
integer(4) :: ieee
logical have3,have4,have5,have6,have7
have3=.false.
have4=.false.
have5=.false.
have6=.false.
have7=.false.
ierr=0
numfld=0
!
! Check for valid request number
!
if (ifldnum.le.0) then
print *,'getfield: Request for field number must be positive.'
ierr=3
return
endif
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'getfield: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'getfield: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Loop through the remaining sections keeping track of the
! length of each. Also keep the latest Grid Definition Section info.
! Unpack the requested field number.
!
do
! Check to see if we are at end of GRIB message
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
! If end of GRIB message not where expected, issue error
if (ipos.ne.(istart+lengrib)) then
print *,'getfield: "7777" found, but not where expected.'
ierr=4
return
endif
exit
endif
! Get length of Section and Section number
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
!print *,' lensec= ',lensec,' secnum= ',isecnum
!
! If found Section 3, unpack the GDS info using the
! appropriate template. Save in case this is the latest
! grid before the requested field.
!
if (isecnum.eq.3) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,igdslen,
& ideflist,idefnum,jerr)
if (jerr.eq.0) then
have3=.true.
else
ierr=10
return
endif
endif
!
! If found Section 4, check to see if this field is the
! one requested.
!
if (isecnum.eq.4) then
numfld=numfld+1
if (numfld.eq.ifldnum) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,ipdslen,
& coordlist,numcoord,jerr)
if (jerr.eq.0) then
have4=.true.
else
ierr=11
return
endif
endif
endif
!
! If found Section 5, check to see if this field is the
! one requested.
!
if ((isecnum.eq.5).and.(numfld.eq.ifldnum)) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,idrstmpl,
& idrslen,jerr)
if (jerr.eq.0) then
have5=.true.
else
ierr=12
return
endif
endif
!
! If found Section 6, Unpack bitmap.
! Save in case this is the latest
! bitmap before the requested field.
!
if (isecnum.eq.6) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack6(cgrib,lcgrib,iofst,igds(2),ibmap,bmap,jerr)
if (jerr.eq.0) then
have6=.true.
else
ierr=13
return
endif
endif
!
! If found Section 7, check to see if this field is the
! one requested.
!
if ((isecnum.eq.7).and.(numfld.eq.ifldnum)) then
if (idrsnum.eq.0) then
call simunpack(cgrib(ipos+5),lensec-6,idrstmpl,ndpts,fld)
have7=.true.
elseif (idrsnum.eq.2.or.idrsnum.eq.3) then
call comunpack(cgrib(ipos+5),lensec-6,lensec,idrsnum,
& idrstmpl,ndpts,fld,ier)
if ( ier .ne. 0 ) then
ierr=14
return
endif
have7=.true.
elseif (idrsnum.eq.50) then
call simunpack(cgrib(ipos+5),lensec-6,idrstmpl,ndpts-1,
& fld(2))
ieee=idrstmpl(5)
call rdieee(ieee,fld(1),1)
have7=.true.
else
print *,'getfield: Data Representation Template ',idrsnum,
& ' not yet implemented.'
ierr=9
return
endif
endif
!
! Check to see if we read pass the end of the GRIB
! message and missed the terminator string '7777'.
!
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'getfield: "7777" not found at end of GRIB message.'
ierr=7
return
endif
if (have3.and.have4.and.have5.and.have6.and.have7) return
enddo
!
! If exited from above loop, the end of the GRIB message was reached
! before the requested field was found.
!
print *,'getfield: GRIB message contained ',numlocal,
& ' different fields.'
print *,'getfield: The request was for the ',ifldnum,
& ' field.'
ierr=6
return
end
subroutine unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: unpack3
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 3 (Grid Definition Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL unpack3(cgrib,lcgrib,lensec,iofst,igds,igdstmpl,
! & mapgridlen,ideflist,idefnum,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 3.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 3, returned.
! igds - Contains information read from the appropriate GRIB Grid
! Definition Section 3 for the field being returned.
! Must be dimensioned >= 5.
! igds(1)=Source of grid definition (see Code Table 3.0)
! igds(2)=Number of grid points in the defined grid.
! igds(3)=Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! igds(4)=Interpretation of list for optional points
! definition. (Code Table 3.11)
! igds(5)=Grid Definition Template Number (Code Table 3.1)
! igdstmpl - Contains the data values for the specified Grid Definition
! Template ( NN=igds(5) ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Defintion Template 3.NN
! mapgridlen- Number of elements in igdstmpl(). i.e. number of entries
! in Grid Defintion Template 3.NN ( NN=igds(5) ).
! ideflist - (Used if igds(3) .ne. 0) This array contains the
! number of grid points contained in each row ( or column ).
! (part of Section 3)
! idefnum - (Used if igds(3) .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined.
! ierr - Error return code.
! 0 = no error
! 5 = "GRIB" message contains an undefined Grid Definition
! Template.
!
! REMARKS: Uses Fortran 90 module gridtemplates.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use gridtemplates
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: ierr,idefnum
integer,allocatable :: mapgrid(:)
integer :: mapgridlen,ibyttem
logical needext
ierr=0
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
call gbyte(cgrib,igds(1),iofst,8) ! Get source of Grid def.
iofst=iofst+8
call gbyte(cgrib,igds(2),iofst,32) ! Get number of grid pts.
iofst=iofst+32
call gbyte(cgrib,igds(3),iofst,8) ! Get num octets for opt. list
iofst=iofst+8
call gbyte(cgrib,igds(4),iofst,8) ! Get interpret. for opt. list
iofst=iofst+8
call gbyte(cgrib,igds(5),iofst,16) ! Get Grid Def Template num.
iofst=iofst+16
if (igds(1).eq.0) then
! if (igds(1).eq.0.OR.igds(1).eq.255) then ! FOR ECMWF TEST ONLY
allocate(mapgrid(lensec))
! Get Grid Definition Template
call getgridtemplate(igds(5),mapgridlen,mapgrid,needext,
& iret)
if (iret.ne.0) then
ierr=5
return
endif
else
! igdstmpl=-1
mapgridlen=0
needext=.false.
endif
!
! Unpack each value into array igdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapgrid.
!
ibyttem=0
do i=1,mapgridlen
nbits=iabs(mapgrid(i))*8
if ( mapgrid(i).ge.0 ) then
call gbyte(cgrib,igdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,igdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
endif
iofst=iofst+nbits
ibyttem=ibyttem+iabs(mapgrid(i))
enddo
!
! Check to see if the Grid Definition Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extgridtemplate(igds(5),igdstmpl,newmapgridlen,mapgrid)
! Unpack the rest of the Grid Definition Template
do i=mapgridlen+1,newmapgridlen
nbits=iabs(mapgrid(i))*8
if ( mapgrid(i).ge.0 ) then
call gbyte(cgrib,igdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,igdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
endif
iofst=iofst+nbits
ibyttem=ibyttem+iabs(mapgrid(i))
enddo
mapgridlen=newmapgridlen
endif
!
! Unpack optional list of numbers defining number of points
! in each row or column, if included. This is used for non regular
! grids.
!
if ( igds(3).ne.0 ) then
nbits=igds(3)*8
idefnum=(lensec-14-ibyttem)/igds(3)
call gbytes(cgrib,ideflist,iofst,nbits,0,idefnum)
iofst=iofst+(nbits*idefnum)
else
idefnum=0
endif
if( allocated(mapgrid) ) deallocate(mapgrid)
return ! End of Section 3 processing
end
subroutine unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,mappdslen,
& coordlist,numcoord,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: unpack4
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 4 (Product Definition Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,mappdslen,
! & coordlist,numcoord,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 4.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset of the end of Section 4, returned.
! ipdsnum - Product Definition Template Number ( see Code Table 4.0)
! ipdstmpl - Contains the data values for the specified Product Definition
! Template ( N=ipdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 4.N
! mappdslen- Number of elements in ipdstmpl(). i.e. number of entries
! in Product Defintion Template 4.N ( N=ipdsnum ).
! coordlist- Array containg floating point values intended to document
! the vertical discretisation associated to model data
! on hybrid coordinate vertical levels. (part of Section 4)
! numcoord - number of values in array coordlist.
! ierr - Error return code.
! 0 = no error
! 5 = "GRIB" message contains an undefined Product Definition
! Template.
!
! REMARKS: Uses Fortran 90 module pdstemplates.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use pdstemplates
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
real,intent(out) :: coordlist(*)
integer,intent(out) :: ipdsnum,ipdstmpl(*)
integer,intent(out) :: ierr,numcoord
real(4),allocatable :: coordieee(:)
integer,allocatable :: mappds(:)
integer :: mappdslen
logical needext
ierr=0
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
allocate(mappds(lensec))
call gbyte(cgrib,numcoord,iofst,16) ! Get num of coordinate values
iofst=iofst+16
call gbyte(cgrib,ipdsnum,iofst,16) ! Get Prod. Def Template num.
iofst=iofst+16
! Get Product Definition Template
call getpdstemplate(ipdsnum,mappdslen,mappds,needext,iret)
if (iret.ne.0) then
ierr=5
return
endif
!
! Unpack each value into array ipdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mappds.
!
do i=1,mappdslen
nbits=iabs(mappds(i))*8
if ( mappds(i).ge.0 ) then
call gbyte(cgrib,ipdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,ipdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) ipdstmpl(i)=-ipdstmpl(i)
endif
iofst=iofst+nbits
enddo
!
! Check to see if the Product Definition Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extpdstemplate(ipdsnum,ipdstmpl,newmappdslen,mappds)
! Unpack the rest of the Product Definition Template
do i=mappdslen+1,newmappdslen
nbits=iabs(mappds(i))*8
if ( mappds(i).ge.0 ) then
call gbyte(cgrib,ipdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,ipdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) ipdstmpl(i)=-ipdstmpl(i)
endif
iofst=iofst+nbits
enddo
mappdslen=newmappdslen
endif
!
! Get Optional list of vertical coordinate values
! after the Product Definition Template, if necessary.
!
if ( numcoord .ne. 0 ) then
allocate (coordieee(numcoord))
call gbytes(cgrib,coordieee,iofst,32,0,numcoord)
call rdieee(coordieee,coordlist,numcoord)
deallocate (coordieee)
iofst=iofst+(32*numcoord)
endif
if( allocated(mappds) ) deallocate(mappds)
return ! End of Section 4 processing
end
subroutine unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,idrstmpl,
& mapdrslen,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: unpack5
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 5 (Data Representation Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,idrstmpl,
! mapdrslen,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 5.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 5, returned.
! ndpts - Number of data points unpacked and returned.
! idrsnum - Data Representation Template Number ( see Code Table 5.0)
! idrstmpl - Contains the data values for the specified Data Representation
! Template ( N=idrsnum ). Each element of this integer
! array contains an entry (in the order specified) of Data
! Representation Template 5.N
! mapdrslen- Number of elements in idrstmpl(). i.e. number of entries
! in Data Representation Template 5.N ( N=idrsnum ).
! ierr - Error return code.
! 0 = no error
! 7 = "GRIB" message contains an undefined Data
! Representation Template.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use drstemplates
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: ndpts,idrsnum,idrstmpl(*)
integer,intent(out) :: ierr
C integer,allocatable :: mapdrs(:)
integer,allocatable :: mapdrs(:)
integer :: mapdrslen
logical needext
ierr=0
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
allocate(mapdrs(lensec))
call gbyte(cgrib,ndpts,iofst,32) ! Get num of data points
iofst=iofst+32
call gbyte(cgrib,idrsnum,iofst,16) ! Get Data Rep Template Num.
iofst=iofst+16
! Gen Data Representation Template
call getdrstemplate(idrsnum,mapdrslen,mapdrs,needext,iret)
if (iret.ne.0) then
ierr=7
return
endif
!
! Unpack each value into array ipdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mappds.
!
do i=1,mapdrslen
nbits=iabs(mapdrs(i))*8
if ( mapdrs(i).ge.0 ) then
call gbyte(cgrib,idrstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,idrstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) idrstmpl(i)=-idrstmpl(i)
endif
iofst=iofst+nbits
enddo
!
! Check to see if the Data Representation Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extdrstemplate(idrsnum,idrstmpl,newmapdrslen,mapdrs)
! Unpack the rest of the Data Representation Template
do i=mapdrslen+1,newmapdrslen
nbits=iabs(mapdrs(i))*8
if ( mapdrs(i).ge.0 ) then
call gbyte(cgrib,idrstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,idrstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) idrstmpl(i)=-idrstmpl(i)
endif
iofst=iofst+nbits
enddo
mapdrslen=newmapdrslen
endif
if( allocated(mapdrs) ) deallocate(mapdrs)
return ! End of Section 5 processing
end
subroutine unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: unpack6
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 6 (Bit-Map Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 6.
! ngpts - Number of grid points specified in the bit-map
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 6, returned.
! ibmap - Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! bmap() - Logical*1 array containing decoded bitmap. ( if ibmap=0 )
! ierr - Error return code.
! 0 = no error
! 4 = Unrecognized pre-defined bit-map.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ngpts
integer,intent(inout) :: iofst
integer,intent(out) :: ibmap
integer,intent(out) :: ierr
logical*1,intent(out) :: bmap(ngpts)
integer :: intbmap(ngpts)
ierr=0
iofst=iofst+32 ! skip Length of Section
iofst=iofst+8 ! skip section number
call gbyte(cgrib,ibmap,iofst,8) ! Get bit-map indicator
iofst=iofst+8
if (ibmap.eq.0) then ! Unpack bitmap
call gbytes(cgrib,intbmap,iofst,1,0,ngpts)
iofst=iofst+ngpts
do j=1,ngpts
bmap(j)=.true.
if (intbmap(j).eq.0) bmap(j)=.false.
enddo
elseif (ibmap.eq.254) then ! Use previous bitmap
return
elseif (ibmap.eq.255) then ! No bitmap in message
bmap(1:ngpts)=.true.
else
print *,'unpack6: Predefined bitmap ',ibmap,' not recognized.'
ierr=4
endif
return ! End of Section 6 processing
end

View file

@ -1,93 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETG2I(LUGI,CBUF,NLEN,NNUM,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETG2I READS A GRIB2 INDEX FILE
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 95-10-31
C
C ABSTRACT: READ A GRIB2 INDEX FILE AND RETURN ITS CONTENTS.
C VERSION 1 OF THE INDEX FILE HAS THE FOLLOWING FORMAT:
C 81-BYTE S.LORD HEADER WITH 'GB2IX1' IN COLUMNS 42-47 FOLLOWED BY
C 81-BYTE HEADER WITH NUMBER OF BYTES TO SKIP BEFORE INDEX RECORDS,
C TOTAL LENGTH IN BYTES OF THE INDEX RECORDS, NUMBER OF INDEX RECORDS,
C AND GRIB FILE BASENAME WRITTEN IN FORMAT ('IX1FORM:',3I10,2X,A40).
C EACH FOLLOWING INDEX RECORD CORRESPONDS TO A GRIB MESSAGE
C AND HAS THE INTERNAL FORMAT:
C BYTE 001 - 004: LENGTH OF INDEX RECORD
C BYTE 005 - 008: BYTES TO SKIP IN DATA FILE BEFORE GRIB MESSAGE
C BYTE 009 - 012: BYTES TO SKIP IN MESSAGE BEFORE LUS (LOCAL USE)
C SET = 0, IF NO LOCAL USE SECTION IN GRIB2 MESSAGE.
C BYTE 013 - 016: BYTES TO SKIP IN MESSAGE BEFORE GDS
C BYTE 017 - 020: BYTES TO SKIP IN MESSAGE BEFORE PDS
C BYTE 021 - 024: BYTES TO SKIP IN MESSAGE BEFORE DRS
C BYTE 025 - 028: BYTES TO SKIP IN MESSAGE BEFORE BMS
C BYTE 029 - 032: BYTES TO SKIP IN MESSAGE BEFORE DATA SECTION
C BYTE 033 - 040: BYTES TOTAL IN THE MESSAGE
C BYTE 041 - 041: GRIB VERSION NUMBER ( CURRENTLY 2 )
C BYTE 042 - 042: MESSAGE DISCIPLINE
C BYTE 043 - 044: FIELD NUMBER WITHIN GRIB2 MESSAGE
C BYTE 045 - II: IDENTIFICATION SECTION (IDS)
C BYTE II+1- JJ: GRID DEFINITION SECTION (GDS)
C BYTE JJ+1- KK: PRODUCT DEFINITION SECTION (PDS)
C BYTE KK+1- LL: THE DATA REPRESENTATION SECTION (DRS)
C BYTE LL+1-LL+6: FIRST 6 BYTES OF THE BIT MAP SECTION (BMS)
C
C PROGRAM HISTORY LOG:
C 95-10-31 IREDELL
C 96-10-31 IREDELL AUGMENTED OPTIONAL DEFINITIONS TO BYTE 320
C 2002-01-03 GILBERT MODIFIED FROM GETGI TO WORK WITH GRIB2
C
C USAGE: CALL GETG2I(LUGI,CBUF,NLEN,NNUM,IRET)
C INPUT ARGUMENTS:
C LUGI INTEGER UNIT OF THE UNBLOCKED GRIB INDEX FILE
C OUTPUT ARGUMENTS:
C CBUF CHARACTER*1 POINTER TO A BUFFER THAT CONTAINS INDEX RECORDS.
C USERS SHOULD FREE MEMORY THAT CBUF POINTS TO
C USING DEALLOCATE(CBUF) WHEN CBUF IS NO LONGER NEEDED.
C NLEN INTEGER TOTAL LENGTH OF ALL INDEX RECORDS
C NNUM INTEGER NUMBER OF INDEX RECORDS
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 2 NOT ENOUGH MEMORY TO HOLD INDEX BUFFER
C 3 ERROR READING INDEX FILE BUFFER
C 4 ERROR READING INDEX FILE HEADER
C
C SUBPROGRAMS CALLED:
C BAREAD BYTE-ADDRESSABLE READ
C
C REMARKS: SUBPROGRAM CAN BE CALLED FROM A MULTIPROCESSING ENVIRONMENT.
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGI
INTEGER,INTENT(OUT) :: NLEN,NNUM,IRET
CHARACTER CHEAD*162
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IF (ASSOCIATED(CBUF)) NULLIFY(CBUF)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NLEN=0
NNUM=0
IRET=4
CALL BAREAD(LUGI,0,162,LHEAD,CHEAD)
IF(LHEAD.EQ.162.AND.CHEAD(42:47).EQ.'GB2IX1') THEN
READ(CHEAD(82:162),'(8X,3I10,2X,A40)',IOSTAT=IOS) NSKP,NLEN,NNUM
IF(IOS.EQ.0) THEN
ALLOCATE(CBUF(NLEN),STAT=ISTAT) ! ALLOCATE SPACE FOR CBUF
IF (ISTAT.NE.0) THEN
IRET=2
RETURN
ENDIF
IRET=0
CALL BAREAD(LUGI,NSKP,NLEN,LBUF,CBUF)
IF(LBUF.NE.NLEN) IRET=3
ENDIF
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,138 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETG2IR(LUGB,MSK1,MSK2,MNUM,CBUF,NLEN,NNUM,NMESS,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETG2IR CREATES AN INDEX OF A GRIB2 FILE
C PRGMMR: GILBERT ORG: W/NP11 DATE: 2002-01-02
C
C ABSTRACT: READ A GRIB FILE AND RETURN ITS INDEX CONTENTS.
C THE INDEX BUFFER RETURNED CONTAINS INDEX RECORDS WITH THE INTERNAL FORMAT:
C BYTE 001 - 004: LENGTH OF INDEX RECORD
C BYTE 005 - 008: BYTES TO SKIP IN DATA FILE BEFORE GRIB MESSAGE
C BYTE 009 - 012: BYTES TO SKIP IN MESSAGE BEFORE LUS (LOCAL USE)
C SET = 0, IF NO LOCAL USE SECTION IN GRIB2 MESSAGE.
C BYTE 013 - 016: BYTES TO SKIP IN MESSAGE BEFORE GDS
C BYTE 017 - 020: BYTES TO SKIP IN MESSAGE BEFORE PDS
C BYTE 021 - 024: BYTES TO SKIP IN MESSAGE BEFORE DRS
C BYTE 025 - 028: BYTES TO SKIP IN MESSAGE BEFORE BMS
C BYTE 029 - 032: BYTES TO SKIP IN MESSAGE BEFORE DATA SECTION
C BYTE 033 - 040: BYTES TOTAL IN THE MESSAGE
C BYTE 041 - 041: GRIB VERSION NUMBER ( CURRENTLY 2 )
C BYTE 042 - 042: MESSAGE DISCIPLINE
C BYTE 043 - 044: FIELD NUMBER WITHIN GRIB2 MESSAGE
C BYTE 045 - II: IDENTIFICATION SECTION (IDS)
C BYTE II+1- JJ: GRID DEFINITION SECTION (GDS)
C BYTE JJ+1- KK: PRODUCT DEFINITION SECTION (PDS)
C BYTE KK+1- LL: THE DATA REPRESENTATION SECTION (DRS)
C BYTE LL+1-LL+6: FIRST 6 BYTES OF THE BIT MAP SECTION (BMS)
C
C PROGRAM HISTORY LOG:
C 95-10-31 IREDELL
C 96-10-31 IREDELL AUGMENTED OPTIONAL DEFINITIONS TO BYTE 320
C 2002-01-02 GILBERT MODIFIED FROM GETGIR TO CREATE GRIB2 INDEXES
C
C USAGE: CALL GETG2IR(LUGB,MSK1,MSK2,MNUM,CBUF,NLEN,NNUM,NMESS,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB FILE
C MSK1 INTEGER NUMBER OF BYTES TO SEARCH FOR FIRST MESSAGE
C MSK2 INTEGER NUMBER OF BYTES TO SEARCH FOR OTHER MESSAGES
C MNUM INTEGER NUMBER OF GRIB MESSAGES TO SKIP (USUALLY 0)
C OUTPUT ARGUMENTS:
C CBUF CHARACTER*1 POINTER TO A BUFFER THAT CONTAINS INDEX RECORDS.
C USERS SHOULD FREE MEMORY THAT CBUF POINTS TO
C USING DEALLOCATE(CBUF) WHEN CBUF IS NO LONGER NEEDED.
C NLEN INTEGER TOTAL LENGTH OF INDEX RECORD BUFFER IN BYTES
C NNUM INTEGER NUMBER OF INDEX RECORDS
C (=0 IF NO GRIB MESSAGES ARE FOUND)
C NMESS LAST GRIB MESSAGE IN FILE SUCCESSFULLY PROCESSED
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 1 NOT ENOUGH MEMORY AVAILABLE TO HOLD FULL INDEX
C BUFFER
C 2 NOT ENOUGH MEMORY TO ALLOCATE INITIAL INDEX BUFFER
C
C SUBPROGRAMS CALLED:
C SKGB SEEK NEXT GRIB MESSAGE
C IXGB2 MAKE INDEX RECORD
C
C REMARKS: SUBPROGRAM CAN BE CALLED FROM A MULTIPROCESSING ENVIRONMENT.
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE RE_ALLOC ! NEEDED FOR SUBROUTINE REALLOC
PARAMETER(INIT=50000,NEXT=10000)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGB,MSK1,MSK2,MNUM
INTEGER,INTENT(OUT) :: NLEN,NNUM,NMESS,IRET
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUFTMP
INTERFACE ! REQUIRED FOR CBUF POINTER
SUBROUTINE IXGB2(LUGB,LSKIP,LGRIB,CBUF,NUMFLD,MLEN,IRET)
INTEGER,INTENT(IN) :: LUGB,LSKIP,LGRIB
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(OUT) :: NUMFLD,MLEN,IRET
END SUBROUTINE IXGB2
END INTERFACE
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C INITIALIZE
IRET=0
IF (ASSOCIATED(CBUF)) NULLIFY(CBUF)
MBUF=INIT
ALLOCATE(CBUF(MBUF),STAT=ISTAT) ! ALLOCATE INITIAL SPACE FOR CBUF
IF (ISTAT.NE.0) THEN
IRET=2
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C SEARCH FOR FIRST GRIB MESSAGE
ISEEK=0
CALL SKGB(LUGB,ISEEK,MSK1,LSKIP,LGRIB)
DO M=1,MNUM
IF(LGRIB.GT.0) THEN
ISEEK=LSKIP+LGRIB
CALL SKGB(LUGB,ISEEK,MSK2,LSKIP,LGRIB)
ENDIF
ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C GET INDEX RECORDS FOR EVERY GRIB MESSAGE FOUND
NLEN=0
NNUM=0
NMESS=MNUM
DOWHILE(IRET.EQ.0.AND.LGRIB.GT.0)
CALL IXGB2(LUGB,LSKIP,LGRIB,CBUFTMP,NUMFLD,NBYTES,IRET1)
IF (IRET1.NE.0) PRINT *,' SAGT ',NUMFLD,NBYTES,IRET1
IF((NBYTES+NLEN).GT.MBUF) THEN ! ALLOCATE MORE SPACE, IF
! NECESSARY
NEWSIZE=MAX(MBUF+NEXT,MBUF+NBYTES)
CALL REALLOC(CBUF,NLEN,NEWSIZE,ISTAT)
IF ( ISTAT .NE. 0 ) THEN
IRET=1
RETURN
ENDIF
MBUF=NEWSIZE
ENDIF
!
! IF INDEX RECORDS WERE RETURNED IN CBUFTMP FROM IXGB2,
! COPY CBUFTMP INTO CBUF, THEN DEALLOCATE CBUFTMP WHEN DONE
!
IF ( ASSOCIATED(CBUFTMP) ) THEN
CBUF(NLEN+1:NLEN+NBYTES)=CBUFTMP(1:NBYTES)
DEALLOCATE(CBUFTMP,STAT=ISTAT)
IF (ISTAT.NE.0) THEN
PRINT *,' deallocating cbuftmp ... ',istat
stop 99
ENDIF
NULLIFY(CBUFTMP)
NNUM=NNUM+NUMFLD
NLEN=NLEN+NBYTES
NMESS=NMESS+1
ENDIF
! LOOK FOR NEXT GRIB MESSAGE
ISEEK=LSKIP+LGRIB
CALL SKGB(LUGB,ISEEK,MSK2,LSKIP,LGRIB)
ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,331 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2(LUGB,LUGI,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
& UNPACK,K,GFLD,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2 FINDS AND UNPACKS A GRIB MESSAGE
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 94-04-01
C
C ABSTRACT: FIND AND UNPACK A GRIB MESSAGE.
C READ A GRIB INDEX FILE (OR OPTIONALLY THE GRIB FILE ITSELF)
C TO GET THE INDEX BUFFER (I.E. TABLE OF CONTENTS) FOR THE GRIB FILE.
C FIND IN THE INDEX BUFFER A REFERENCE TO THE GRIB FIELD REQUESTED.
C THE GRIB FIELD REQUEST SPECIFIES THE NUMBER OF FIELDS TO SKIP
C AND THE UNPACKED IDENTIFICATION SECTION, GRID DEFINITION TEMPLATE AND
C PRODUCT DEFINTION SECTION PARAMETERS. (A REQUESTED PARAMETER
C OF -9999 MEANS TO ALLOW ANY VALUE OF THIS PARAMETER TO BE FOUND.)
C IF THE REQUESTED GRIB FIELD IS FOUND, THEN IT IS READ FROM THE
C GRIB FILE AND UNPACKED. ITS NUMBER IS RETURNED ALONG WITH
C THE ASSOCIATED UNPACKED PARAMETERS. THE BITMAP (IF ANY),
C AND THE DATA VALUES ARE UNPACKED ONLY IF ARGUMENT "UNPACK" IS SET TO
C TRUE. IF THE GRIB FIELD IS NOT FOUND, THEN THE
C RETURN CODE WILL BE NONZERO.
C
C The decoded information for the selected GRIB field
C is returned in a derived type variable, gfld.
C Gfld is of type gribfield, which is defined
C in module grib_mod, so users of this routine will need to include
C the line "USE GRIB_MOD" in their calling routine. Each component of the
C gribfield type is described in the OUTPUT ARGUMENT LIST section below.
C
C PROGRAM HISTORY LOG:
C 94-04-01 IREDELL
C 95-10-31 IREDELL MODULARIZED PORTIONS OF CODE INTO SUBPROGRAMS
C AND ALLOWED FOR UNSPECIFIED INDEX FILE
C 2002-01-11 GILBERT MODIFIED FROM GETGB AND GETGBM TO WORK WITH GRIB2
C
C USAGE: CALL GETGB2(LUGB,LUGI,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
C & UNPACK,K,GFLD,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE.
C FILE MUST BE OPENED WITH BAOPEN OR BAOPENR BEFORE CALLING
C THIS ROUTINE.
C LUGI INTEGER UNIT OF THE UNBLOCKED GRIB INDEX FILE.
C IF NONZERO, FILE MUST BE OPENED WITH BAOPEN BAOPENR BEFORE
C CALLING THIS ROUTINE.
C >0 - READ INDEX FROM INDEX FILE LUGI, IF INDEX DOESN"T
C ALREADY EXIST.
C =0 - TO GET INDEX BUFFER FROM THE GRIB FILE, IF INDEX
C DOESN"T ALREADY EXIST.
C <0 - FORCE REREAD OF INDEX FROM INDEX FILE ABS(LUGI).
C =LUGB - FORCE REGENERATION OF INDEX FROM GRIB2 FILE LUGB.
C J INTEGER NUMBER OF FIELDS TO SKIP
C (=0 TO SEARCH FROM BEGINNING)
C JDISC GRIB2 DISCIPLINE NUMBER OF REQUESTED FIELD
C ( IF = -1, ACCEPT ANY DISCIPLINE)
C ( SEE CODE TABLE 0.0 )
C 0 - Meteorological products
C 1 - Hydrological products
C 2 - Land surface products
C 3 - Space products
C 10 - Oceanographic products
C JIDS() INTEGER ARRAY OF VALUES IN THE IDENTIFICATION SECTION
C (=-9999 FOR WILDCARD)
C JIDS(1) = IDENTIFICATION OF ORIGINATING CENTRE
C ( SEE COMMON CODE TABLE C-1 )
C JIDS(2) = IDENTIFICATION OF ORIGINATING SUB-CENTRE
C JIDS(3) = GRIB MASTER TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C JIDS(4) = GRIB LOCAL TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C JIDS(5) = SIGNIFICANCE OF REFERENCE TIME (CODE TABLE 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C JIDS(6) = YEAR ( 4 DIGITS )
C JIDS(7) = MONTH
C JIDS(8) = DAY
C JIDS(9) = HOUR
C JIDS(10) = MINUTE
C JIDS(11) = SECOND
C JIDS(12) = PRODUCTION STATUS OF PROCESSED DATA
C ( SEE CODE TABLE 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C JIDS(13) = TYPE OF PROCESSED DATA ( SEE CODE TABLE 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C JPDTN INTEGER PRODUCT DEFINITION TEMPLATE NUMBER (N)
C ( IF = -1, DON'T BOTHER MATCHING PDT - ACCEPT ANY )
C JPDT() INTEGER ARRAY OF VALUES DEFINING THE PRODUCT DEFINITION
C TEMPLATE 4.N OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C JGDTN INTEGER GRID DEFINITION TEMPLATE NUMBER (M)
C ( IF = -1, DON'T BOTHER MATCHING GDT - ACCEPT ANY )
C JGDT() INTEGER ARRAY OF VALUES DEFINING THE GRID DEFINITION
C TEMPLATE 3.M OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C UNPACK LOGICAL VALUE INDICATING WHETHER TO UNPACK BITMAP/DATA
C .TRUE. = UNPACK BITMAP AND DATA VALUES
C .FALSE. = DO NOT UNPACK BITMAP AND DATA VALUES
C
C OUTPUT ARGUMENTS:
C K INTEGER FIELD NUMBER UNPACKED
C gfld - derived type gribfield ( defined in module grib_mod )
C ( NOTE: See Remarks Section )
C gfld%version = GRIB edition number ( currently 2 )
C gfld%discipline = Message Discipline ( see Code Table 0.0 )
C gfld%idsect() = Contains the entries in the Identification
C Section ( Section 1 )
C This element is actually a pointer to an array
C that holds the data.
C gfld%idsect(1) = Identification of originating Centre
C ( see Common Code Table C-1 )
C 7 - US National Weather Service
C gfld%idsect(2) = Identification of originating Sub-centre
C gfld%idsect(3) = GRIB Master Tables Version Number
C ( see Code Table 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C gfld%idsect(4) = GRIB Local Tables Version Number
C ( see Code Table 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C gfld%idsect(6) = Year ( 4 digits )
C gfld%idsect(7) = Month
C gfld%idsect(8) = Day
C gfld%idsect(9) = Hour
C gfld%idsect(10) = Minute
C gfld%idsect(11) = Second
C gfld%idsect(12) = Production status of processed data
C ( see Code Table 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C gfld%idsectlen = Number of elements in gfld%idsect().
C gfld%local() = Pointer to character array containing contents
C of Local Section 2, if included
C gfld%locallen = length of array gfld%local()
C gfld%ifldnum = field number within GRIB message
C gfld%griddef = Source of grid definition (see Code Table 3.0)
C 0 - Specified in Code table 3.1
C 1 - Predetermined grid Defined by originating centre
C gfld%ngrdpts = Number of grid points in the defined grid.
C gfld%numoct_opt = Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C gfld%interp_opt = Interpretation of list for optional points
C definition. (Code Table 3.11)
C gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
C gfld%igdtmpl() = Contains the data values for the specified Grid
C Definition Template ( NN=gfld%igdtnum ). Each
C element of this integer array contains an entry (in
C the order specified) of Grid Defintion Template 3.NN
C This element is actually a pointer to an array
C that holds the data.
C gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
C entries in Grid Defintion Template 3.NN
C ( NN=gfld%igdtnum ).
C gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
C contains the number of grid points contained in
C each row ( or column ). (part of Section 3)
C This element is actually a pointer to an array
C that holds the data. This pointer is nullified
C if gfld%numoct_opt=0.
C gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
C in array ideflist. i.e. number of rows ( or columns )
C for which optional grid points are defined. This value
C is set to zero, if gfld%numoct_opt=0.
C gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
C gfld%ipdtmpl() = Contains the data values for the specified Product
C Definition Template ( N=gfdl%ipdtnum ). Each element
C of this integer array contains an entry (in the
C order specified) of Product Defintion Template 4.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
C entries in Product Defintion Template 4.N
C ( N=gfdl%ipdtnum ).
C gfld%coord_list() = Real array containing floating point values
C intended to document the vertical discretisation
C associated to model data on hybrid coordinate
C vertical levels. (part of Section 4)
C This element is actually a pointer to an array
C that holds the data.
C gfld%num_coord = number of values in array gfld%coord_list().
C gfld%ndpts = Number of data points unpacked and returned.
C gfld%idrtnum = Data Representation Template Number
C ( see Code Table 5.0)
C gfld%idrtmpl() = Contains the data values for the specified Data
C Representation Template ( N=gfld%idrtnum ). Each
C element of this integer array contains an entry
C (in the order specified) of Product Defintion
C Template 5.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
C of entries in Data Representation Template 5.N
C ( N=gfld%idrtnum ).
C gfld%unpacked = logical value indicating whether the bitmap and
C data values were unpacked. If false,
C gfld%bmap and gfld%fld pointers are nullified.
C gfld%expanded = Logical value indicating whether the data field
C was expanded to the grid in the case where a
C bit-map is present. If true, the data points in
C gfld%fld match the grid points and zeros were
C inserted at grid points where data was bit-mapped
C out. If false, the data values in gfld%fld were
C not expanded to the grid and are just a consecutive
C array of data points corresponding to each value of
C "1" in gfld%bmap.
C gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
C 0 = bitmap applies and is included in Section 6.
C 1-253 = Predefined bitmap applies
C 254 = Previously defined bitmap applies to this field
C 255 = Bit map does not apply to this product.
C gfld%bmap() = Logical*1 array containing decoded bitmap,
C if ibmap=0 or ibap=254. Otherwise nullified.
C This element is actually a pointer to an array
C that holds the data.
C gfld%fld() = Array of gfld%ndpts unpacked data points.
C This element is actually a pointer to an array
C that holds the data.
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 96 ERROR READING INDEX
C 97 ERROR READING GRIB FILE
C 99 REQUEST NOT FOUND
C OTHER GF_GETFLD GRIB2 UNPACKER RETURN CODE
C
C SUBPROGRAMS CALLED:
C GETIDX GET INDEX
C GETGB2S SEARCH INDEX RECORDS
C GETGB2R READ AND UNPACK GRIB RECORD
C GF_FREE FREES MEMORY USED BY GFLD ( SEE REMARKS )
C
C REMARKS: SPECIFY AN INDEX FILE IF FEASIBLE TO INCREASE SPEED.
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C
C Note that derived type gribfield contains pointers to many
C arrays of data. The memory for these arrays is allocated
C when the values in the arrays are set, to help minimize
C problems with array overloading. Because of this users
C are encouraged to free up this memory, when it is no longer
C needed, by an explicit call to subroutine gf_free.
C ( i.e. CALL GF_FREE(GFLD) )
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE GRIB_MOD
INTEGER,INTENT(IN) :: LUGB,LUGI,J,JDISC,JPDTN,JGDTN
INTEGER,DIMENSION(:) :: JIDS(*),JPDT(*),JGDT(*)
LOGICAL,INTENT(IN) :: UNPACK
INTEGER,INTENT(OUT) :: K,IRET
TYPE(GRIBFIELD),INTENT(OUT) :: GFLD
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DECLARE INTERFACES (REQUIRED FOR CBUF POINTER)
INTERFACE
SUBROUTINE GETIDX(LUGB,LUGI,CBUF,NLEN,NNUM,IRGI)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGB,LUGI
INTEGER,INTENT(OUT) :: NLEN,NNUM,IRGI
END SUBROUTINE GETIDX
END INTERFACE
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DETERMINE WHETHER INDEX BUFFER NEEDS TO BE INITIALIZED
IRGI=0
CALL GETIDX(LUGB,LUGI,CBUF,NLEN,NNUM,IRGI)
IF(IRGI.GT.1) THEN
IRET=96
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C SEARCH INDEX BUFFER
CALL GETGB2S(CBUF,NLEN,NNUM,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
& JK,GFLD,LPOS,IRGS)
IF(IRGS.NE.0) THEN
IRET=99
CALL GF_FREE(GFLD)
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ LOCAL USE SECTION, IF AVAILABLE
CALL GETGB2L(LUGB,CBUF(LPOS),GFLD,IRET)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ AND UNPACK GRIB RECORD
IF (UNPACK) THEN
! NUMFLD=GFLD%IFLDNUM
! CALL GF_FREE(GFLD)
CALL GETGB2R(LUGB,CBUF(LPOS),GFLD,IRET)
ENDIF
K=JK
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,234 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2L(LUGB,CINDEX,GFLD,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2L EXTRACTS LOCAL USE SECTION
C PRGMMR: GILBERT ORG: W/NP11 DATE: 02-05-07
C
C ABSTRACT: READ AND UNPACK A LOCAL USE SECTION FROM A GRIB2 MESSAGE.
C
C The decoded information for the selected GRIB field
C is returned in a derived type variable, gfld.
C Gfld is of type gribfield, which is defined
C in module grib_mod, so users of this routine will need to include
C the line "USE GRIB_MOD" in their calling routine. Each component of the
C gribfield type is described in the OUTPUT ARGUMENT LIST section below.
C
C PROGRAM HISTORY LOG:
C 2002-05-07 GILBERT
C
C USAGE: CALL GETGB2L(LUGB,CINDEX,GFLD,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE
C CINDEX INDEX RECORD OF THE GRIB FIELD ( SEE DOCBLOCK OF
C SUBROUTINE IXGB2 FOR DESCRIPTION OF AN INDEX RECORD.)
C OUTPUT ARGUMENTS:
C gfld - derived type gribfield ( defined in module grib_mod )
C ( NOTE: See Remarks Section )
C gfld%version = GRIB edition number ( currently 2 )
C gfld%discipline = Message Discipline ( see Code Table 0.0 )
C gfld%idsect() = Contains the entries in the Identification
C Section ( Section 1 )
C This element is actually a pointer to an array
C that holds the data.
C gfld%idsect(1) = Identification of originating Centre
C ( see Common Code Table C-1 )
C 7 - US National Weather Service
C gfld%idsect(2) = Identification of originating Sub-centre
C gfld%idsect(3) = GRIB Master Tables Version Number
C ( see Code Table 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C gfld%idsect(4) = GRIB Local Tables Version Number
C ( see Code Table 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C gfld%idsect(6) = Year ( 4 digits )
C gfld%idsect(7) = Month
C gfld%idsect(8) = Day
C gfld%idsect(9) = Hour
C gfld%idsect(10) = Minute
C gfld%idsect(11) = Second
C gfld%idsect(12) = Production status of processed data
C ( see Code Table 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C gfld%idsectlen = Number of elements in gfld%idsect().
C gfld%local() = Pointer to character array containing contents
C of Local Section 2, if included
C gfld%locallen = length of array gfld%local()
C gfld%ifldnum = field number within GRIB message
C gfld%griddef = Source of grid definition (see Code Table 3.0)
C 0 - Specified in Code table 3.1
C 1 - Predetermined grid Defined by originating centre
C gfld%ngrdpts = Number of grid points in the defined grid.
C gfld%numoct_opt = Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C gfld%interp_opt = Interpretation of list for optional points
C definition. (Code Table 3.11)
C gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
C gfld%igdtmpl() = Contains the data values for the specified Grid
C Definition Template ( NN=gfld%igdtnum ). Each
C element of this integer array contains an entry (in
C the order specified) of Grid Defintion Template 3.NN
C This element is actually a pointer to an array
C that holds the data.
C gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
C entries in Grid Defintion Template 3.NN
C ( NN=gfld%igdtnum ).
C gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
C contains the number of grid points contained in
C each row ( or column ). (part of Section 3)
C This element is actually a pointer to an array
C that holds the data. This pointer is nullified
C if gfld%numoct_opt=0.
C gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
C in array ideflist. i.e. number of rows ( or columns )
C for which optional grid points are defined. This value
C is set to zero, if gfld%numoct_opt=0.
C gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
C gfld%ipdtmpl() = Contains the data values for the specified Product
C Definition Template ( N=gfdl%ipdtnum ). Each element
C of this integer array contains an entry (in the
C order specified) of Product Defintion Template 4.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
C entries in Product Defintion Template 4.N
C ( N=gfdl%ipdtnum ).
C gfld%coord_list() = Real array containing floating point values
C intended to document the vertical discretisation
C associated to model data on hybrid coordinate
C vertical levels. (part of Section 4)
C This element is actually a pointer to an array
C that holds the data.
C gfld%num_coord = number of values in array gfld%coord_list().
C gfld%ndpts = Number of data points unpacked and returned.
C gfld%idrtnum = Data Representation Template Number
C ( see Code Table 5.0)
C gfld%idrtmpl() = Contains the data values for the specified Data
C Representation Template ( N=gfld%idrtnum ). Each
C element of this integer array contains an entry
C (in the order specified) of Product Defintion
C Template 5.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
C of entries in Data Representation Template 5.N
C ( N=gfld%idrtnum ).
C gfld%unpacked = logical value indicating whether the bitmap and
C data values were unpacked. If false,
C gfld%bmap and gfld%fld pointers are nullified.
C gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
C 0 = bitmap applies and is included in Section 6.
C 1-253 = Predefined bitmap applies
C 254 = Previously defined bitmap applies to this field
C 255 = Bit map does not apply to this product.
C gfld%bmap() = Logical*1 array containing decoded bitmap,
C if ibmap=0 or ibap=254. Otherwise nullified.
C This element is actually a pointer to an array
C that holds the data.
C gfld%fld() = Array of gfld%ndpts unpacked data points.
C This element is actually a pointer to an array
C that holds the data.
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 97 ERROR READING GRIB FILE
C OTHER GF_GETFLD GRIB UNPACKER RETURN CODE
C
C SUBPROGRAMS CALLED:
C BAREAD BYTE-ADDRESSABLE READ
C GF_GETFLD UNPACK GRIB FIELD
C
C REMARKS:
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C THIS SUBPROGRAM IS INTENDED FOR PRIVATE USE BY GETGB2 ROUTINES ONLY.
C
C Note that derived type gribfield contains pointers to many
C arrays of data. The memory for these arrays is allocated
C when the values in the arrays are set, to help minimize
C problems with array overloading. Because of this users
C are encouraged to free up this memory, when it is no longer
C needed, by an explicit call to subroutine gf_free.
C ( i.e. CALL GF_FREE(GFLD) )
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE GRIB_MOD
INTEGER,INTENT(IN) :: LUGB
CHARACTER(LEN=1),INTENT(IN) :: CINDEX(*)
INTEGER,INTENT(OUT) :: IRET
TYPE(GRIBFIELD) :: GFLD
INTEGER :: LSKIP,SKIP2
CHARACTER(LEN=1):: CSIZE(4)
CHARACTER(LEN=1),ALLOCATABLE :: CTEMP(:)
interface
subroutine gf_unpack2(cgrib,lcgrib,iofst,lencsec2,csec2,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: lencsec2
integer,intent(out) :: ierr
character(len=1),pointer,dimension(:) :: csec2
end subroutine gf_unpack2
end interface
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C GET INFO
NULLIFY(gfld%local)
IRET=0
CALL GBYTE(CINDEX,LSKIP,4*8,4*8)
CALL GBYTE(CINDEX,SKIP2,8*8,4*8)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ AND UNPACK LOCAL USE SECTION, IF PRESENT
IF ( SKIP2.NE.0 ) THEN
ISKIP=LSKIP+SKIP2
CALL BAREAD(LUGB,ISKIP,4,LREAD,CSIZE) ! GET LENGTH OF SECTION
CALL GBYTE(CSIZE,ILEN,0,32)
ALLOCATE(CTEMP(ILEN))
CALL BAREAD(LUGB,ISKIP,ILEN,LREAD,CTEMP) ! READ IN SECTION
IF (ILEN.NE.LREAD) THEN
IRET=97
DEALLOCATE(CTEMP)
RETURN
ENDIF
IOFST=0
CALL GF_UNPACK2(CTEMP,ILEN,IOFST,gfld%locallen,
& gfld%local,ierr)
IF (IERR.NE.0) THEN
IRET=98
DEALLOCATE(CTEMP)
RETURN
ENDIF
DEALLOCATE(CTEMP)
ELSE
gfld%locallen=0
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,223 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2P(LUGB,LUGI,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
& EXTRACT,K,GRIBM,LENG,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2P FINDS AND EXTRACTS A GRIB MESSAGE
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 94-04-01
C
C ABSTRACT: FIND AND EXTRACTS A GRIB MESSAGE FROM A FILE.
C READ A GRIB INDEX FILE (OR OPTIONALLY THE GRIB FILE ITSELF)
C TO GET THE INDEX BUFFER (I.E. TABLE OF CONTENTS) FOR THE GRIB FILE.
C FIND IN THE INDEX BUFFER A REFERENCE TO THE GRIB FIELD REQUESTED.
C THE GRIB FIELD REQUEST SPECIFIES THE NUMBER OF FIELDS TO SKIP
C AND THE UNPACKED IDENTIFICATION SECTION, GRID DEFINITION TEMPLATE AND
C PRODUCT DEFINTION SECTION PARAMETERS. (A REQUESTED PARAMETER
C OF -9999 MEANS TO ALLOW ANY VALUE OF THIS PARAMETER TO BE FOUND.)
C IF THE REQUESTED GRIB FIELD IS FOUND, THEN IT IS READ FROM THE
C GRIB FILE AND RETURNED.
C IF THE GRIB FIELD IS NOT FOUND, THEN THE RETURN CODE WILL BE NONZERO.
C
C PROGRAM HISTORY LOG:
C 94-04-01 IREDELL
C 95-10-31 IREDELL MODULARIZED PORTIONS OF CODE INTO SUBPROGRAMS
C AND ALLOWED FOR UNSPECIFIED INDEX FILE
C 2002-01-11 GILBERT MODIFIED FROM GETGB AND GETGBM TO WORK WITH GRIB2
C 2003-12-17 GILBERT MODIFIED FROM GETGB2 TO RETURN PACKED GRIB2 MESSAGE.
C
C USAGE: CALL GETGB2P(LUGB,LUGI,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
C & EXTRACT,K,GRIBM,LENG,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE.
C FILE MUST BE OPENED WITH BAOPEN OR BAOPENR BEFORE CALLING
C THIS ROUTINE.
C LUGI INTEGER UNIT OF THE UNBLOCKED GRIB INDEX FILE.
C IF NONZERO, FILE MUST BE OPENED WITH BAOPEN BAOPENR BEFORE
C CALLING THIS ROUTINE.
C (=0 TO GET INDEX BUFFER FROM THE GRIB FILE)
C J INTEGER NUMBER OF FIELDS TO SKIP
C (=0 TO SEARCH FROM BEGINNING)
C JDISC GRIB2 DISCIPLINE NUMBER OF REQUESTED FIELD
C ( IF = -1, ACCEPT ANY DISCIPLINE)
C ( SEE CODE TABLE 0.0 )
C 0 - Meteorological products
C 1 - Hydrological products
C 2 - Land surface products
C 3 - Space products
C 10 - Oceanographic products
C JIDS() INTEGER ARRAY OF VALUES IN THE IDENTIFICATION SECTION
C (=-9999 FOR WILDCARD)
C JIDS(1) = IDENTIFICATION OF ORIGINATING CENTRE
C ( SEE COMMON CODE TABLE C-1 )
C JIDS(2) = IDENTIFICATION OF ORIGINATING SUB-CENTRE
C JIDS(3) = GRIB MASTER TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C JIDS(4) = GRIB LOCAL TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C JIDS(5) = SIGNIFICANCE OF REFERENCE TIME (CODE TABLE 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C JIDS(6) = YEAR ( 4 DIGITS )
C JIDS(7) = MONTH
C JIDS(8) = DAY
C JIDS(9) = HOUR
C JIDS(10) = MINUTE
C JIDS(11) = SECOND
C JIDS(12) = PRODUCTION STATUS OF PROCESSED DATA
C ( SEE CODE TABLE 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C JIDS(13) = TYPE OF PROCESSED DATA ( SEE CODE TABLE 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C JPDTN INTEGER PRODUCT DEFINITION TEMPLATE NUMBER (N)
C ( IF = -1, DON'T BOTHER MATCHING PDT - ACCEPT ANY )
C JPDT() INTEGER ARRAY OF VALUES DEFINING THE PRODUCT DEFINITION
C TEMPLATE 4.N OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C JGDTN INTEGER GRID DEFINITION TEMPLATE NUMBER (M)
C ( IF = -1, DON'T BOTHER MATCHING GDT - ACCEPT ANY )
C JGDT() INTEGER ARRAY OF VALUES DEFINING THE GRID DEFINITION
C TEMPLATE 3.M OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C EXTRACT LOGICAL VALUE INDICATING WHETHER TO RETURN A GRIB2
C MESSAGE WITH JUST THE REQUESTED FIELD, OR THE ENTIRE
C GRIB2 MESSAGE CONTAINING THE REQUESTED FIELD.
C .TRUE. = RETURN GRIB2 MESSAGE CONTAINING ONLY THE REQUESTED
C FIELD.
C .FALSE. = RETURN ENTIRE GRIB2 MESSAGE CONTAINING THE
C REQUESTED FIELD.
C
C OUTPUT ARGUMENTS:
C K INTEGER FIELD NUMBER RETURNED.
C GRIBM RETURNED GRIB MESSAGE.
C LENG LENGTH OF RETURNED GRIB MESSAGE IN BYTES.
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 96 ERROR READING INDEX FILE
C 97 ERROR READING GRIB FILE
C 99 REQUEST NOT FOUND
C
C SUBPROGRAMS CALLED:
C GETG2I READ INDEX FILE
C GETG2IR READ INDEX BUFFER FROM GRIB FILE
C GETGB2S SEARCH INDEX RECORDS
C GETGB2RP READ A PACKED GRIB RECORD
C GF_FREE FREES MEMORY USED BY GFLD ( SEE REMARKS )
C
C REMARKS: SPECIFY AN INDEX FILE IF FEASIBLE TO INCREASE SPEED.
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C
C Note that derived type gribfield contains pointers to many
C arrays of data. The memory for these arrays is allocated
C when the values in the arrays are set, to help minimize
C problems with array overloading. Because of this users
C are encouraged to free up this memory, when it is no longer
C needed, by an explicit call to subroutine gf_free.
C ( i.e. CALL GF_FREE(GFLD) )
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE GRIB_MOD
INTEGER,INTENT(IN) :: LUGB,LUGI,J,JDISC,JPDTN,JGDTN
INTEGER,DIMENSION(:) :: JIDS(*),JPDT(*),JGDT(*)
LOGICAL,INTENT(IN) :: EXTRACT
INTEGER,INTENT(OUT) :: K,IRET,LENG
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: GRIBM
TYPE(GRIBFIELD) :: GFLD
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
PARAMETER(MSK1=32000,MSK2=4000)
SAVE CBUF,NLEN,NNUM
DATA LUX/0/
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DECLARE INTERFACES (REQUIRED FOR CBUF POINTER)
INTERFACE
SUBROUTINE GETG2I(LUGI,CBUF,NLEN,NNUM,IRET)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGI
INTEGER,INTENT(OUT) :: NLEN,NNUM,IRET
END SUBROUTINE GETG2I
SUBROUTINE GETG2IR(LUGB,MSK1,MSK2,MNUM,CBUF,NLEN,NNUM,
& NMESS,IRET)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGB,MSK1,MSK2,MNUM
INTEGER,INTENT(OUT) :: NLEN,NNUM,NMESS,IRET
END SUBROUTINE GETG2IR
SUBROUTINE GETGB2RP(LUGB,CINDEX,EXTRACT,GRIBM,LENG,IRET)
INTEGER,INTENT(IN) :: LUGB
CHARACTER(LEN=1),INTENT(IN) :: CINDEX(*)
LOGICAL,INTENT(IN) :: EXTRACT
INTEGER,INTENT(OUT) :: LENG,IRET
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: GRIBM
END SUBROUTINE GETGB2RP
END INTERFACE
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DETERMINE WHETHER INDEX BUFFER NEEDS TO BE INITIALIZED
IRGI=0
IF(LUGI.GT.0.AND.LUGI.NE.LUX) THEN
CALL GETG2I(LUGI,CBUF,NLEN,NNUM,IRGI)
LUX=LUGI
ELSEIF(LUGI.LE.0.AND.LUGB.NE.LUX) THEN
MSKP=0
CALL GETG2IR(LUGB,MSK1,MSK2,MSKP,CBUF,NLEN,NNUM,NMESS,IRGI)
LUX=LUGB
ENDIF
IF(IRGI.GT.1) THEN
IRET=96
LUX=0
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C SEARCH INDEX BUFFER
CALL GETGB2S(CBUF,NLEN,NNUM,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT,
& JK,GFLD,LPOS,IRGS)
IF(IRGS.NE.0) THEN
IRET=99
CALL GF_FREE(GFLD)
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C EXTRACT GRIB MESSAGE FROM FILE
CALL GETGB2RP(LUGB,CBUF(LPOS:),EXTRACT,GRIBM,LENG,IRET)
! IF ( EXTRACT ) THEN
! PRINT *,'NOT SUPPOSED TO BE HERE.'
! ELSE
! IPOS=(LPOS+3)*8
! CALL GBYTE(CBUF,ISKIP,IPOS,32) ! BYTES TO SKIP IN FILE
! IPOS=IPOS+(32*8)
! CALL GBYTE(CBUF,LENG,IPOS,32) ! LENGTH OF GRIB MESSAGE
! IF (.NOT. ASSOCIATED(GRIBM)) ALLOCATE(GRIBM(LENG))
! CALL BAREAD(LUGB,ISKIP,LENG,LREAD,GRIBM)
! IF ( LENG .NE. LREAD ) THEN
! IRET=97
! CALL GF_FREE(GFLD)
! RETURN
! ENDIF
! ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
K=JK
CALL GF_FREE(GFLD)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,304 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2R(LUGB,CINDEX,GFLD,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2R READS AND UNPACKS A GRIB FIELD
C PRGMMR: GILBERT ORG: W/NP11 DATE: 02-01-15
C
C ABSTRACT: READ AND UNPACK SECTIONS 6 AND 7 FROM A GRIB2 MESSAGE.
C
C This routine assumes that the "metadata" for this field
C already exists in derived type gribfield. Specifically,
C it requires gfld%ibmap,gfld%ngrdpts,gfld%idrtnum,gfld%idrtmpl,
C and gfld%ndpts.
C
C The decoded information for the selected GRIB field
C is returned in a derived type variable, gfld.
C Gfld is of type gribfield, which is defined
C in module grib_mod, so users of this routine will need to include
C the line "USE GRIB_MOD" in their calling routine. Each component of the
C gribfield type is described in the OUTPUT ARGUMENT LIST section below.
C
C PROGRAM HISTORY LOG:
C 95-10-31 IREDELL
C 2002-01-11 GILBERT MODIFIED FROM GETGB1R TO WORK WITH GRIB2
C
C USAGE: CALL GETGB2R(LUGB,CINDEX,GFLD,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE
C CINDEX INDEX RECORD OF THE GRIB FIELD ( SEE DOCBLOCK OF
C SUBROUTINE IXGB2 FOR DESCRIPTION OF AN INDEX RECORD.)
C OUTPUT ARGUMENTS:
C gfld - derived type gribfield ( defined in module grib_mod )
C ( NOTE: See Remarks Section )
C gfld%version = GRIB edition number ( currently 2 )
C gfld%discipline = Message Discipline ( see Code Table 0.0 )
C gfld%idsect() = Contains the entries in the Identification
C Section ( Section 1 )
C This element is actually a pointer to an array
C that holds the data.
C gfld%idsect(1) = Identification of originating Centre
C ( see Common Code Table C-1 )
C 7 - US National Weather Service
C gfld%idsect(2) = Identification of originating Sub-centre
C gfld%idsect(3) = GRIB Master Tables Version Number
C ( see Code Table 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C gfld%idsect(4) = GRIB Local Tables Version Number
C ( see Code Table 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C gfld%idsect(6) = Year ( 4 digits )
C gfld%idsect(7) = Month
C gfld%idsect(8) = Day
C gfld%idsect(9) = Hour
C gfld%idsect(10) = Minute
C gfld%idsect(11) = Second
C gfld%idsect(12) = Production status of processed data
C ( see Code Table 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C gfld%idsectlen = Number of elements in gfld%idsect().
C gfld%local() = Pointer to character array containing contents
C of Local Section 2, if included
C gfld%locallen = length of array gfld%local()
C gfld%ifldnum = field number within GRIB message
C gfld%griddef = Source of grid definition (see Code Table 3.0)
C 0 - Specified in Code table 3.1
C 1 - Predetermined grid Defined by originating centre
C gfld%ngrdpts = Number of grid points in the defined grid.
C gfld%numoct_opt = Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C gfld%interp_opt = Interpretation of list for optional points
C definition. (Code Table 3.11)
C gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
C gfld%igdtmpl() = Contains the data values for the specified Grid
C Definition Template ( NN=gfld%igdtnum ). Each
C element of this integer array contains an entry (in
C the order specified) of Grid Defintion Template 3.NN
C This element is actually a pointer to an array
C that holds the data.
C gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
C entries in Grid Defintion Template 3.NN
C ( NN=gfld%igdtnum ).
C gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
C contains the number of grid points contained in
C each row ( or column ). (part of Section 3)
C This element is actually a pointer to an array
C that holds the data. This pointer is nullified
C if gfld%numoct_opt=0.
C gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
C in array ideflist. i.e. number of rows ( or columns )
C for which optional grid points are defined. This value
C is set to zero, if gfld%numoct_opt=0.
C gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
C gfld%ipdtmpl() = Contains the data values for the specified Product
C Definition Template ( N=gfdl%ipdtnum ). Each element
C of this integer array contains an entry (in the
C order specified) of Product Defintion Template 4.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
C entries in Product Defintion Template 4.N
C ( N=gfdl%ipdtnum ).
C gfld%coord_list() = Real array containing floating point values
C intended to document the vertical discretisation
C associated to model data on hybrid coordinate
C vertical levels. (part of Section 4)
C This element is actually a pointer to an array
C that holds the data.
C gfld%num_coord = number of values in array gfld%coord_list().
C gfld%ndpts = Number of data points unpacked and returned.
C gfld%idrtnum = Data Representation Template Number
C ( see Code Table 5.0)
C gfld%idrtmpl() = Contains the data values for the specified Data
C Representation Template ( N=gfld%idrtnum ). Each
C element of this integer array contains an entry
C (in the order specified) of Product Defintion
C Template 5.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
C of entries in Data Representation Template 5.N
C ( N=gfld%idrtnum ).
C gfld%unpacked = logical value indicating whether the bitmap and
C data values were unpacked. If false,
C gfld%bmap and gfld%fld pointers are nullified.
C gfld%expanded = Logical value indicating whether the data field
C was expanded to the grid in the case where a
C bit-map is present. If true, the data points in
C gfld%fld match the grid points and zeros were
C inserted at grid points where data was bit-mapped
C out. If false, the data values in gfld%fld were
C not expanded to the grid and are just a consecutive
C array of data points corresponding to each value of
C "1" in gfld%bmap.
C gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
C 0 = bitmap applies and is included in Section 6.
C 1-253 = Predefined bitmap applies
C 254 = Previously defined bitmap applies to this field
C 255 = Bit map does not apply to this product.
C gfld%bmap() = Logical*1 array containing decoded bitmap,
C if ibmap=0 or ibap=254. Otherwise nullified.
C This element is actually a pointer to an array
C that holds the data.
C gfld%fld() = Array of gfld%ndpts unpacked data points.
C This element is actually a pointer to an array
C that holds the data.
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 97 ERROR READING GRIB FILE
C OTHER GF_GETFLD GRIB UNPACKER RETURN CODE
C
C SUBPROGRAMS CALLED:
C BAREAD BYTE-ADDRESSABLE READ
C GF_UNPACK6 UNAPCKS BIT_MAP SECTION
C GF_UNPACK7 UNAPCKS DATA SECTION
C
C REMARKS:
C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.
C THIS SUBPROGRAM IS INTENDED FOR PRIVATE USE BY GETGB2 ROUTINES ONLY.
C
C Note that derived type gribfield contains pointers to many
C arrays of data. The memory for these arrays is allocated
C when the values in the arrays are set, to help minimize
C problems with array overloading. Because of this, users
C are encouraged to free up this memory, when it is no longer
C needed, by an explicit call to subroutine gf_free.
C ( i.e. CALL GF_FREE(GFLD) )
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE GRIB_MOD
INTEGER,INTENT(IN) :: LUGB
CHARACTER(LEN=1),INTENT(IN) :: CINDEX(*)
INTEGER,INTENT(OUT) :: IRET
TYPE(GRIBFIELD) :: GFLD
INTEGER :: LSKIP,SKIP6,SKIP7
CHARACTER(LEN=1):: CSIZE(4)
CHARACTER(LEN=1),ALLOCATABLE :: CTEMP(:)
real,pointer,dimension(:) :: newfld
interface
subroutine gf_unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,
& bmap,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ngpts
integer,intent(inout) :: iofst
integer,intent(out) :: ibmap
integer,intent(out) :: ierr
logical*1,pointer,dimension(:) :: bmap
end subroutine gf_unpack6
subroutine gf_unpack7(cgrib,lcgrib,iofst,igdsnum,igdstmpl,
& idrsnum,idrstmpl,ndpts,fld,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ndpts,idrsnum,igdsnum
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: idrstmpl,igdstmpl
integer,intent(out) :: ierr
real,pointer,dimension(:) :: fld
end subroutine gf_unpack7
end interface
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C GET INFO
NULLIFY(gfld%bmap,gfld%fld)
IRET=0
CALL GBYTE(CINDEX,LSKIP,4*8,4*8)
CALL GBYTE(CINDEX,SKIP6,24*8,4*8)
CALL GBYTE(CINDEX,SKIP7,28*8,4*8)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ AND UNPACK BIT_MAP, IF PRESENT
IF ( gfld%ibmap.eq.0.OR.gfld%ibmap.eq.254 ) THEN
ISKIP=LSKIP+SKIP6
CALL BAREAD(LUGB,ISKIP,4,LREAD,CSIZE) ! GET LENGTH OF SECTION
CALL GBYTE(CSIZE,ILEN,0,32)
ALLOCATE(CTEMP(ILEN))
CALL BAREAD(LUGB,ISKIP,ILEN,LREAD,CTEMP) ! READ IN SECTION
IF (ILEN.NE.LREAD) THEN
IRET=97
DEALLOCATE(CTEMP)
RETURN
ENDIF
IOFST=0
CALL GF_UNPACK6(CTEMP,ILEN,IOFST,gfld%ngrdpts,idum,
& gfld%bmap,ierr)
IF (IERR.NE.0) THEN
IRET=98
DEALLOCATE(CTEMP)
RETURN
ENDIF
DEALLOCATE(CTEMP)
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ AND UNPACK DATA FIELD
ISKIP=LSKIP+SKIP7
CALL BAREAD(LUGB,ISKIP,4,LREAD,CSIZE) ! GET LENGTH OF SECTION
CALL GBYTE(CSIZE,ILEN,0,32)
ALLOCATE(CTEMP(ILEN))
CALL BAREAD(LUGB,ISKIP,ILEN,LREAD,CTEMP) ! READ IN SECTION
IF (ILEN.NE.LREAD) THEN
IRET=97
DEALLOCATE(CTEMP)
RETURN
ENDIF
IOFST=0
CALL GF_UNPACK7(CTEMP,ILEN,IOFST,gfld%igdtnum,gfld%igdtmpl,
& gfld%idrtnum,gfld%idrtmpl,gfld%ndpts,
& gfld%fld,ierr)
IF (IERR.NE.0) THEN
IRET=98
DEALLOCATE(CTEMP)
RETURN
ENDIF
DEALLOCATE(CTEMP)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! If bitmap is used with this field, expand data field
! to grid, if possible.
if ( gfld%ibmap .ne. 255 .AND. associated(gfld%bmap) ) then
allocate(newfld(gfld%ngrdpts))
!newfld=0.0
!newfld=unpack(lgfld%fld,lgfld%bmap,newfld)
n=1
do j=1,gfld%ngrdpts
if ( gfld%bmap(j) ) then
newfld(j)=gfld%fld(n)
n=n+1
else
newfld(j)=0.0
endif
enddo
deallocate(gfld%fld);
gfld%fld=>newfld;
gfld%expanded=.true.
else
gfld%expanded=.true.
endif
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,189 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2RP(LUGB,CINDEX,EXTRACT,GRIBM,LENG,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2RP EXTRACTS A GRIB MESSAGE FROM A FILE
C PRGMMR: GILBERT ORG: W/NMC23 DATE: 2003-12-31
C
C ABSTRACT: FIND AND EXTRACTS A GRIB MESSAGE FROM A FILE GIVEN THE
C INDEX FOR THE REQUESTED FIELD.
C THE GRIB MESSAGE RETURNED CAN CONTAIN ONLY THE REQUESTED FIELD
C (EXTRACT=.TRUE.). OR THE COMPLETE GRIB MESSAGE ORIGINALLY CONTAINING
C THE DESIRED FIELD CAN BE RETURNED (EXTRACT=.FALSE.) EVEN IF OTHER
C FIELDS WERE INCLUDED IN THE GRIB MESSAGE.
C IF THE GRIB FIELD IS NOT FOUND, THEN THE RETURN CODE WILL BE NONZERO.
C
C PROGRAM HISTORY LOG:
C 2003-12-31 GILBERT
C
C USAGE: CALL GETGB2RP(LUGB,CINDEX,EXTRACT,GRIBM,LENG,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE.
C FILE MUST BE OPENED WITH BAOPEN OR BAOPENR BEFORE CALLING
C THIS ROUTINE.
C CINDEX INDEX RECORD OF THE GRIB FILE ( SEE DOCBLOCK OF
C SUBROUTINE IXGB2 FOR DESCRIPTION OF AN INDEX RECORD.)
C EXTRACT LOGICAL VALUE INDICATING WHETHER TO RETURN A GRIB2
C MESSAGE WITH JUST THE REQUESTED FIELD, OR THE ENTIRE
C GRIB2 MESSAGE CONTAINING THE REQUESTED FIELD.
C .TRUE. = RETURN GRIB2 MESSAGE CONTAINING ONLY THE REQUESTED
C FIELD.
C .FALSE. = RETURN ENTIRE GRIB2 MESSAGE CONTAINING THE
C REQUESTED FIELD.
C
C OUTPUT ARGUMENTS:
C GRIBM RETURNED GRIB MESSAGE.
C LENG LENGTH OF RETURNED GRIB MESSAGE IN BYTES.
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 97 ERROR READING GRIB FILE
C
C SUBPROGRAMS CALLED:
C BAREAD BYTE-ADDRESSABLE READ
C
C REMARKS: NONE
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
INTEGER,INTENT(IN) :: LUGB
CHARACTER(LEN=1),INTENT(IN) :: CINDEX(*)
LOGICAL,INTENT(IN) :: EXTRACT
INTEGER,INTENT(OUT) :: LENG,IRET
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: GRIBM
INTEGER,PARAMETER :: ZERO=0
CHARACTER(LEN=1),ALLOCATABLE,DIMENSION(:) :: CSEC2,CSEC6,CSEC7
CHARACTER(LEN=4) :: Ctemp
IRET=0
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C EXTRACT GRIB MESSAGE FROM FILE
IF ( EXTRACT ) THEN
LEN0=16
LEN8=4
CALL GBYTE(CINDEX,ISKIP,4*8,4*8) ! BYTES TO SKIP IN FILE
CALL GBYTE(CINDEX,ISKP2,8*8,4*8) ! BYTES TO SKIP FOR section 2
if ( iskp2 .gt. 0 ) then
CALL BAREAD(LUGB,ISKIP+ISKP2,4,LREAD,ctemp)
CALL GBYTE(Ctemp,LEN2,0,4*8) ! LENGTH OF SECTION 2
ALLOCATE(csec2(len2))
CALL BAREAD(LUGB,ISKIP+ISKP2,LEN2,LREAD,csec2)
else
LEN2=0
endif
CALL GBYTE(CINDEX,LEN1,44*8,4*8) ! LENGTH OF SECTION 1
IPOS=44+LEN1
CALL GBYTE(CINDEX,LEN3,IPOS*8,4*8) ! LENGTH OF SECTION 3
IPOS=IPOS+LEN3
CALL GBYTE(CINDEX,LEN4,IPOS*8,4*8) ! LENGTH OF SECTION 4
IPOS=IPOS+LEN4
CALL GBYTE(CINDEX,LEN5,IPOS*8,4*8) ! LENGTH OF SECTION 5
IPOS=IPOS+LEN5
CALL GBYTE(CINDEX,LEN6,IPOS*8,4*8) ! LENGTH OF SECTION 6
IPOS=IPOS+5
CALL GBYTE(CINDEX,IBMAP,IPOS*8,1*8) ! Bitmap indicator
IF ( IBMAP .eq. 254 ) THEN
CALL GBYTE(CINDEX,ISKP6,24*8,4*8) ! BYTES TO SKIP FOR section 6
CALL BAREAD(LUGB,ISKIP+ISKP6,4,LREAD,ctemp)
CALL GBYTE(Ctemp,LEN6,0,4*8) ! LENGTH OF SECTION 6
ENDIF
!
! READ IN SECTION 7 from file
!
CALL GBYTE(CINDEX,ISKP7,28*8,4*8) ! BYTES TO SKIP FOR section 7
CALL BAREAD(LUGB,ISKIP+ISKP7,4,LREAD,ctemp)
CALL GBYTE(Ctemp,LEN7,0,4*8) ! LENGTH OF SECTION 7
ALLOCATE(csec7(len7))
CALL BAREAD(LUGB,ISKIP+ISKP7,LEN7,LREAD,csec7)
LENG=LEN0+LEN1+LEN2+LEN3+LEN4+LEN5+LEN6+LEN7+LEN8
IF (.NOT. ASSOCIATED(GRIBM)) ALLOCATE(GRIBM(LENG))
! Create Section 0
!
GRIBM(1)='G'
GRIBM(2)='R'
GRIBM(3)='I'
GRIBM(4)='B'
GRIBM(5)=CHAR(0)
GRIBM(6)=CHAR(0)
GRIBM(7)=CINDEX(42)
GRIBM(8)=CINDEX(41)
GRIBM(9)=CHAR(0)
GRIBM(10)=CHAR(0)
GRIBM(11)=CHAR(0)
GRIBM(12)=CHAR(0)
CALL SBYTE(GRIBM,LENG,12*8,4*8)
!
! Copy Section 1
!
GRIBM(17:16+LEN1)=CINDEX(45:44+LEN1)
lencur=16+LEN1
ipos=44+len1
!
! Copy Section 2, if necessary
!
if ( iskp2 .gt. 0 ) then
GRIBM(lencur+1:lencur+LEN2)=csec2(1:LEN2)
lencur=lencur+LEN2
endif
!
! Copy Sections 3 through 5
!
GRIBM(lencur+1:lencur+LEN3+LEN4+LEN5)=
& CINDEX(ipos+1:ipos+LEN3+LEN4+LEN5)
lencur=lencur+LEN3+LEN4+LEN5
ipos=ipos+LEN3+LEN4+LEN5
!
! Copy Section 6
!
if ( LEN6 .eq. 6 .AND. IBMAP .ne. 254 ) then
GRIBM(lencur+1:lencur+LEN6)=CINDEX(ipos+1:ipos+LEN6)
lencur=lencur+LEN6
else
CALL GBYTE(CINDEX,ISKP6,24*8,4*8) ! BYTES TO SKIP FOR section 6
CALL BAREAD(LUGB,ISKIP+ISKP6,4,LREAD,ctemp)
CALL GBYTE(Ctemp,LEN6,0,4*8) ! LENGTH OF SECTION 6
ALLOCATE(csec6(len6))
CALL BAREAD(LUGB,ISKIP+ISKP6,LEN6,LREAD,csec6)
GRIBM(lencur+1:lencur+LEN6)=csec6(1:LEN6)
lencur=lencur+LEN6
IF ( allocated(csec6)) DEALLOCATE(csec6)
endif
!
! Copy Section 7
!
GRIBM(lencur+1:lencur+LEN7)=csec7(1:LEN7)
lencur=lencur+LEN7
!
! Section 8
!
GRIBM(lencur+1)='7'
GRIBM(lencur+2)='7'
GRIBM(lencur+3)='7'
GRIBM(lencur+4)='7'
! clean up
!
IF ( allocated(csec2)) DEALLOCATE(csec2)
IF ( allocated(csec7)) deallocate(csec7)
ELSE ! DO NOT extract field from message : Get entire message
CALL GBYTE(CINDEX,ISKIP,4*8,4*8) ! BYTES TO SKIP IN FILE
CALL GBYTE(CINDEX,LENG,36*8,4*8) ! LENGTH OF GRIB MESSAGE
IF (.NOT. ASSOCIATED(GRIBM)) ALLOCATE(GRIBM(LENG))
CALL BAREAD(LUGB,ISKIP,LENG,LREAD,GRIBM)
IF ( LENG .NE. LREAD ) THEN
DEALLOCATE(GRIBM)
NULLIFY(GRIBM)
IRET=97
RETURN
ENDIF
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,489 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETGB2S(CBUF,NLEN,NNUM,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,
& JGDT,K,GFLD,LPOS,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETGB2S FINDS A GRIB MESSAGE
C PRGMMR: GILBERT ORG: W/NP11 DATE: 02-01-15
C
C ABSTRACT: FIND A GRIB MESSAGE.
C FIND IN THE INDEX FILE A REFERENCE TO THE GRIB FIELD REQUESTED.
C THE GRIB FIELD REQUEST SPECIFIES THE NUMBER OF MESSAGES TO SKIP
C AND THE UNPACKED IDENTIFICATION SECTION, GRID DEFINITION TEMPLATE AND
C PRODUCT DEFINTION SECTION PARAMETERS. (A REQUESTED PARAMETER
C OF -9999 MEANS TO ALLOW ANY VALUE OF THIS PARAMETER TO BE FOUND.)
C
C EACH INDEX RECORD HAS THE FOLLOWING FORM:
C BYTE 001 - 004: LENGTH OF INDEX RECORD
C BYTE 005 - 008: BYTES TO SKIP IN DATA FILE BEFORE GRIB MESSAGE
C BYTE 009 - 012: BYTES TO SKIP IN MESSAGE BEFORE LUS (LOCAL USE)
C SET = 0, IF NO LOCAL USE SECTION IN GRIB2 MESSAGE.
C BYTE 013 - 016: BYTES TO SKIP IN MESSAGE BEFORE GDS
C BYTE 017 - 020: BYTES TO SKIP IN MESSAGE BEFORE PDS
C BYTE 021 - 024: BYTES TO SKIP IN MESSAGE BEFORE DRS
C BYTE 025 - 028: BYTES TO SKIP IN MESSAGE BEFORE BMS
C BYTE 029 - 032: BYTES TO SKIP IN MESSAGE BEFORE DATA SECTION
C BYTE 033 - 040: BYTES TOTAL IN THE MESSAGE
C BYTE 041 - 041: GRIB VERSION NUMBER ( CURRENTLY 2 )
C BYTE 042 - 042: MESSAGE DISCIPLINE
C BYTE 043 - 044: FIELD NUMBER WITHIN GRIB2 MESSAGE
C BYTE 045 - II: IDENTIFICATION SECTION (IDS)
C BYTE II+1- JJ: GRID DEFINITION SECTION (GDS)
C BYTE JJ+1- KK: PRODUCT DEFINITION SECTION (PDS)
C BYTE KK+1- LL: THE DATA REPRESENTATION SECTION (DRS)
C BYTE LL+1-LL+6: FIRST 6 BYTES OF THE BIT MAP SECTION (BMS)
C
C Most of the decoded information for the selected GRIB field
C is returned in a derived type variable, gfld.
C Gfld is of type gribfield, which is defined
C in module grib_mod, so users of this routine will need to include
C the line "USE GRIB_MOD" in their calling routine. Each component of the
C gribfield type is described in the OUTPUT ARGUMENT LIST section below.
C Only the unpacked bitmap and data field components are not set by this
C routine.
C
C PROGRAM HISTORY LOG:
C 95-10-31 IREDELL
C 2002-01-02 GILBERT MODIFIED FROM GETG1S TO WORK WITH GRIB2
C
C USAGE: CALL GETGB2S(CBUF,NLEN,NNUM,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,
C & JGDT,K,GFLD,LPOS,IRET)
C INPUT ARGUMENTS:
C CBUF CHARACTER*1 (NLEN) BUFFER CONTAINING INDEX DATA
C NLEN INTEGER TOTAL LENGTH OF ALL INDEX RECORDS
C NNUM INTEGER NUMBER OF INDEX RECORDS
C J INTEGER NUMBER OF MESSAGES TO SKIP
C (=0 TO SEARCH FROM BEGINNING)
C JDISC GRIB2 DISCIPLINE NUMBER OF REQUESTED FIELD
C ( IF = -1, ACCEPT ANY DISCIPLINE)
C ( SEE CODE TABLE 0.0 )
C 0 - Meteorological products
C 1 - Hydrological products
C 2 - Land surface products
C 3 - Space products
C 10 - Oceanographic products
C JIDS() INTEGER ARRAY OF VALUES IN THE IDENTIFICATION SECTION
C (=-9999 FOR WILDCARD)
C JIDS(1) = IDENTIFICATION OF ORIGINATING CENTRE
C ( SEE COMMON CODE TABLE C-1 )
C JIDS(2) = IDENTIFICATION OF ORIGINATING SUB-CENTRE
C JIDS(3) = GRIB MASTER TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C JIDS(4) = GRIB LOCAL TABLES VERSION NUMBER
C ( SEE CODE TABLE 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C JIDS(5) = SIGNIFICANCE OF REFERENCE TIME (CODE TABLE 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C JIDS(6) = YEAR ( 4 DIGITS )
C JIDS(7) = MONTH
C JIDS(8) = DAY
C JIDS(9) = HOUR
C JIDS(10) = MINUTE
C JIDS(11) = SECOND
C JIDS(12) = PRODUCTION STATUS OF PROCESSED DATA
C ( SEE CODE TABLE 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C JIDS(13) = TYPE OF PROCESSED DATA ( SEE CODE TABLE 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C JPDTN INTEGER PRODUCT DEFINITION TEMPLATE NUMBER (N)
C ( IF = -1, DON'T BOTHER MATCHING PDT )
C JPDT() INTEGER ARRAY OF VALUES DEFINING THE PRODUCT DEFINITION
C TEMPLATE 4.N OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C JGDTN INTEGER GRID DEFINITION TEMPLATE NUMBER (M)
C ( IF = -1, DON'T BOTHER MATCHING GDT )
C JGDT() INTEGER ARRAY OF VALUES DEFINING THE GRID DEFINITION
C TEMPLATE 3.M OF THE FIELD FOR WHICH TO SEARCH
C (=-9999 FOR WILDCARD)
C OUTPUT ARGUMENTS:
C K INTEGER MESSAGE NUMBER FOUND
C (CAN BE SAME AS J IN CALLING PROGRAM
C IN ORDER TO FACILITATE MULTIPLE SEARCHES)
C gfld - derived type gribfield ( defined in module grib_mod )
C ( NOTE: See Remarks Section )
C gfld%version = GRIB edition number ( currently 2 )
C gfld%discipline = Message Discipline ( see Code Table 0.0 )
C gfld%idsect() = Contains the entries in the Identification
C Section ( Section 1 )
C This element is actually a pointer to an array
C that holds the data.
C gfld%idsect(1) = Identification of originating Centre
C ( see Common Code Table C-1 )
C 7 - US National Weather Service
C gfld%idsect(2) = Identification of originating Sub-centre
C gfld%idsect(3) = GRIB Master Tables Version Number
C ( see Code Table 1.0 )
C 0 - Experimental
C 1 - Initial operational version number
C gfld%idsect(4) = GRIB Local Tables Version Number
C ( see Code Table 1.1 )
C 0 - Local tables not used
C 1-254 - Number of local tables version used
C gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
C 0 - Analysis
C 1 - Start of forecast
C 2 - Verifying time of forecast
C 3 - Observation time
C gfld%idsect(6) = Year ( 4 digits )
C gfld%idsect(7) = Month
C gfld%idsect(8) = Day
C gfld%idsect(9) = Hour
C gfld%idsect(10) = Minute
C gfld%idsect(11) = Second
C gfld%idsect(12) = Production status of processed data
C ( see Code Table 1.3 )
C 0 - Operational products
C 1 - Operational test products
C 2 - Research products
C 3 - Re-analysis products
C gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
C 0 - Analysis products
C 1 - Forecast products
C 2 - Analysis and forecast products
C 3 - Control forecast products
C 4 - Perturbed forecast products
C 5 - Control and perturbed forecast products
C 6 - Processed satellite observations
C 7 - Processed radar observations
C gfld%idsectlen = Number of elements in gfld%idsect().
C gfld%local() = Pointer to character array containing contents
C of Local Section 2, if included
C gfld%locallen = length of array gfld%local()
C gfld%ifldnum = field number within GRIB message
C gfld%griddef = Source of grid definition (see Code Table 3.0)
C 0 - Specified in Code table 3.1
C 1 - Predetermined grid Defined by originating centre
C gfld%ngrdpts = Number of grid points in the defined grid.
C gfld%numoct_opt = Number of octets needed for each
C additional grid points definition.
C Used to define number of
C points in each row ( or column ) for
C non-regular grids.
C = 0, if using regular grid.
C gfld%interp_opt = Interpretation of list for optional points
C definition. (Code Table 3.11)
C gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
C gfld%igdtmpl() = Contains the data values for the specified Grid
C Definition Template ( NN=gfld%igdtnum ). Each
C element of this integer array contains an entry (in
C the order specified) of Grid Defintion Template 3.NN
C This element is actually a pointer to an array
C that holds the data.
C gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
C entries in Grid Defintion Template 3.NN
C ( NN=gfld%igdtnum ).
C gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
C contains the number of grid points contained in
C each row ( or column ). (part of Section 3)
C This element is actually a pointer to an array
C that holds the data. This pointer is nullified
C if gfld%numoct_opt=0.
C gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
C in array ideflist. i.e. number of rows ( or columns )
C for which optional grid points are defined. This value
C is set to zero, if gfld%numoct_opt=0.
C gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
C gfld%ipdtmpl() = Contains the data values for the specified Product
C Definition Template ( N=gfdl%ipdtnum ). Each element
C of this integer array contains an entry (in the
C order specified) of Product Defintion Template 4.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
C entries in Product Defintion Template 4.N
C ( N=gfdl%ipdtnum ).
C gfld%coord_list() = Real array containing floating point values
C intended to document the vertical discretisation
C associated to model data on hybrid coordinate
C vertical levels. (part of Section 4)
C This element is actually a pointer to an array
C that holds the data.
C gfld%num_coord = number of values in array gfld%coord_list().
C gfld%ndpts = Number of data points unpacked and returned.
C gfld%idrtnum = Data Representation Template Number
C ( see Code Table 5.0)
C gfld%idrtmpl() = Contains the data values for the specified Data
C Representation Template ( N=gfld%idrtnum ). Each
C element of this integer array contains an entry
C (in the order specified) of Product Defintion
C Template 5.N.
C This element is actually a pointer to an array
C that holds the data.
C gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
C of entries in Data Representation Template 5.N
C ( N=gfld%idrtnum ).
C gfld%unpacked = logical value indicating whether the bitmap and
C data values were unpacked. If false,
C gfld%bmap and gfld%fld pointers are nullified.
C NOTE: This routine sets this component to .FALSE.
C gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
C 0 = bitmap applies and is included in Section 6.
C 1-253 = Predefined bitmap applies
C 254 = Previously defined bitmap applies to this field
C 255 = Bit map does not apply to this product.
C gfld%bmap() = Logical*1 array containing decoded bitmap,
C if ibmap=0 or ibap=254. Otherwise nullified.
C This element is actually a pointer to an array
C that holds the data.
C NOTE: This component is not set by this routine.
C gfld%fld() = Array of gfld%ndpts unpacked data points.
C This element is actually a pointer to an array
C that holds the data.
C NOTE: This component is not set by this routine.
C LPOS STARTING POSITION OF THE FOUND INDEX RECORD WITHIN
C THE COMPLETE INDEX BUFFER, CBUF.
C = 0, IF REQUEST NOT FOUND
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 1 REQUEST NOT FOUND
C
C REMARKS:
C THIS SUBPROGRAM IS INTENDED FOR PRIVATE USE BY GETGB2 ROUTINES ONLY.
C
C Note that derived type gribfield contains pointers to many
C arrays of data. The memory for these arrays is allocated
C when the values in the arrays are set, to help minimize
C problems with array overloading. Because of this users
C are encouraged to free up this memory, when it is no longer
C needed, by an explicit call to subroutine gf_free.
C ( i.e. CALL GF_FREE(GFLD) )
C
C SUBPROGRAMS CALLED:
C GBYTE UNPACK BYTES
C GF_UNPACK1 UNPACK IDS
C GF_UNPACK4 UNPACK PDS
C GF_UNPACK3 UNPACK GDS
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE GRIB_MOD
! CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
CHARACTER(LEN=1),INTENT(IN) :: CBUF(NLEN)
INTEGER,INTENT(IN) :: NLEN,NNUM,J,JDISC,JPDTN,JGDTN
INTEGER,DIMENSION(:) :: JIDS(*),JPDT(*),JGDT(*)
INTEGER,INTENT(OUT) :: K,LPOS,IRET
TYPE(GRIBFIELD),INTENT(OUT) :: GFLD
INTEGER :: KGDS(5)
LOGICAL :: MATCH1,MATCH3,MATCH4
! INTEGER,POINTER,DIMENSION(:) :: KIDS,KPDT,KGDT
! INTEGER,POINTER,DIMENSION(:) :: IDEF
! REAL,POINTER,DIMENSION(:) :: COORD
interface
subroutine gf_unpack1(cgrib,lcgrib,iofst,ids,idslen,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: ids
integer,intent(out) :: ierr,idslen
end subroutine gf_unpack1
subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,ideflist
integer,intent(out) :: igds(5)
integer,intent(out) :: ierr,idefnum
end subroutine gf_unpack3
subroutine gf_unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,
& mappdslen,coordlist,numcoord,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
real,pointer,dimension(:) :: coordlist
integer,pointer,dimension(:) :: ipdstmpl
integer,intent(out) :: ipdsnum
integer,intent(out) :: ierr,numcoord
end subroutine gf_unpack4
subroutine gf_unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,
& idrstmpl,mapdrslen,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: ndpts,idrsnum
integer,pointer,dimension(:) :: idrstmpl
integer,intent(out) :: ierr
end subroutine gf_unpack5
end interface
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C INITIALIZE
K=0
LPOS=0
IRET=1
IPOS=0
nullify(gfld%list_opt,gfld%igdtmpl,gfld%ipdtmpl)
nullify(gfld%coord_list,gfld%idrtmpl,gfld%bmap,gfld%fld)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C SEARCH FOR REQUEST
DOWHILE(IRET.NE.0.AND.K.LT.NNUM)
K=K+1
CALL GBYTE(CBUF,INLEN,IPOS*8,4*8) ! GET LENGTH OF CURRENT
! INDEX RECORD
IF ( K.LE.J ) THEN ! SKIP THIS INDEX
IPOS=IPOS+INLEN
CYCLE
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C CHECK IF GRIB2 DISCIPLINE IS A MATCH
CALL GBYTE(CBUF,GFLD%DISCIPLINE,(IPOS+41)*8,1*8)
IF ( (JDISC.NE.-1).AND.(JDISC.NE.GFLD%DISCIPLINE) ) THEN
IPOS=IPOS+INLEN
CYCLE
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C CHECK IF IDENTIFICATION SECTION IS A MATCH
MATCH1=.FALSE.
CALL GBYTE(CBUF,LSEC1,(IPOS+44)*8,4*8) ! GET LENGTH OF IDS
IOF=0
CALL GF_UNPACK1(CBUF(IPOS+45),LSEC1,IOF,GFLD%IDSECT,
& GFLD%IDSECTLEN,ICND)
IF ( ICND.EQ.0 ) THEN
MATCH1=.TRUE.
DO I=1,GFLD%IDSECTLEN
IF ( (JIDS(I).NE.-9999).AND.
& (JIDS(I).NE.GFLD%IDSECT(I)) ) THEN
MATCH1=.FALSE.
EXIT
ENDIF
ENDDO
ENDIF
IF ( .NOT. MATCH1 ) THEN
DEALLOCATE(GFLD%IDSECT)
IPOS=IPOS+INLEN
CYCLE
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C CHECK IF GRID DEFINITION TEMPLATE IS A MATCH
JPOS=IPOS+44+LSEC1
MATCH3=.FALSE.
CALL GBYTE(CBUF,LSEC3,JPOS*8,4*8) ! GET LENGTH OF GDS
IF ( JGDTN.EQ.-1 ) THEN
MATCH3=.TRUE.
ELSE
CALL GBYTE(CBUF,NUMGDT,(JPOS+12)*8,2*8) ! GET GDT TEMPLATE NO.
IF ( JGDTN.EQ.NUMGDT ) THEN
IOF=0
CALL GF_UNPACK3(CBUF(JPOS+1),LSEC3,IOF,KGDS,GFLD%IGDTMPL,
& GFLD%IGDTLEN,GFLD%LIST_OPT,GFLD%NUM_OPT,ICND)
IF ( ICND.EQ.0 ) THEN
MATCH3=.TRUE.
DO I=1,GFLD%IGDTLEN
IF ( (JGDT(I).NE.-9999).AND.
& (JGDT(I).NE.GFLD%IGDTMPL(I)) ) THEN
MATCH3=.FALSE.
EXIT
ENDIF
ENDDO
C WHERE ( JGDT(1:GFLD%IGDTLEN).NE.-9999 )
C & MATCH3=ALL(JGDT(1:GFLD%IGDTLEN).EQ.GFLD%IGDTMPL(1:GFLD%IGDTLEN))
ENDIF
ENDIF
ENDIF
IF ( .NOT. MATCH3 ) THEN
IF (ASSOCIATED(GFLD%IGDTMPL)) DEALLOCATE(GFLD%IGDTMPL)
IF (ASSOCIATED(GFLD%LIST_OPT)) DEALLOCATE(GFLD%LIST_OPT)
IPOS=IPOS+INLEN
CYCLE
ELSE
GFLD%GRIDDEF=KGDS(1)
GFLD%NGRDPTS=KGDS(2)
GFLD%NUMOCT_OPT=KGDS(3)
GFLD%INTERP_OPT=KGDS(4)
GFLD%IGDTNUM=KGDS(5)
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C CHECK IF PRODUCT DEFINITION TEMPLATE IS A MATCH
JPOS=JPOS+LSEC3
MATCH4=.FALSE.
CALL GBYTE(CBUF,LSEC4,JPOS*8,4*8) ! GET LENGTH OF PDS
IF ( JPDTN.EQ.-1 ) THEN
MATCH4=.TRUE.
ELSE
CALL GBYTE(CBUF,NUMPDT,(JPOS+7)*8,2*8) ! GET PDT TEMPLATE NO.
IF ( JPDTN.EQ.NUMPDT ) THEN
IOF=0
CALL GF_UNPACK4(CBUF(JPOS+1),LSEC4,IOF,GFLD%IPDTNUM,
& GFLD%IPDTMPL,GFLD%IPDTLEN,
& GFLD%COORD_LIST,GFLD%NUM_COORD,ICND)
IF ( ICND.EQ.0 ) THEN
MATCH4=.TRUE.
DO I=1,GFLD%IPDTLEN
IF ( (JPDT(I).NE.-9999).AND.
& (JPDT(I).NE.GFLD%IPDTMPL(I)) ) THEN
MATCH4=.FALSE.
EXIT
ENDIF
ENDDO
c WHERE ( JPDT.NE.-9999)
c & MATCH4=ALL( JPDT(1:GFLD%IPDTLEN) .EQ. GFLD%IPDTMPL(1:GFLD%IPDTLEN) )
ENDIF
ENDIF
ENDIF
IF ( .NOT. MATCH4 ) THEN
IF (ASSOCIATED(GFLD%IPDTMPL)) DEALLOCATE(GFLD%IPDTMPL)
IF (ASSOCIATED(GFLD%COORD_LIST)) DEALLOCATE(GFLD%COORD_LIST)
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C IF REQUEST IS FOUND
C SET VALUES FOR DERIVED TYPE GFLD AND RETURN
IF(MATCH1.AND.MATCH3.AND.MATCH4) THEN
LPOS=IPOS+1
CALL GBYTE(CBUF,GFLD%VERSION,(IPOS+40)*8,1*8)
CALL GBYTE(CBUF,GFLD%IFLDNUM,(IPOS+42)*8,2*8)
GFLD%UNPACKED=.FALSE.
JPOS=IPOS+44+LSEC1
IF ( JGDTN.EQ.-1 ) THEN ! UNPACK GDS, IF NOT DONE BEFORE
IOF=0
CALL GF_UNPACK3(CBUF(JPOS+1),LSEC3,IOF,KGDS,GFLD%IGDTMPL,
& GFLD%IGDTLEN,GFLD%LIST_OPT,GFLD%NUM_OPT,ICND)
GFLD%GRIDDEF=KGDS(1)
GFLD%NGRDPTS=KGDS(2)
GFLD%NUMOCT_OPT=KGDS(3)
GFLD%INTERP_OPT=KGDS(4)
GFLD%IGDTNUM=KGDS(5)
ENDIF
JPOS=JPOS+LSEC3
IF ( JPDTN.EQ.-1 ) THEN ! UNPACK PDS, IF NOT DONE BEFORE
IOF=0
CALL GF_UNPACK4(CBUF(JPOS+1),LSEC4,IOF,GFLD%IPDTNUM,
& GFLD%IPDTMPL,GFLD%IPDTLEN,
& GFLD%COORD_LIST,GFLD%NUM_COORD,ICND)
ENDIF
JPOS=JPOS+LSEC4
CALL GBYTE(CBUF,LSEC5,JPOS*8,4*8) ! GET LENGTH OF DRS
IOF=0
CALL GF_UNPACK5(CBUF(JPOS+1),LSEC5,IOF,GFLD%NDPTS,
& GFLD%IDRTNUM,GFLD%IDRTMPL,
& GFLD%IDRTLEN,ICND)
JPOS=JPOS+LSEC5
CALL GBYTE(CBUF,GFLD%IBMAP,(JPOS+5)*8,1*8) ! GET IBMAP
IRET=0
ELSE ! PDT DID NOT MATCH
IPOS=IPOS+INLEN
ENDIF
ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,143 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE GETIDX(LUGB,LUGI,CINDEX,NLEN,NNUM,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: GETIDX FINDS, READS OR GENERATES A GRIB2 INDEX
C PRGMMR: GILBERT ORG: W/NP11 DATE: 2005-03-15
C
C ABSTRACT: FINDS, READS OR GENERATES A GRIB2 INDEX FOR THE GRIB2 FILE
C ASSOCIATED WITH UNIT LUGB. IF THE INDEX ALREADY EXISTS, IT IS RETURNED.
C OTHERWISE, THE INDEX IS (1) READ FROM AN EXISTING INDEXFILE ASSOCIATED WITH
C UNIT LUGI. OR (2) GENERATED FROM THE GRIB2FILE LUGB ( IF LUGI=0 ).
C USERS CAN FORCE A REGENERATION OF AN INDEX. IF LUGI EQUALS LUGB, THE INDEX
C WILL BE REGENERATED FROM THE DATA IN FILE LUGB. IF LUGI IS LESS THAN
C ZERO, THEN THE INDEX IS RE READ FROM INDEX FILE ABS(LUGI).
C
C PROGRAM HISTORY LOG:
C 2005-03-15 GILBERT
C
C USAGE: CALL GETIDX(LUGB,LUGI,CINDEX,NLEN,NNUM,IRET)
C
C INPUT ARGUMENTS:
C LUGB INTEGER UNIT OF THE UNBLOCKED GRIB DATA FILE.
C FILE MUST BE OPENED WITH BAOPEN OR BAOPENR BEFORE CALLING
C THIS ROUTINE.
C LUGI INTEGER UNIT OF THE UNBLOCKED GRIB INDEX FILE.
C IF NONZERO, FILE MUST BE OPENED WITH BAOPEN BAOPENR BEFORE
C CALLING THIS ROUTINE.
C >0 - READ INDEX FROM INDEX FILE LUGI, IF INDEX DOESN"T
C ALREADY EXIST.
C =0 - TO GET INDEX BUFFER FROM THE GRIB FILE, IF INDEX
C DOESN"T ALREADY EXIST.
C <0 - FORCE REREAD OF INDEX FROM INDEX FILE ABS(LUGI).
C =LUGB - FORCE REGENERATION OF INDEX FROM GRIB2 FILE LUGB.
C
C OUTPUT ARGUMENTS:
C CINDEX CHARACTER*1 POINTER TO A BUFFER THAT CONTAINS INDEX RECORDS.
C NLEN INTEGER TOTAL LENGTH OF ALL INDEX RECORDS
C NNUM INTEGER NUMBER OF INDEX RECORDS
C IRET INTEGER RETURN CODE
C 0 ALL OK
C 90 UNIT NUMBER OUT OF RANGE
C 96 ERROR READING/CREATING INDEX FILE
C
C SUBPROGRAMS CALLED:
C GETG2I READ INDEX FILE
C GETG2IR READ INDEX BUFFER FROM GRIB FILE
C
C REMARKS:
C
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
INTEGER,INTENT(IN) :: LUGB,LUGI
INTEGER,INTENT(OUT) :: NLEN,NNUM,IRET
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CINDEX
INTEGER,PARAMETER :: MAXIDX=100
INTEGER,PARAMETER :: MSK1=32000,MSK2=4000
TYPE GINDEX
integer :: nlen
integer :: nnum
character(len=1),pointer,dimension(:) :: cbuf
END TYPE GINDEX
TYPE(GINDEX),SAVE :: IDXLIST(100)
DATA LUX/0/
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DECLARE INTERFACES (REQUIRED FOR CBUF POINTER)
INTERFACE
SUBROUTINE GETG2I(LUGI,CBUF,NLEN,NNUM,IRET)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGI
INTEGER,INTENT(OUT) :: NLEN,NNUM,IRET
END SUBROUTINE GETG2I
SUBROUTINE GETG2IR(LUGB,MSK1,MSK2,MNUM,CBUF,NLEN,NNUM,
& NMESS,IRET)
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
INTEGER,INTENT(IN) :: LUGB,MSK1,MSK2,MNUM
INTEGER,INTENT(OUT) :: NLEN,NNUM,NMESS,IRET
END SUBROUTINE GETG2IR
END INTERFACE
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C DETERMINE WHETHER INDEX BUFFER NEEDS TO BE INITIALIZED
LUX=0
IRET=0
IF ( LUGB.LE.0 .AND. LUGB.GT.100 ) THEN
IRET=90
RETURN
ENDIF
IF (LUGI.EQ.LUGB) THEN ! Force regeneration of index from GRIB2 File
IF ( ASSOCIATED( IDXLIST(LUGB)%CBUF ) )
& DEALLOCATE(IDXLIST(LUGB)%CBUF)
NULLIFY(IDXLIST(LUGB)%CBUF)
IDXLIST(LUGB)%NLEN=0
IDXLIST(LUGB)%NNUM=0
LUX=0
ENDIF
IF (LUGI.LT.0) THEN ! Force re-read of index from indexfile
! associated with unit abs(lugi)
IF ( ASSOCIATED( IDXLIST(LUGB)%CBUF ) )
& DEALLOCATE(IDXLIST(LUGB)%CBUF)
NULLIFY(IDXLIST(LUGB)%CBUF)
IDXLIST(LUGB)%NLEN=0
IDXLIST(LUGB)%NNUM=0
LUX=ABS(LUGI)
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C Check if index already exists in memory
IF ( ASSOCIATED( IDXLIST(LUGB)%CBUF ) ) THEN
CINDEX => IDXLIST(LUGB)%CBUF
NLEN = IDXLIST(LUGB)%NLEN
NNUM = IDXLIST(LUGB)%NNUM
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IRGI=0
IF(LUX.GT.0) THEN
CALL GETG2I(LUX,IDXLIST(LUGB)%CBUF,NLEN,NNUM,IRGI)
ELSEIF(LUX.LE.0) THEN
MSKP=0
CALL GETG2IR(LUGB,MSK1,MSK2,MSKP,IDXLIST(LUGB)%CBUF,
& NLEN,NNUM,NMESS,IRGI)
ENDIF
IF(IRGI.EQ.0) THEN
CINDEX => IDXLIST(LUGB)%CBUF
IDXLIST(LUGB)%NLEN = NLEN
IDXLIST(LUGB)%NNUM = NNUM
ELSE
NLEN = 0
NNUM = 0
IRET=96
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,168 +0,0 @@
subroutine getlocal(cgrib,lcgrib,localnum,csec2,lcsec2,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getlocal
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-25
!
! ABSTRACT: This subroutine returns the contents of Section 2 ( Local
! Use Section ) from a GRIB2 message. Since there can be multiple
! occurrences of Section 2 within a GRIB message, the calling routine
! indicates which occurrence is being requested with the localnum argument.
!
! PROGRAM HISTORY LOG:
! 2000-05-25 Gilbert
!
! USAGE: CALL getlocal(cgrib,lcgrib,localnum,csec2,lcsec2,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message in array cgrib.
! localnum - The nth occurrence of Section 2 requested.
!
! OUTPUT ARGUMENT LIST:
! csec2 - Character array containing information read from
! Section 2.
! The dimension of this array can be obtained in advance
! from argument maxlocal, which is returned from subroutine
! gb_info.
! lcsec2 - Number of bytes of character array csec2 read from
! Section 2.
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = The section 2 request number was not positive.
! 4 = End string "7777" found, but not where expected.
! 5 = End string "7777" not found at end of message.
! 6 = GRIB message did not contain the requested number of
! Local Use Sections.
!
! REMARKS: Note that subroutine gb_info can be used to first determine
! how many Local Use sections exist in a given GRIB message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,localnum
character(len=1),intent(out) :: csec2(*)
integer,intent(out) :: lcsec2,ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
integer :: listsec0(2)
integer iofst,ibeg,istart,numlocal
ierr=0
numlocal=0
!
! Check for valid request number
!
if (localnum.le.0) then
print *,'getlocal: Request for local section must be positive.'
ierr=3
return
endif
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'getlocal: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'getlocal: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Loop through the remaining sections keeping track of the
! length of each. Also check to see that if the current occurrence
! of Section 2 is the same as the one requested.
!
do
! Check to see if we are at end of GRIB message
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
! If end of GRIB message not where expected, issue error
if (ipos.ne.(istart+lengrib)) then
print *,'getlocal: "7777" found, but not where expected.'
ierr=4
return
endif
exit
endif
! Get length of Section and Section number
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
! If found the requested occurrence of Section 2,
! return the section contents.
if (isecnum.eq.2) then
numlocal=numlocal+1
if (numlocal.eq.localnum) then
lcsec2=lensec-5
csec2(1:lcsec2)=cgrib(ipos+5:ipos+lensec-1)
return
endif
endif
! Check to see if we read pass the end of the GRIB
! message and missed the terminator string '7777'.
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'getlocal: "7777" not found at end of GRIB message.'
ierr=5
return
endif
enddo
!
! If exited from above loop, the end of the GRIB message was reached
! before the requested occurrence of section 2 was found.
!
print *,'getlocal: GRIB message contained ',numlocal,
& ' local sections.'
print *,'getlocal: The request was for the ',localnum,
& ' occurrence.'
ierr=6
return
end

View file

@ -1,80 +0,0 @@
subroutine getpoly(csec3,lcsec3,jj,kk,mm)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getpoly
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-11
!
! ABSTRACT: This subroutine returns the J, K, and M pentagonal resolution
! parameters specified in a GRIB Grid Definition Section used
! spherical harmonic coefficients using GDT 5.50 through 5.53
!
! PROGRAM HISTORY LOG:
! 2002-12-11 Gilbert
!
! USAGE: CALL getpoly(csec3,lcsec3,jj,kk,mm)
! INPUT ARGUMENT LIST:
! csec3 - Character array that contains the packed GRIB2 GDS
! lcsec3 - Length (in octets) of section 3
!
! OUTPUT ARGUMENT LIST:
! JJ = J - pentagonal resolution parameter
! KK = K - pentagonal resolution parameter
! MM = M - pentagonal resolution parameter
!
! REMARKS: Returns JJ, KK, and MM set to zero, if grid template
! not recognized.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
! use grib_mod
character(len=1),intent(in) :: csec3(*)
integer,intent(in) :: lcsec3
integer,intent(out) :: jj,kk,mm
integer,pointer,dimension(:) :: igdstmpl,list_opt
integer :: igds(5)
integer iofst,igdtlen,num_opt,jerr
interface
subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,ideflist
integer,intent(out) :: igds(5)
integer,intent(out) :: ierr,idefnum
end subroutine gf_unpack3
end interface
nullify(igdstmpl,list_opt)
!
iofst=0 ! set offset to beginning of section
call gf_unpack3(csec3,lcsec3,iofst,igds,igdstmpl,
& igdtlen,list_opt,num_opt,jerr)
if (jerr.eq.0) then
selectcase( igds(5) ) ! Template number
case (50:53) ! Spherical harmonic coefficients
jj=igdstmpl(1)
kk=igdstmpl(2)
mm=igdstmpl(3)
case default
jj=0
kk=0
mm=0
end select
else
jj=0
kk=0
mm=0
endif
!
if (associated(igdstmpl)) deallocate(igdstmpl)
if (associated(list_opt)) deallocate(list_opt)
return
end

View file

@ -1,244 +0,0 @@
subroutine gettemplates(cgrib,lcgrib,ifldnum,igds,igdstmpl,
& igdslen,ideflist,idefnum,ipdsnum,ipdstmpl,
& ipdslen,coordlist,numcoord,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gettemplates
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine returns the Grid Definition, and
! Product Definition for a given data
! field. Since there can be multiple data fields packed into a GRIB2
! message, the calling routine indicates which field is being requested
! with the ifldnum argument.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL gettemplates(cgrib,lcgrib,ifldnum,igds,igdstmpl,igdslen,
! & ideflist,idefnum,ipdsnum,ipdstmpl,ipdslen,
! & coordlist,numcoord,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! ifldnum - Specifies which field in the GRIB2 message to return.
!
! OUTPUT ARGUMENT LIST:
! igds - Contains information read from the appropriate GRIB Grid
! Definition Section 3 for the field being returned.
! Must be dimensioned >= 5.
! igds(1)=Source of grid definition (see Code Table 3.0)
! igds(2)=Number of grid points in the defined grid.
! igds(3)=Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! igds(4)=Interpretation of list for optional points
! definition. (Code Table 3.11)
! igds(5)=Grid Definition Template Number (Code Table 3.1)
! igdstmpl - Contains the data values for the specified Grid Definition
! Template ( NN=igds(5) ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Defintion Template 3.NN
! A safe dimension for this array can be obtained in advance
! from maxvals(2), which is returned from subroutine gribinfo.
! igdslen - Number of elements in igdstmpl(). i.e. number of entries
! in Grid Defintion Template 3.NN ( NN=igds(5) ).
! ideflist - (Used if igds(3) .ne. 0) This array contains the
! number of grid points contained in each row ( or column ).
! (part of Section 3)
! A safe dimension for this array can be obtained in advance
! from maxvals(3), which is returned from subroutine gribinfo.
! idefnum - (Used if igds(3) .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined.
! ipdsnum - Product Definition Template Number ( see Code Table 4.0)
! ipdstmpl - Contains the data values for the specified Product Definition
! Template ( N=ipdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 4.N
! A safe dimension for this array can be obtained in advance
! from maxvals(4), which is returned from subroutine gribinfo.
! ipdslen - Number of elements in ipdstmpl(). i.e. number of entries
! in Product Defintion Template 4.N ( N=ipdsnum ).
! coordlist- Array containg floating point values intended to document
! the vertical discretisation associated to model data
! on hybrid coordinate vertical levels. (part of Section 4)
! The dimension of this array can be obtained in advance
! from maxvals(5), which is returned from subroutine gribinfo.
! numcoord - number of values in array coordlist.
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = The data field request number was not positive.
! 4 = End string "7777" found, but not where expected.
! 6 = GRIB message did not contain the requested number of
! data fields.
! 7 = End string "7777" not found at end of message.
! 10 = Error unpacking Section 3.
! 11 = Error unpacking Section 4.
!
! REMARKS: Note that subroutine gribinfo can be used to first determine
! how many data fields exist in the given GRIB message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ifldnum
integer,intent(out) :: igds(*),igdstmpl(*),ideflist(*)
integer,intent(out) :: ipdsnum,ipdstmpl(*)
integer,intent(out) :: idefnum,numcoord
integer,intent(out) :: ierr
real,intent(out) :: coordlist(*)
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
integer:: listsec0(2)
integer iofst,ibeg,istart
logical have3,have4
have3=.false.
have4=.false.
ierr=0
numfld=0
!
! Check for valid request number
!
if (ifldnum.le.0) then
print *,'gettemplates: Request for field number must be ',
& 'positive.'
ierr=3
return
endif
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'gettemplates: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'gettemplates: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Loop through the remaining sections keeping track of the
! length of each. Also keep the latest Grid Definition Section info.
! Unpack the requested field number.
!
do
! Check to see if we are at end of GRIB message
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
! If end of GRIB message not where expected, issue error
if (ipos.ne.(istart+lengrib)) then
print *,'gettemplates: "7777" found, but not where ',
& 'expected.'
ierr=4
return
endif
exit
endif
! Get length of Section and Section number
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
!print *,' lensec= ',lensec,' secnum= ',isecnum
!
! If found Section 3, unpack the GDS info using the
! appropriate template. Save in case this is the latest
! grid before the requested field.
!
if (isecnum.eq.3) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,igdslen,
& ideflist,idefnum,jerr)
if (jerr.eq.0) then
have3=.true.
else
ierr=10
return
endif
endif
!
! If found Section 4, check to see if this field is the
! one requested.
!
if (isecnum.eq.4) then
numfld=numfld+1
if (numfld.eq.ifldnum) then
iofst=iofst-40 ! reset offset to beginning of section
call unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,ipdslen,
& coordlist,numcoord,jerr)
if (jerr.eq.0) then
have4=.true.
else
ierr=11
return
endif
endif
endif
!
! Check to see if we read pass the end of the GRIB
! message and missed the terminator string '7777'.
!
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'gettemplates: "7777" not found at end of GRIB ',
& 'message.'
ierr=7
return
endif
if (have3.and.have4) return
enddo
!
! If exited from above loop, the end of the GRIB message was reached
! before the requested field was found.
!
print *,'gettemplates: GRIB message contained ',numlocal,
& ' different fields.'
print *,'gettemplates: The request was for the ',ifldnum,
& ' field.'
ierr=6
return
end

View file

@ -1,199 +0,0 @@
subroutine gf_free(gfld)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_free
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine frees up memory that was used to store
! array values in derived type gribfield.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
!
! USAGE: CALL gf_free(gfld)
! INPUT ARGUMENT LIST:
! gfld - derived type gribfield ( defined in module grib_mod )
!
! OUTPUT ARGUMENT LIST:
! gfld - derived type gribfield ( defined in module grib_mod )
! gfld%version = GRIB edition number
! gfld%discipline = Message Discipline ( see Code Table 0.0 )
! gfld%idsect() = Contains the entries in the Identification
! Section ( Section 1 )
! This element is actually a pointer to an array
! that holds the data.
! gfld%idsect(1) = Identification of originating Centre
! ( see Common Code Table C-1 )
! gfld%idsect(2) = Identification of originating Sub-centre
! gfld%idsect(3) = GRIB Master Tables Version Number
! ( see Code Table 1.0 )
! gfld%idsect(4) = GRIB Local Tables Version Number
! ( see Code Table 1.1 )
! gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
! gfld%idsect(6) = Year ( 4 digits )
! gfld%idsect(7) = Month
! gfld%idsect(8) = Day
! gfld%idsect(9) = Hour
! gfld%idsect(10) = Minute
! gfld%idsect(11) = Second
! gfld%idsect(12) = Production status of processed data
! ( see Code Table 1.3 )
! gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
! gfld%idsectlen = Number of elements in gfld%idsect().
! gfld%local() = Pointer to character array containing contents
! of Local Section 2, if included
! gfld%locallen = length of array gfld%local()
! gfld%ifldnum = field number within GRIB message
! gfld%griddef = Source of grid definition (see Code Table 3.0)
! gfld%ngrdpts = Number of grid points in the defined grid.
! gfld%numoct_opt = Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! gfld%interp_opt = Interpretation of list for optional points
! definition. (Code Table 3.11)
! gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
! gfld%igdtmpl() = Contains the data values for the specified Grid
! Definition Template ( NN=gfld%igdtnum ). Each
! element of this integer array contains an entry (in
! the order specified) of Grid Defintion Template 3.NN
! This element is actually a pointer to an array
! that holds the data.
! gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
! entries in Grid Defintion Template 3.NN
! ( NN=gfld%igdtnum ).
! gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
! contains the number of grid points contained in
! each row ( or column ). (part of Section 3)
! This element is actually a pointer to an array
! that holds the data. This pointer is nullified
! if gfld%numoct_opt=0.
! gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined. This value
! is set to zero, if gfld%numoct_opt=0.
! gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
! gfld%ipdtmpl() = Contains the data values for the specified Product
! Definition Template ( N=gfdl%ipdtnum ). Each element
! of this integer array contains an entry (in the
! order specified) of Product Defintion Template 4.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
! entries in Product Defintion Template 4.N
! ( N=gfdl%ipdtnum ).
! gfld%coord_list() = Real array containing floating point values
! intended to document the vertical discretisation
! associated to model data on hybrid coordinate
! vertical levels. (part of Section 4)
! This element is actually a pointer to an array
! that holds the data.
! gfld%num_coord = number of values in array gfld%coord_list().
! gfld%ndpts = Number of data points unpacked and returned.
! gfld%idrtnum = Data Representation Template Number
! ( see Code Table 5.0)
! gfld%idrtmpl() = Contains the data values for the specified Data
! Representation Template ( N=gfld%idrtnum ). Each
! element of this integer array contains an entry
! (in the order specified) of Product Defintion
! Template 5.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
! of entries in Data Representation Template 5.N
! ( N=gfld%idrtnum ).
! gfld%unpacked = logical value indicating whether the bitmap and
! data values were unpacked. If false, gfld%ndpts
! is set to zero, and gfld%bmap and gfld%fld
! pointers are nullified.
! gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! gfld%bmap() - Logical*1 array containing decoded bitmap,
! if ibmap=0 or ibap=254. Otherwise nullified.
! This element is actually a pointer to an array
! that holds the data.
! gfld%fld() = Array of gfld%ndpts unpacked data points.
! This element is actually a pointer to an array
! that holds the data.
!
! REMARKS:
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use grib_mod
type(gribfield) :: gfld
if (associated(gfld%idsect)) then
deallocate(gfld%idsect)
!deallocate(gfld%idsect,stat=is)
!print *,'gfld%idsect: ',is
endif
nullify(gfld%idsect)
if (associated(gfld%local)) then
deallocate(gfld%local)
!deallocate(gfld%local,stat=is)
!print *,'gfld%local: ',is
endif
nullify(gfld%local)
if (associated(gfld%list_opt)) then
deallocate(gfld%list_opt)
!deallocate(gfld%list_opt,stat=is)
!print *,'gfld%list_opt: ',is
endif
nullify(gfld%list_opt)
if (associated(gfld%igdtmpl)) then
deallocate(gfld%igdtmpl)
!deallocate(gfld%igdtmpl,stat=is)
!print *,'gfld%igdtmpl: ',is
endif
nullify(gfld%igdtmpl)
if (associated(gfld%ipdtmpl)) then
deallocate(gfld%ipdtmpl)
!deallocate(gfld%ipdtmpl,stat=is)
!print *,'gfld%ipdtmpl: ',is
endif
nullify(gfld%ipdtmpl)
if (associated(gfld%coord_list)) then
deallocate(gfld%coord_list)
!deallocate(gfld%coord_list,stat=is)
!print *,'gfld%coord_list: ',is
endif
nullify(gfld%coord_list)
if (associated(gfld%idrtmpl)) then
deallocate(gfld%idrtmpl)
!deallocate(gfld%idrtmpl,stat=is)
!print *,'gfld%idrtmpl: ',is
endif
nullify(gfld%idrtmpl)
if (associated(gfld%bmap)) then
deallocate(gfld%bmap)
!deallocate(gfld%bmap,stat=is)
!print *,'gfld%bmap: ',is
endif
nullify(gfld%bmap)
if (associated(gfld%fld)) then
deallocate(gfld%fld)
!deallocate(gfld%fld,stat=is)
!print *,'gfld%fld: ',is
endif
nullify(gfld%fld)
return
end

View file

@ -1,602 +0,0 @@
subroutine gf_getfld(cgrib,lcgrib,ifldnum,unpack,expand,gfld,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_getfld
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine returns the Grid Definition, Product Definition,
! Bit-map ( if applicable ), and the unpacked data for a given data
! field. All of the information returned is stored in a derived
! type variable, gfld. Gfld is of type gribfield, which is defined
! in module grib_mod, so users of this routine will need to include
! the line "USE GRIB_MOD" in their calling routine. Each component of the
! gribfield type is described in the OUTPUT ARGUMENT LIST section below.
!
! Since there can be multiple data fields packed into a GRIB2
! message, the calling routine indicates which field is being requested
! with the ifldnum argument.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to pass back derived type gribfield
! variable through argument list, instead of
! having many different arguments.
! 2004-05-20 Gilbert - Added check to see if previous a bit-map is specified,
! but none was found.
!
! USAGE: CALL gf_getfld(cgrib,lcgrib,ifldnum,unpack,expand,gfld,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! ifldnum - Specifies which field in the GRIB2 message to return.
! unpack - Logical value indicating whether to unpack bitmap/data
! .true. = unpack bitmap and data values
! .false. = do not unpack bitmap and data values
! expand - Boolean value indicating whether the data points should be
! expanded to the correspond grid, if a bit-map is present.
! 1 = if possible, expand data field to grid, inserting zero
! values at gridpoints that are bitmapped out.
! (SEE REMARKS2)
! 0 = do not expand data field, leaving it an array of
! consecutive data points for each "1" in the bitmap.
! This argument is ignored if unpack == 0 OR if the
! returned field does not contain a bit-map.
!
! OUTPUT ARGUMENT LIST:
! gfld - derived type gribfield ( defined in module grib_mod )
! ( NOTE: See Remarks Section )
! gfld%version = GRIB edition number ( currently 2 )
! gfld%discipline = Message Discipline ( see Code Table 0.0 )
! gfld%idsect() = Contains the entries in the Identification
! Section ( Section 1 )
! This element is actually a pointer to an array
! that holds the data.
! gfld%idsect(1) = Identification of originating Centre
! ( see Common Code Table C-1 )
! 7 - US National Weather Service
! gfld%idsect(2) = Identification of originating Sub-centre
! gfld%idsect(3) = GRIB Master Tables Version Number
! ( see Code Table 1.0 )
! 0 - Experimental
! 1 - Initial operational version number
! gfld%idsect(4) = GRIB Local Tables Version Number
! ( see Code Table 1.1 )
! 0 - Local tables not used
! 1-254 - Number of local tables version used
! gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
! 0 - Analysis
! 1 - Start of forecast
! 2 - Verifying time of forecast
! 3 - Observation time
! gfld%idsect(6) = Year ( 4 digits )
! gfld%idsect(7) = Month
! gfld%idsect(8) = Day
! gfld%idsect(9) = Hour
! gfld%idsect(10) = Minute
! gfld%idsect(11) = Second
! gfld%idsect(12) = Production status of processed data
! ( see Code Table 1.3 )
! 0 - Operational products
! 1 - Operational test products
! 2 - Research products
! 3 - Re-analysis products
! gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
! 0 - Analysis products
! 1 - Forecast products
! 2 - Analysis and forecast products
! 3 - Control forecast products
! 4 - Perturbed forecast products
! 5 - Control and perturbed forecast products
! 6 - Processed satellite observations
! 7 - Processed radar observations
! gfld%idsectlen = Number of elements in gfld%idsect().
! gfld%local() = Pointer to character array containing contents
! of Local Section 2, if included
! gfld%locallen = length of array gfld%local()
! gfld%ifldnum = field number within GRIB message
! gfld%griddef = Source of grid definition (see Code Table 3.0)
! 0 - Specified in Code table 3.1
! 1 - Predetermined grid Defined by originating centre
! gfld%ngrdpts = Number of grid points in the defined grid.
! gfld%numoct_opt = Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! gfld%interp_opt = Interpretation of list for optional points
! definition. (Code Table 3.11)
! gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
! gfld%igdtmpl() = Contains the data values for the specified Grid
! Definition Template ( NN=gfld%igdtnum ). Each
! element of this integer array contains an entry (in
! the order specified) of Grid Defintion Template 3.NN
! This element is actually a pointer to an array
! that holds the data.
! gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
! entries in Grid Defintion Template 3.NN
! ( NN=gfld%igdtnum ).
! gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
! contains the number of grid points contained in
! each row ( or column ). (part of Section 3)
! This element is actually a pointer to an array
! that holds the data. This pointer is nullified
! if gfld%numoct_opt=0.
! gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined. This value
! is set to zero, if gfld%numoct_opt=0.
! gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
! gfld%ipdtmpl() = Contains the data values for the specified Product
! Definition Template ( N=gfdl%ipdtnum ). Each element
! of this integer array contains an entry (in the
! order specified) of Product Defintion Template 4.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
! entries in Product Defintion Template 4.N
! ( N=gfdl%ipdtnum ).
! gfld%coord_list() = Real array containing floating point values
! intended to document the vertical discretisation
! associated to model data on hybrid coordinate
! vertical levels. (part of Section 4)
! This element is actually a pointer to an array
! that holds the data.
! gfld%num_coord = number of values in array gfld%coord_list().
! gfld%ndpts = Number of data points unpacked and returned.
! gfld%idrtnum = Data Representation Template Number
! ( see Code Table 5.0)
! gfld%idrtmpl() = Contains the data values for the specified Data
! Representation Template ( N=gfld%idrtnum ). Each
! element of this integer array contains an entry
! (in the order specified) of Product Defintion
! Template 5.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
! of entries in Data Representation Template 5.N
! ( N=gfld%idrtnum ).
! gfld%unpacked = logical value indicating whether the bitmap and
! data values were unpacked. If false,
! gfld%bmap and gfld%fld pointers are nullified.
! gfld%expanded = Logical value indicating whether the data field
! was expanded to the grid in the case where a
! bit-map is present. If true, the data points in
! gfld%fld match the grid points and zeros were
! inserted at grid points where data was bit-mapped
! out. If false, the data values in gfld%fld were
! not expanded to the grid and are just a consecutive
! array of data points corresponding to each value of
! "1" in gfld%bmap.
! gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! gfld%bmap() = Logical*1 array containing decoded bitmap,
! if ibmap=0 or ibap=254. Otherwise nullified.
! This element is actually a pointer to an array
! that holds the data.
! gfld%fld() = Array of gfld%ndpts unpacked data points.
! This element is actually a pointer to an array
! that holds the data.
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = The data field request number was not positive.
! 4 = End string "7777" found, but not where expected.
! 6 = GRIB message did not contain the requested number of
! data fields.
! 7 = End string "7777" not found at end of message.
! 8 = Unrecognized Section encountered.
! 9 = Data Representation Template 5.NN not yet implemented.
! 15 = Error unpacking Section 1.
! 16 = Error unpacking Section 2.
! 10 = Error unpacking Section 3.
! 11 = Error unpacking Section 4.
! 12 = Error unpacking Section 5.
! 13 = Error unpacking Section 6.
! 14 = Error unpacking Section 7.
! 17 = Previous bitmap specified, but none exists.
!
! REMARKS: Note that derived type gribfield contains pointers to many
! arrays of data. The memory for these arrays is allocated
! when the values in the arrays are set, to help minimize
! problems with array overloading. Because of this users
! are encouraged to free up this memory, when it is no longer
! needed, by an explicit call to subroutine gf_free.
! ( i.e. CALL GF_FREE(GFLD) )
!
! Subroutine gb_info can be used to first determine
! how many data fields exist in a given GRIB message.
!
! REMARKS2: It may not always be possible to expand a bit-mapped data field.
! If a pre-defined bit-map is used and not included in the GRIB2
! message itself, this routine would not have the necessary
! information to expand the data. In this case, gfld%expanded would
! would be set to 0 (false), regardless of the value of input
! argument expand.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use grib_mod
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ifldnum
logical,intent(in) :: unpack,expand
type(gribfield),intent(out) :: gfld
integer,intent(out) :: ierr
! integer,intent(out) :: igds(*),igdstmpl(*),ideflist(*)
! integer,intent(out) :: ipdsnum,ipdstmpl(*)
! integer,intent(out) :: idrsnum,idrstmpl(*)
! integer,intent(out) :: ndpts,ibmap,idefnum,numcoord
! logical*1,intent(out) :: bmap(*)
! real,intent(out) :: fld(*),coordlist(*)
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
real,pointer,dimension(:) :: newfld
integer:: listsec0(2),igds(5)
integer iofst,ibeg,istart
integer(4) :: ieee
logical*1,pointer,dimension(:) :: bmpsave
logical have3,have4,have5,have6,have7
interface
subroutine gf_unpack1(cgrib,lcgrib,iofst,ids,idslen,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: ids
integer,intent(out) :: ierr,idslen
end subroutine gf_unpack1
subroutine gf_unpack2(cgrib,lcgrib,iofst,lencsec2,csec2,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: lencsec2
integer,intent(out) :: ierr
character(len=1),pointer,dimension(:) :: csec2
end subroutine gf_unpack2
subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,ideflist
integer,intent(out) :: igds(5)
integer,intent(out) :: ierr,idefnum
end subroutine gf_unpack3
subroutine gf_unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,
& mappdslen,coordlist,numcoord,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
real,pointer,dimension(:) :: coordlist
integer,pointer,dimension(:) :: ipdstmpl
integer,intent(out) :: ipdsnum
integer,intent(out) :: ierr,numcoord
end subroutine gf_unpack4
subroutine gf_unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,
& idrstmpl,mapdrslen,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: ndpts,idrsnum
integer,pointer,dimension(:) :: idrstmpl
integer,intent(out) :: ierr
end subroutine gf_unpack5
subroutine gf_unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ngpts
integer,intent(inout) :: iofst
integer,intent(out) :: ibmap
integer,intent(out) :: ierr
logical*1,pointer,dimension(:) :: bmap
end subroutine gf_unpack6
subroutine gf_unpack7(cgrib,lcgrib,iofst,igdsnum,igdstmpl,
& idrsnum,idrstmpl,ndpts,fld,ierr)
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ndpts,idrsnum,igdsnum
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: idrstmpl,igdstmpl
integer,intent(out) :: ierr
real,pointer,dimension(:) :: fld
end subroutine gf_unpack7
end interface
have3=.false.
have4=.false.
have5=.false.
have6=.false.
have7=.false.
ierr=0
numfld=0
gfld%locallen=0
nullify(gfld%list_opt,gfld%igdtmpl,gfld%ipdtmpl)
nullify(gfld%coord_list,gfld%idrtmpl,gfld%bmap,gfld%fld)
!
! Check for valid request number
!
if (ifldnum.le.0) then
print *,'gf_getfld: Request for field number must be positive.'
ierr=3
return
endif
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'gf_getfld: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'gf_getfld: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Loop through the remaining sections keeping track of the
! length of each. Also keep the latest Grid Definition Section info.
! Unpack the requested field number.
!
do
! Check to see if we are at end of GRIB message
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
! If end of GRIB message not where expected, issue error
if (ipos.ne.(istart+lengrib)) then
print *,'gf_getfld: "7777" found, but not where expected.'
ierr=4
return
endif
exit
endif
! Get length of Section and Section number
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
!print *,' lensec= ',lensec,' secnum= ',isecnum
!
! Check to see if section number is valid
!
if ( (isecnum.lt.1).OR.(isecnum.gt.7) ) then
print *,'gf_getfld: Unrecognized Section Encountered=',isecnum
ierr=8
return
endif
!
! If found Section 1, decode elements in Identification Section
!
if (isecnum.eq.1) then
iofst=iofst-40 ! reset offset to beginning of section
call gf_unpack1(cgrib,lcgrib,iofst,gfld%idsect,
& gfld%idsectlen,jerr)
if (jerr.ne.0) then
ierr=15
return
endif
endif
!
! If found Section 2, Grab local section
! Save in case this is the latest one before the requested field.
!
if (isecnum.eq.2) then
iofst=iofst-40 ! reset offset to beginning of section
if (associated(gfld%local)) deallocate(gfld%local)
call gf_unpack2(cgrib,lcgrib,iofst,gfld%locallen,
& gfld%local,jerr)
if (jerr.ne.0) then
ierr=16
return
endif
endif
!
! If found Section 3, unpack the GDS info using the
! appropriate template. Save in case this is the latest
! grid before the requested field.
!
if (isecnum.eq.3) then
iofst=iofst-40 ! reset offset to beginning of section
if (associated(gfld%igdtmpl)) deallocate(gfld%igdtmpl)
if (associated(gfld%list_opt)) deallocate(gfld%list_opt)
call gf_unpack3(cgrib,lcgrib,iofst,igds,gfld%igdtmpl,
& gfld%igdtlen,gfld%list_opt,gfld%num_opt,jerr)
if (jerr.eq.0) then
have3=.true.
gfld%griddef=igds(1)
gfld%ngrdpts=igds(2)
gfld%numoct_opt=igds(3)
gfld%interp_opt=igds(4)
gfld%igdtnum=igds(5)
else
ierr=10
return
endif
endif
!
! If found Section 4, check to see if this field is the
! one requested.
!
if (isecnum.eq.4) then
numfld=numfld+1
if (numfld.eq.ifldnum) then
gfld%discipline=listsec0(1)
gfld%version=listsec0(2)
gfld%ifldnum=ifldnum
gfld%unpacked=unpack
gfld%expanded=.false.
iofst=iofst-40 ! reset offset to beginning of section
call gf_unpack4(cgrib,lcgrib,iofst,gfld%ipdtnum,
& gfld%ipdtmpl,gfld%ipdtlen,gfld%coord_list,
& gfld%num_coord,jerr)
if (jerr.eq.0) then
have4=.true.
else
ierr=11
return
endif
endif
endif
!
! If found Section 5, check to see if this field is the
! one requested.
!
if ((isecnum.eq.5).and.(numfld.eq.ifldnum)) then
iofst=iofst-40 ! reset offset to beginning of section
call gf_unpack5(cgrib,lcgrib,iofst,gfld%ndpts,gfld%idrtnum,
& gfld%idrtmpl,gfld%idrtlen,jerr)
if (jerr.eq.0) then
have5=.true.
else
ierr=12
return
endif
endif
!
! If found Section 6, Unpack bitmap.
! Save in case this is the latest
! bitmap before the requested field.
!
if (isecnum.eq.6) then
if (unpack) then ! unpack bitmap
iofst=iofst-40 ! reset offset to beginning of section
bmpsave=>gfld%bmap ! save pointer to previous bitmap
call gf_unpack6(cgrib,lcgrib,iofst,gfld%ngrdpts,gfld%ibmap,
& gfld%bmap,jerr)
if (jerr.eq.0) then
have6=.true.
if (gfld%ibmap .eq. 254) then ! use previously specified bitmap
if ( associated(bmpsave) ) then
gfld%bmap=>bmpsave
else
print *,'gf_getfld: Previous bit-map specified,',
& ' but none exists,'
ierr=17
return
endif
else ! get rid of it
if ( associated(bmpsave) ) deallocate(bmpsave)
endif
else
ierr=13
return
endif
else ! do not unpack bitmap
call gbyte(cgrib,gfld%ibmap,iofst,8) ! Get BitMap Indicator
have6=.true.
endif
endif
!
! If found Section 7, check to see if this field is the
! one requested.
!
if ((isecnum.eq.7).and.(numfld.eq.ifldnum).and.unpack) then
iofst=iofst-40 ! reset offset to beginning of section
call gf_unpack7(cgrib,lcgrib,iofst,gfld%igdtnum,
& gfld%igdtmpl,gfld%idrtnum,
& gfld%idrtmpl,gfld%ndpts,
& gfld%fld,jerr)
if (jerr.eq.0) then
have7=.true.
! If bitmap is used with this field, expand data field
! to grid, if possible.
if ( gfld%ibmap .ne. 255 .AND. associated(gfld%bmap) ) then
if ( expand ) then
allocate(newfld(gfld%ngrdpts))
!newfld(1:gfld%ngrdpts)=0.0
!newfld=unpack(gfld%fld,gfld%bmap,newfld)
n=1
do j=1,gfld%ngrdpts
if ( gfld%bmap(j) ) then
newfld(j)=gfld%fld(n)
n=n+1
else
newfld(j)=0.0
endif
enddo
deallocate(gfld%fld);
gfld%fld=>newfld;
gfld%expanded=.true.
else
gfld%expanded=.false.
endif
else
gfld%expanded=.true.
endif
else
print *,'gf_getfld: return from gf_unpack7 = ',jerr
ierr=14
return
endif
endif
!
! Check to see if we read pass the end of the GRIB
! message and missed the terminator string '7777'.
!
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'gf_getfld: "7777" not found at end of GRIB message.'
ierr=7
return
endif
!
! If unpacking requested, return when all sections have been
! processed
!
if (unpack.and.have3.and.have4.and.have5.and.have6.and.have7)
& return
!
! If unpacking is not requested, return when sections
! 3 through 6 have been processed
!
if ((.NOT.unpack).and.have3.and.have4.and.have5.and.have6)
& return
enddo
!
! If exited from above loop, the end of the GRIB message was reached
! before the requested field was found.
!
print *,'gf_getfld: GRIB message contained ',numlocal,
& ' different fields.'
print *,'gf_getfld: The request was for the ',ifldnum,
& ' field.'
ierr=6
return
end

View file

@ -1,93 +0,0 @@
subroutine gf_unpack1(cgrib,lcgrib,iofst,ids,idslen,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack1
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 1 (Identification Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to dynamically allocate arrays
! and to pass pointers to those arrays through
! the argument list.
!
! USAGE: CALL gf_unpack1(cgrib,lcgrib,iofst,ids,idslen,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array containing Section 1 of the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 1.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 1, returned.
! ids - Pointer to integer array containing information read from
! Section 1, the Identification section.
! ids(1) = Identification of originating Centre
! ( see Common Code Table C-1 )
! ids(2) = Identification of originating Sub-centre
! ids(3) = GRIB Master Tables Version Number
! ( see Code Table 1.0 )
! ids(4) = GRIB Local Tables Version Number
! ( see Code Table 1.1 )
! ids(5) = Significance of Reference Time (Code Table 1.2)
! ids(6) = Year ( 4 digits )
! ids(7) = Month
! ids(8) = Day
! ids(9) = Hour
! ids(10) = Minute
! ids(11) = Second
! ids(12) = Production status of processed data
! ( see Code Table 1.3 )
! ids(13) = Type of processed data ( see Code Table 1.4 )
! idslen - Number of elements in ids().
! ierr - Error return code.
! 0 = no error
! 6 = memory allocation error
!
! REMARKS:
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: ids
integer,intent(out) :: ierr,idslen
integer,dimension(:) :: mapid(13)
data mapid /2,2,1,1,1,2,1,1,1,1,1,1,1/
ierr=0
idslen=13
nullify(ids)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
!
! Unpack each value into array ids from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapid.
!
istat=0
allocate(ids(idslen),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(ids)
return
endif
do i=1,idslen
nbits=mapid(i)*8
call gbyte(cgrib,ids(i),iofst,nbits)
iofst=iofst+nbits
enddo
return ! End of Section 1 processing
end

View file

@ -1,72 +0,0 @@
subroutine gf_unpack2(cgrib,lcgrib,iofst,lencsec2,csec2,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack2
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-04-09
!
! ABSTRACT: This subroutine unpacks Section 2 (Local Use Section)
! as defined in GRIB Edition 2.
!
! PROGRAM HISTORY LOG:
! 2002-04-09 Gilbert
!
! USAGE: CALL gf_unpack2(cgrib,lcgrib,iofst,lencsec2,csec2,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array containing Section 2 of the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 2.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 2, returned.
! lencsec2 - Length (in octets) of Local Use data
! csec2() - Pointer to a character*1 array containing local use data
! ierr - Error return code.
! 0 = no error
! 2 = Array passed is not section 2
! 6 = memory allocation error
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: lencsec2
integer,intent(out) :: ierr
character(len=1),pointer,dimension(:) :: csec2
ierr=0
lencsec2=0
nullify(csec2)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
lencsec2=lensec-5
call gbyte(cgrib,isecnum,iofst,8) ! Get Section Number
iofst=iofst+8
ipos=(iofst/8)+1
if ( isecnum.ne.2 ) then
ierr=6
print *,'gf_unpack2: Not Section 2 data. '
return
endif
allocate(csec2(lencsec2),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(csec2)
return
endif
csec2(1:lencsec2)=cgrib(ipos:ipos+lencsec2-1)
iofst=iofst+(lencsec2*8)
return ! End of Section 2 processing
end

View file

@ -1,189 +0,0 @@
subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
& mapgridlen,ideflist,idefnum,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack3
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 3 (Grid Definition Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to dynamically allocate arrays
! and to pass pointers to those arrays through
! the argument list.
!
! USAGE: CALL gf_unpack3(cgrib,lcgrib,lensec,iofst,igds,igdstmpl,
! & mapgridlen,ideflist,idefnum,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 3.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 3, returned.
! igds - Contains information read from the appropriate GRIB Grid
! Definition Section 3 for the field being returned.
! Must be dimensioned >= 5.
! igds(1)=Source of grid definition (see Code Table 3.0)
! igds(2)=Number of grid points in the defined grid.
! igds(3)=Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! igds(4)=Interpretation of list for optional points
! definition. (Code Table 3.11)
! igds(5)=Grid Definition Template Number (Code Table 3.1)
! igdstmpl - Pointer to integer array containing the data values for
! the specified Grid Definition
! Template ( NN=igds(5) ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Defintion Template 3.NN
! mapgridlen- Number of elements in igdstmpl(). i.e. number of entries
! in Grid Defintion Template 3.NN ( NN=igds(5) ).
! ideflist - (Used if igds(3) .ne. 0) Pointer to integer array containing
! the number of grid points contained in each row ( or column ).
! (part of Section 3)
! idefnum - (Used if igds(3) .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined.
! ierr - Error return code.
! 0 = no error
! 5 = "GRIB" message contains an undefined Grid Definition
! Template.
! 6 = memory allocation error
!
! REMARKS: Uses Fortran 90 module gridtemplates and module re_alloc.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use gridtemplates
use re_alloc ! needed for subroutine realloc
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,ideflist
integer,intent(out) :: igds(5)
integer,intent(out) :: ierr,idefnum
integer,allocatable :: mapgrid(:)
integer :: mapgridlen,ibyttem
logical needext
ierr=0
nullify(igdstmpl,ideflist)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
call gbyte(cgrib,igds(1),iofst,8) ! Get source of Grid def.
iofst=iofst+8
call gbyte(cgrib,igds(2),iofst,32) ! Get number of grid pts.
iofst=iofst+32
call gbyte(cgrib,igds(3),iofst,8) ! Get num octets for opt. list
iofst=iofst+8
call gbyte(cgrib,igds(4),iofst,8) ! Get interpret. for opt. list
iofst=iofst+8
call gbyte(cgrib,igds(5),iofst,16) ! Get Grid Def Template num.
iofst=iofst+16
! if (igds(1).eq.0) then
if (igds(1).eq.0.OR.igds(1).eq.255) then ! FOR ECMWF TEST ONLY
allocate(mapgrid(lensec))
! Get Grid Definition Template
call getgridtemplate(igds(5),mapgridlen,mapgrid,needext,
& iret)
if (iret.ne.0) then
ierr=5
if( allocated(mapgrid) ) deallocate(mapgrid)
return
endif
else
! igdstmpl=-1
mapgridlen=0
needext=.false.
endif
!
! Unpack each value into array igdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapgrid.
!
istat=0
if (mapgridlen.gt.0) allocate(igdstmpl(mapgridlen),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(igdstmpl)
if( allocated(mapgrid) ) deallocate(mapgrid)
return
endif
ibyttem=0
do i=1,mapgridlen
nbits=iabs(mapgrid(i))*8
if ( mapgrid(i).ge.0 ) then
call gbyte(cgrib,igdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,igdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
endif
iofst=iofst+nbits
ibyttem=ibyttem+iabs(mapgrid(i))
enddo
!
! Check to see if the Grid Definition Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extgridtemplate(igds(5),igdstmpl,newmapgridlen,mapgrid)
! Unpack the rest of the Grid Definition Template
call realloc(igdstmpl,mapgridlen,newmapgridlen,istat)
do i=mapgridlen+1,newmapgridlen
nbits=iabs(mapgrid(i))*8
if ( mapgrid(i).ge.0 ) then
call gbyte(cgrib,igdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,igdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
endif
iofst=iofst+nbits
ibyttem=ibyttem+iabs(mapgrid(i))
enddo
mapgridlen=newmapgridlen
endif
if( allocated(mapgrid) ) deallocate(mapgrid)
!
! Unpack optional list of numbers defining number of points
! in each row or column, if included. This is used for non regular
! grids.
!
if ( igds(3).ne.0 ) then
nbits=igds(3)*8
idefnum=(lensec-14-ibyttem)/igds(3)
istat=0
if (idefnum.gt.0) allocate(ideflist(idefnum),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(ideflist)
return
endif
call gbytes(cgrib,ideflist,iofst,nbits,0,idefnum)
iofst=iofst+(nbits*idefnum)
else
idefnum=0
nullify(ideflist)
endif
return ! End of Section 3 processing
end

View file

@ -1,159 +0,0 @@
subroutine gf_unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,
& mappdslen,coordlist,numcoord,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack4
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 4 (Product Definition Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to dynamically allocate arrays
! and to pass pointers to those arrays through
! the argument list.
!
! USAGE: CALL gf_unpack4(cgrib,lcgrib,iofst,ipdsnum,ipdstmpl,mappdslen,
! & coordlist,numcoord,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 4.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset of the end of Section 4, returned.
! ipdsnum - Product Definition Template Number ( see Code Table 4.0)
! ipdstmpl - Pointer to integer array containing the data values for
! the specified Product Definition
! Template ( N=ipdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Product
! Defintion Template 4.N
! mappdslen- Number of elements in ipdstmpl(). i.e. number of entries
! in Product Defintion Template 4.N ( N=ipdsnum ).
! coordlist- Pointer to real array containing floating point values
! intended to document
! the vertical discretisation associated to model data
! on hybrid coordinate vertical levels. (part of Section 4)
! numcoord - number of values in array coordlist.
! ierr - Error return code.
! 0 = no error
! 5 = "GRIB" message contains an undefined Product Definition
! Template.
! 6 = memory allocation error
!
! REMARKS: Uses Fortran 90 module pdstemplates and module re_alloc.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use pdstemplates
use re_alloc ! needed for subroutine realloc
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
real,pointer,dimension(:) :: coordlist
integer,pointer,dimension(:) :: ipdstmpl
integer,intent(out) :: ipdsnum
integer,intent(out) :: ierr,numcoord
real(4),allocatable :: coordieee(:)
integer,allocatable :: mappds(:)
integer :: mappdslen
logical needext
ierr=0
nullify(ipdstmpl,coordlist)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
allocate(mappds(lensec))
call gbyte(cgrib,numcoord,iofst,16) ! Get num of coordinate values
iofst=iofst+16
call gbyte(cgrib,ipdsnum,iofst,16) ! Get Prod. Def Template num.
iofst=iofst+16
! Get Product Definition Template
call getpdstemplate(ipdsnum,mappdslen,mappds,needext,iret)
if (iret.ne.0) then
ierr=5
if( allocated(mappds) ) deallocate(mappds)
return
endif
!
! Unpack each value into array ipdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mappds.
!
istat=0
if (mappdslen.gt.0) allocate(ipdstmpl(mappdslen),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(ipdstmpl)
if( allocated(mappds) ) deallocate(mappds)
return
endif
do i=1,mappdslen
nbits=iabs(mappds(i))*8
if ( mappds(i).ge.0 ) then
call gbyte(cgrib,ipdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,ipdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) ipdstmpl(i)=-ipdstmpl(i)
endif
iofst=iofst+nbits
enddo
!
! Check to see if the Product Definition Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extpdstemplate(ipdsnum,ipdstmpl,newmappdslen,mappds)
call realloc(ipdstmpl,mappdslen,newmappdslen,istat)
! Unpack the rest of the Product Definition Template
do i=mappdslen+1,newmappdslen
nbits=iabs(mappds(i))*8
if ( mappds(i).ge.0 ) then
call gbyte(cgrib,ipdstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,ipdstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) ipdstmpl(i)=-ipdstmpl(i)
endif
iofst=iofst+nbits
enddo
mappdslen=newmappdslen
endif
if( allocated(mappds) ) deallocate(mappds)
!
! Get Optional list of vertical coordinate values
! after the Product Definition Template, if necessary.
!
nullify(coordlist)
if ( numcoord .ne. 0 ) then
allocate (coordieee(numcoord),stat=istat1)
allocate(coordlist(numcoord),stat=istat)
if ((istat1+istat).ne.0) then
ierr=6
nullify(coordlist)
if( allocated(coordieee) ) deallocate(coordieee)
return
endif
call gbytes(cgrib,coordieee,iofst,32,0,numcoord)
call rdieee(coordieee,coordlist,numcoord)
deallocate (coordieee)
iofst=iofst+(32*numcoord)
endif
return ! End of Section 4 processing
end

View file

@ -1,134 +0,0 @@
subroutine gf_unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,idrstmpl,
& mapdrslen,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack5
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 5 (Data Representation Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to dynamically allocate arrays
! and to pass pointers to those arrays through
! the argument list.
!
! USAGE: CALL gf_unpack5(cgrib,lcgrib,iofst,ndpts,idrsnum,idrstmpl,
! mapdrslen,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 5.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 5, returned.
! ndpts - Number of data points unpacked and returned.
! idrsnum - Data Representation Template Number ( see Code Table 5.0)
! idrstmpl - Pointer to an integer array containing the data values for
! the specified Data Representation
! Template ( N=idrsnum ). Each element of this integer
! array contains an entry (in the order specified) of Data
! Representation Template 5.N
! mapdrslen- Number of elements in idrstmpl(). i.e. number of entries
! in Data Representation Template 5.N ( N=idrsnum ).
! ierr - Error return code.
! 0 = no error
! 6 = memory allocation error
! 7 = "GRIB" message contains an undefined Data
! Representation Template.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
use drstemplates
use re_alloc ! needed for subroutine realloc
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(inout) :: iofst
integer,intent(out) :: ndpts,idrsnum
integer,pointer,dimension(:) :: idrstmpl
integer,intent(out) :: ierr
integer,allocatable :: mapdrs(:)
integer :: mapdrslen
logical needext
ierr=0
nullify(idrstmpl)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
allocate(mapdrs(lensec))
call gbyte(cgrib,ndpts,iofst,32) ! Get num of data points
iofst=iofst+32
call gbyte(cgrib,idrsnum,iofst,16) ! Get Data Rep Template Num.
iofst=iofst+16
! Gen Data Representation Template
call getdrstemplate(idrsnum,mapdrslen,mapdrs,needext,iret)
if (iret.ne.0) then
ierr=7
if( allocated(mapdrs) ) deallocate(mapdrs)
return
endif
!
! Unpack each value into array ipdstmpl from the
! the appropriate number of octets, which are specified in
! corresponding entries in array mappds.
!
istat=0
if (mapdrslen.gt.0) allocate(idrstmpl(mapdrslen),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(idrstmpl)
if( allocated(mapdrs) ) deallocate(mapdrs)
return
endif
do i=1,mapdrslen
nbits=iabs(mapdrs(i))*8
if ( mapdrs(i).ge.0 ) then
call gbyte(cgrib,idrstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,idrstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) idrstmpl(i)=-idrstmpl(i)
endif
iofst=iofst+nbits
enddo
!
! Check to see if the Data Representation Template needs to be
! extended.
! The number of values in a specific template may vary
! depending on data specified in the "static" part of the
! template.
!
if ( needext ) then
call extdrstemplate(idrsnum,idrstmpl,newmapdrslen,mapdrs)
call realloc(idrstmpl,mapdrslen,newmapdrslen,istat)
! Unpack the rest of the Data Representation Template
do i=mapdrslen+1,newmapdrslen
nbits=iabs(mapdrs(i))*8
if ( mapdrs(i).ge.0 ) then
call gbyte(cgrib,idrstmpl(i),iofst,nbits)
else
call gbyte(cgrib,isign,iofst,1)
call gbyte(cgrib,idrstmpl(i),iofst+1,nbits-1)
if (isign.eq.1) idrstmpl(i)=-idrstmpl(i)
endif
iofst=iofst+nbits
enddo
mapdrslen=newmapdrslen
endif
if( allocated(mapdrs) ) deallocate(mapdrs)
return ! End of Section 5 processing
end

View file

@ -1,88 +0,0 @@
subroutine gf_unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack6
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-26
!
! ABSTRACT: This subroutine unpacks Section 6 (Bit-Map Section)
! starting at octet 6 of that Section.
!
! PROGRAM HISTORY LOG:
! 2000-05-26 Gilbert
! 2002-01-24 Gilbert - Changed to dynamically allocate arrays
! and to pass pointers to those arrays through
! the argument list.
!
! USAGE: CALL gf_unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 6.
! ngpts - Number of grid points specified in the bit-map
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 6, returned.
! ibmap - Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! bmap() - Pointer to a logical*1 array containing decoded bitmap.
! ( if ibmap=0 )
! ierr - Error return code.
! 0 = no error
! 4 = Unrecognized pre-defined bit-map.
! 6 = memory allocation error
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ngpts
integer,intent(inout) :: iofst
integer,intent(out) :: ibmap
integer,intent(out) :: ierr
logical*1,pointer,dimension(:) :: bmap
integer :: intbmap(ngpts)
ierr=0
nullify(bmap)
iofst=iofst+32 ! skip Length of Section
iofst=iofst+8 ! skip section number
call gbyte(cgrib,ibmap,iofst,8) ! Get bit-map indicator
iofst=iofst+8
if (ibmap.eq.0) then ! Unpack bitmap
istat=0
if (ngpts.gt.0) allocate(bmap(ngpts),stat=istat)
if (istat.ne.0) then
ierr=6
nullify(bmap)
return
endif
call gbytes(cgrib,intbmap,iofst,1,0,ngpts)
iofst=iofst+ngpts
do j=1,ngpts
bmap(j)=.true.
if (intbmap(j).eq.0) bmap(j)=.false.
enddo
! elseif (ibmap.eq.254) then ! Use previous bitmap
! return
! elseif (ibmap.eq.255) then ! No bitmap in message
! bmap(1:ngpts)=.true.
! else
! print *,'gf_unpack6: Predefined bitmap ',ibmap,' not recognized.'
! ierr=4
endif
return ! End of Section 6 processing
end

View file

@ -1,124 +0,0 @@
subroutine gf_unpack7(cgrib,lcgrib,iofst,igdsnum,igdstmpl,
& idrsnum,idrstmpl,ndpts,fld,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gf_unpack7
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-24
!
! ABSTRACT: This subroutine unpacks GRIB2 Section 7 (Data Section).
!
! PROGRAM HISTORY LOG:
! 2002-01-24 Gilbert
! 2002-12-17 Gilbert - Added support for new templates using
! PNG and JPEG2000 algorithms/templates.
! 2004-12-29 Gilbert - Added check on comunpack return code.
!
! USAGE: CALL gf_unpack7(cgrib,lcgrib,iofst,igdsnum,igdstmpl,
! & idrsnum,idrstmpl,ndpts,fld,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message array cgrib.
! iofst - Bit offset of the beginning of Section 7.
! igdsnum - Grid Definition Template Number ( see Code Table 3.0)
! (Only required to unpack DRT 5.51)
! igdstmpl - Pointer to an integer array containing the data values for
! the specified Grid Definition
! Template ( N=igdsnum ). Each element of this integer
! array contains an entry (in the order specified) of Grid
! Definition Template 3.N
! (Only required to unpack DRT 5.51)
! idrsnum - Data Representation Template Number ( see Code Table 5.0)
! idrstmpl - Pointer to an integer array containing the data values for
! the specified Data Representation
! Template ( N=idrsnum ). Each element of this integer
! array contains an entry (in the order specified) of Data
! Representation Template 5.N
! ndpts - Number of data points unpacked and returned.
!
! OUTPUT ARGUMENT LIST:
! iofst - Bit offset at the end of Section 7, returned.
! fld() - Pointer to a real array containing the unpacked data field.
! ierr - Error return code.
! 0 = no error
! 4 = Unrecognized Data Representation Template
! 5 = One of GDT 3.50 through 3.53 required to unpack DRT 5.51
! 6 = memory allocation error
! 7 = corrupt section 7.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib,ndpts,igdsnum,idrsnum
integer,intent(inout) :: iofst
integer,pointer,dimension(:) :: igdstmpl,idrstmpl
integer,intent(out) :: ierr
real,pointer,dimension(:) :: fld
ierr=0
nullify(fld)
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
iofst=iofst+8 ! skip section number
ipos=(iofst/8)+1
istat=0
allocate(fld(ndpts),stat=istat)
if (istat.ne.0) then
ierr=6
return
endif
if (idrsnum.eq.0) then
call simunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
elseif (idrsnum.eq.2.or.idrsnum.eq.3) then
call comunpack(cgrib(ipos),lensec-5,lensec,idrsnum,idrstmpl,
& ndpts,fld,ier)
if ( ier .NE. 0 ) then
ierr=7
return
endif
elseif (idrsnum.eq.50) then ! Spectral simple
call simunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts-1,
& fld(2))
ieee=idrstmpl(5)
call rdieee(ieee,fld(1),1)
elseif (idrsnum.eq.51) then ! Spectral complex
if (igdsnum.ge.50.AND.igdsnum.le.53) then
call specunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,
& igdstmpl(1),igdstmpl(2),igdstmpl(3),fld)
else
print *,'gf_unpack7: Cannot use GDT 3.',igdsnum,
& ' to unpack Data Section 5.51.'
ierr=5
nullify(fld)
return
endif
#ifdef USE_JPEG2000
elseif (idrsnum.eq.40 .OR. idrsnum.eq.40000) then
call jpcunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
#endif /* USE_JPEG2000 */
#ifdef USE_PNG
elseif (idrsnum.eq.41 .OR. idrsnum.eq.40010) then
call pngunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
#endif /* USE_PNG */
else
print *,'gf_unpack7: Data Representation Template ',idrsnum,
& ' not yet implemented.'
ierr=4
nullify(fld)
return
endif
iofst=iofst+(8*lensec)
return ! End of Section 7 processing
end

View file

@ -1,42 +0,0 @@
GFORTRAN module created from gribmod.f on Mon Nov 16 16:42:53 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'grib_mod' 'grib_mod' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(UNKNOWN 0 ()) 0 0 () () 0 () ())
3 'g2_version' 'grib_mod' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (CHARACTER 1 ((CONSTANT (INTEGER 4 ()) 0 '12'))) 0 0 () () 0 ()
())
4 'gribfield' 'grib_mod' 1 ((DERIVED UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(UNKNOWN 0 ()) 0 0 () () 0 ((5 'version' (INTEGER 4 ()) () 0 0 ()) (6
'discipline' (INTEGER 4 ()) () 0 0 ()) (7 'idsect' (INTEGER 4 ()) (1
DEFERRED () ()) 1 1 ()) (8 'idsectlen' (INTEGER 4 ()) () 0 0 ()) (9
'local' (CHARACTER 1 ((CONSTANT (INTEGER 4 ()) 0 '1'))) (1 DEFERRED () ())
1 1 ()) (10 'locallen' (INTEGER 4 ()) () 0 0 ()) (11 'ifldnum' (INTEGER
4 ()) () 0 0 ()) (12 'griddef' (INTEGER 4 ()) () 0 0 ()) (13 'ngrdpts' (
INTEGER 4 ()) () 0 0 ()) (14 'numoct_opt' (INTEGER 4 ()) () 0 0 ()) (15
'interp_opt' (INTEGER 4 ()) () 0 0 ()) (16 'num_opt' (INTEGER 4 ()) () 0
0 ()) (17 'list_opt' (INTEGER 4 ()) (1 DEFERRED () ()) 1 1 ()) (18
'igdtnum' (INTEGER 4 ()) () 0 0 ()) (19 'igdtlen' (INTEGER 4 ()) () 0 0
()) (20 'igdtmpl' (INTEGER 4 ()) (1 DEFERRED () ()) 1 1 ()) (21 'ipdtnum'
(INTEGER 4 ()) () 0 0 ()) (22 'ipdtlen' (INTEGER 4 ()) () 0 0 ()) (23
'ipdtmpl' (INTEGER 4 ()) (1 DEFERRED () ()) 1 1 ()) (24 'num_coord' (
INTEGER 4 ()) () 0 0 ()) (25 'coord_list' (REAL 4 ()) (1 DEFERRED () ())
1 1 ()) (26 'ndpts' (INTEGER 4 ()) () 0 0 ()) (27 'idrtnum' (INTEGER 4 ())
() 0 0 ()) (28 'idrtlen' (INTEGER 4 ()) () 0 0 ()) (29 'idrtmpl' (
INTEGER 4 ()) (1 DEFERRED () ()) 1 1 ()) (30 'unpacked' (LOGICAL 4 ()) ()
0 0 ()) (31 'expanded' (LOGICAL 4 ()) () 0 0 ()) (32 'ibmap' (INTEGER 4
()) () 0 0 ()) (33 'bmap' (LOGICAL 1 ()) (1 DEFERRED () ()) 1 1 ()) (34
'fld' (REAL 4 ()) (1 DEFERRED () ()) 1 1 ())) PUBLIC ())
)
('gribfield' 0 4 'g2_version' 0 3 'grib_mod' 0 2)

View file

@ -1,123 +0,0 @@
subroutine gribcreate(cgrib,lcgrib,listsec0,listsec1,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gribcreate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-04-28
!
! ABSTRACT: This subroutine initializes a new GRIB2 message and packs
! GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).
! This routine is used with routines "addlocal", "addgrid", "addfield",
! and "gribend" to create a complete GRIB2 message. Subroutine
! gribcreate must be called first to initialize a new GRIB2 message.
! Also, a call to gribend is required to complete GRIB2 message
! after all fields have been added.
!
! PROGRAM HISTORY LOG:
! 2000-04-28 Gilbert
!
! USAGE: CALL gribcreate(cgrib,lcgrib,listsec0,listsec1,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lcgrib - Maximum length (bytes) of array cgrib.
! listsec0 - Contains information needed for GRIB Indicator Section 0.
! Must be dimensioned >= 2.
! listsec0(1)=Discipline-GRIB Master Table Number
! (see Code Table 0.0)
! listsec0(2)=GRIB Edition Number (currently 2)
! listsec1 - Contains information needed for GRIB Identification Section 1.
! Must be dimensioned >= 13.
! listsec1(1)=Id of orginating centre (Common Code Table C-1)
! listsec1(2)=Id of orginating sub-centre (local table)
! listsec1(3)=GRIB Master Tables Version Number (Code Table 1.0)
! listsec1(4)=GRIB Local Tables Version Number (Code Table 1.1)
! listsec1(5)=Significance of Reference Time (Code Table 1.2)
! listsec1(6)=Reference Time - Year (4 digits)
! listsec1(7)=Reference Time - Month
! listsec1(8)=Reference Time - Day
! listsec1(9)=Reference Time - Hour
! listsec1(10)=Reference Time - Minute
! listsec1(11)=Reference Time - Second
! listsec1(12)=Production status of data (Code Table 1.3)
! listsec1(13)=Type of processed data (Code Table 1.4)
!
! OUTPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! ierr - Error return code.
! 0 = no error
! 1 = Tried to use for version other than GRIB Edition 2
!
! REMARKS: This routine is intended for use with routines "addlocal",
! "addgrid", "addfield", and "gribend" to create a complete
! GRIB2 message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(inout) :: cgrib(lcgrib)
integer,intent(in) :: listsec0(*),listsec1(*)
integer,intent(in) :: lcgrib
integer,intent(out) :: ierr
character(len=4),parameter :: grib='GRIB'
integer,parameter :: zero=0,one=1
integer,parameter :: mapsec1len=13
integer,parameter ::
& mapsec1(mapsec1len)=(/ 2,2,1,1,1,2,1,1,1,1,1,1,1 /)
integer lensec0,iofst,ibeg
ierr=0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'gribcreate: can only code GRIB edition 2.'
ierr=1
return
endif
!
! Pack Section 0 - Indicator Section
! ( except for total length of GRIB message )
!
! cgrib=' '
cgrib(1)=grib(1:1) ! Beginning of GRIB message
cgrib(2)=grib(2:2)
cgrib(3)=grib(3:3)
cgrib(4)=grib(4:4)
call sbyte(cgrib,zero,32,16) ! reserved for future use
call sbyte(cgrib,listsec0(1),48,8) ! Discipline
call sbyte(cgrib,listsec0(2),56,8) ! GRIB edition number
lensec0=16 ! bytes (octets)
!
! Pack Section 1 - Identification Section
!
ibeg=lensec0*8 ! Calculate offset for beginning of section 1
iofst=ibeg+32 ! leave space for length of section
call sbyte(cgrib,one,iofst,8) ! Store section number ( 1 )
iofst=iofst+8
!
! Pack up each input value in array listsec1 into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapsec1.
!
do i=1,mapsec1len
nbits=mapsec1(i)*8
call sbyte(cgrib,listsec1(i),iofst,nbits)
iofst=iofst+nbits
enddo
!
! Calculate length of section 1 and store it in octets
! 1-4 of section 1.
!
lensec1=(iofst-ibeg)/8
call sbyte(cgrib,lensec1,ibeg,32)
!
! Put current byte total of message into Section 0
!
call sbyte(cgrib,zero,64,32)
call sbyte(cgrib,lensec0+lensec1,96,32)
return
end

View file

@ -1,126 +0,0 @@
subroutine gribend(cgrib,lcgrib,lengrib,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gribend
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-02
!
! ABSTRACT: This subroutine finalizes a GRIB message after all grids
! and fields have been added. It adds the End Section ( "7777" )
! to the end of the GRIB message and calculates the length and stores
! it in the appropriate place in Section 0.
! This routine is used with routines "gribcreate", "addlocal", "addgrid",
! and "addfield" to create a complete GRIB2 message. Subroutine
! gribcreate must be called first to initialize a new GRIB2 message.
!
! PROGRAM HISTORY LOG:
! 2000-05-02 Gilbert
!
! USAGE: CALL gribend(cgrib,lcgrib,lengrib,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lcgrib - Maximum length (bytes) of array cgrib.
!
! OUTPUT ARGUMENT LIST:
! cgrib - Character array to contain the GRIB2 message
! lengrib - Length of the final GRIB2 message in octets (bytes)
! ierr - Error return code.
! 0 = no error
! 1 = GRIB message was not initialized. Need to call
! routine gribcreate first.
! 2 = GRIB message already complete.
! 3 = Sum of Section byte counts doesn't add to total byte count.
! 4 = Previous Section was not 7.
!
! REMARKS: This routine is intended for use with routines "gribcreate",
! "addlocal", "addgrid", and "addfield" to create a complete
! GRIB2 message.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(inout) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(out) :: lengrib,ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4):: ctemp
integer iofst,ibeg,lencurr,len
ierr=0
!
! Check to see if beginning of GRIB message exists
!
ctemp=cgrib(1)//cgrib(2)//cgrib(3)//cgrib(4)
if ( ctemp.ne.grib ) then
print *,'gribend: GRIB not found in given message.'
ierr=1
return
endif
!
! Get current length of GRIB message
!
call gbyte(cgrib,lencurr,96,32)
!
! Check to see if GRIB message is already complete
!
! ctemp=cgrib(lencurr-3)//cgrib(lencurr-2)//cgrib(lencurr-1)
! & //cgrib(lencurr)
! if ( ctemp.eq.c7777 ) then
! print *,'gribend: GRIB message already complete.'
! ierr=2
! return
! endif
!
! Loop through all current sections of the GRIB message to
! find the last section number.
!
len=16 ! Length of Section 0
do
! Get number and length of next section
iofst=len*8
call gbyte(cgrib,ilen,iofst,32)
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8)
len=len+ilen
! Exit loop if last section reached
if ( len.eq.lencurr ) exit
! If byte count for each section doesn't match current
! total length, then there is a problem.
if ( len.gt.lencurr ) then
print *,'gribend: Section byte counts don''t add to total.'
print *,'gribend: Sum of section byte counts = ',len
print *,'gribend: Total byte count in Section 0 = ',lencurr
ierr=3
return
endif
enddo
!
! Can only add End Section (Section 8) after Section 7.
!
if ( isecnum.ne.7 ) then
print *,'gribend: Section 8 can only be added after Section 7.'
print *,'gribend: Section ',isecnum,' was the last found in',
& ' given GRIB message.'
ierr=4
return
endif
!
! Add Section 8 - End Section
!
cgrib(lencurr+1:lencurr+4)=c7777
!
! Update current byte total of message in Section 0
!
lengrib=lencurr+4
call sbyte(cgrib,lengrib,96,32)
return
end

View file

@ -1,243 +0,0 @@
subroutine gribinfo(cgrib,lcgrib,listsec0,listsec1,
& numlocal,numfields,maxvals,ierr)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: gribinfo
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-25
!
! ABSTRACT: This subroutine searches through a GRIB2 message and
! returns the number of Local Use Sections and number of gridded
! fields found in the message. It also performs various checks
! to see if the message is a valid GRIB2 message.
! Last, a list of safe array dimensions is returned for use in
! allocating return arrays from routines getlocal, gettemplates, and
! getfields. (See maxvals and REMARKS)
!
! PROGRAM HISTORY LOG:
! 2000-05-25 Gilbert
!
! USAGE: CALL gribinfo(cgrib,lcgrib,listsec0,listsec1,
! & numlocal,numfields,ierr)
! INPUT ARGUMENT LIST:
! cgrib - Character array that contains the GRIB2 message
! lcgrib - Length (in bytes) of GRIB message in array cgrib.
!
! OUTPUT ARGUMENT LIST:
! listsec0 - Contains information decoded from GRIB Indicator Section 0.
! Must be dimensioned >= 2.
! listsec0(1)=Discipline-GRIB Master Table Number
! (see Code Table 0.0)
! listsec0(2)=GRIB Edition Number (currently 2)
! listsec0(3)=Length of GRIB message
! listsec1 - Contains information read from GRIB Identification Section 1.
! Must be dimensioned >= 13.
! listsec1(1)=Id of orginating centre (Common Code Table C-1)
! listsec1(2)=Id of orginating sub-centre (local table)
! listsec1(3)=GRIB Master Tables Version Number (Code Table 1.0)
! listsec1(4)=GRIB Local Tables Version Number
! listsec1(5)=Significance of Reference Time (Code Table 1.1)
! listsec1(6)=Reference Time - Year (4 digits)
! listsec1(7)=Reference Time - Month
! listsec1(8)=Reference Time - Day
! listsec1(9)=Reference Time - Hour
! listsec1(10)=Reference Time - Minute
! listsec1(11)=Reference Time - Second
! listsec1(12)=Production status of data (Code Table 1.2)
! listsec1(13)=Type of processed data (Code Table 1.3)
! numlocal - The number of Local Use Sections ( Section 2 ) found in
! the GRIB message.
! numfields- The number of gridded fieldse found in the GRIB message.
! maxvals()- The maximum number of elements that could be returned
! in various arrays from this GRIB2 message. (see REMARKS)
! maxvals(1)=max length of local section 2 (for getlocal)
! maxvals(2)=max length of GDS Template (for gettemplates
! and getfield)
! maxvals(3)=max length of GDS Optional list (for getfield)
! maxvals(4)=max length of PDS Template (for gettemplates
! and getfield)
! maxvals(5)=max length of PDS Optional list (for getfield)
! maxvals(6)=max length of DRS Template (for gettemplates
! and getfield)
! maxvals(7)=max number of gridpoints (for getfield)
! ierr - Error return code.
! 0 = no error
! 1 = Beginning characters "GRIB" not found.
! 2 = GRIB message is not Edition 2.
! 3 = Could not find Section 1, where expected.
! 4 = End string "7777" found, but not where expected.
! 5 = End string "7777" not found at end of message.
!
! REMARKS: Array maxvals contains the maximum possible
! number of values that will be returned in argument arrays
! for routines getlocal, gettemplates, and getfields.
! Users can use this info to determine if their arrays are
! dimensioned large enough for the data that may be returned
! from the above routines, or to dynamically allocate arrays
! with a reasonable size.
! NOTE that the actual number of values in these arrays is returned
! from the routines and will likely be less than the values
! calculated by this routine.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cgrib(lcgrib)
integer,intent(in) :: lcgrib
integer,intent(out) :: listsec0(3),listsec1(13),maxvals(7)
integer,intent(out) :: numlocal,numfields,ierr
character(len=4),parameter :: grib='GRIB',c7777='7777'
character(len=4) :: ctemp
integer,parameter :: zero=0,one=1
integer,parameter :: mapsec1len=13
integer,parameter ::
& mapsec1(mapsec1len)=(/ 2,2,1,1,1,2,1,1,1,1,1,1,1 /)
integer iofst,ibeg,istart
ierr=0
numlocal=0
numfields=0
maxsec2len=1
maxgdstmpl=1
maxdeflist=1
maxpdstmpl=1
maxcoordlist=1
maxdrstmpl=1
maxgridpts=0
!
! Check for beginning of GRIB message in the first 100 bytes
!
istart=0
do j=1,100
ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
if (ctemp.eq.grib ) then
istart=j
exit
endif
enddo
if (istart.eq.0) then
print *,'gribinfo: Beginning characters GRIB not found.'
ierr=1
return
endif
!
! Unpack Section 0 - Indicator Section
!
iofst=8*(istart+5)
call gbyte(cgrib,listsec0(1),iofst,8) ! Discipline
iofst=iofst+8
call gbyte(cgrib,listsec0(2),iofst,8) ! GRIB edition number
iofst=iofst+8
iofst=iofst+32
call gbyte(cgrib,lengrib,iofst,32) ! Length of GRIB message
iofst=iofst+32
listsec0(3)=lengrib
lensec0=16
ipos=istart+lensec0
!
! Currently handles only GRIB Edition 2.
!
if (listsec0(2).ne.2) then
print *,'gribinfo: can only decode GRIB edition 2.'
ierr=2
return
endif
!
! Unpack Section 1 - Identification Section
!
call gbyte(cgrib,lensec1,iofst,32) ! Length of Section 1
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Section number ( 1 )
iofst=iofst+8
if (isecnum.ne.1) then
print *,'gribinfo: Could not find section 1.'
ierr=3
return
endif
!
! Unpack each input value in array listsec1 into the
! the appropriate number of octets, which are specified in
! corresponding entries in array mapsec1.
!
do i=1,mapsec1len
nbits=mapsec1(i)*8
call gbyte(cgrib,listsec1(i),iofst,nbits)
iofst=iofst+nbits
enddo
ipos=ipos+lensec1
!
! Loop through the remaining sections keeping track of the
! length of each. Also count the number of times Section 2
! and Section 4 appear.
!
do
ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
if (ctemp.eq.c7777 ) then
ipos=ipos+4
if (ipos.ne.(istart+lengrib)) then
print *,'gribinfo: "7777" found, but not where expected.'
ierr=4
return
endif
exit
endif
iofst=(ipos-1)*8
call gbyte(cgrib,lensec,iofst,32) ! Get Length of Section
iofst=iofst+32
call gbyte(cgrib,isecnum,iofst,8) ! Get Section number
iofst=iofst+8
ipos=ipos+lensec ! Update beginning of section pointer
if (ipos.gt.(istart+lengrib)) then
print *,'gribinfo: "7777" not found at end of GRIB message.'
ierr=5
return
endif
if (isecnum.eq.2) then ! Local Section 2
! increment counter for total number of local sections found
! and determine largest Section 2 in message
numlocal=numlocal+1
lenposs=lensec-5
if ( lenposs.gt.maxsec2len ) maxsec2len=lenposs
elseif (isecnum.eq.3) then
iofst=iofst+8 ! skip source of grid def.
call gbyte(cgrib,ngdpts,iofst,32) ! Get Num of Grid Points
iofst=iofst+32
call gbyte(cgrib,nbyte,iofst,8) ! Get Num octets for opt. list
iofst=iofst+8
if (ngdpts.gt.maxgridpts) maxgridpts=ngdpts
lenposs=lensec-14
if ( lenposs.gt.maxgdstmpl ) maxgdstmpl=lenposs
if (nbyte.ne.0) then
lenposs=lenposs/nbyte
if ( lenposs.gt.maxdeflist ) maxdeflist=lenposs
endif
elseif (isecnum.eq.4) then
numfields=numfields+1
call gbyte(cgrib,numcoord,iofst,16) ! Get Num of Coord Values
iofst=iofst+16
if (numcoord.ne.0) then
if (numcoord.gt.maxcoordlist) maxcoordlist=numcoord
endif
lenposs=lensec-9
if ( lenposs.gt.maxpdstmpl ) maxpdstmpl=lenposs
elseif (isecnum.eq.5) then
lenposs=lensec-11
if ( lenposs.gt.maxdrstmpl ) maxdrstmpl=lenposs
endif
enddo
maxvals(1)=maxsec2len
maxvals(2)=maxgdstmpl
maxvals(3)=maxdeflist
maxvals(4)=maxpdstmpl
maxvals(5)=maxcoordlist
maxvals(6)=maxdrstmpl
maxvals(7)=maxgridpts
return
end

View file

@ -1,189 +0,0 @@
module grib_mod
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: grib_mod
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-23
!
! ABSTRACT: This Fortran Module contains the declaration
! of derived type gribfield.
! If variable gfld is declared of type gribfield
! ( i.e. TYPE(GRIBFIELD) :: GFLD ), it would have the following componenets:
!
! gfld%version = GRIB edition number ( currently 2 )
! gfld%discipline = Message Discipline ( see Code Table 0.0 )
! gfld%idsect() = Contains the entries in the Identification
! Section ( Section 1 )
! This element is actually a pointer to an array
! that holds the data.
! gfld%idsect(1) = Identification of originating Centre
! ( see Common Code Table C-1 )
! 7 - US National Weather Service
! gfld%idsect(2) = Identification of originating Sub-centre
! gfld%idsect(3) = GRIB Master Tables Version Number
! ( see Code Table 1.0 )
! 0 - Experimental
! 1 - Initial operational version number
! gfld%idsect(4) = GRIB Local Tables Version Number
! ( see Code Table 1.1 )
! 0 - Local tables not used
! 1-254 - Number of local tables version used
! gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
! 0 - Analysis
! 1 - Start of forecast
! 2 - Verifying time of forecast
! 3 - Observation time
! gfld%idsect(6) = Year ( 4 digits )
! gfld%idsect(7) = Month
! gfld%idsect(8) = Day
! gfld%idsect(9) = Hour
! gfld%idsect(10) = Minute
! gfld%idsect(11) = Second
! gfld%idsect(12) = Production status of processed data
! ( see Code Table 1.3 )
! 0 - Operational products
! 1 - Operational test products
! 2 - Research products
! 3 - Re-analysis products
! gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
! 0 - Analysis products
! 1 - Forecast products
! 2 - Analysis and forecast products
! 3 - Control forecast products
! 4 - Perturbed forecast products
! 5 - Control and perturbed forecast products
! 6 - Processed satellite observations
! 7 - Processed radar observations
! gfld%idsectlen = Number of elements in gfld%idsect().
! gfld%local() = Pointer to character array containing contents
! of Local Section 2, if included
! gfld%locallen = length of array gfld%local()
! gfld%ifldnum = field number within GRIB message
! gfld%griddef = Source of grid definition (see Code Table 3.0)
! 0 - Specified in Code table 3.1
! 1 - Predetermined grid Defined by originating centre
! gfld%ngrdpts = Number of grid points in the defined grid.
! gfld%numoct_opt = Number of octets needed for each
! additional grid points definition.
! Used to define number of
! points in each row ( or column ) for
! non-regular grids.
! = 0, if using regular grid.
! gfld%interp_opt = Interpretation of list for optional points
! definition. (Code Table 3.11)
! gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
! gfld%igdtmpl() = Contains the data values for the specified Grid
! Definition Template ( NN=gfld%igdtnum ). Each
! element of this integer array contains an entry (in
! the order specified) of Grid Defintion Template 3.NN
! This element is actually a pointer to an array
! that holds the data.
! gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
! entries in Grid Defintion Template 3.NN
! ( NN=gfld%igdtnum ).
! gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
! contains the number of grid points contained in
! each row ( or column ). (part of Section 3)
! This element is actually a pointer to an array
! that holds the data. This pointer is nullified
! if gfld%numoct_opt=0.
! gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
! in array ideflist. i.e. number of rows ( or columns )
! for which optional grid points are defined. This value
! is set to zero, if gfld%numoct_opt=0.
! gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
! gfld%ipdtmpl() = Contains the data values for the specified Product
! Definition Template ( N=gfdl%ipdtnum ). Each element
! of this integer array contains an entry (in the
! order specified) of Product Defintion Template 4.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
! entries in Product Defintion Template 4.N
! ( N=gfdl%ipdtnum ).
! gfld%coord_list() = Real array containing floating point values
! intended to document the vertical discretisation
! associated to model data on hybrid coordinate
! vertical levels. (part of Section 4)
! This element is actually a pointer to an array
! that holds the data.
! gfld%num_coord = number of values in array gfld%coord_list().
! gfld%ndpts = Number of data points unpacked and returned.
! gfld%idrtnum = Data Representation Template Number
! ( see Code Table 5.0)
! gfld%idrtmpl() = Contains the data values for the specified Data
! Representation Template ( N=gfld%idrtnum ). Each
! element of this integer array contains an entry
! (in the order specified) of Product Defintion
! Template 5.N.
! This element is actually a pointer to an array
! that holds the data.
! gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
! of entries in Data Representation Template 5.N
! ( N=gfld%idrtnum ).
! gfld%unpacked = logical value indicating whether the bitmap and
! data values were unpacked. If false,
! gfld%bmap and gfld%fld pointers are nullified.
! gfld%expanded = Logical value indicating whether the data field
! was expanded to the grid in the case where a
! bit-map is present. If true, the data points in
! gfld%fld match the grid points and zeros were
! inserted at grid points where data was bit-mapped
! out. If false, the data values in gfld%fld were
! not expanded to the grid and are just a consecutive
! array of data points corresponding to each value of
! "1" in gfld%bmap.
! gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
! 0 = bitmap applies and is included in Section 6.
! 1-253 = Predefined bitmap applies
! 254 = Previously defined bitmap applies to this field
! 255 = Bit map does not apply to this product.
! gfld%bmap() = Logical*1 array containing decoded bitmap,
! if ibmap=0 or ibap=254. Otherwise nullified.
! This element is actually a pointer to an array
! that holds the data.
! gfld%fld() = Array of gfld%ndpts unpacked data points.
! This element is actually a pointer to an array
! that holds the data.
!
!
! PROGRAM HISTORY LOG:
! 2002-01-23 Gilbert
! 2007-04-24 Vuong - Added GDT 3.204 Curvilinear Orthogonal Grids
! 2008-05-29 Vuong - Added GDT 3.32768 Rotate Lat/Lon E-grid
!
! USAGE: use grib_mod
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=12) :: G2_VERSION="g2lib-1.1.8"
type gribfield
integer :: version,discipline
integer,pointer,dimension(:) :: idsect
integer :: idsectlen
character(len=1),pointer,dimension(:) :: local
integer :: locallen
integer :: ifldnum
integer :: griddef,ngrdpts
integer :: numoct_opt,interp_opt,num_opt
integer,pointer,dimension(:) :: list_opt
integer :: igdtnum,igdtlen
integer,pointer,dimension(:) :: igdtmpl
integer :: ipdtnum,ipdtlen
integer,pointer,dimension(:) :: ipdtmpl
integer :: num_coord
real,pointer,dimension(:) :: coord_list
integer :: ndpts,idrtnum,idrtlen
integer,pointer,dimension(:) :: idrtmpl
logical :: unpacked
logical :: expanded
integer :: ibmap
logical*1,pointer,dimension(:) :: bmap
real,pointer,dimension(:) :: fld
end type gribfield
end module

View file

@ -1,417 +0,0 @@
module gridtemplates
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: gridtemplates
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-09
!
! ABSTRACT: This Fortran Module contains info on all the available
! GRIB2 Grid Definition Templates used in Section 3 (GDS).
! Each Template has three parts: The number of entries in the template
! (mapgridlen); A map of the template (mapgrid), which contains the
! number of octets in which to pack each of the template values; and
! a logical value (needext) that indicates whether the Template needs
! to be extended. In some cases the number of entries in a template
! can vary depending upon values specified in the "static" part of
! the template. ( See Template 3.120 as an example )
!
! This module also contains two subroutines. Subroutine getgridtemplate
! returns the octet map for a specified Template number, and
! subroutine extgridtemplate will calculate the extended octet map
! of an appropriate template given values for the "static" part of the
! template. See docblocks below for the arguments and usage of these
! routines.
!
! NOTE: Array mapgrid contains the number of octets in which the
! corresponding template values will be stored. A negative value in
! mapgrid is used to indicate that the corresponding template entry can
! contain negative values. This information is used later when packing
! (or unpacking) the template data values. Negative data values in GRIB
! are stored with the left most bit set to one, and a negative number
! of octets value in mapgrid() indicates that this possibility should
! be considered. The number of octets used to store the data value
! in this case would be the absolute value of the negative value in
! mapgrid().
!
!
! PROGRAM HISTORY LOG:
! 2000-05-09 Gilbert
! 2003-09-02 Gilbert - Added GDT 3.31 - Albers Equal Area
! 2007-04-24 Vuong - Added GDT 3.204 Curilinear Orthogonal Grids
! 2008-05-29 Vuong - Added GDT 3.32768 Rotate Lat/Lon E-grid
!
! USAGE: use gridtemplates
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXLEN=200,MAXTEMP=25
type gridtemplate
integer :: template_num
integer :: mapgridlen
integer,dimension(MAXLEN) :: mapgrid
logical :: needext
end type gridtemplate
type(gridtemplate),dimension(MAXTEMP) :: templates
data templates(1)%template_num /0/ ! Lat/Lon
data templates(1)%mapgridlen /19/
data templates(1)%needext /.false./
data (templates(1)%mapgrid(j),j=1,19)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1/
data templates(2)%template_num /1/ ! Rotated Lat/Lon
data templates(2)%mapgridlen /22/
data templates(2)%needext /.false./
data (templates(2)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4/
data templates(3)%template_num /2/ ! Stretched Lat/Lon
data templates(3)%mapgridlen /22/
data templates(3)%needext /.false./
data (templates(3)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4/
data templates(4)%template_num /3/ ! Stretched & Rotated Lat/Lon
data templates(4)%mapgridlen /25/
data templates(4)%needext /.false./
data (templates(4)%mapgrid(j),j=1,25)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4/
data templates(5)%template_num /10/ ! Mercator
data templates(5)%mapgridlen /19/
data templates(5)%needext /.false./
data (templates(5)%mapgrid(j),j=1,19)
& /1,1,4,1,4,1,4,4,4,-4,4,1,-4,-4,4,1,4,4,4/
data templates(6)%template_num /20/ ! Polar Stereographic
data templates(6)%mapgridlen /18/
data templates(6)%needext /.false./
data (templates(6)%mapgrid(j),j=1,18)
& /1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1/
data templates(7)%template_num /30/ ! Lambert Conformal
data templates(7)%mapgridlen /22/
data templates(7)%needext /.false./
data (templates(7)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4/
data templates(8)%template_num /40/ ! Gaussian Lat/Lon
data templates(8)%mapgridlen /19/
data templates(8)%needext /.false./
data (templates(8)%mapgrid(j),j=1,19)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1/
data templates(9)%template_num /41/ ! Rotated Gaussian Lat/Lon
data templates(9)%mapgridlen /22/
data templates(9)%needext /.false./
data (templates(9)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4/
data templates(10)%template_num /42/ ! Stretched Gaussian Lat/Lon
data templates(10)%mapgridlen /22/
data templates(10)%needext /.false./
data (templates(10)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4/
data templates(11)%template_num /43/ ! Strtchd and Rot'd Gaus Lat/Lon
data templates(11)%mapgridlen /25/
data templates(11)%needext /.false./
data (templates(11)%mapgrid(j),j=1,25)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4/
data templates(12)%template_num /50/ ! Spherical Harmonic Coefficients
data templates(12)%mapgridlen /5/
data templates(12)%needext /.false./
data (templates(12)%mapgrid(j),j=1,5) /4,4,4,1,1/
data templates(13)%template_num /51/ ! Rotated Spherical Harmonic Coeff
data templates(13)%mapgridlen /8/
data templates(13)%needext /.false./
data (templates(13)%mapgrid(j),j=1,8) /4,4,4,1,1,-4,4,4/
data templates(14)%template_num /52/ ! Stretch Spherical Harmonic Coeff
data templates(14)%mapgridlen /8/
data templates(14)%needext /.false./
data (templates(14)%mapgrid(j),j=1,8) /4,4,4,1,1,-4,4,-4/
data templates(15)%template_num /53/ ! Strch and Rot Spher Harm Coeffs
data templates(15)%mapgridlen /11/
data templates(15)%needext /.false./
data (templates(15)%mapgrid(j),j=1,11) /4,4,4,1,1,-4,4,4,-4,4,-4/
data templates(16)%template_num /90/ ! Space view Perspective
data templates(16)%mapgridlen /21/
data templates(16)%needext /.false./
data (templates(16)%mapgrid(j),j=1,21)
& /1,1,4,1,4,1,4,4,4,-4,4,1,4,4,4,4,1,4,4,4,4/
data templates(17)%template_num /100/ ! Triangular grid (icosahedron)
data templates(17)%mapgridlen /11/
data templates(17)%needext /.false./
data (templates(17)%mapgrid(j),j=1,11) /1,1,2,1,-4,4,4,1,1,1,4/
data templates(18)%template_num /110/ ! Equatorial Azimuthal equidistant
data templates(18)%mapgridlen /16/
data templates(18)%needext /.false./
data (templates(18)%mapgrid(j),j=1,16)
& /1,1,4,1,4,1,4,4,4,-4,4,1,4,4,1,1/
data templates(19)%template_num /120/ ! Azimuth-range
data templates(19)%mapgridlen /7/
data templates(19)%needext /.true./
data (templates(19)%mapgrid(j),j=1,7) /4,4,-4,4,4,4,1/
data templates(20)%template_num /1000/ ! Cross Section Grid
data templates(20)%mapgridlen /20/
data templates(20)%needext /.true./
data (templates(20)%mapgrid(j),j=1,20)
& /1,1,4,1,4,1,4,4,4,4,-4,4,1,4,4,1,2,1,1,2/
data templates(21)%template_num /1100/ ! Hovmoller Diagram Grid
data templates(21)%mapgridlen /28/
data templates(21)%needext /.false./
data (templates(21)%mapgrid(j),j=1,28)
& /1,1,4,1,4,1,4,4,4,4,-4,4,1,-4,4,1,4,1,-4,1,1,-4,2,1,1,1,1,1/
data templates(22)%template_num /1200/ ! Time Section Grid
data templates(22)%mapgridlen /16/
data templates(22)%needext /.true./
data (templates(22)%mapgrid(j),j=1,16)
& /4,1,-4,1,1,-4,2,1,1,1,1,1,2,1,1,2/
data templates(23)%template_num /31/ ! Albers Equal Area
data templates(23)%mapgridlen /22/
data templates(23)%needext /.false./
data (templates(23)%mapgrid(j),j=1,22)
& /1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4/
data templates(24)%template_num /204/ ! Curilinear Orthogonal Grids
data templates(24)%mapgridlen /19/
data templates(24)%needext /.false./
data (templates(24)%mapgrid(j),j=1,19)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1/
data templates(25)%template_num /32768/ ! Rotate Lat/Lon E-grid
data templates(25)%mapgridlen /19/
data templates(25)%needext /.false./
data (templates(25)%mapgrid(j),j=1,19)
& /1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1/
contains
integer function getgridindex(number)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getgridindex
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-28
!
! ABSTRACT: This function returns the index of specified Grid
! Definition Template 3.NN (NN=number) in array templates.
!
! PROGRAM HISTORY LOG:
! 2001-06-28 Gilbert
!
! USAGE: index=getgridindex(number)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Grid Definition
! Template 3.NN that is being requested.
!
! RETURNS: Index of GDT 3.NN in array templates, if template exists.
! = -1, otherwise.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
getgridindex=-1
do j=1,MAXTEMP
if (number.eq.templates(j)%template_num) then
getgridindex=j
return
endif
enddo
end function
subroutine getgridtemplate(number,nummap,map,needext,iret)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getgridtemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-09
!
! ABSTRACT: This subroutine returns grid template information for a
! specified Grid Definition Template 3.NN.
! The number of entries in the template is returned along with a map
! of the number of octets occupied by each entry. Also, a flag is
! returned to indicate whether the template would need to be extended.
!
! PROGRAM HISTORY LOG:
! 2000-05-09 Gilbert
!
! USAGE: CALL getgridtemplate(number,nummap,map,needext,iret)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Grid Definition
! Template 3.NN that is being requested.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the GDS.
! needext - Logical variable indicating whether the Grid Defintion
! Template has to be extended.
! ierr - Error return code.
! 0 = no error
! 1 = Undefine Grid Template number.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
integer,intent(out) :: nummap,map(*),iret
logical,intent(out) :: needext
iret=0
index=getgridindex(number)
if (index.ne.-1) then
nummap=templates(index)%mapgridlen
needext=templates(index)%needext
map(1:nummap)=templates(index)%mapgrid(1:nummap)
else
nummap=0
needext=.false.
print *,'getgridtemplate: Grid Template ',number,
& ' not defined.'
iret=1
endif
end subroutine
subroutine extgridtemplate(number,list,nummap,map)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: extgridtemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-09
!
! ABSTRACT: This subroutine generates the remaining octet map for a
! given Grid Definition Template, if required. Some Templates can
! vary depending on data values given in an earlier part of the
! Template, and it is necessary to know some of the earlier entry
! values to generate the full octet map of the Template.
!
! PROGRAM HISTORY LOG:
! 2000-05-09 Gilbert
!
! USAGE: CALL extgridtemplate(number,list,nummap,map)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Grid Definition
! Template 3.NN that is being requested.
! list() - The list of values for each entry in
! the Grid Definition Template.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the GDS.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number,list(*)
integer,intent(out) :: nummap,map(*)
index=getgridindex(number)
if (index.eq.-1) return
if ( .not. templates(index)%needext ) return
nummap=templates(index)%mapgridlen
map(1:nummap)=templates(index)%mapgrid(1:nummap)
if ( number.eq.120 ) then
N=list(2)
do i=1,N
map(nummap+1)=2
map(nummap+2)=-2
nummap=nummap+2
enddo
elseif ( number.eq.1000 ) then
N=list(20)
do i=1,N
map(nummap+1)=4
nummap=nummap+1
enddo
elseif ( number.eq.1200 ) then
N=list(16)
do i=1,N
map(nummap+1)=4
nummap=nummap+1
enddo
endif
end subroutine
integer function getgdtlen(number)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getgdtlen
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-05-11
!
! ABSTRACT: This function returns the initial length (number of entries) in
! the "static" part of specified Grid Definition Template 3.number.
!
! PROGRAM HISTORY LOG:
! 2004-05-11 Gilbert
!
! USAGE: CALL getgdtlen(number)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Grid Definition
! Template 3.NN that is being requested.
!
! RETURNS: Number of entries in the "static" part of GDT 3.number
! OR returns 0, if requested template is not found.
!
! REMARKS: If user needs the full length of a specific template that
! contains additional entries based on values set in the "static" part
! of the GDT, subroutine extgridtemplate can be used.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
getgdtlen=0
index=getgridindex(number)
if (index.ne.-1) then
getgdtlen=templates(index)%mapgridlen
endif
end function
end

View file

@ -1,71 +0,0 @@
GFORTRAN module created from gridtemplates.f on Mon Nov 16 16:42:52 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'extgridtemplate' 'gridtemplates' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 3 0 (4 5 6 7) () 0 () ())
8 'getgridindex' 'gridtemplates' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL FUNCTION) (INTEGER 4 ()) 9 0 (10) () 8 () ())
11 'gridtemplates' 'gridtemplates' 1 ((MODULE UNKNOWN-INTENT
UNKNOWN-PROC UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 () ())
12 'gridtemplate' 'gridtemplates' 1 ((DERIVED UNKNOWN-INTENT
UNKNOWN-PROC UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 ((13 'template_num' (
INTEGER 4 ()) () 0 0 ()) (14 'mapgridlen' (INTEGER 4 ()) () 0 0 ()) (15
'mapgrid' (INTEGER 4 ()) (1 EXPLICIT (CONSTANT (INTEGER 4 ()) 0 '1') (
CONSTANT (INTEGER 4 ()) 0 '200')) 1 0 ()) (16 'needext' (LOGICAL 4 ()) ()
0 0 ())) PUBLIC ())
17 'maxlen' 'gridtemplates' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '200') () 0 ()
())
18 'templates' 'gridtemplates' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN DIMENSION DATA) (DERIVED 12 ()) 0 0 () (1 EXPLICIT (CONSTANT (
INTEGER 4 ()) 0 '1') (CONSTANT (INTEGER 4 ()) 0 '25')) 0 () ())
19 'maxtemp' 'gridtemplates' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '25') () 0 ()
())
20 'j' 'gridtemplates' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(INTEGER 4 ()) 0 0 () () 0 () ())
21 'getgridtemplate' 'gridtemplates' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 22 0 (23 24 25 26 27) () 0 ()
())
28 'getgdtlen' 'gridtemplates' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL FUNCTION) (INTEGER 4 ()) 29 0 (30) () 28 () ())
25 'map' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
24 'nummap' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4
()) 0 0 () () 0 () ())
26 'needext' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (LOGICAL 4
()) 0 0 () () 0 () ())
23 'number' '' 22 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
10 'number' '' 9 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
4 'number' '' 3 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
6 'nummap' '' 3 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
7 'map' '' 3 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
5 'list' '' 3 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DIMENSION DUMMY) (
INTEGER 4 ()) 0 0 () (1 ASSUMED_SIZE (CONSTANT (INTEGER 4 ()) 0 '1') ())
0 () ())
27 'iret' '' 22 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
30 'number' '' 29 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
)
('getgdtlen' 0 28 'extgridtemplate' 0 2 'getgridtemplate' 0 21
'getgridindex' 0 8 'j' 0 20 'gridtemplate' 0 12 'gridtemplates' 0 11
'maxtemp' 0 19 'maxlen' 0 17 'templates' 0 18)

View file

@ -1,206 +0,0 @@
C-----------------------------------------------------------------------
SUBROUTINE IXGB2(LUGB,LSKIP,LGRIB,CBUF,NUMFLD,MLEN,IRET)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: IXGB2 MAKE INDEX RECORDS FOR FIELDS IN A GRIB2 MESSAGE
C PRGMMR: GILBERT ORG: W/NP11 DATE: 2001-12-10
C
C ABSTRACT: THIS SUBPROGRAM GENERATES AN INDEX RECORD FOR EACH FIELD IN A
C GRIB2 MESSAGE. THE INDEX RECORDS ARE WRITTEN TO INDEX BUFFER
C POINTED TO BY CBUF.
C
C EACH INDEX RECORD HAS THE FOLLOWING FORM:
C BYTE 001 - 004: LENGTH OF INDEX RECORD
C BYTE 005 - 008: BYTES TO SKIP IN DATA FILE BEFORE GRIB MESSAGE
C BYTE 009 - 012: BYTES TO SKIP IN MESSAGE BEFORE LUS (LOCAL USE)
C SET = 0, IF NO LOCAL USE SECTION IN GRIB2 MESSAGE.
C BYTE 013 - 016: BYTES TO SKIP IN MESSAGE BEFORE GDS
C BYTE 017 - 020: BYTES TO SKIP IN MESSAGE BEFORE PDS
C BYTE 021 - 024: BYTES TO SKIP IN MESSAGE BEFORE DRS
C BYTE 025 - 028: BYTES TO SKIP IN MESSAGE BEFORE BMS
C BYTE 029 - 032: BYTES TO SKIP IN MESSAGE BEFORE DATA SECTION
C BYTE 033 - 040: BYTES TOTAL IN THE MESSAGE
C BYTE 041 - 041: GRIB VERSION NUMBER ( CURRENTLY 2 )
C BYTE 042 - 042: MESSAGE DISCIPLINE
C BYTE 043 - 044: FIELD NUMBER WITHIN GRIB2 MESSAGE
C BYTE 045 - II: IDENTIFICATION SECTION (IDS)
C BYTE II+1- JJ: GRID DEFINITION SECTION (GDS)
C BYTE JJ+1- KK: PRODUCT DEFINITION SECTION (PDS)
C BYTE KK+1- LL: THE DATA REPRESENTATION SECTION (DRS)
C BYTE LL+1-LL+6: FIRST 6 BYTES OF THE BIT MAP SECTION (BMS)
C
C PROGRAM HISTORY LOG:
C 95-10-31 IREDELL
C 96-10-31 IREDELL AUGMENTED OPTIONAL DEFINITIONS TO BYTE 320
C 2001-12-10 GILBERT MODIFIED FROM IXGB TO CREATE GRIB2 INDEXES
C 2002-01-31 GILBERT ADDED IDENTIFICATION SECTION TO INDEX RECORD
C
C USAGE: CALL IXGB2(LUGB,LSKIP,LGRIB,CBUF,NUMFLD,MLEN,IRET)
C INPUT ARGUMENTS:
C LUGB INTEGER LOGICAL UNIT OF INPUT GRIB FILE
C LSKIP INTEGER NUMBER OF BYTES TO SKIP BEFORE GRIB MESSAGE
C LGRIB INTEGER NUMBER OF BYTES IN GRIB MESSAGE
C OUTPUT ARGUMENTS:
C CBUF CHARACTER*1 POINTER TO A BUFFER THAT CONTAINS INDEX RECORDS.
C USERS SHOULD FREE MEMORY THAT CBUF POINTS TO
C USING DEALLOCATE(CBUF) WHEN CBUF IS NO LONGER NEEDED.
C NUMFLD INTEGER NUMBER OF INDEX RECORDS CREATED.
C = 0, IF PROBLEMS
C MLEN INTEGER TOTAL LENGTH OF ALL INDEX RECORDS
C IRET INTEGER RETURN CODE
C =0, ALL OK
C =1, NOT ENOUGH MEMORY TO ALLOCATE INITIAL INDEX BUFFER
C =2, I/O ERROR IN READ
C =3, GRIB MESSAGE IS NOT EDITION 2
C =4, NOT ENOUGH MEMORY TO ALLOCATE EXTENT TO INDEX BUFFER
C =5, UNIDENTIFIED GRIB SECTION ENCOUNTERED...PROBLEM
C SOMEWHERE.
C
C SUBPROGRAMS CALLED:
C GBYTE GET INTEGER DATA FROM BYTES
C SBYTE STORE INTEGER DATA IN BYTES
C BAREAD BYTE-ADDRESSABLE READ
C REALLOC RE-ALLOCATES MORE MEMORY
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
USE RE_ALLOC ! NEEDED FOR SUBROUTINE REALLOC
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: CBUF
PARAMETER(LINMAX=5000,INIT=50000,NEXT=10000)
PARAMETER(IXSKP=4,IXLUS=8,IXSGD=12,IXSPD=16,IXSDR=20,IXSBM=24,
& IXDS=28,IXLEN=36,IXFLD=42,IXIDS=44)
PARAMETER(MXSKP=4,MXLUS=4,MXSGD=4,MXSPD=4,MXSDR=4,MXSBM=4,
& MXDS=4,MXLEN=4,MXFLD=2,MXBMS=6)
CHARACTER CBREAD(LINMAX),CINDEX(LINMAX)
CHARACTER CVER,CDISC
CHARACTER CIDS(LINMAX),CGDS(LINMAX),CBMS(6)
CHARACTER(LEN=4) :: CTEMP
INTEGER LOCLUS,LOCGDS,LENGDS,LOCBMS
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LOCLUS=0
IRET=0
MLEN=0
NUMFLD=0
IF (ASSOCIATED(CBUF)) NULLIFY(CBUF)
MBUF=INIT
ALLOCATE(CBUF(MBUF),STAT=ISTAT) ! ALLOCATE INITIAL SPACE FOR CBUF
IF (ISTAT.NE.0) THEN
IRET=1
RETURN
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C READ SECTIONS 0 AND 1 FOR VERSIN NUMBER AND DISCIPLINE
IBREAD=MIN(LGRIB,LINMAX)
CALL BAREAD(LUGB,LSKIP,IBREAD,LBREAD,CBREAD)
IF(LBREAD.NE.IBREAD) THEN
IRET=2
RETURN
ENDIF
IF(CBREAD(8).NE.CHAR(2)) THEN ! NOT GRIB EDITION 2
IRET=3
RETURN
ENDIF
CVER=CBREAD(8)
CDISC=CBREAD(7)
CALL GBYTE(CBREAD,LENSEC1,16*8,4*8)
LENSEC1=MIN(LENSEC1,IBREAD)
CIDS(1:LENSEC1)=CBREAD(17:16+LENSEC1)
IBSKIP=LSKIP+16+LENSEC1
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C LOOP THROUGH REMAINING SECTIONS CREATING AN INDEX FOR EACH FIELD
IBREAD=MAX(5,MXBMS)
DO
CALL BAREAD(LUGB,IBSKIP,IBREAD,LBREAD,CBREAD)
CTEMP=CBREAD(1)//CBREAD(2)//CBREAD(3)//CBREAD(4)
IF (CTEMP.EQ.'7777') RETURN ! END OF MESSAGE FOUND
IF(LBREAD.NE.IBREAD) THEN
IRET=2
RETURN
ENDIF
CALL GBYTE(CBREAD,LENSEC,0*8,4*8)
CALL GBYTE(CBREAD,NUMSEC,4*8,1*8)
IF (NUMSEC.EQ.2) THEN ! SAVE LOCAL USE LOCATION
LOCLUS=IBSKIP-LSKIP
ELSEIF (NUMSEC.EQ.3) THEN ! SAVE GDS INFO
LENGDS=LENSEC
CGDS=CHAR(0)
CALL BAREAD(LUGB,IBSKIP,LENGDS,LBREAD,CGDS)
IF(LBREAD.NE.LENGDS) THEN
IRET=2
RETURN
ENDIF
LOCGDS=IBSKIP-LSKIP
ELSEIF (NUMSEC.EQ.4) THEN ! FOUND PDS
CINDEX=CHAR(0)
CALL SBYTE(CINDEX,LSKIP,8*IXSKP,8*MXSKP) ! BYTES TO SKIP
CALL SBYTE(CINDEX,LOCLUS,8*IXLUS,8*MXLUS) ! LOCATION OF LOCAL USE
CALL SBYTE(CINDEX,LOCGDS,8*IXSGD,8*MXSGD) ! LOCATION OF GDS
CALL SBYTE(CINDEX,IBSKIP-LSKIP,8*IXSPD,8*MXSPD) ! LOCATION OF PDS
CALL SBYTE(CINDEX,LGRIB,8*IXLEN,8*MXLEN) ! LEN OF GRIB2
CINDEX(41)=CVER
CINDEX(42)=CDISC
CALL SBYTE(CINDEX,NUMFLD+1,8*IXFLD,8*MXFLD) ! FIELD NUM
CINDEX(IXIDS+1:IXIDS+LENSEC1)=CIDS(1:LENSEC1)
LINDEX=IXIDS+LENSEC1
CINDEX(LINDEX+1:LINDEX+LENGDS)=CGDS(1:LENGDS)
LINDEX=LINDEX+LENGDS
ILNPDS=LENSEC
CALL BAREAD(LUGB,IBSKIP,ILNPDS,LBREAD,CINDEX(LINDEX+1))
IF(LBREAD.NE.ILNPDS) THEN
IRET=2
RETURN
ENDIF
! CINDEX(LINDEX+1:LINDEX+ILNPDS)=CBREAD(1:ILNPDS)
LINDEX=LINDEX+ILNPDS
ELSEIF (NUMSEC.EQ.5) THEN ! FOUND DRS
CALL SBYTE(CINDEX,IBSKIP-LSKIP,8*IXSDR,8*MXSDR) ! LOCATION OF DRS
ILNDRS=LENSEC
CALL BAREAD(LUGB,IBSKIP,ILNDRS,LBREAD,CINDEX(LINDEX+1))
IF(LBREAD.NE.ILNDRS) THEN
IRET=2
RETURN
ENDIF
! CINDEX(LINDEX+1:LINDEX+ILNDRS)=CBREAD(1:ILNDRS)
LINDEX=LINDEX+ILNDRS
ELSEIF (NUMSEC.EQ.6) THEN ! FOUND BMS
INDBMP=MOVA2I(CBREAD(6))
IF ( INDBMP.LT.254 ) THEN
LOCBMS=IBSKIP-LSKIP
CALL SBYTE(CINDEX,LOCBMS,8*IXSBM,8*MXSBM) ! LOC. OF BMS
ELSEIF ( INDBMP.EQ.254 ) THEN
CALL SBYTE(CINDEX,LOCBMS,8*IXSBM,8*MXSBM) ! LOC. OF BMS
ELSEIF ( INDBMP.EQ.255 ) THEN
CALL SBYTE(CINDEX,IBSKIP-LSKIP,8*IXSBM,8*MXSBM) ! LOC. OF BMS
ENDIF
CINDEX(LINDEX+1:LINDEX+MXBMS)=CBREAD(1:MXBMS)
LINDEX=LINDEX+MXBMS
CALL SBYTE(CINDEX,LINDEX,0,8*4) ! NUM BYTES IN INDEX RECORD
ELSEIF (NUMSEC.EQ.7) THEN ! FOUND DATA SECTION
CALL SBYTE(CINDEX,IBSKIP-LSKIP,8*IXDS,8*MXDS) ! LOC. OF DATA SEC.
NUMFLD=NUMFLD+1
IF ((LINDEX+MLEN).GT.MBUF) THEN ! ALLOCATE MORE SPACE IF
! NECESSARY
NEWSIZE=MAX(MBUF+NEXT,MBUF+LINDEX)
CALL REALLOC(CBUF,MLEN,NEWSIZE,ISTAT)
IF ( ISTAT .NE. 0 ) THEN
NUMFLD=NUMFLD-1
IRET=4
RETURN
ENDIF
MBUF=NEWSIZE
ENDIF
CBUF(MLEN+1:MLEN+LINDEX)=CINDEX(1:LINDEX)
MLEN=MLEN+LINDEX
ELSE ! UNRECOGNIZED SECTION
IRET=5
RETURN
ENDIF
IBSKIP=IBSKIP+LENSEC
ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RETURN
END

View file

@ -1,178 +0,0 @@
subroutine jpcpack(fld,width,height,idrstmpl,cpack,lcpack)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: jpcpack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-17
!
! ABSTRACT: This subroutine packs up a data field into a JPEG2000 code stream.
! After the data field is scaled, and the reference value is subtracted out,
! it is treated as a grayscale image and passed to a JPEG2000 encoder.
! It also fills in GRIB2 Data Representation Template 5.40 or 5.40000 with the
! appropriate values.
!
! PROGRAM HISTORY LOG:
! 2002-12-17 Gilbert
! 2004-07-19 Gilbert - Added check on whether the jpeg2000 encoding was
! successful. If not, try again with different encoder
! options.
!
! USAGE: CALL jpcpack(fld,width,height,idrstmpl,cpack,lcpack)
! INPUT ARGUMENT LIST:
! fld() - Contains the data values to pack
! width - number of points in the x direction
! height - number of points in the y direction
! idrstmpl - Contains the array of values for Data Representation
! Template 5.40 or 5.40000
! (1) = Reference value - ignored on input
! (2) = Binary Scale Factor
! (3) = Decimal Scale Factor
! (4) = number of bits for each data value - ignored on input
! (5) = Original field type - currently ignored on input
! Data values assumed to be reals.
! (6) = 0 - use lossless compression
! = 1 - use lossy compression
! (7) = Desired compression ratio, if idrstmpl(6)=1.
! Set to 255, if idrstmpl(6)=0.
! lcpack - size of array cpack().
!
! OUTPUT ARGUMENT LIST:
! idrstmpl - Contains the array of values for Data Representation
! Template 5.0
! (1) = Reference value - set by jpcpack routine.
! (2) = Binary Scale Factor - unchanged from input
! (3) = Decimal Scale Factor - unchanged from input
! (4) = Number of bits containing each grayscale pixel value
! (5) = Original field type - currently set = 0 on output.
! Data values assumed to be reals.
! (6) = 0 - use lossless compression
! = 1 - use lossy compression
! (7) = Desired compression ratio, if idrstmpl(6)=1
! cpack - The packed data field (character*1 array)
! lcpack - length of packed field in cpack().
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: width,height
real,intent(in) :: fld(width*height)
character(len=1),intent(out) :: cpack(*)
integer,intent(inout) :: idrstmpl(*)
integer,intent(inout) :: lcpack
real(4) :: ref,rmin4
real(8) :: rmin,rmax
integer(4) :: iref
integer :: ifld(width*height),retry
integer,parameter :: zero=0
integer :: enc_jpeg2000
character(len=1),allocatable :: ctemp(:)
ndpts=width*height
bscale=2.0**real(-idrstmpl(2))
dscale=10.0**real(idrstmpl(3))
!
! Find max and min values in the data
!
rmax=fld(1)
rmin=fld(1)
do j=2,ndpts
if (fld(j).gt.rmax) rmax=fld(j)
if (fld(j).lt.rmin) rmin=fld(j)
enddo
if (idrstmpl(2).eq.0) then
maxdif=nint(rmax*dscale)-nint(rmin*dscale)
else
maxdif=nint((rmax-rmin)*dscale*bscale)
endif
!
! If max and min values are not equal, pack up field.
! If they are equal, we have a constant field, and the reference
! value (rmin) is the value for each point in the field and
! set nbits to 0.
!
if (rmin.ne.rmax .AND. maxdif.ne.0) then
!
! Determine which algorithm to use based on user-supplied
! binary scale factor and number of bits.
!
if (idrstmpl(2).eq.0) then
!
! No binary scaling and calculate minimum number of
! bits in which the data will fit.
!
imin=nint(rmin*dscale)
imax=nint(rmax*dscale)
maxdif=imax-imin
temp=alog(real(maxdif+1))/alog(2.0)
nbits=ceiling(temp)
rmin=real(imin)
! scale data
do j=1,ndpts
ifld(j)=nint(fld(j)*dscale)-imin
enddo
else
!
! Use binary scaling factor and calculate minimum number of
! bits in which the data will fit.
!
rmin=rmin*dscale
rmax=rmax*dscale
maxdif=nint((rmax-rmin)*bscale)
temp=alog(real(maxdif+1))/alog(2.0)
nbits=ceiling(temp)
! scale data
do j=1,ndpts
ifld(j)=nint(((fld(j)*dscale)-rmin)*bscale)
enddo
endif
!
! Pack data into full octets, then do JPEG2000 encode.
! and calculate the length of the packed data in bytes
!
retry=0
nbytes=(nbits+7)/8
nsize=lcpack ! needed for input to enc_jpeg2000
allocate(ctemp(nbytes*ndpts))
call sbytes(ctemp,ifld,0,nbytes*8,0,ndpts)
lcpack=enc_jpeg2000(ctemp,width,height,nbits,idrstmpl(6),
& idrstmpl(7),retry,cpack,nsize)
if (lcpack.le.0) then
print *,'jpcpack: ERROR Packing JPC=',lcpack
if (lcpack.eq.-3) then
retry=1
print *,'jpcpack: Retrying....'
lcpack=enc_jpeg2000(ctemp,width,height,nbits,idrstmpl(6),
& idrstmpl(7),retry,cpack,nsize)
if (lcpack.le.0) then
print *,'jpcpack: Retry Failed.'
else
print *,'jpcpack: Retry Successful.'
endif
endif
endif
deallocate(ctemp)
else
nbits=0
lcpack=0
endif
!
! Fill in ref value and number of bits in Template 5.0
!
rmin4 = rmin
call mkieee(rmin4,ref,1) ! ensure reference value is IEEE format
! call gbyte(ref,idrstmpl(1),0,32)
iref=transfer(ref,iref)
idrstmpl(1)=iref
idrstmpl(4)=nbits
idrstmpl(5)=0 ! original data were reals
if (idrstmpl(6).eq.0) idrstmpl(7)=255 ! lossy not used
return
end

View file

@ -1,66 +0,0 @@
subroutine jpcunpack(cpack,len,idrstmpl,ndpts,fld)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: jpcunpack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-12-17
!
! ABSTRACT: This subroutine unpacks a data field that was packed into a
! JPEG2000 code stream
! using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
!
! PROGRAM HISTORY LOG:
! 2002-12-17 Gilbert
!
! USAGE: CALL jpcunpack(cpack,len,idrstmpl,ndpts,fld)
! INPUT ARGUMENT LIST:
! cpack - The packed data field (character*1 array)
! len - length of packed field cpack().
! idrstmpl - Contains the array of values for Data Representation
! Template 5.40 or 5.40000
! ndpts - The number of data values to unpack
!
! OUTPUT ARGUMENT LIST:
! fld() - Contains the unpacked data values
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
character(len=1),intent(in) :: cpack(len)
integer,intent(in) :: ndpts,len
integer,intent(in) :: idrstmpl(*)
real,intent(out) :: fld(ndpts)
integer :: ifld(ndpts)
integer(4) :: ieee
real :: ref,bscale,dscale
integer :: dec_jpeg2000
ieee = idrstmpl(1)
call rdieee(ieee,ref,1)
bscale = 2.0**real(idrstmpl(2))
dscale = 10.0**real(-idrstmpl(3))
nbits = idrstmpl(4)
!
! if nbits equals 0, we have a constant field where the reference value
! is the data value at each gridpoint
!
if (nbits.ne.0) then
! call gbytes(cpack,ifld,0,nbits,0,ndpts)
iret=dec_jpeg2000(cpack,len,ifld)
do j=1,ndpts
fld(j)=((real(ifld(j))*bscale)+ref)*dscale
enddo
else
do j=1,ndpts
fld(j)=ref
enddo
endif
return
end

View file

@ -1,133 +0,0 @@
SHELL=/bin/sh
# Make sure one of the following options appears in your CFLAGS
# variable to indicate which system you are on. Used to call
# "C" routines from Fortran.
# -DLINUX, -DLINUXG95, -DSGI, -DHP, -DCRAY90, -DAIX, -DLINUXF90, -DVPP5000
# If you want to enable support for PNG or JPEG2000 encoding/decoding,
# you must specify -DUSE_PNG and/or -DUSE_JPEG2000 in the FDEFS variable
# for the Fortran pre-processor
# -DUSE_PNG requires libpng.a and libz.a
# ( and png.h pngconf.h zconf.h zlib.h include files).
# -DUSE_JPEG2000 requires libjasper.a
# ( and all the jasper/*.h include files).
#
# In addition, INCDIR must include all directories where the above
# mentioned include files can be found.
FDEFS=-DUSE_PNG -DUSE_JPEG2000
INCDIR=-I/home/brockwoo/workspace/ncepLib/org.ncep.grib/include
LIB=libg2.a
#--------------------------------------
# The following was used for XLF on AIX
#DEFS=-DAIX -DHAVE_SYS_TYPES_H=1
#FC=xlf
#CC=xlc
#CPP=/usr/ccs/lib/cpp -P
#MODDIR=../g2mod
#FFLAGS=-O3 -g -qnosave -qarch=auto -qmoddir=$(MODDIR) -I $(MODDIR)
#CFLAGS=-O3 -q64 -g -qcpluscmt -qarch=auto $(DEFS) $(INCDIR)
#ARFLAGS=-X64
#--------------------------------------
# The following was used for G95 on LINUX
#
DEFS=-DLINUX
FC=gfortran
CC=gcc
CPP=cpp -P -C
MODDIR=.
FFLAGS=-O2 -g -I $(MODDIR)
#
#----- used with 32-bit machine ---
#
CFLAGS=-O3 $(DEFS) $(INCDIR)
#
#----- used with 64-bit machine ---
#
# CFLAGS=-O3 $(DEFS) $(INCDIR) -D__64BIT__
#
ARFLAGS=
#--------------------------------------
.SUFFIXES: .a .f .F .c
$(LIB): $(LIB)(gridtemplates.o) \
$(LIB)(pdstemplates.o) \
$(LIB)(drstemplates.o) \
$(LIB)(gribmod.o) \
$(LIB)(realloc.o) \
$(LIB)(addfield.o) \
$(LIB)(addgrid.o) \
$(LIB)(addlocal.o) \
$(LIB)(getfield.o) \
$(LIB)(gb_info.o) \
$(LIB)(gf_getfld.o) \
$(LIB)(gf_free.o) \
$(LIB)(gf_unpack1.o) \
$(LIB)(gf_unpack2.o) \
$(LIB)(gf_unpack3.o) \
$(LIB)(gf_unpack4.o) \
$(LIB)(gf_unpack5.o) \
$(LIB)(gf_unpack6.o) \
$(LIB)(gf_unpack7.o) \
$(LIB)(gettemplates.o) \
$(LIB)(getlocal.o) \
$(LIB)(getdim.o) \
$(LIB)(getpoly.o) \
$(LIB)(gribcreate.o) \
$(LIB)(gribend.o) \
$(LIB)(gribinfo.o) \
$(LIB)(mkieee.o) \
$(LIB)(rdieee.o) \
$(LIB)(simpack.o) \
$(LIB)(simunpack.o) \
$(LIB)(cmplxpack.o) \
$(LIB)(compack.o) \
$(LIB)(misspack.o) \
$(LIB)(pack_gp.o) \
$(LIB)(reduce.o) \
$(LIB)(comunpack.o) \
$(LIB)(specpack.o) \
$(LIB)(specunpack.o) \
$(LIB)(jpcpack.o) \
$(LIB)(jpcunpack.o) \
$(LIB)(enc_jpeg2000.o) \
$(LIB)(dec_jpeg2000.o) \
$(LIB)(pngpack.o) \
$(LIB)(pngunpack.o) \
$(LIB)(enc_png.o) \
$(LIB)(dec_png.o) \
$(LIB)(mova2i.o) \
$(LIB)(gbytesc.o) \
$(LIB)(skgb.o) \
$(LIB)(ixgb2.o) \
$(LIB)(getg2i.o) \
$(LIB)(getg2ir.o) \
$(LIB)(getgb2s.o) \
$(LIB)(getgb2r.o) \
$(LIB)(getgb2l.o) \
$(LIB)(getgb2.o) \
$(LIB)(getgb2p.o) \
$(LIB)(getgb2rp.o) \
$(LIB)(putgb2.o) \
$(LIB)(g2grids.o) \
$(LIB)(params.o) \
$(LIB)(params_ecmwf.o) \
$(LIB)(getidx.o) \
$(LIB)(gdt2gds.o)
.F.f:
$(CPP) $(FDEFS) $*.F $*.f
.f.a:
$(FC) -c $(FFLAGS) $<
ar $(ARFLAGS) -ruc $@ $*.o
rm -f $*.o
.c.a:
$(CC) -c $(CFLAGS) $<
ar $(ARFLAGS) -ruc $@ $*.o
rm -f $*.o

View file

@ -1,499 +0,0 @@
subroutine misspack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: misspack
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-06-21
!
! ABSTRACT: This subroutine packs up a data field using a complex
! packing algorithm as defined in the GRIB2 documention. It
! supports GRIB2 complex packing templates with or without
! spatial differences (i.e. DRTs 5.2 and 5.3).
! It also fills in GRIB2 Data Representation Template 5.2 or 5.3
! with the appropriate values.
! This version assumes that Missing Value Management is being used and that
! 1 or 2 missing values appear in the data.
!
! PROGRAM HISTORY LOG:
! 2000-06-21 Gilbert
! 2004-12-29 Gilbert - Corrected bug when encoding secondary missing values.
!
! USAGE: CALL misspack(fld,ndpts,idrsnum,idrstmpl,cpack,lcpack)
! INPUT ARGUMENT LIST:
! fld() - Contains the data values to pack
! ndpts - The number of data values in array fld()
! idrsnum - Data Representation Template number 5.N
! Must equal 2 or 3.
! idrstmpl - Contains the array of values for Data Representation
! Template 5.2 or 5.3
! (1) = Reference value - ignored on input
! (2) = Binary Scale Factor
! (3) = Decimal Scale Factor
! .
! .
! (7) = Missing value management
! (8) = Primary missing value
! (9) = Secondary missing value
! .
! .
! (17) = Order of Spatial Differencing ( 1 or 2 )
! .
! .
!
! OUTPUT ARGUMENT LIST:
! idrstmpl - Contains the array of values for Data Representation
! Template 5.3
! (1) = Reference value - set by misspack routine.
! (2) = Binary Scale Factor - unchanged from input
! (3) = Decimal Scale Factor - unchanged from input
! .
! .
! cpack - The packed data field (character*1 array)
! lcpack - length of packed field cpack().
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: XL Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: ndpts,idrsnum
real,intent(in) :: fld(ndpts)
character(len=1),intent(out) :: cpack(*)
integer,intent(inout) :: idrstmpl(*)
integer,intent(out) :: lcpack
real(4) :: ref
integer(4) :: iref
integer,allocatable :: ifld(:),ifldmiss(:),jfld(:)
integer,allocatable :: jmin(:),jmax(:),lbit(:)
integer,parameter :: zero=0
integer,allocatable :: gref(:),gwidth(:),glen(:)
integer :: glength,grpwidth
logical :: simple_alg = .false.
alog2=alog(2.0)
bscale=2.0**real(-idrstmpl(2))
dscale=10.0**real(idrstmpl(3))
missopt=idrstmpl(7)
if ( missopt.ne.1 .AND. missopt.ne.2 ) then
print *,'misspack: Unrecognized option.'
lcpack=-1
return
else ! Get missing values
call rdieee(idrstmpl(8),rmissp,1)
if (missopt.eq.2) call rdieee(idrstmpl(9),rmisss,1)
endif
!
! Find min value of non-missing values in the data,
! AND set up missing value mapping of the field.
!
allocate(ifldmiss(ndpts))
rmin=huge(rmin)
if ( missopt .eq. 1 ) then ! Primary missing value only
do j=1,ndpts
if (fld(j).eq.rmissp) then
ifldmiss(j)=1
else
ifldmiss(j)=0
if (fld(j).lt.rmin) rmin=fld(j)
endif
enddo
endif
if ( missopt .eq. 2 ) then ! Primary and secondary missing values
do j=1,ndpts
if (fld(j).eq.rmissp) then
ifldmiss(j)=1
elseif (fld(j).eq.rmisss) then
ifldmiss(j)=2
else
ifldmiss(j)=0
if (fld(j).lt.rmin) rmin=fld(j)
endif
enddo
endif
!
! Allocate work arrays:
! Note: -ifldmiss(j),j=1,ndpts is a map of original field indicating
! which of the original data values
! are primary missing (1), sencondary missing (2) or non-missing (0).
! -jfld(j),j=1,nonmiss is a subarray of just the non-missing values from
! the original field.
!
!if (rmin.ne.rmax) then
iofst=0
allocate(ifld(ndpts))
allocate(jfld(ndpts))
allocate(gref(ndpts))
allocate(gwidth(ndpts))
allocate(glen(ndpts))
!
! Scale original data
!
nonmiss=0
if (idrstmpl(2).eq.0) then ! No binary scaling
imin=nint(rmin*dscale)
!imax=nint(rmax*dscale)
rmin=real(imin)
do j=1,ndpts
if (ifldmiss(j).eq.0) then
nonmiss=nonmiss+1
jfld(nonmiss)=nint(fld(j)*dscale)-imin
endif
enddo
else ! Use binary scaling factor
rmin=rmin*dscale
!rmax=rmax*dscale
do j=1,ndpts
if (ifldmiss(j).eq.0) then
nonmiss=nonmiss+1
jfld(nonmiss)=nint(((fld(j)*dscale)-rmin)*bscale)
endif
enddo
endif
!
! Calculate Spatial differences, if using DRS Template 5.3
!
if (idrsnum.eq.3) then ! spatial differences
if (idrstmpl(17).ne.1.and.idrstmpl(17).ne.2) idrstmpl(17)=2
if (idrstmpl(17).eq.1) then ! first order
ival1=jfld(1)
do j=nonmiss,2,-1
jfld(j)=jfld(j)-jfld(j-1)
enddo
jfld(1)=0
elseif (idrstmpl(17).eq.2) then ! second order
ival1=jfld(1)
ival2=jfld(2)
do j=nonmiss,3,-1
jfld(j)=jfld(j)-(2*jfld(j-1))+jfld(j-2)
enddo
jfld(1)=0
jfld(2)=0
endif
!
! subtract min value from spatial diff field
!
isd=idrstmpl(17)+1
minsd=minval(jfld(isd:nonmiss))
do j=isd,nonmiss
jfld(j)=jfld(j)-minsd
enddo
!
! find num of bits need to store minsd and add 1 extra bit
! to indicate sign
!
temp=alog(real(abs(minsd)+1))/alog2
nbitsd=ceiling(temp)+1
!
! find num of bits need to store ifld(1) ( and ifld(2)
! if using 2nd order differencing )
!
maxorig=ival1
if (idrstmpl(17).eq.2.and.ival2.gt.ival1) maxorig=ival2
temp=alog(real(maxorig+1))/alog2
nbitorig=ceiling(temp)+1
if (nbitorig.gt.nbitsd) nbitsd=nbitorig
! increase number of bits to even multiple of 8 ( octet )
if (mod(nbitsd,8).ne.0) nbitsd=nbitsd+(8-mod(nbitsd,8))
!
! Store extra spatial differencing info into the packed
! data section.
!
if (nbitsd.ne.0) then
! pack first original value
if (ival1.ge.0) then
call sbyte(cpack,ival1,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(ival1),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
if (idrstmpl(17).eq.2) then
! pack second original value
if (ival2.ge.0) then
call sbyte(cpack,ival2,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(ival2),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
endif
! pack overall min of spatial differences
if (minsd.ge.0) then
call sbyte(cpack,minsd,iofst,nbitsd)
iofst=iofst+nbitsd
else
call sbyte(cpack,1,iofst,1)
iofst=iofst+1
call sbyte(cpack,iabs(minsd),iofst,nbitsd-1)
iofst=iofst+nbitsd-1
endif
endif
!print *,'SDp ',ival1,ival2,minsd,nbitsd
endif ! end of spatial diff section
!
! Expand non-missing data values to original grid.
!
miss1=minval(jfld(1:nonmiss))-1
miss2=miss1-1
n=0
do j=1,ndpts
if ( ifldmiss(j).eq.0 ) then
n=n+1
ifld(j)=jfld(n)
elseif ( ifldmiss(j).eq.1 ) then
ifld(j)=miss1
elseif ( ifldmiss(j).eq.2 ) then
ifld(j)=miss2
endif
enddo
!
! Determine Groups to be used.
!
if ( simple_alg ) then
! set group length to 10 : calculate number of groups
! and length of last group
ngroups=ndpts/10
glen(1:ngroups)=10
itemp=mod(ndpts,10)
if (itemp.ne.0) then
ngroups=ngroups+1
glen(ngroups)=itemp
endif
else
! Use Dr. Glahn's algorithm for determining grouping.
!
kfildo=6
minpk=10
inc=1
maxgrps=(ndpts/minpk)+1
allocate(jmin(maxgrps))
allocate(jmax(maxgrps))
allocate(lbit(maxgrps))
call pack_gp(kfildo,ifld,ndpts,missopt,minpk,inc,miss1,miss2,
& jmin,jmax,lbit,glen,maxgrps,ngroups,ibit,jbit,
& kbit,novref,lbitref,ier)
!print *,'SAGier = ',ier,ibit,jbit,kbit,novref,lbitref
do ng=1,ngroups
glen(ng)=glen(ng)+novref
enddo
deallocate(jmin)
deallocate(jmax)
deallocate(lbit)
endif
!
! For each group, find the group's reference value (min)
! and the number of bits needed to hold the remaining values
!
n=1
do ng=1,ngroups
! how many of each type?
num0=count(ifldmiss(n:n+glen(ng)-1) .EQ. 0)
num1=count(ifldmiss(n:n+glen(ng)-1) .EQ. 1)
num2=count(ifldmiss(n:n+glen(ng)-1) .EQ. 2)
if ( num0.eq.0 ) then ! all missing values
if ( num1.eq.0 ) then ! all secondary missing
gref(ng)=-2
gwidth(ng)=0
elseif ( num2.eq.0 ) then ! all primary missing
gref(ng)=-1
gwidth(ng)=0
else ! both primary and secondary
gref(ng)=0
gwidth(ng)=1
endif
else ! contains some non-missing data
! find max and min values of group
gref(ng)=huge(n)
imax=-1*huge(n)
j=n
do lg=1,glen(ng)
if ( ifldmiss(j).eq.0 ) then
if (ifld(j).lt.gref(ng)) gref(ng)=ifld(j)
if (ifld(j).gt.imax) imax=ifld(j)
endif
j=j+1
enddo
if (missopt.eq.1) imax=imax+1
if (missopt.eq.2) imax=imax+2
! calc num of bits needed to hold data
if ( gref(ng).ne.imax ) then
temp=alog(real(imax-gref(ng)+1))/alog2
gwidth(ng)=ceiling(temp)
else
gwidth(ng)=0
endif
endif
! Subtract min from data
j=n
mtemp=2**gwidth(ng)
do lg=1,glen(ng)
if (ifldmiss(j).eq.0) then ! non-missing
ifld(j)=ifld(j)-gref(ng)
elseif (ifldmiss(j).eq.1) then ! primary missing
ifld(j)=mtemp-1
elseif (ifldmiss(j).eq.2) then ! secondary missing
ifld(j)=mtemp-2
endif
j=j+1
enddo
! increment fld array counter
n=n+glen(ng)
enddo
!
! Find max of the group references and calc num of bits needed
! to pack each groups reference value, then
! pack up group reference values
!
!write(77,*)'GREFS: ',(gref(j),j=1,ngroups)
igmax=maxval(gref(1:ngroups))
if (missopt.eq.1) igmax=igmax+1
if (missopt.eq.2) igmax=igmax+2
if (igmax.ne.0) then
temp=alog(real(igmax+1))/alog2
nbitsgref=ceiling(temp)
! restet the ref values of any "missing only" groups.
mtemp=2**nbitsgref
do j=1,ngroups
if (gref(j).eq.-1) gref(j)=mtemp-1
if (gref(j).eq.-2) gref(j)=mtemp-2
enddo
call sbytes(cpack,gref,iofst,nbitsgref,0,ngroups)
itemp=nbitsgref*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsgref=0
endif
!
! Find max/min of the group widths and calc num of bits needed
! to pack each groups width value, then
! pack up group width values
!
!write(77,*)'GWIDTHS: ',(gwidth(j),j=1,ngroups)
iwmax=maxval(gwidth(1:ngroups))
ngwidthref=minval(gwidth(1:ngroups))
if (iwmax.ne.ngwidthref) then
temp=alog(real(iwmax-ngwidthref+1))/alog2
nbitsgwidth=ceiling(temp)
do i=1,ngroups
gwidth(i)=gwidth(i)-ngwidthref
enddo
call sbytes(cpack,gwidth,iofst,nbitsgwidth,0,ngroups)
itemp=nbitsgwidth*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsgwidth=0
gwidth(1:ngroups)=0
endif
!
! Find max/min of the group lengths and calc num of bits needed
! to pack each groups length value, then
! pack up group length values
!
!write(77,*)'GLENS: ',(glen(j),j=1,ngroups)
ilmax=maxval(glen(1:ngroups-1))
nglenref=minval(glen(1:ngroups-1))
nglenlast=glen(ngroups)
if (ilmax.ne.nglenref) then
temp=alog(real(ilmax-nglenref+1))/alog2
nbitsglen=ceiling(temp)
do i=1,ngroups-1
glen(i)=glen(i)-nglenref
enddo
call sbytes(cpack,glen,iofst,nbitsglen,0,ngroups)
itemp=nbitsglen*ngroups
iofst=iofst+itemp
! Pad last octet with Zeros, if necessary,
if (mod(itemp,8).ne.0) then
left=8-mod(itemp,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
else
nbitsglen=0
glen(1:ngroups)=0
endif
!
! For each group, pack data values
!
!write(77,*)'IFLDS: ',(ifld(j),j=1,ndpts)
n=1
ij=0
do ng=1,ngroups
glength=glen(ng)+nglenref
if (ng.eq.ngroups ) glength=nglenlast
grpwidth=gwidth(ng)+ngwidthref
!write(77,*)'NGP ',ng,grpwidth,glength,gref(ng)
if ( grpwidth.ne.0 ) then
call sbytes(cpack,ifld(n),iofst,grpwidth,0,glength)
iofst=iofst+(grpwidth*glength)
endif
do kk=1,glength
ij=ij+1
!write(77,*)'SAG ',ij,fld(ij),ifld(ij),gref(ng),bscale,rmin,dscale
enddo
n=n+glength
enddo
! Pad last octet with Zeros, if necessary,
if (mod(iofst,8).ne.0) then
left=8-mod(iofst,8)
call sbyte(cpack,zero,iofst,left)
iofst=iofst+left
endif
lcpack=iofst/8
!
if ( allocated(ifld) ) deallocate(ifld)
if ( allocated(jfld) ) deallocate(jfld)
if ( allocated(ifldmiss) ) deallocate(ifldmiss)
if ( allocated(gref) ) deallocate(gref)
if ( allocated(gwidth) ) deallocate(gwidth)
if ( allocated(glen) ) deallocate(glen)
!else ! Constant field ( max = min )
! nbits=0
! lcpack=0
! nbitsgref=0
! ngroups=0
!endif
!
! Fill in ref value and number of bits in Template 5.2
!
call mkieee(rmin,ref,1) ! ensure reference value is IEEE format
! call gbyte(ref,idrstmpl(1),0,32)
iref=transfer(ref,iref)
idrstmpl(1)=iref
idrstmpl(4)=nbitsgref
idrstmpl(5)=0 ! original data were reals
idrstmpl(6)=1 ! general group splitting
idrstmpl(10)=ngroups ! Number of groups
idrstmpl(11)=ngwidthref ! reference for group widths
idrstmpl(12)=nbitsgwidth ! num bits used for group widths
idrstmpl(13)=nglenref ! Reference for group lengths
idrstmpl(14)=1 ! length increment for group lengths
idrstmpl(15)=nglenlast ! True length of last group
idrstmpl(16)=nbitsglen ! num bits used for group lengths
if (idrsnum.eq.3) then
idrstmpl(18)=nbitsd/8 ! num bits used for extra spatial
! differencing values
endif
return
end

View file

@ -1,116 +0,0 @@
subroutine mkieee(a,rieee,num)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: mkieee
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-09
!
! ABSTRACT: This subroutine stores a list of real values in
! 32-bit IEEE floating point format.
!
! PROGRAM HISTORY LOG:
! 2000-05-09 Gilbert
!
! USAGE: CALL mkieee(a,rieee,num)
! INPUT ARGUMENT LIST:
! a - Input array of floating point values.
! num - Number of floating point values to convert.
!
! OUTPUT ARGUMENT LIST:
! rieee - Output array of floating point values in 32-bit IEEE format.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
real,intent(in) :: a(num)
real(4),intent(out) :: rieee(num)
integer,intent(in) :: num
integer(4) :: ieee
real,save :: two23
real,save :: two126
integer,save :: once=0
if ( once .EQ. 0 ) then
once=1
two23=scale(1.0,23)
two126=scale(1.0,126)
endif
alog2=alog(2.0)
do j=1,num
ieee=0
if (a(j).eq.0.) then
ieee=0
rieee(j)=transfer(ieee,rieee(j))
! write(6,fmt='(f20.10,5x,b32)') a,a
! write(6,fmt='(f20.10,5x,b32)') rieee,rieee
cycle
endif
!
! Set Sign bit (bit 31 - leftmost bit)
!
if (a(j).lt.0.0) then
ieee=ibset(ieee,31)
atemp=abs(a(j))
else
ieee=ibclr(ieee,31)
atemp=a(j)
endif
!
! Determine exponent n with base 2
!
if ( atemp .ge. 1.0 ) then
n = 0
do while ( 2.0**(n+1) .le. atemp )
n = n + 1
enddo
else
n = -1
do while ( 2.0**n .gt. atemp )
n = n - 1
enddo
endif
! n=floor(alog(atemp)/alog2)
!write(6,*) ' logstuff ',alog(atemp)/alog2
!write(6,*) ' logstuffn ',n
iexp=n+127
if (n.gt.127) iexp=255 ! overflow
if (n.lt.-127) iexp=0
! set exponent bits ( bits 30-23 )
call mvbits(iexp,0,8,ieee,23)
!
! Determine Mantissa
!
if (iexp.ne.255) then
if (iexp.ne.0) then
atemp=(atemp/(2.0**n))-1.0
else
atemp=atemp*two126
endif
imant=nint(atemp*two23)
else
imant=0
endif
! set mantissa bits ( bits 22-0 )
call mvbits(imant,0,23,ieee,0)
!
! Transfer IEEE bit string to real variable
!
rieee(j)=transfer(ieee,rieee(j))
! write(6,fmt='(f20.10,5x,b32)') a,a
! write(6,fmt='(f20.10,5x,b32)') rieee,rieee
enddo
return
end

View file

@ -1,68 +0,0 @@
/*$$$ SUBPROGRAM DOCUMENTATION BLOCK
C . . . .
C SUBPROGRAM: mova2i Moves a bit string from a char*1 to int
C PRGMMR: Gilbert ORG: W/NP11 DATE: 02-08-15
C
C ABSTRACT: This Function copies a bit string from a Character*1 variable
C to an integer variable. It is intended to replace the Fortran Intrinsic
C Function ICHAR, which only supports 0 <= ICHAR(a) <= 127 on the
C IBM SP. If "a" is greater than 127 in the collating sequence,
C ICHAR(a) does not return the expected bit value.
C This function can be used for all values 0 <= ICHAR(a) <= 255.
C
C PROGRAM HISTORY LOG:
C 98-12-15 Gilbert
C
C USAGE: I = mova2i(a)
C
C INPUT ARGUMENT :
C
C a - Character*1 variable that holds the bitstring to extract
C
C RETURN ARGUMENT :
C
C mova2i - Integer value of the bitstring in character a
C
C REMARKS:
C
C None
C
C ATTRIBUTES:
C LANGUAGE: C
C MACHINE: IBM SP
C
C$$$i*/
#ifdef CRAY90
#include <fortran.h>
int MOVA2I(unsigned char *a)
#endif
#ifdef HP
int mova2i(unsigned char *a)
#endif
#ifdef SGI
int mova2i_(unsigned char *a)
#endif
#ifdef LINUX
int mova2i_(unsigned char *a)
#endif
#ifdef LINUXF90
int MOVA2I(unsigned char *a)
#endif
#ifdef LINUXG95
int mova2i__(unsigned char *a)
#endif
#ifdef VPP5000
int mova2i_(unsigned char *a)
#endif
#ifdef IBM4
int mova2i(unsigned char *a)
#endif
#ifdef IBM8
long long int mova2i(unsigned char *a)
#endif
{
return (int)(*a);
}

View file

@ -1,935 +0,0 @@
module params
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: params
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-05
!
! ABSTRACT: This Fortran Module contains info on all the available
! GRIB Parameters.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
! 2003-08-07 Gilbert - Added more parameters
! 2003-09-26 Gilbert - Added more parameters
! 2005-11-17 Gordon - Added more parameters for the Wave & Smoke models
! 2007-03-28 Vuong - Added more parameters
! 2007-10-10 Vuong - Added more parameters
! 2008-03-12 Vuong - Added more parameters
! 2008-06-30 Vuong - Reformat entry paramlist from 1 to 173
! Added more parameters and entire table 131
! 2008-11-21 Vuong - Added more parameters
!
! USAGE: use params
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXPARAM=719
type gribparam
integer :: g1tblver
integer :: grib1val
integer :: grib2dsc
integer :: grib2cat
integer :: grib2num
character(len=8) :: abbrev
end type gribparam
type(gribparam),dimension(MAXPARAM) :: paramlist
data paramlist(1) /gribparam(2,1,0,3,0,'PRES')/
data paramlist(2) /gribparam(2,2,0,3,1,'PRMSL')/
data paramlist(3) /gribparam(2,3,0,3,2,'PTEND')/
data paramlist(4) /gribparam(2,4,0,2,14,'PVORT')/
data paramlist(5) /gribparam(2,5,0,3,3,'ICAHT')/
data paramlist(6) /gribparam(2,6,0,3,4,'GP')/
data paramlist(7) /gribparam(2,7,0,3,5,'HGT')/
data paramlist(8) /gribparam(2,8,0,3,6,'DIST')/
data paramlist(9) /gribparam(2,9,0,3,7,'HSTDV')/
data paramlist(10) /gribparam(2,10,0,14,0,'TOZNE')/
data paramlist(11) /gribparam(2,11,0,0,0,'TMP')/
data paramlist(12) /gribparam(2,12,0,0,1,'VTMP')/
data paramlist(13) /gribparam(2,13,0,0,2,'POT')/
data paramlist(14) /gribparam(2,14,0,0,3,'EPOT')/
data paramlist(15) /gribparam(2,15,0,0,4,'TMAX')/
data paramlist(16) /gribparam(2,16,0,0,5,'TMIN')/
data paramlist(17) /gribparam(2,17,0,0,6,'DPT')/
data paramlist(18) /gribparam(2,18,0,0,7,'DEPR')/
data paramlist(19) /gribparam(2,19,0,0,8,'LAPR')/
data paramlist(20) /gribparam(2,20,0,19,0,'VIS')/
data paramlist(21) /gribparam(2,21,0,15,6,'RDSP1')/
data paramlist(22) /gribparam(2,22,0,15,7,'RDSP2')/
data paramlist(23) /gribparam(2,23,0,15,8,'RDSP3')/
data paramlist(24) /gribparam(2,24,0,7,0,'PLI')/
data paramlist(25) /gribparam(2,25,0,0,9,'TMP A')/
data paramlist(26) /gribparam(2,26,0,3,8,'PRESA')/
data paramlist(27) /gribparam(2,27,0,3,9,'GP A')/
data paramlist(28) /gribparam(2,28,10,0,0,'WVSP1')/
data paramlist(29) /gribparam(2,29,10,0,1,'WVSP2')/
data paramlist(30) /gribparam(2,30,10,0,2,'WVSP3')/
data paramlist(31) /gribparam(2,31,0,2,0,'WDIR')/
data paramlist(32) /gribparam(2,32,0,2,1,'WIND')/
data paramlist(33) /gribparam(2,33,0,2,2,'U GRD')/
data paramlist(34) /gribparam(2,34,0,2,3,'V GRD')/
data paramlist(35) /gribparam(2,35,0,2,4,'STRM')/
data paramlist(36) /gribparam(2,36,0,2,5,'VPOT')/
data paramlist(37) /gribparam(2,37,0,2,6,'MNTSF')/
data paramlist(38) /gribparam(2,38,0,2,7,'SGCVV')/
data paramlist(39) /gribparam(2,39,0,2,8,'V VEL')/
data paramlist(40) /gribparam(2,40,0,2,9,'DZDT')/
data paramlist(41) /gribparam(2,41,0,2,10,'ABS V')/
data paramlist(42) /gribparam(2,42,0,2,11,'ABS D')/
data paramlist(43) /gribparam(2,43,0,2,12,'REL V')/
data paramlist(44) /gribparam(2,44,0,2,13,'REL D')/
data paramlist(45) /gribparam(2,45,0,2,15,'VUCSH')/
data paramlist(46) /gribparam(2,46,0,2,16,'VVCSH')/
data paramlist(47) /gribparam(2,47,10,1,0,'DIR C')/
data paramlist(48) /gribparam(2,48,10,1,1,'SP C')/
data paramlist(49) /gribparam(2,49,10,1,2,'UOGRD')/
data paramlist(50) /gribparam(2,50,10,1,3,'VOGRD')/
data paramlist(51) /gribparam(2,51,0,1,0,'SPF H')/
data paramlist(52) /gribparam(2,52,0,1,1,'R H')/
data paramlist(53) /gribparam(2,53,0,1,2,'MIXR')/
data paramlist(54) /gribparam(2,54,0,1,3,'P WAT')/
data paramlist(55) /gribparam(2,55,0,1,4,'VAPP')/
data paramlist(56) /gribparam(2,56,0,1,5,'SAT D')/
data paramlist(57) /gribparam(2,57,0,1,6,'EVP')/
data paramlist(58) /gribparam(2,58,0,6,0,'C ICE')/
data paramlist(59) /gribparam(2,59,0,1,7,'PRATE')/
data paramlist(60) /gribparam(2,60,0,19,2,'TSTM')/
data paramlist(61) /gribparam(2,61,0,1,8,'A PCP')/
data paramlist(62) /gribparam(2,62,0,1,9,'NCPCP')/
data paramlist(63) /gribparam(2,63,0,1,10,'ACPCP')/
data paramlist(64) /gribparam(2,64,0,1,12,'SRWEQ')/
data paramlist(65) /gribparam(2,65,0,1,13,'WEASD')/
data paramlist(66) /gribparam(2,66,0,1,11,'SNO D')/
data paramlist(67) /gribparam(2,67,0,19,3,'MIXHT')/
data paramlist(68) /gribparam(2,68,10,4,2,'TTHDP')/
data paramlist(69) /gribparam(2,69,10,4,0,'MTHD')/
data paramlist(70) /gribparam(2,70,10,4,1,'MTH A')/
data paramlist(71) /gribparam(2,71,0,6,1,'T CDC')/
data paramlist(72) /gribparam(2,72,0,6,2,'CDCON')/
data paramlist(73) /gribparam(2,73,0,6,3,'L CDC')/
data paramlist(74) /gribparam(2,74,0,6,4,'M CDC')/
data paramlist(75) /gribparam(2,75,0,6,5,'H CDC')/
data paramlist(76) /gribparam(2,76,0,6,6,'C WAT')/
data paramlist(77) /gribparam(2,77,0,7,1,'BLI')/
data paramlist(78) /gribparam(2,78,0,1,14,'SNO C')/
data paramlist(79) /gribparam(2,79,0,1,15,'SNO L')/
data paramlist(80) /gribparam(2,80,10,3,0,'WTMP')/
data paramlist(81) /gribparam(2,81,2,0,0,'LAND')/
data paramlist(82) /gribparam(2,82,10,3,1,'DSL M')/
data paramlist(83) /gribparam(2,83,2,0,1,'SFC R')/
data paramlist(84) /gribparam(2,84,0,19,1,'ALBDO')/
data paramlist(85) /gribparam(2,85,2,0,2,'TSOIL')/
data paramlist(86) /gribparam(2,86,2,0,3,'SOIL M')/
data paramlist(87) /gribparam(2,87,2,0,4,'VEG')/
data paramlist(88) /gribparam(2,88,10,4,3,'SALTY')/
data paramlist(89) /gribparam(2,89,0,3,10,'DEN')/
data paramlist(90) /gribparam(2,90,2,0,5,'WATR')/
data paramlist(91) /gribparam(2,91,10,2,0,'ICE C')/
data paramlist(92) /gribparam(2,92,10,2,1,'ICETK')/
data paramlist(93) /gribparam(2,93,10,2,2,'DICED')/
data paramlist(94) /gribparam(2,94,10,2,3,'SICED')/
data paramlist(95) /gribparam(2,95,10,2,4,'U ICE')/
data paramlist(96) /gribparam(2,96,10,2,5,'V ICE')/
data paramlist(97) /gribparam(2,97,10,2,6,'ICE G')/
data paramlist(98) /gribparam(2,98,10,2,7,'ICE D')/
data paramlist(99) /gribparam(2,99,0,1,16,'SNO M')/
data paramlist(100) /gribparam(2,100,10,0,3,'HTSGW')/
data paramlist(101) /gribparam(2,101,10,0,4,'WVDIR')/
data paramlist(102) /gribparam(2,102,10,0,5,'WVHGT')/
data paramlist(103) /gribparam(2,103,10,0,6,'WVPER')/
data paramlist(104) /gribparam(2,104,10,0,7,'SWDIR')/
data paramlist(105) /gribparam(2,105,10,0,8,'SWELL')/
data paramlist(106) /gribparam(2,106,10,0,9,'SWPER')/
data paramlist(107) /gribparam(2,107,10,0,10,'DIRPW')/
data paramlist(108) /gribparam(2,108,10,0,11,'PERPW')/
data paramlist(109) /gribparam(2,109,10,0,12,'DIRSW')/
data paramlist(110) /gribparam(2,110,10,0,13,'PERSW')/
data paramlist(111) /gribparam(2,111,0,4,0,'NSWRS')/
data paramlist(112) /gribparam(2,112,0,5,0,'NLWRS')/
data paramlist(113) /gribparam(2,113,0,4,1,'NSWRT')/
data paramlist(114) /gribparam(2,114,0,5,1,'NLWRT')/
data paramlist(115) /gribparam(2,115,0,5,2,'LWAVR')/
data paramlist(116) /gribparam(2,116,0,4,2,'SWAVR')/
data paramlist(117) /gribparam(2,117,0,4,3,'G RAD')/
data paramlist(118) /gribparam(2,118,0,4,4,'BRTMP')/
data paramlist(119) /gribparam(2,119,0,4,5,'LWRAD')/
data paramlist(120) /gribparam(2,120,0,4,6,'SWRAD')/
data paramlist(121) /gribparam(2,121,0,0,10,'LHTFL')/
data paramlist(122) /gribparam(2,122,0,0,11,'SHTFL')/
data paramlist(123) /gribparam(2,123,0,2,20,'BLYDP')/
data paramlist(124) /gribparam(2,124,0,2,17,'UFLX')/
data paramlist(125) /gribparam(2,125,0,2,18,'VFLX')/
data paramlist(126) /gribparam(2,126,0,2,19,'WMIXE')/
data paramlist(127) /gribparam(2,127,255,255,255,'IMGD')/
!
! GRIB1 parameters in NCEP Local Table version 2
! Added 8/07/2003
!
data paramlist(128) /gribparam(2,229,0,0,192,'SNOHF')/
data paramlist(129) /gribparam(2,153,0,1,22,'CLWMR')/
data paramlist(130) /gribparam(2,140,0,1,192,'CRAIN')/
data paramlist(131) /gribparam(2,141,0,1,193,'CFRZR')/
data paramlist(132) /gribparam(2,142,0,1,194,'CICEP')/
data paramlist(133) /gribparam(2,143,0,1,195,'CSNOW')/
data paramlist(134) /gribparam(2,214,0,1,196,'CPRAT')/
data paramlist(135) /gribparam(2,135,0,1,197,'MCONV')/
data paramlist(136) /gribparam(2,194,1,1,193,'CPOFP')/
data paramlist(137) /gribparam(2,228,0,1,199,'PEVAP')/
data paramlist(138) /gribparam(2,136,0,2,192,'VW SH')/
data paramlist(139) /gribparam(2,172,0,2,193,'MFLX')/
data paramlist(140) /gribparam(2,196,0,2,194,'USTM')/
data paramlist(141) /gribparam(2,197,0,2,195,'VSTM')/
data paramlist(142) /gribparam(2,252,0,2,196,'CD')/
data paramlist(143) /gribparam(2,253,0,2,197,'FRICV')/
data paramlist(144) /gribparam(2,130,0,3,192,'MSLET')/
data paramlist(145) /gribparam(2,204,0,4,192,'DSWRF')/
data paramlist(146) /gribparam(2,211,0,4,193,'USWRF')/
data paramlist(147) /gribparam(2,205,0,5,192,'DLWRF')/
data paramlist(148) /gribparam(2,212,0,5,193,'ULWRF')/
data paramlist(149) /gribparam(2,213,0,6,192,'CDLYR')/
data paramlist(150) /gribparam(2,132,0,7,193,'4LFTX')/
data paramlist(151) /gribparam(2,157,0,7,6,'CAPE')/
data paramlist(152) /gribparam(2,156,0,7,7,'CIN')/
data paramlist(153) /gribparam(2,190,0,7,8,'HLCY')/
data paramlist(154) /gribparam(2,131,0,7,192,'LFT X')/
data paramlist(155) /gribparam(2,158,0,19,11,'TKE')/
data paramlist(156) /gribparam(2,176,0,191,192,'NLAT')/
data paramlist(157) /gribparam(2,177,0,191,193,'ELON')/
data paramlist(158) /gribparam(2,234,1,0,192,'BGRUN')/
data paramlist(159) /gribparam(2,235,1,0,193,'SSRUN')/
data paramlist(160) /gribparam(2,144,2,0,192,'SOILW')/
data paramlist(161) /gribparam(2,155,2,0,193,'GFLUX')/
data paramlist(162) /gribparam(2,207,2,0,194,'MSTAV')/
data paramlist(163) /gribparam(2,208,2,0,195,'SFEXC')/
data paramlist(164) /gribparam(2,223,2,0,196,'CNWAT')/
data paramlist(165) /gribparam(2,226,2,0,197,'BMIXL')/
data paramlist(166) /gribparam(2,154,0,14,192,'O3MR')/
data paramlist(167) /gribparam(2,222,0,3,193,'5WAVH')/
data paramlist(168) /gribparam(2,145,0,1,200,'PEVPR')/
data paramlist(169) /gribparam(2,146,0,6,193,'CWORK')/
data paramlist(170) /gribparam(2,147,0,3,194,'U-GWD')/
data paramlist(171) /gribparam(2,148,0,3,195,'V-GWD')/
data paramlist(172) /gribparam(2,221,0,3,196,'HPBL')/
data paramlist(173) /gribparam(2,230,0,3,197,'5WAVA')/
! Added 9/26/2003
data paramlist(174) /gribparam(130,160,2,3,192,'SOILL ')/
data paramlist(175) /gribparam(130,171,2,3,193,'RLYRS ')/
data paramlist(176) /gribparam(130,219,2,0,201,'WILT ')/
data paramlist(177) /gribparam(130,222,2,3,194,'SLTYP ')/
data paramlist(178) /gribparam(2,224,2,3,0,'SOTYP ')/
data paramlist(179) /gribparam(2,225,2,0,198,'VGTYP ')/
data paramlist(180) /gribparam(130,230,2,3,195,'SMREF ')/
data paramlist(181) /gribparam(130,231,2,3,196,'SMDRY ')/
data paramlist(182) /gribparam(2,238,0,1,201,'SNOWC ')/
data paramlist(183) /gribparam(130,240,2,3,197,'POROS ')/
data paramlist(184) /gribparam(129,131,0,1,202,'FRAIN ')/
data paramlist(185) /gribparam(129,132,0,6,199,'FICE ')/
data paramlist(186) /gribparam(129,133,0,1,203,'FRIME ')/
data paramlist(187) /gribparam(129,134,0,6,194,'CUEFI ')/
data paramlist(188) /gribparam(129,135,0,6,195,'TCOND ')/
data paramlist(189) /gribparam(129,136,0,6,196,'TCOLW ')/
data paramlist(190) /gribparam(129,137,0,6,197,'TCOLI ')/
data paramlist(191) /gribparam(129,138,0,1,204,'TCOLR ')/
data paramlist(192) /gribparam(129,139,0,1,205,'TCOLS ')/
data paramlist(193) /gribparam(129,140,0,6,198,'TCOLC ')/
data paramlist(194) /gribparam(130,159,0,19,192,'MXSALB ')/
data paramlist(195) /gribparam(130,170,0,19,193,'SNFALB ')/
data paramlist(196) /gribparam(2,170,0,1,24,'RWMR ')/
data paramlist(197) /gribparam(2,171,0,1,25,'SNMR ')/
data paramlist(198) /gribparam(130,181,2,0,199,'CCOND ')/
data paramlist(199) /gribparam(130,203,2,0,200,'RSMIN ')/
data paramlist(200) /gribparam(130,246,2,0,202,'RCS ')/
data paramlist(201) /gribparam(130,247,2,0,203,'RCT ')/
data paramlist(202) /gribparam(130,248,2,0,204,'RCQ ')/
data paramlist(203) /gribparam(130,249,2,0,205,'RCSOL ')/
data paramlist(204) /gribparam(2,254,0,7,194,'RI ')/
data paramlist(205) /gribparam(129,190,3,1,192,'USCT ')/
data paramlist(206) /gribparam(129,191,3,1,193,'VSCT ')/
data paramlist(207) /gribparam(129,171,0,191,194,'TSEC ')/
data paramlist(208) /gribparam(129,180,0,14,193,'OZCON ')/
data paramlist(209) /gribparam(129,181,0,14,194,'OZCAT ')/
data paramlist(210) /gribparam(2,193,1,1,2,'POP ')/
data paramlist(211) /gribparam(2,195,1,1,192,'CPOZP ')/
data paramlist(212) /gribparam(2,180,0,2,22,'GUST ')/
! Added 11/17/2005 - for wave models
data paramlist(213) /gribparam(0,31,0,2,0,'WDIR ')/
data paramlist(214) /gribparam(0,32,0,2,1,'WIND ')/
data paramlist(215) /gribparam(0,33,0,2,2,'U GRD ')/
data paramlist(216) /gribparam(0,34,0,2,3,'V GRD ')/
data paramlist(217) /gribparam(0,100,10,0,3,'HTSGW ')/
data paramlist(218) /gribparam(0,101,10,0,4,'WVDIR ')/
data paramlist(219) /gribparam(0,103,10,0,6,'WVPER ')/
data paramlist(220) /gribparam(0,107,10,0,10,'DIRPW ')/
data paramlist(221) /gribparam(0,108,10,0,11,'PERPW ')/
data paramlist(222) /gribparam(0,109,10,0,12,'DIRSW ')/
data paramlist(223) /gribparam(0,110,10,0,13,'PERSW ')/
! Added 1/26/2006 -
data paramlist(224) /gribparam(129,156,0,13,192,'PMTC ')/
data paramlist(225) /gribparam(129,157,0,13,193,'PMTF ')/
data paramlist(226) /gribparam(3,11,0,0,0,'TMP ')/
data paramlist(227) /gribparam(2,129,0,3,198,'MSLMA ')/
data paramlist(228) /gribparam(129,163,0,13,194,'LPMTF ')/
data paramlist(229) /gribparam(129,164,0,13,195,'LIPMF ')/
! Added 3/6/2006 - For missing GRIB1 to GRIB2 conversions
data paramlist(230) /gribparam(2,178,0,1,23,'ICMR ')/
data paramlist(231) /gribparam(2,179,0,1,32,'GRMR ')/
data paramlist(232) /gribparam(2,186,0,1,206,'TIPD ')/
data paramlist(233) /gribparam(2,187,0,17,192,'LTNG ')/
data paramlist(234) /gribparam(2,188,2,0,206,'RDRIP ')/
data paramlist(235) /gribparam(2,189,0,0,15,'VPTMP ')/
data paramlist(236) /gribparam(2,198,0,1,207,'NCIP ')/
data paramlist(237) /gribparam(2,239,0,1,208,'SNOT ')/
data paramlist(238) /gribparam(2,128,0,3,1,'MSLSA ')/
data paramlist(239) /gribparam(2,137,0,3,199,'TSLSA ')/
data paramlist(240) /gribparam(129,141,0,3,200,'PLPL ')/
data paramlist(241) /gribparam(129,200,0,4,194,'DUVB ')/
data paramlist(242) /gribparam(129,201,0,4,195,'CDUVB ')/
data paramlist(243) /gribparam(2,201,2,0,207,'ICWAT ')/
data paramlist(244) /gribparam(2,209,0,19,204,'MIXLY ')/
data paramlist(245) /gribparam(2,216,0,0,193,'TTRAD ')/
data paramlist(246) /gribparam(129,211,0,16,195,'REFD ')/
data paramlist(247) /gribparam(129,212,0,16,196,'REFC ')/
data paramlist(248) /gribparam(2,161,0,4,196,'CSDSF ')/
data paramlist(249) /gribparam(129,168,0,1,209,'TCLSW ')/
data paramlist(250) /gribparam(129,169,0,1,210,'TCOLM ')/
data paramlist(251) /gribparam(2,181,0,3,201,'LPS X ')/
data paramlist(252) /gribparam(2,182,0,3,202,'LPS Y ')/
data paramlist(253) /gribparam(2,183,0,3,203,'HGT X ')/
data paramlist(254) /gribparam(2,184,0,3,204,'HGT Y ')/
data paramlist(255) /gribparam(128,254,0,0,194,'REV ')/
! Added 4/20/2007 - For missing GRIB1 to GRIB2 conversions
data paramlist(256) /gribparam(1,91,10,2,0,'ICE C ')/
data paramlist(257) /gribparam(0,49,10,1,2,'UOGRD ')/
data paramlist(258) /gribparam(0,50,10,1,3,'VOGRD ')/
data paramlist(259) /gribparam(0,80,10,3,0,'WTMP ')/
data paramlist(260) /gribparam(0,82,10,3,1,'DSL M ')/
data paramlist(261) /gribparam(0,88,10,4,3,'SALTY ')/
data paramlist(262) /gribparam(1,49,10,1,2,'UOGRD ')/
data paramlist(263) /gribparam(1,50,10,1,3,'VOGRD ')/
data paramlist(264) /gribparam(1,80,10,3,0,'WTMP ')/
data paramlist(265) /gribparam(1,88,10,4,3,'SALTY ')/
data paramlist(266) /gribparam(1,40,0,2,9,'DZDT ')/
data paramlist(267) /gribparam(1,67,0,19,3,'MIXHT ')/
data paramlist(268) /gribparam(3,2,0,3,1,'PRMSL ')/
data paramlist(269) /gribparam(3,7,0,3,5,'HGT ')/
data paramlist(270) /gribparam(128,130,10,3,194,'ELEV ')/
data paramlist(271) /gribparam(129,217,0,1,198,'MINRH ')/
data paramlist(272) /gribparam(129,218,0,1,27,'MAXRH ')/
data paramlist(273) /gribparam(130,161,0,1,29,'ASNOW ')/
data paramlist(274) /gribparam(129,165,0,16,192,'REFZR ')/
data paramlist(275) /gribparam(129,166,0,16,193,'REFZI ')/
data paramlist(276) /gribparam(129,167,0,16,194,'REFZC ')/
data paramlist(277) /gribparam(129,192,0,2,198,'LAUV ')/
data paramlist(278) /gribparam(129,193,0,2,199,'LOUV ')/
data paramlist(279) /gribparam(129,188,0,2,200,'LAVV ')/
data paramlist(280) /gribparam(129,189,0,2,201,'LOVV ')/
data paramlist(281) /gribparam(129,207,0,2,202,'LAPP ')/
data paramlist(282) /gribparam(129,208,0,2,203,'LOPP ')/
data paramlist(283) /gribparam(129,198,10,3,195,'SSHG ')/
data paramlist(284) /gribparam(1,33,0,2,2,'U GRD ')/
data paramlist(285) /gribparam(1,34,0,2,3,'V GRD ')/
data paramlist(286) /gribparam(1,2,0,3,1,'PRMSL ')/
data paramlist(287) /gribparam(1,7,0,3,5,'HGT ')/
data paramlist(288) /gribparam(128,186,10,4,192,'WTMPC ')/
data paramlist(289) /gribparam(128,187,10,4,193,'SALIN ')/
data paramlist(290) /gribparam(128,177,10,3,196,'P2OMLT ')/
data paramlist(291) /gribparam(128,178,10,1,192,'OMLU ')/
data paramlist(292) /gribparam(128,179,10,1,193,'OMLV ')/
data paramlist(293) /gribparam(128,183,10,1,194,'UBARO ')/
data paramlist(294) /gribparam(128,184,10,1,195,'VBARO ')/
data paramlist(295) /gribparam(129,179,0,19,205,'FLGHT ')/
data paramlist(296) /gribparam(129,185,0,19,206,'CICEL ')/
data paramlist(297) /gribparam(129,186,0,19,207,'CIVIS ')/
data paramlist(298) /gribparam(129,187,0,19,208,'CIFLT ')/
data paramlist(299) /gribparam(129,177,0,19,209,'LAVNI ')/
data paramlist(300) /gribparam(129,178,0,19,210,'HAVNI ')/
data paramlist(301) /gribparam(130,189,0,19,211,'SBSALB ')/
data paramlist(302) /gribparam(130,190,0,19,212,'SWSALB ')/
data paramlist(303) /gribparam(130,191,0,19,213,'NBSALB ')/
data paramlist(304) /gribparam(130,192,0,19,214,'NWSALB ')/
data paramlist(305) /gribparam(129,149,10,0,192,'WSTP ')/
data paramlist(306) /gribparam(128,188,0,1,211,'EMNP ')/
data paramlist(307) /gribparam(128,192,0,3,205,'LAYTH ')/
data paramlist(308) /gribparam(129,219,0,6,13,'CEIL ')/
data paramlist(309) /gribparam(129,220,0,19,12,'PBLREG ')/
data paramlist(310) /gribparam(130,179,2,0,210,'ACOND ')/
data paramlist(311) /gribparam(130,198,0,1,212,'SBSNO ')/
data paramlist(312) /gribparam(2,199,2,3,198,'EVBS ')/
data paramlist(313) /gribparam(2,200,2,0,208,'EVCW ')/
data paramlist(314) /gribparam(2,210,2,0,209,'TRANS ')/
data paramlist(315) /gribparam(129,182,0,2,204,'VEDH ')/
data paramlist(320) /gribparam(2,241,0,0,195,'LRGHR ')/
data paramlist(321) /gribparam(2,242,0,0,196,'CNVHR ')/
data paramlist(322) /gribparam(140,168,0,19,217,'MEIP ')/
data paramlist(323) /gribparam(140,169,0,19,218,'MAIP ')/
data paramlist(324) /gribparam(140,170,0,19,219,'MECTP ')/
data paramlist(325) /gribparam(140,171,0,19,220,'MACTP ')/
data paramlist(326) /gribparam(140,172,0,19,221,'MECAT ')/
data paramlist(327) /gribparam(140,173,0,19,222,'MACAT ')/
data paramlist(328) /gribparam(140,174,0,19,223,'CBHE ')/
data paramlist(329) /gribparam(140,175,0,19,224,'PCBB ')/
data paramlist(330) /gribparam(140,176,0,19,225,'PCBT ')/
data paramlist(331) /gribparam(140,177,0,19,226,'PECBB ')/
data paramlist(332) /gribparam(140,178,0,19,227,'PECBT ')/
data paramlist(333) /gribparam(140,179,0,19,228,'HCBB ')/
data paramlist(334) /gribparam(140,180,0,19,229,'HCBT ')/
data paramlist(335) /gribparam(140,181,0,19,230,'HECBB ')/
data paramlist(336) /gribparam(140,182,0,19,231,'HECBT ')/
data paramlist(337) /gribparam(129,76,0,6,6,'C WAT ')/
! Added 8/24/2007
data paramlist(338) /gribparam(0,104,10,0,7,'SWDIR ')/
data paramlist(339) /gribparam(0,105,10,0,8,'SWELL ')/
data paramlist(340) /gribparam(0,106,10,0,9,'SWPER ')/
data paramlist(341) /gribparam(0,102,10,0,5,'WVHGT ')/
data paramlist(342) /gribparam(129,213,3,192,0,'SBT122 ')/
data paramlist(343) /gribparam(129,214,3,192,1,'SBT123 ')/
data paramlist(344) /gribparam(129,215,3,192,2,'SBT124 ')/
data paramlist(345) /gribparam(129,216,3,192,3,'SBT125 ')/
data paramlist(346) /gribparam(129,221,3,192,4,'SBC123 ')/
data paramlist(347) /gribparam(129,222,3,192,5,'SBC124 ')/
data paramlist(348) /gribparam(129,228,10,3,192,'SURGE ')/
data paramlist(349) /gribparam(129,229,10,3,193,'ETSRG ')/
data paramlist(350) /gribparam(2,149,0,2,14,'PVORT ')/
data paramlist(351) /gribparam(2,150,0,192,1,'COVMZ ')/
data paramlist(352) /gribparam(2,151,0,192,2,'COVTZ ')/
data paramlist(353) /gribparam(2,152,0,192,3,'COVTM ')/
data paramlist(354) /gribparam(129,202,0,0,197,'THFLX ')/
data paramlist(355) /gribparam(3,33,0,2,2,'U GRD ')/
data paramlist(356) /gribparam(3,34,0,2,3,'V GRD ')/
data paramlist(357) /gribparam(3,40,0,2,9,'DZDT ')/
data paramlist(358) /gribparam(3,124,0,2,17,'UFLX ')/
data paramlist(359) /gribparam(3,125,0,2,18,'VFLX ')/
data paramlist(360) /gribparam(3,8,0,3,6,'DIST ')/
data paramlist(361) /gribparam(3,13,0,0,2,'POT ')/
data paramlist(362) /gribparam(3,88,10,4,3,'SALTY ')/
data paramlist(363) /gribparam(3,49,10,1,2,'UOGRD ')/
data paramlist(364) /gribparam(3,50,10,1,3,'VOGRD ')/
data paramlist(365) /gribparam(2,215,0,0,198,'TTDIA ')/
data paramlist(366) /gribparam(2,217,0,0,199,'TTPHY ')/
data paramlist(367) /gribparam(130,154,2,3,199,'LSPA ')/
data paramlist(368) /gribparam(2,250,0,4,197,'SWHR ')/
data paramlist(369) /gribparam(2,251,0,5,194,'LWHR ')/
data paramlist(370) /gribparam(2,160,0,4,198,'CSUSF ')/
data paramlist(371) /gribparam(2,162,0,5,195,'CSULF ')/
data paramlist(372) /gribparam(2,163,0,5,196,'CSDLF ')/
data paramlist(373) /gribparam(2,164,0,4,199,'CFNSF ')/
data paramlist(374) /gribparam(2,165,0,5,197,'CFNLF ')/
data paramlist(375) /gribparam(2,166,0,4,200,'VBDSF ')/
data paramlist(376) /gribparam(2,167,0,4,201,'VDDSF ')/
data paramlist(377) /gribparam(2,168,0,4,202,'NBDSF ')/
data paramlist(378) /gribparam(2,169,0,4,203,'NDDSF ')/
data paramlist(379) /gribparam(2,206,0,7,196,'UVI ')/
data paramlist(380) /gribparam(2,219,0,0,200,'TSD1D ')/
data paramlist(381) /gribparam(2,220,0,3,206,'NLGSP ')/
data paramlist(382) /gribparam(2,244,0,0,201,'SHAHR ')/
data paramlist(383) /gribparam(2,246,0,0,202,'VDFHR ')/
data paramlist(384) /gribparam(2,243,0,1,213,'CNVMR ')/
data paramlist(385) /gribparam(2,245,0,1,214,'SHAMR ')/
data paramlist(386) /gribparam(2,249,0,1,215,'VDFMR ')/
data paramlist(387) /gribparam(2,247,0,2,208,'VDFUA ')/
data paramlist(388) /gribparam(2,248,0,2,209,'VDFVA ')/
data paramlist(389) /gribparam(3,202,0,7,195,'CWDI ')/
data paramlist(390) /gribparam(2,232,0,4,204,'DTRF ')/
data paramlist(391) /gribparam(2,233,0,4,205,'UTRF ')/
data paramlist(392) /gribparam(2,231,0,6,200,'MFLUX ')/
data paramlist(393) /gribparam(2,202,0,7,195,'CWDI ')/
data paramlist(394) /gribparam(2,203,0,19,232,'VAFTD ')/
data paramlist(395) /gribparam(3,238,0,1,201,'SNOWC ')/
data paramlist(396) /gribparam(3,66,0,1,11,'SNO D ')/
data paramlist(397) /gribparam(2,133,0,7,2,'KX ')/
data paramlist(398) /gribparam(2,134,0,7,5,'SX ')/
data paramlist(399) /gribparam(128,191,10,4,194,'BKENG ')/
data paramlist(400) /gribparam(129,195,10,4,195,'DBSS ')/
data paramlist(401) /gribparam(128,171,10,3,197,'AOHFLX ')/
data paramlist(402) /gribparam(128,180,10,3,198,'ASHFL ')/
data paramlist(403) /gribparam(128,193,10,3,199,'SSTT ')/
data paramlist(404) /gribparam(128,194,10,3,200,'SSST ')/
data paramlist(405) /gribparam(128,190,10,3,201,'KENG ')/
data paramlist(406) /gribparam(128,185,10,4,196,'INTFD ')/
data paramlist(407) /gribparam(129,199,10,3,202,'SLTFL ')/
data paramlist(408) /gribparam(129,197,10,4,197,'OHC ')/
data paramlist(409) /gribparam(2,159,0,1,216,'CONP ')/
data paramlist(410) /gribparam(2,175,0,191,195,'MLYNO ')/
data paramlist(411) /gribparam(129,223,0,1,65,'RPRATE ')/
data paramlist(412) /gribparam(129,224,0,1,66,'SPRATE ')/
data paramlist(413) /gribparam(129,225,0,1,67,'FPRATE ')/
data paramlist(414) /gribparam(129,226,0,1,68,'IPRATE ')/
data paramlist(415) /gribparam(129,227,0,7,197,'UPHL ')/
data paramlist(416) /gribparam(3,87,2,0,4,'VEG ')/
data paramlist(417) /gribparam(129,130,1,1,195,'CWR ')/
data paramlist(418) /gribparam(2,240,0,192,4,'COVTW ')/
data paramlist(419) /gribparam(133,164,0,192,5,'COVZZ ')/
data paramlist(420) /gribparam(133,165,0,192,6,'COVMM ')/
data paramlist(421) /gribparam(133,166,0,192,7,'COVQZ ')/
data paramlist(422) /gribparam(133,167,0,192,8,'COVQM ')/
data paramlist(423) /gribparam(133,168,0,192,9,'COVTVV ')/
data paramlist(424) /gribparam(133,169,0,192,10,'COVQVV ')/
data paramlist(425) /gribparam(133,203,0,192,11,'COVPSPS ')/
data paramlist(426) /gribparam(133,206,0,192,12,'COVQQ ')/
data paramlist(427) /gribparam(133,220,0,192,13,'COVVVVV ')/
data paramlist(428) /gribparam(133,234,0,192,14,'COVTT ')/
data paramlist(429) /gribparam(133,201,0,0,203,'THZ0 ')/
data paramlist(430) /gribparam(133,195,0,1,218,'QZ0 ')/
data paramlist(431) /gribparam(133,204,0,1,219,'QMAX ')/
data paramlist(432) /gribparam(133,205,0,1,220,'QMIN ')/
data paramlist(433) /gribparam(133,181,0,2,210,'GWDU ')/
data paramlist(434) /gribparam(133,182,0,2,211,'GWDV ')/
data paramlist(435) /gribparam(133,183,0,2,212,'CNVU ')/
data paramlist(436) /gribparam(133,184,0,2,213,'CNVV ')/
data paramlist(437) /gribparam(133,236,0,2,214,'WTEND ')/
data paramlist(438) /gribparam(133,154,0,2,215,'OMGALF ')/
data paramlist(439) /gribparam(133,196,0,2,216,'CNGWDU ')/
data paramlist(440) /gribparam(133,197,0,2,217,'CNGWDV ')/
data paramlist(441) /gribparam(133,202,0,3,207,'CNVUMF ')/
data paramlist(442) /gribparam(133,209,0,3,208,'CNVDMF ')/
data paramlist(443) /gribparam(133,219,0,3,209,'CNVDEMF ')/
data paramlist(444) /gribparam(133,173,0,1,217,'LRGMR ')/
data paramlist(445) /gribparam(133,174,0,14,195,'VDFOZ ')/
data paramlist(446) /gribparam(133,175,0,14,196,'POZ ')/
data paramlist(447) /gribparam(133,188,0,14,197,'TOZ ')/
data paramlist(448) /gribparam(133,139,0,14,198,'POZT ')/
data paramlist(449) /gribparam(133,239,0,14,199,'POZO ')/
data paramlist(450) /gribparam(133,185,2,0,208,'AKHS ')/
data paramlist(451) /gribparam(133,186,2,0,209,'AKMS ')/
data paramlist(452) /gribparam(133,193,0,19,218,'EPSR ')/
data paramlist(453) /gribparam(130,229,0,0,192,'SNOHF ')/
data paramlist(454) /gribparam(129,194,0,0,204,'TCHP ')/
! Added 5/29/2008
data paramlist(455) /gribparam(2,185,0,19,219,'TPFI ')/
data paramlist(456) /gribparam(130,182,0,7,198,'LAI ')/
data paramlist(457) /gribparam(2,173,0,3,210,'LMH ')/
data paramlist(458) /gribparam(2,174,0,2,218,'LMV ')/
! Added 6/30/2008 Add GRIB1 parameters in Table version 131
data paramlist(459) /gribparam(131,1,0,3,0,'PRES')/
data paramlist(460) /gribparam(131,2,0,3,1,'PRMSL')/
data paramlist(461) /gribparam(131,3,0,3,2,'PTEND')/
data paramlist(462) /gribparam(131,4,0,2,14,'PVORT')/
data paramlist(463) /gribparam(131,5,0,3,3,'ICAHT')/
data paramlist(464) /gribparam(131,6,0,3,4,'GP')/
data paramlist(465) /gribparam(131,7,0,3,5,'HGT')/
data paramlist(466) /gribparam(131,8,0,3,6,'DIST')/
data paramlist(467) /gribparam(131,9,0,3,7,'HSTDV')/
data paramlist(468) /gribparam(131,10,0,14,0,'TOZNE')/
data paramlist(469) /gribparam(131,11,0,0,0,'TMP')/
data paramlist(470) /gribparam(131,12,0,0,1,'VTMP')/
data paramlist(471) /gribparam(131,13,0,0,2,'POT')/
data paramlist(472) /gribparam(131,14,0,0,3,'EPOT')/
data paramlist(473) /gribparam(131,15,0,0,4,'TMAX')/
data paramlist(474) /gribparam(131,16,0,0,5,'TMIN')/
data paramlist(475) /gribparam(131,17,0,0,6,'DPT')/
data paramlist(476) /gribparam(131,18,0,0,7,'DEPR')/
data paramlist(477) /gribparam(131,19,0,0,8,'LAPR')/
data paramlist(478) /gribparam(131,20,0,19,0,'VIS')/
data paramlist(479) /gribparam(131,21,0,15,6,'RDSP1')/
data paramlist(480) /gribparam(131,22,0,15,7,'RDSP2')/
data paramlist(481) /gribparam(131,23,0,15,8,'RDSP3')/
data paramlist(482) /gribparam(131,24,0,7,0,'PLI')/
data paramlist(483) /gribparam(131,25,0,0,9,'TMPA')/
data paramlist(484) /gribparam(131,26,0,3,8,'PRESA')/
data paramlist(485) /gribparam(131,27,0,3,9,'GPA')/
data paramlist(486) /gribparam(131,28,10,0,0,'WVSP1')/
data paramlist(487) /gribparam(131,29,10,0,1,'WVSP2')/
data paramlist(488) /gribparam(131,30,10,0,2,'WVSP3')/
data paramlist(489) /gribparam(131,31,0,2,0,'WDIR')/
data paramlist(490) /gribparam(131,32,0,2,1,'WIND')/
data paramlist(491) /gribparam(131,33,0,2,2,'UGRD')/
data paramlist(492) /gribparam(131,34,0,2,3,'VGRD')/
data paramlist(493) /gribparam(131,35,0,2,4,'STRM')/
data paramlist(494) /gribparam(131,36,0,2,5,'VPOT')/
data paramlist(495) /gribparam(131,37,0,2,6,'MNTSF')/
data paramlist(496) /gribparam(131,38,0,2,7,'SGCVV')/
data paramlist(497) /gribparam(131,39,0,2,8,'VVEL')/
data paramlist(498) /gribparam(131,40,0,2,9,'DZDT')/
data paramlist(499) /gribparam(131,41,0,2,10,'ABSV')/
data paramlist(500) /gribparam(131,42,0,2,11,'ABSD')/
data paramlist(501) /gribparam(131,43,0,2,12,'RELV')/
data paramlist(502) /gribparam(131,44,0,2,13,'RELD')/
data paramlist(503) /gribparam(131,45,0,2,15,'VUCSH')/
data paramlist(504) /gribparam(131,46,0,2,16,'VVCSH')/
data paramlist(505) /gribparam(131,47,10,1,0,'DIRC')/
data paramlist(506) /gribparam(131,48,10,1,1,'SPC')/
data paramlist(507) /gribparam(131,49,10,1,2,'UOGRD')/
data paramlist(508) /gribparam(131,50,10,1,3,'VOGRD')/
data paramlist(509) /gribparam(131,51,0,1,0,'SPFH')/
data paramlist(510) /gribparam(131,52,0,1,1,'RH')/
data paramlist(511) /gribparam(131,53,0,1,2,'MIXR')/
data paramlist(512) /gribparam(131,54,0,1,3,'PWAT')/
data paramlist(513) /gribparam(131,55,0,1,4,'VAPP')/
data paramlist(514) /gribparam(131,56,0,1,5,'SATD')/
data paramlist(515) /gribparam(131,57,0,1,6,'EVP')/
data paramlist(516) /gribparam(131,58,0,6,0,'CICE')/
data paramlist(517) /gribparam(131,59,0,1,7,'PRATE')/
data paramlist(518) /gribparam(131,60,0,19,2,'TSTM')/
data paramlist(519) /gribparam(131,61,0,1,8,'APCP')/
data paramlist(520) /gribparam(131,62,0,1,9,'NCPCP')/
data paramlist(521) /gribparam(131,63,0,1,10,'ACPCP')/
data paramlist(522) /gribparam(131,64,0,1,12,'SRWEQ')/
data paramlist(523) /gribparam(131,65,0,1,13,'WEASD')/
data paramlist(524) /gribparam(131,66,0,1,11,'SNOD')/
data paramlist(525) /gribparam(131,67,0,19,3,'MIXHT')/
data paramlist(526) /gribparam(131,68,10,4,2,'TTHDP')/
data paramlist(527) /gribparam(131,69,10,4,0,'MTHD')/
data paramlist(528) /gribparam(131,70,10,4,1,'MTHA')/
data paramlist(529) /gribparam(131,71,0,6,1,'TCDC')/
data paramlist(530) /gribparam(131,72,0,6,2,'CDCON')/
data paramlist(531) /gribparam(131,73,0,6,3,'LCDC')/
data paramlist(532) /gribparam(131,74,0,6,4,'MCDC')/
data paramlist(533) /gribparam(131,75,0,6,5,'HCDC')/
data paramlist(534) /gribparam(131,76,0,6,6,'CWAT')/
data paramlist(535) /gribparam(131,77,0,7,1,'BLI')/
data paramlist(536) /gribparam(131,78,0,1,14,'SNOC')/
data paramlist(537) /gribparam(131,79,0,1,15,'SNOL')/
data paramlist(538) /gribparam(131,80,10,3,0,'WTMP')/
data paramlist(539) /gribparam(131,81,2,0,0,'LAND')/
data paramlist(540) /gribparam(131,82,10,3,1,'DSLM')/
data paramlist(541) /gribparam(131,83,2,0,1,'SFCR')/
data paramlist(542) /gribparam(131,84,0,19,1,'ALBDO')/
data paramlist(543) /gribparam(131,85,2,0,2,'TSOIL')/
data paramlist(544) /gribparam(131,86,2,0,3,'SOILM')/
data paramlist(545) /gribparam(131,87,2,0,4,'VEG')/
data paramlist(546) /gribparam(131,88,10,4,3,'SALTY')/
data paramlist(547) /gribparam(131,89,0,3,10,'DEN')/
data paramlist(548) /gribparam(131,90,2,0,5,'WATR')/
data paramlist(549) /gribparam(131,91,10,2,0,'ICEC')/
data paramlist(550) /gribparam(131,92,10,2,1,'ICETK')/
data paramlist(551) /gribparam(131,93,10,2,2,'DICED')/
data paramlist(552) /gribparam(131,94,10,2,3,'SICED')/
data paramlist(553) /gribparam(131,95,10,2,4,'UICE')/
data paramlist(554) /gribparam(131,96,10,2,5,'VICE')/
data paramlist(555) /gribparam(131,97,10,2,6,'ICEG')/
data paramlist(556) /gribparam(131,98,10,2,7,'ICED')/
data paramlist(557) /gribparam(131,99,0,1,16,'SNOM')/
data paramlist(558) /gribparam(131,100,10,0,3,'HTSGW')/
data paramlist(559) /gribparam(131,101,10,0,4,'WVDIR')/
data paramlist(560) /gribparam(131,102,10,0,5,'WVHGT')/
data paramlist(561) /gribparam(131,103,10,0,6,'WVPER')/
data paramlist(562) /gribparam(131,104,10,0,7,'SWDIR')/
data paramlist(563) /gribparam(131,105,10,0,8,'SWELL')/
data paramlist(564) /gribparam(131,106,10,0,9,'SWPER')/
data paramlist(565) /gribparam(131,107,10,0,10,'DIRPW')/
data paramlist(566) /gribparam(131,108,10,0,11,'PERPW')/
data paramlist(567) /gribparam(131,109,10,0,12,'DIRSW')/
data paramlist(568) /gribparam(131,110,10,0,13,'PERSW')/
data paramlist(569) /gribparam(131,111,0,4,0,'NSWRS')/
data paramlist(570) /gribparam(131,112,0,5,0,'NLWRS')/
data paramlist(571) /gribparam(131,113,0,4,1,'NSWRT')/
data paramlist(572) /gribparam(131,114,0,5,1,'NLWRT')/
data paramlist(573) /gribparam(131,115,0,5,2,'LWAVR')/
data paramlist(574) /gribparam(131,116,0,4,2,'SWAVR')/
data paramlist(575) /gribparam(131,117,0,4,3,'GRAD')/
data paramlist(576) /gribparam(131,118,0,4,4,'BRTMP')/
data paramlist(577) /gribparam(131,119,0,4,5,'LWRAD')/
data paramlist(578) /gribparam(131,120,0,4,6,'SWRAD')/
data paramlist(579) /gribparam(131,121,0,0,10,'LHTFL')/
data paramlist(580) /gribparam(131,122,0,0,11,'SHTFL')/
data paramlist(581) /gribparam(131,123,0,2,20,'BLYDP')/
data paramlist(582) /gribparam(131,124,0,2,17,'UFLX')/
data paramlist(583) /gribparam(131,125,0,2,18,'VFLX')/
data paramlist(584) /gribparam(131,126,0,2,19,'WMIXE')/
data paramlist(585) /gribparam(131,127,255,255,255,'IMGD')/
data paramlist(586) /gribparam(131,128,0,3,1,'MSLSA')/
data paramlist(587) /gribparam(131,130,0,3,192,'MSLET')/
data paramlist(588) /gribparam(131,131,0,7,192,'LFTX')/
data paramlist(589) /gribparam(131,132,0,7,193,'4LFTX')/
data paramlist(590) /gribparam(131,134,0,3,212,'PRESN')/
data paramlist(591) /gribparam(131,135,0,1,197,'MCONV')/
data paramlist(592) /gribparam(131,136,0,2,192,'VWSH')/
data paramlist(593) /gribparam(131,137,0,2,219,'PVMWW')/
data paramlist(594) /gribparam(131,140,0,1,192,'CRAIN')/
data paramlist(595) /gribparam(131,141,0,1,193,'CFRZR')/
data paramlist(596) /gribparam(131,142,0,1,194,'CICEP')/
data paramlist(597) /gribparam(131,143,0,1,195,'CSNOW')/
data paramlist(598) /gribparam(131,144,2,0,192,'SOILW')/
data paramlist(599) /gribparam(131,145,0,1,200,'PEVPR')/
data paramlist(600) /gribparam(131,146,2,2,210,'VEGT')/
data paramlist(601) /gribparam(131,147,2,3,200,'BARET')/
data paramlist(602) /gribparam(131,148,2,3,201,'AVSFT')/
data paramlist(603) /gribparam(131,149,2,3,202,'RADT')/
data paramlist(604) /gribparam(131,150,2,2,211,'SSTOR')/
data paramlist(605) /gribparam(131,151,2,2,212,'LSOIL')/
data paramlist(606) /gribparam(131,152,2,2,213,'EWATR')/
data paramlist(607) /gribparam(131,153,0,1,22,'CLWMR')/
data paramlist(608) /gribparam(131,155,2,0,193,'GFLUX')/
data paramlist(609) /gribparam(131,156,0,7,7,'CIN')/
data paramlist(610) /gribparam(131,157,0,7,6,'CAPE')/
data paramlist(611) /gribparam(131,158,0,19,11,'TKE')/
data paramlist(612) /gribparam(131,159,0,19,192,'MXSALB')/
data paramlist(613) /gribparam(131,160,2,3,192,'SOILL')/
data paramlist(614) /gribparam(131,161,0,1,29,'ASNOW')/
data paramlist(615) /gribparam(131,162,0,1,221,'ARAIN')/
data paramlist(616) /gribparam(131,163,2,0,214,'GWREC')/
data paramlist(617) /gribparam(131,164,2,0,215,'QREC')/
data paramlist(618) /gribparam(131,165,0,1,222,'SNOWT')/
data paramlist(619) /gribparam(131,166,0,4,200,'VBDSF')/
data paramlist(620) /gribparam(131,167,0,4,201,'VDDSF')/
data paramlist(621) /gribparam(131,168,0,4,202,'NBDSF')/
data paramlist(622) /gribparam(131,169,0,4,203,'NDDSF')/
data paramlist(623) /gribparam(131,170,0,19,193,'SNFALB')/
data paramlist(624) /gribparam(131,171,2,3,193,'RLYRS')/
data paramlist(625) /gribparam(131,172,0,2,193,'MFLX')/
data paramlist(626) /gribparam(131,173,0,3,210,'LMH')/
data paramlist(627) /gribparam(131,174,0,2,218,'LMV')/
data paramlist(628) /gribparam(131,175,0,191,195,'MLYNO')/
data paramlist(629) /gribparam(131,176,0,191,192,'NLAT')/
data paramlist(630) /gribparam(131,177,0,191,193,'ELON')/
data paramlist(631) /gribparam(131,178,0,1,23,'ICMR')/
data paramlist(632) /gribparam(131,179,2,0,210,'ACOND')/
data paramlist(633) /gribparam(131,180,0,1,17,'SNOAG')/
data paramlist(634) /gribparam(131,181,2,0,199,'CCOND')/
data paramlist(635) /gribparam(131,182,0,7,198,'LAI')/
data paramlist(636) /gribparam(131,183,2,0,216,'SFCRH')/
data paramlist(637) /gribparam(131,184,0,19,19,'SALBD')/
data paramlist(638) /gribparam(131,187,2,0,217,'NDVI')/
data paramlist(639) /gribparam(131,188,2,0,206,'RDRIP')/
data paramlist(640) /gribparam(131,189,2,0,218,'LANDN')/
data paramlist(641) /gribparam(131,190,0,7,8,'HLCY')/
data paramlist(642) /gribparam(131,191,0,191,196,'NLATN')/
data paramlist(643) /gribparam(131,192,0,191,197,'ELONN')/
data paramlist(644) /gribparam(131,194,1,1,193,'CPOFP')/
data paramlist(645) /gribparam(131,196,0,2,194,'USTM')/
data paramlist(646) /gribparam(131,197,0,2,195,'VSTM')/
data paramlist(647) /gribparam(131,198,0,1,212,'SBSNO')/
data paramlist(648) /gribparam(131,199,2,3,198,'EVBS')/
data paramlist(649) /gribparam(131,200,2,0,208,'EVCW')/
data paramlist(650) /gribparam(131,202,0,1,223,'APCPN')/
data paramlist(651) /gribparam(131,203,2,0,200,'RSMIN')/
data paramlist(652) /gribparam(131,204,0,4,192,'DSWRF')/
data paramlist(653) /gribparam(131,205,0,5,192,'DLWRF')/
data paramlist(654) /gribparam(131,206,0,1,224,'ACPCPN')/
data paramlist(655) /gribparam(131,207,2,0,194,'MSTAV')/
data paramlist(656) /gribparam(131,208,2,0,195,'SFEXC')/
data paramlist(657) /gribparam(131,210,2,0,209,'TRANS')/
data paramlist(658) /gribparam(131,211,0,4,193,'USWRF')/
data paramlist(659) /gribparam(131,212,0,5,193,'ULWRF')/
data paramlist(660) /gribparam(131,213,0,6,192,'CDLYR')/
data paramlist(661) /gribparam(131,214,0,1,196,'CPRAT')/
data paramlist(662) /gribparam(131,216,0,0,193,'TTRAD')/
data paramlist(663) /gribparam(131,218,0,3,211,'HGTN')/
data paramlist(664) /gribparam(131,219,2,0,201,'WILT')/
data paramlist(665) /gribparam(130,220,2,3,203,'FLDCP')/
data paramlist(666) /gribparam(131,221,0,3,196,'HPBL')/
data paramlist(667) /gribparam(131,222,2,3,194,'SLTYP')/
data paramlist(668) /gribparam(131,223,2,0,196,'CNWAT')/
data paramlist(669) /gribparam(131,224,2,3,0,'SOTYP')/
data paramlist(670) /gribparam(131,225,2,0,198,'VGTYP')/
data paramlist(671) /gribparam(131,226,2,0,197,'BMIXL')/
data paramlist(672) /gribparam(131,227,2,0,219,'AMIXL')/
data paramlist(673) /gribparam(131,228,0,1,199,'PEVAP')/
data paramlist(674) /gribparam(131,229,0,0,192,'SNOHF')/
data paramlist(675) /gribparam(131,230,2,3,195,'SMREF')/
data paramlist(676) /gribparam(131,231,2,3,196,'SMDRY')/
data paramlist(677) /gribparam(131,232,2,0,220,'WVINC')/
data paramlist(678) /gribparam(131,233,2,0,221,'WCINC')/
data paramlist(679) /gribparam(131,234,1,0,192,'BGRUN')/
data paramlist(680) /gribparam(131,235,1,0,193,'SSRUN')/
data paramlist(681) /gribparam(131,237,2,0,222,'WVCONV')/
data paramlist(682) /gribparam(131,238,0,1,201,'SNOWC')/
data paramlist(683) /gribparam(131,239,0,1,208,'SNOT')/
data paramlist(684) /gribparam(131,240,2,3,197,'POROS')/
data paramlist(685) /gribparam(131,241,2,0,223,'WCCONV')/
data paramlist(686) /gribparam(131,242,2,0,224,'WVUFLX')/
data paramlist(687) /gribparam(131,243,2,0,225,'WVVFLX')/
data paramlist(688) /gribparam(131,244,2,0,226,'WCUFLX')/
data paramlist(689) /gribparam(131,245,2,0,227,'WCVFLX')/
data paramlist(690) /gribparam(131,246,2,0,202,'RCS')/
data paramlist(691) /gribparam(131,247,2,0,203,'RCT')/
data paramlist(692) /gribparam(131,248,2,0,204,'RCQ')/
data paramlist(693) /gribparam(131,249,2,0,205,'RCSOL')/
data paramlist(694) /gribparam(131,250,0,4,197,'SWHR')/
data paramlist(695) /gribparam(131,251,0,5,194,'LWHR')/
data paramlist(696) /gribparam(131,252,0,2,196,'CD')/
data paramlist(697) /gribparam(131,253,0,2,197,'FRICV')/
data paramlist(698) /gribparam(131,254,0,7,194,'RI')/
data paramlist(699) /gribparam(129,62,0,1,9,'NCPCP')/
data paramlist(700) /gribparam(129,63,0,1,10,'ACPCP')/
data paramlist(701) /gribparam(131,220,2,3,203,'FLDCP')/
data paramlist(702) /gribparam(128,221,1,0,221,'FFLDG')/
data paramlist(703) /gribparam(128,222,1,0,222,'FFLDG')/
data paramlist(704) /gribparam(128,223,1,0,223,'FFLDG')/
data paramlist(705) /gribparam(128,224,1,0,224,'FFLDG')/
data paramlist(706) /gribparam(128,225,1,0,225,'FFLDG')/
data paramlist(707) /gribparam(128,226,1,0,226,'FFLDG')/
data paramlist(708) /gribparam(128,227,1,0,227,'FFLDG')/
data paramlist(709) /gribparam(128,228,1,0,228,'FFLDG')/
data paramlist(710) /gribparam(128,229,1,0,229,'FFLDG')/
data paramlist(711) /gribparam(128,230,1,0,230,'FFLDG')/
data paramlist(712) /gribparam(128,237,1,0,237,'FFLDG')/
data paramlist(713) /gribparam(128,239,1,0,239,'FFLDG')/
data paramlist(714) /gribparam(128,242,1,0,242,'FFLDG')/
data paramlist(715) /gribparam(128,247,1,0,247,'FFLDG')/
data paramlist(716) /gribparam(128,250,1,0,250,'FFLDG')/
! Aviation parameters
data paramlist(717) /gribparam(129,175,0,19,20,'ICIP')/
data paramlist(718) /gribparam(129,176,0,19,7,'ICI')/
data paramlist(719) /gribparam(2,236,0,19,23,'SLDP')/
contains
subroutine param_g1_to_g2(g1val,g1ver,g2disc,g2cat,g2num)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: param_g1_to_g2
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-05
!
! ABSTRACT: This subroutine returns the corresponding GRIB2 Discipline
! Category and Number for a given GRIB1 parameter value and table version.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL param_g1_to_g2(g1val,g1ver,g2disc,g2cat,g2num)
! INPUT ARGUMENT LIST:
! g1val - GRIB1 parameter number for which discipline is requested
! g1ver - GRIB1 parameter table version number
!
! OUTPUT ARGUMENT LIST:
! g2disc - corresponding GRIB2 Discipline number
! g2cat - corresponding GRIB2 Category number
! g2num - corresponding GRIB2 Parameter number within Category g2cat
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: g1val,g1ver
integer,intent(out) :: g2disc,g2cat,g2num
g2disc=255
g2cat=255
g2num=255
! for testing
! g2num=g1val
! for testing
do n=1,MAXPARAM
if (paramlist(n)%grib1val.eq.g1val .AND.
& paramlist(n)%g1tblver.eq.g1ver ) then
g2disc=paramlist(n)%grib2dsc
g2cat=paramlist(n)%grib2cat
g2num=paramlist(n)%grib2num
return
endif
enddo
print *,'param_g1_to_g2:GRIB1 param ',g1val,' not found.',
& ' for table version ',g1ver
return
end subroutine
character(len=8) function param_get_abbrev(g2disc,g2cat,g2num)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: param_get_abbrev
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-04
!
! ABSTRACT: This function returns the parameter abbreviation for
! a given GRIB2 Discipline, Category and Parameter number.
!
! PROGRAM HISTORY LOG:
! 2001-06-05 Gilbert
!
! USAGE: abrev=param_get_abbrev(g2disc,g2cat,g2num)
! INPUT ARGUMENT LIST:
! g2disc - GRIB2 discipline number (See Code Table 0.0)
! g2cat - corresponding GRIB2 Category number
! g2num - corresponding GRIB2 Parameter number within Category g2cat
!
! RETURNS: ASCII Paramter Abbreviation
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: g2disc,g2cat,g2num
param_get_abbrev='UNKNOWN '
do n=1,MAXPARAM
if (paramlist(n)%grib2dsc.eq.g2disc.AND.
& paramlist(n)%grib2cat.eq.g2cat.AND.
& paramlist(n)%grib2num.eq.g2num) then
param_get_abbrev=paramlist(n)%abbrev
return
endif
enddo
! print *,'param_get_abbrev:GRIB2 param ',g2disc,g2cat,
! & g2num,' not found.'
return
end function
subroutine param_g2_to_g1(g2disc,g2cat,g2num,g1val,g1ver)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: param_g2_to_g1
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-04
!
! ABSTRACT: This function returns the GRIB 1 parameter number for
! a given GRIB2 Discipline, Category and Parameter number.
!
! PROGRAM HISTORY LOG:
! 2001-06-05 Gilbert
!
! USAGE: call param_g2_to_g1(g2disc,g2cat,g2num,g1val,g1ver)
! INPUT ARGUMENT LIST:
! g2disc - GRIB2 discipline number (See Code Table 0.0)
! g2cat - corresponding GRIB2 Category number
! g2num - corresponding GRIB2 Parameter number within Category g2cat
!
! OUTPUT ARGUMENT LIST:
! g1val - GRIB1 parameter number for which discipline is requested
! g1ver - GRIB1 parameter table version number
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: g2disc,g2cat,g2num
integer,intent(out) :: g1val,g1ver
g1val=255
g1ver=255
! for testing
! if ( g2disc.eq.255.and.g2cat.eq.255 ) then
! g1val=g2num
! g1ver=2
! return
! endif
! for testing
do n=1,MAXPARAM
if (paramlist(n)%grib2dsc.eq.g2disc.AND.
& paramlist(n)%grib2cat.eq.g2cat.AND.
& paramlist(n)%grib2num.eq.g2num) then
g1val=paramlist(n)%grib1val
g1ver=paramlist(n)%g1tblver
return
endif
enddo
print *,'param_g2_to_g1:GRIB2 param ',g2disc,g2cat,
& g2num,' not found.'
return
end subroutine
end module

View file

@ -1,63 +0,0 @@
GFORTRAN module created from params.f on Mon Nov 16 16:43:03 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'gribparam' 'params' 1 ((DERIVED UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(UNKNOWN 0 ()) 0 0 () () 0 ((3 'g1tblver' (INTEGER 4 ()) () 0 0 ()) (4
'grib1val' (INTEGER 4 ()) () 0 0 ()) (5 'grib2dsc' (INTEGER 4 ()) () 0 0
()) (6 'grib2cat' (INTEGER 4 ()) () 0 0 ()) (7 'grib2num' (INTEGER 4 ())
() 0 0 ()) (8 'abbrev' (CHARACTER 1 ((CONSTANT (INTEGER 4 ()) 0 '8'))) ()
0 0 ())) PUBLIC ())
9 'param_g1_to_g2' 'params' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL SUBROUTINE) (UNKNOWN 0 ()) 10 0 (11 12 13 14 15) () 0 () ())
16 'param_g2_to_g1' 'params' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL SUBROUTINE) (UNKNOWN 0 ()) 17 0 (18 19 20 21 22) () 0 () ())
23 'maxparam' 'params' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN)
(INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '716') () 0 () ())
24 'param_get_abbrev' 'params' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC
DECL FUNCTION) (CHARACTER 1 ((CONSTANT (INTEGER 4 ()) 0 '8'))) 25 0 (26
27 28) () 24 () ())
29 'params' 'params' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN) (
UNKNOWN 0 ()) 0 0 () () 0 () ())
30 'paramlist' 'params' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN
DIMENSION DATA) (DERIVED 2 ()) 0 0 () (1 EXPLICIT (CONSTANT (INTEGER 4 ())
0 '1') (CONSTANT (INTEGER 4 ()) 0 '716')) 0 () ())
15 'g2num' '' 10 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
13 'g2disc' '' 10 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4
()) 0 0 () () 0 () ())
11 'g1val' '' 10 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
12 'g1ver' '' 10 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
27 'g2cat' '' 25 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
26 'g2disc' '' 25 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
20 'g2num' '' 17 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
21 'g1val' '' 17 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
28 'g2num' '' 25 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
19 'g2cat' '' 17 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
14 'g2cat' '' 10 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
22 'g1ver' '' 17 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
18 'g2disc' '' 17 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
)
('paramlist' 0 30 'param_get_abbrev' 0 24 'maxparam' 0 23 'gribparam' 0
2 'param_g2_to_g1' 0 16 'param_g1_to_g2' 0 9 'params' 0 29)

View file

@ -1,336 +0,0 @@
module params_ecmwf
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: params_ecmwf
! PRGMMR: Gordon ORG: W/NP11 DATE: 2006-09-07
!
! ABSTRACT: This Fortran Module contains info on all the available
! ECMWF GRIB Parameters.
!
! PROGRAM HISTORY LOG:
! 2006-09-07 Gordon - Modified from Steve Gilbert's params.f for NCEP GRIB data
! 2007-04-20 Vuong - Add more parameters
! 2007-10-11 Vuong - Add more parameters
!
! USAGE: use params
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXPARAM=177
type gribparam
integer :: g1tblver
integer :: grib1val
integer :: grib2dsc
integer :: grib2cat
integer :: grib2num
character(len=8) :: abbrev
end type gribparam
type(gribparam),dimension(MAXPARAM) :: paramlist
data paramlist(1) /gribparam(128,1,255,255,255,'STRF ')/
data paramlist(2) /gribparam(128,002,255,255,255,'VPOT ')/
data paramlist(3) /gribparam(128,003,255,255,255,'THTA ')/
data paramlist(4) /gribparam(128,004,255,255,255,'THTE ')/
data paramlist(5) /gribparam(128,005,255,255,255,'THTS ')/
data paramlist(6) /gribparam(128,011,255,255,255,'UDVW ')/
data paramlist(7) /gribparam(128,012,255,255,255,'VDVW ')/
data paramlist(8) /gribparam(128,013,255,255,255,'URTW ')/
data paramlist(9) /gribparam(128,014,255,255,255,'VRTW ')/
data paramlist(10) /gribparam(128,021,255,255,255,'UCTP ')/
data paramlist(11) /gribparam(128,022,255,255,255,'UCLN ')/
data paramlist(12) /gribparam(128,023,255,255,255,'UCDV ')/
data paramlist(13) /gribparam(128,026,255,255,255,'CLAK ')/
data paramlist(14) /gribparam(128,027,255,255,255,'CVEGL ')/
data paramlist(15) /gribparam(128,028,255,255,255,'CVEGH ')/
data paramlist(16) /gribparam(128,029,255,255,255,'TVEGL ')/
data paramlist(17) /gribparam(128,030,255,255,255,'TVEGH ')/
data paramlist(18) /gribparam(128,031,255,255,255,'CSICE ')/
data paramlist(19) /gribparam(128,032,255,255,255,'ASNOW ')/
data paramlist(20) /gribparam(128,033,255,255,255,'RSNOW ')/
data paramlist(21) /gribparam(128,034,255,255,255,'SSTK ')/
data paramlist(22) /gribparam(128,035,255,255,255,'ISTL1 ')/
data paramlist(23) /gribparam(128,036,255,255,255,'ISTL2 ')/
data paramlist(24) /gribparam(128,037,255,255,255,'ISTL3 ')/
data paramlist(25) /gribparam(128,038,255,255,255,'ISTL4 ')/
data paramlist(26) /gribparam(128,039,255,255,255,'SWVL1 ')/
data paramlist(27) /gribparam(128,040,255,255,255,'SWVL2 ')/
data paramlist(28) /gribparam(128,041,255,255,255,'SWVL3 ')/
data paramlist(29) /gribparam(128,042,255,255,255,'SWVL4 ')/
data paramlist(30) /gribparam(128,043,255,255,255,'SOILT ')/
data paramlist(31) /gribparam(128,044,255,255,255,'ESNOW ')/
data paramlist(32) /gribparam(128,045,255,255,255,'SMLT ')/
data paramlist(33) /gribparam(128,046,255,255,255,'SDUR ')/
data paramlist(34) /gribparam(128,047,255,255,255,'DSRP ')/
data paramlist(35) /gribparam(128,048,255,255,255,'MAGSS ')/
data paramlist(36) /gribparam(128,049,255,255,255,'GUST ')/
data paramlist(37) /gribparam(128,050,255,255,255,'LSPF ')/
data paramlist(38) /gribparam(128,051,255,255,255,'TMXK24 ')/
data paramlist(39) /gribparam(128,052,255,255,255,'TMNK24 ')/
data paramlist(40) /gribparam(128,053,255,255,255,'MONT ')/
data paramlist(41) /gribparam(128,054,255,255,255,'PRES ')/
data paramlist(42) /gribparam(128,060,255,255,255,'PVOR ')/
data paramlist(43) /gribparam(128,127,255,255,255,'ATIDE ')/
data paramlist(44) /gribparam(128,128,255,255,255,'BVAL ')/
data paramlist(45) /gribparam(128,129,255,255,255,'HGHT ')/
data paramlist(46) /gribparam(128,130,0,0,0,'TMPK ')/
data paramlist(47) /gribparam(128,131,0,2,2,'UWND ')/
data paramlist(48) /gribparam(128,132,0,2,3,'VWND ')/
data paramlist(49) /gribparam(128,133,255,255,255,'SPCH ')/
data paramlist(50) /gribparam(128,134,255,255,255,'PRES ')/
data paramlist(51) /gribparam(128,135,255,255,255,'OMEG ')/
data paramlist(52) /gribparam(128,136,255,255,255,'TCWTR ')/
data paramlist(53) /gribparam(128,137,255,255,255,'TCWV ')/
data paramlist(54) /gribparam(128,138,255,255,255,'VORT ')/
data paramlist(55) /gribparam(128,139,255,255,255,'STL1 ')/
data paramlist(56) /gribparam(128,140,255,255,255,'SWL1 ')/
data paramlist(57) /gribparam(128,141,255,255,255,'SNOWD ')/
data paramlist(58) /gribparam(128,142,255,255,255,'S--M ')/
data paramlist(59) /gribparam(128,143,255,255,255,'C--M ')/
data paramlist(60) /gribparam(128,144,255,255,255,'SNOW ')/
data paramlist(61) /gribparam(128,145,255,255,255,'BLDS ')/
data paramlist(62) /gribparam(128,146,255,255,255,'SSHF ')/
data paramlist(63) /gribparam(128,147,255,255,255,'SLHF ')/
data paramlist(64) /gribparam(128,148,255,255,255,'CHNK ')/
data paramlist(65) /gribparam(128,149,255,255,255,'SNRAD ')/
data paramlist(66) /gribparam(128,150,255,255,255,'TNRAD ')/
data paramlist(67) /gribparam(128,151,0,3,1,'PMSL ')/
data paramlist(68) /gribparam(128,152,255,255,255,'LNSP ')/
data paramlist(69) /gribparam(128,153,255,255,255,'SWHR ')/
data paramlist(70) /gribparam(128,154,255,255,255,'LWHR ')/
data paramlist(71) /gribparam(128,155,255,255,255,'DIVG ')/
data paramlist(72) /gribparam(128,156,0,3,5,'HGHT ')/
data paramlist(73) /gribparam(128,157,0,1,1,'RELH ')/
data paramlist(74) /gribparam(128,158,255,255,255,'TSPRES ')/
data paramlist(75) /gribparam(128,159,255,255,255,'BLHGHT ')/
data paramlist(76) /gribparam(128,160,255,255,255,'SDOR ')/
data paramlist(77) /gribparam(128,161,255,255,255,'ISOR ')/
data paramlist(78) /gribparam(128,162,255,255,255,'ANOR ')/
data paramlist(79) /gribparam(128,163,255,255,255,'SLOR ')/
data paramlist(80) /gribparam(128,164,0,6,1,'TCLD ')/
data paramlist(81) /gribparam(128,165,0,2,2,'UWND ')/
data paramlist(82) /gribparam(128,166,0,2,3,'VWND ')/
data paramlist(83) /gribparam(128,167,0,0,0,'TMPK ')/
data paramlist(84) /gribparam(128,168,0,0,6,'DWPK ')/
data paramlist(85) /gribparam(128,169,255,255,255,'SSRD ')/
data paramlist(86) /gribparam(128,170,255,255,255,'STL2 ')/
data paramlist(87) /gribparam(128,171,255,255,255,'SWL2 ')/
data paramlist(88) /gribparam(128,172,255,255,255,'LAND ')/
data paramlist(89) /gribparam(128,173,255,255,255,'SROUGH ')/
data paramlist(90) /gribparam(128,174,255,255,255,'ALBD ')/
data paramlist(91) /gribparam(128,175,255,255,255,'STRD ')/
data paramlist(92) /gribparam(128,176,255,255,255,'SSRAD ')/
data paramlist(93) /gribparam(128,177,255,255,255,'STRAD ')/
data paramlist(94) /gribparam(128,178,255,255,255,'TSRAD ')/
data paramlist(95) /gribparam(128,179,255,255,255,'TTRAD ')/
data paramlist(96) /gribparam(128,180,255,255,255,'EWSS ')/
data paramlist(97) /gribparam(128,181,255,255,255,'NSSS ')/
data paramlist(98) /gribparam(128,182,255,255,255,'EVAP ')/
data paramlist(99) /gribparam(128,183,255,255,255,'STL3 ')/
data paramlist(100) /gribparam(128,184,255,255,255,'SWL3 ')/
data paramlist(101) /gribparam(128,185,255,255,255,'CCLD ')/
data paramlist(102) /gribparam(128,186,255,255,255,'LCLD ')/
data paramlist(103) /gribparam(128,187,255,255,255,'MCLD ')/
data paramlist(104) /gribparam(128,188,255,255,255,'HCLD ')/
data paramlist(105) /gribparam(128,189,255,255,255,'SUND ')/
data paramlist(106) /gribparam(128,190,255,255,255,'EWOV ')/
data paramlist(107) /gribparam(128,191,255,255,255,'NSOV ')/
data paramlist(108) /gribparam(128,192,255,255,255,'NWOV ')/
data paramlist(109) /gribparam(128,193,255,255,255,'NEOV ')/
data paramlist(110) /gribparam(128,194,255,255,255,'BTMP ')/
data paramlist(111) /gribparam(128,195,255,255,255,'LGWS ')/
data paramlist(112) /gribparam(128,196,255,255,255,'MGWS ')/
data paramlist(113) /gribparam(128,197,255,255,255,'GWDS ')/
data paramlist(114) /gribparam(128,198,255,255,255,'SKRC ')/
data paramlist(115) /gribparam(128,199,255,255,255,'VEGE ')/
data paramlist(116) /gribparam(128,200,255,255,255,'VSGO ')/
data paramlist(117) /gribparam(128,201,0,0,4,'TMXK ')/
data paramlist(118) /gribparam(128,202,0,0,5,'TMNK ')/
data paramlist(119) /gribparam(128,203,255,255,255,'OZMR ')/
data paramlist(120) /gribparam(128,204,255,255,255,'PRAW ')/
data paramlist(121) /gribparam(128,205,255,255,255,'RUNOFF ')/
data paramlist(122) /gribparam(128,206,255,255,255,'TCOZ ')/
data paramlist(123) /gribparam(128,207,255,255,255,'SPED ')/
data paramlist(124) /gribparam(128,208,255,255,255,'TSRC ')/
data paramlist(125) /gribparam(128,209,255,255,255,'TTRC ')/
data paramlist(126) /gribparam(128,210,255,255,255,'SSRC ')/
data paramlist(127) /gribparam(128,211,255,255,255,'STRC ')/
data paramlist(128) /gribparam(128,212,255,255,255,'SINSOL ')/
data paramlist(129) /gribparam(128,214,255,255,255,'DHRAD ')/
data paramlist(130) /gribparam(128,215,255,255,255,'DHVD ')/
data paramlist(131) /gribparam(128,216,255,255,255,'DHCC ')/
data paramlist(132) /gribparam(128,217,255,255,255,'DHLC ')/
data paramlist(133) /gribparam(128,218,255,255,255,'VDZW ')/
data paramlist(134) /gribparam(128,219,255,255,255,'VDMW ')/
data paramlist(135) /gribparam(128,220,255,255,255,'EWGD ')/
data paramlist(136) /gribparam(128,221,255,255,255,'NSGD ')/
data paramlist(137) /gribparam(128,222,255,255,255,'CTZW ')/
data paramlist(138) /gribparam(128,223,255,255,255,'CTMW ')/
data paramlist(139) /gribparam(128,224,255,255,255,'VDHUM ')/
data paramlist(140) /gribparam(128,225,255,255,255,'HTCC ')/
data paramlist(141) /gribparam(128,226,255,255,255,'HTLC ')/
data paramlist(142) /gribparam(128,227,255,255,255,'CRNH ')/
data paramlist(143) /gribparam(128,228,0,1,8,'A PCP ')/
data paramlist(144) /gribparam(128,229,255,255,255,'IEWS ')/
data paramlist(145) /gribparam(128,230,255,255,255,'INSS ')/
data paramlist(146) /gribparam(128,231,255,255,255,'ISHF ')/
data paramlist(147) /gribparam(128,232,255,255,255,'MFLUX ')/
data paramlist(148) /gribparam(128,233,255,255,255,'ASHUM ')/
data paramlist(149) /gribparam(128,234,255,255,255,'LSRH ')/
data paramlist(150) /gribparam(128,235,255,255,255,'SKTMP ')/
data paramlist(151) /gribparam(128,236,255,255,255,'STL4 ')/
data paramlist(152) /gribparam(128,237,255,255,255,'SWL4 ')/
data paramlist(153) /gribparam(128,238,255,255,255,'TSNOW ')/
data paramlist(154) /gribparam(128,239,255,255,255,'CSNOWF ')/
data paramlist(155) /gribparam(128,240,255,255,255,'LSNOWF ')/
data paramlist(156) /gribparam(128,241,255,255,255,'ACLD ')/
data paramlist(157) /gribparam(128,242,255,255,255,'ALWTND ')/
data paramlist(158) /gribparam(128,243,255,255,255,'FALBD ')/
data paramlist(159) /gribparam(128,244,255,255,255,'FSROUGH ')/
data paramlist(160) /gribparam(128,245,255,255,255,'FLSR ')/
data paramlist(161) /gribparam(128,246,255,255,255,'CLWC ')/
data paramlist(162) /gribparam(128,247,255,255,255,'CIWC ')/
data paramlist(163) /gribparam(128,248,255,255,255,'CLOUD ')/
data paramlist(164) /gribparam(128,249,255,255,255,'AIWTND ')/
data paramlist(165) /gribparam(128,250,255,255,255,'ICEAGE ')/
data paramlist(166) /gribparam(128,251,255,255,255,'ATTE ')/
data paramlist(167) /gribparam(128,252,255,255,255,'ATHE ')/
data paramlist(168) /gribparam(128,253,255,255,255,'ATZE ')/
data paramlist(169) /gribparam(128,254,255,255,255,'ATMW ')/
data paramlist(170) /gribparam(128,255,255,255,255,'MISS ')/
! Added 4/20/2007 - For missing GRIB1 to GRIB2 conversions
data paramlist(171) /gribparam(1,33,0,2,2,'U GRD ')/
data paramlist(172) /gribparam(1,34,0,2,3,'V GRD ')/
data paramlist(173) /gribparam(1,2,0,3,1,'PRMSL ')/
data paramlist(174) /gribparam(1,7,0,3,5,'HGT ')/
! Added 10/11/2007- Add more parameters
data paramlist(175) /gribparam(1,11,0,0,0,'TMP ')/
data paramlist(176) /gribparam(1,52,0,1,1,'R H ')/
data paramlist(177) /gribparam(1,41,0,2,10,'ABS V ')/
contains
subroutine param_ecmwf_g1_to_g2(g1val,g1ver,g2disc,g2cat,g2num)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: param_ecmwf_g1_to_g2
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-05
!
! ABSTRACT: This subroutine returns the corresponding GRIB2 Discipline
! Category and Number for a given GRIB1 parameter value and table version.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL param_ecmwf_g1_to_g2(g1val,g1ver,g2disc,g2cat,g2num)
! INPUT ARGUMENT LIST:
! g1val - GRIB1 parameter number for which discipline is requested
! g1ver - GRIB1 parameter table version number
!
! OUTPUT ARGUMENT LIST:
! g2disc - corresponding GRIB2 Discipline number
! g2cat - corresponding GRIB2 Category number
! g2num - corresponding GRIB2 Parameter number within Category g2cat
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: g1val,g1ver
integer,intent(out) :: g2disc,g2cat,g2num
g2disc=255
g2cat=255
g2num=255
! for testing
! g2num=g1val
! for testing
do n=1,MAXPARAM
if ( paramlist(n)%grib1val.eq.g1val .AND.
& paramlist(n)%g1tblver.eq.g1ver ) then
g2disc=paramlist(n)%grib2dsc
g2cat=paramlist(n)%grib2cat
g2num=paramlist(n)%grib2num
c print *,g2disc
c print *,g2cat
c print *,g2num
return
endif
enddo
print *,'param_ecmwf_g1_to_g2:GRIB1 param ',g1val,
& ' not found.',
& ' for table version ',g1ver
return
end subroutine
subroutine param_ecmwf_g2_to_g1(g2disc,g2cat,g2num,g1val,g1ver)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: param_ecmwf_g2_to_g1
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-04
!
! ABSTRACT: This function returns the GRIB 1 parameter number for
! a given GRIB2 Discipline, Category and Parameter number.
!
! PROGRAM HISTORY LOG:
! 2001-06-05 Gilbert
!
! USAGE: call param_ecmwf_g2_to_g1(g2disc,g2cat,g2num,g1val,g1ver)
! INPUT ARGUMENT LIST:
! g2disc - GRIB2 discipline number (See Code Table 0.0)
! g2cat - corresponding GRIB2 Category number
! g2num - corresponding GRIB2 Parameter number within Category g2cat
!
! OUTPUT ARGUMENT LIST:
! g1val - GRIB1 parameter number for which discipline is requested
! g1ver - GRIB1 parameter table version number
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: g2disc,g2cat,g2num
integer,intent(out) :: g1val,g1ver
g1val=255
g1ver=255
! for testing
! if ( g2disc.eq.255.and.g2cat.eq.255 ) then
! g1val=g2num
! g1ver=2
! return
! endif
! for testing
do n=1,MAXPARAM
if (paramlist(n)%grib2dsc.eq.g2disc.AND.
& paramlist(n)%grib2cat.eq.g2cat.AND.
& paramlist(n)%grib2num.eq.g2num) then
g1val=paramlist(n)%grib1val
g1ver=paramlist(n)%g1tblver
return
endif
enddo
print *,'param_ecmwf_g2_to_g1:GRIB2 param ',g2disc,g2cat,
& g2num,' not found.'
return
end subroutine
end module

View file

@ -1,57 +0,0 @@
GFORTRAN module created from params_ecmwf.f on Mon Nov 16 16:43:03 2009
If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () ())
()
()
()
()
(2 'gribparam' 'params_ecmwf' 1 ((DERIVED UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 ((3 'g1tblver' (INTEGER 4 ()) () 0 0
()) (4 'grib1val' (INTEGER 4 ()) () 0 0 ()) (5 'grib2dsc' (INTEGER 4 ())
() 0 0 ()) (6 'grib2cat' (INTEGER 4 ()) () 0 0 ()) (7 'grib2num' (
INTEGER 4 ()) () 0 0 ()) (8 'abbrev' (CHARACTER 1 ((CONSTANT (INTEGER 4
()) 0 '8'))) () 0 0 ())) PUBLIC ())
9 'maxparam' 'params_ecmwf' 1 ((PARAMETER UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (INTEGER 4 ()) 0 0 () (CONSTANT (INTEGER 4 ()) 0 '177') () 0 ()
())
10 'param_ecmwf_g2_to_g1' 'params_ecmwf' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 11 0 (12 13 14 15 16) () 0 ()
())
17 'param_ecmwf_g1_to_g2' 'params_ecmwf' 1 ((PROCEDURE UNKNOWN-INTENT
MODULE-PROC DECL SUBROUTINE) (UNKNOWN 0 ()) 18 0 (19 20 21 22 23) () 0 ()
())
24 'params_ecmwf' 'params_ecmwf' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN) (UNKNOWN 0 ()) 0 0 () () 0 () ())
25 'paramlist' 'params_ecmwf' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN DIMENSION DATA) (DERIVED 2 ()) 0 0 () (1 EXPLICIT (CONSTANT (
INTEGER 4 ()) 0 '1') (CONSTANT (INTEGER 4 ()) 0 '177')) 0 () ())
22 'g2cat' '' 18 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
21 'g2disc' '' 18 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4
()) 0 0 () () 0 () ())
20 'g1ver' '' 18 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
23 'g2num' '' 18 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
12 'g2disc' '' 11 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
19 'g1val' '' 18 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
14 'g2num' '' 11 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
15 'g1val' '' 11 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
13 'g2cat' '' 11 ((VARIABLE IN UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
16 'g1ver' '' 11 ((VARIABLE OUT UNKNOWN-PROC UNKNOWN DUMMY) (INTEGER 4 ())
0 0 () () 0 () ())
)
('paramlist' 0 25 'param_ecmwf_g1_to_g2' 0 17 'maxparam' 0 9 'gribparam'
0 2 'param_ecmwf_g2_to_g1' 0 10 'params_ecmwf' 0 24)

View file

@ -1,494 +0,0 @@
module pdstemplates
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! MODULE: pdstemplates
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-11
!
! ABSTRACT: This Fortran Module contains info on all the available
! GRIB2 Product Definition Templates used in Section 4 (PDS).
! Each Template has three parts: The number of entries in the template
! (mapgridlen); A map of the template (mapgrid), which contains the
! number of octets in which to pack each of the template values; and
! a logical value (needext) that indicates whether the Template needs
! to be extended. In some cases the number of entries in a template
! can vary depending upon values specified in the "static" part of
! the template. ( See Template 4.3 as an example )
!
! This module also contains two subroutines. Subroutine getpdstemplate
! returns the octet map for a specified Template number, and
! subroutine extpdstemplate will calculate the extended octet map
! of an appropriate template given values for the "static" part of the
! template. See docblocks below for the arguments and usage of these
! routines.
!
! NOTE: Array mapgrid contains the number of octets in which the
! corresponding template values will be stored. A negative value in
! mapgrid is used to indicate that the corresponding template entry can
! contain negative values. This information is used later when packing
! (or unpacking) the template data values. Negative data values in GRIB
! are stored with the left most bit set to one, and a negative number
! of octets value in mapgrid() indicates that this possibility should
! be considered. The number of octets used to store the data value
! in this case would be the absolute value of the negative value in
! mapgrid().
!
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
! 2001-12-04 Gilbert - Added Templates 4.12, 4.12, 4.14,
! 4.1000, 4.1001, 4.1002, 4.1100 and 4.1101
!
! USAGE: use pdstemplates
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,parameter :: MAXLEN=200,MAXTEMP=23
type pdstemplate
integer :: template_num
integer :: mappdslen
integer,dimension(MAXLEN) :: mappds
logical :: needext
end type pdstemplate
type(pdstemplate),dimension(MAXTEMP) :: templates
data templates(1)%template_num /0/ ! Fcst at Level/Layer
data templates(1)%mappdslen /15/
data templates(1)%needext /.false./
data (templates(1)%mappds(j),j=1,15)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4/
data templates(2)%template_num /1/ ! Ens fcst at level/layer
data templates(2)%mappdslen /18/
data templates(2)%needext /.false./
data (templates(2)%mappds(j),j=1,18)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1/
data templates(3)%template_num /2/ ! Derived Ens fcst at level/layer
data templates(3)%mappdslen /17/
data templates(3)%needext /.false./
data (templates(3)%mappds(j),j=1,17)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1/
data templates(4)%template_num /3/ ! Ens cluster fcst rect. area
data templates(4)%mappdslen /31/
data templates(4)%needext /.true./
data (templates(4)%mappds(j),j=1,31)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,-4,4,4,
& 1,-1,4,-1,4/
data templates(5)%template_num /4/ ! Ens cluster fcst circ. area
data templates(5)%mappdslen /30/
data templates(5)%needext /.true./
data (templates(5)%mappds(j),j=1,30)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,4,4,
& 1,-1,4,-1,4/
data templates(6)%template_num /5/ ! Prob fcst at level/layer
data templates(6)%mappdslen /22/
data templates(6)%needext /.false./
data (templates(6)%mappds(j),j=1,22)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,1,4,1,4/
data templates(7)%template_num /6/ ! Percentile fcst at level/layer
data templates(7)%mappdslen /16/
data templates(7)%needext /.false./
data (templates(7)%mappds(j),j=1,16)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1/
data templates(8)%template_num /7/ ! Error at level/layer
data templates(8)%mappdslen /15/
data templates(8)%needext /.false./
data (templates(8)%mappds(j),j=1,15)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4/
data templates(9)%template_num /8/ ! Ave or Accum at level/layer
data templates(9)%mappdslen /29/
data templates(9)%needext /.true./
data (templates(9)%mappds(j),j=1,29)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,2,1,1,1,1,1,1,4,1,1,1,4,1,4/
data templates(10)%template_num /9/ ! Prob over time interval
data templates(10)%mappdslen /36/
data templates(10)%needext /.true./
data (templates(10)%mappds(j),j=1,36)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,-1,4,-1,4,2,1,1,1,1,1,
& 1,4,1,1,1,4,1,4/
data templates(11)%template_num /10/ ! Percentile over time interval
data templates(11)%mappdslen /30/
data templates(11)%needext /.true./
data (templates(11)%mappds(j),j=1,30)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,2,1,1,1,1,1,1,4,
& 1,1,1,4,1,4/
data templates(12)%template_num /11/ ! Ens member over time interval
data templates(12)%mappdslen /32/
data templates(12)%needext /.true./
data (templates(12)%mappds(j),j=1,32)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1,1,
& 4,1,1,1,4,1,4/
data templates(13)%template_num /12/ ! Derived Ens fcst over time int
data templates(13)%mappdslen /31/
data templates(13)%needext /.true./
data (templates(13)%mappds(j),j=1,31)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,
& 2,1,1,1,1,1,1,4,1,1,1,4,1,4/
data templates(14)%template_num /13/ ! Ens cluster fcst rect. area
data templates(14)%mappdslen /45/
data templates(14)%needext /.true./
data (templates(14)%mappds(j),j=1,45)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,-4,4,4,
& 1,-1,4,-1,4,2,1,1,1,1,1,1,4,1,1,1,4,1,4/
data templates(15)%template_num /14/ ! Ens cluster fcst circ. area
data templates(15)%mappdslen /44/
data templates(15)%needext /.true./
data (templates(15)%mappds(j),j=1,44)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,1,1,1,1,1,1,1,-4,4,4,
& 1,-1,4,-1,4,2,1,1,1,1,1,1,4,1,1,1,4,1,4/
data templates(16)%template_num /20/ ! Radar Product
data templates(16)%mappdslen /19/
data templates(16)%needext /.false./
data (templates(16)%mappds(j),j=1,19)
& /1,1,1,1,1,-4,4,2,4,2,1,1,1,1,1,2,1,3,2/
data templates(17)%template_num /30/ ! Satellite Product
data templates(17)%mappdslen /5/
data templates(17)%needext /.true./
data (templates(17)%mappds(j),j=1,5)
& /1,1,1,1,1/
data templates(18)%template_num /254/ ! CCITTIA5 Character String
data templates(18)%mappdslen /3/
data templates(18)%needext /.false./
data (templates(18)%mappds(j),j=1,3)
& /1,1,4/
data templates(19)%template_num /1000/ ! Cross section
data templates(19)%mappdslen /9/
data templates(19)%needext /.false./
data (templates(19)%mappds(j),j=1,9)
& /1,1,1,1,1,2,1,1,4/
data templates(20)%template_num /1001/ ! Cross section over time
data templates(20)%mappdslen /16/
data templates(20)%needext /.false./
data (templates(20)%mappds(j),j=1,16)
& /1,1,1,1,1,2,1,1,4,4,1,1,1,4,1,4/
data templates(21)%template_num /1002/ ! Cross section processed time
data templates(21)%mappdslen /15/
data templates(21)%needext /.false./
data (templates(21)%mappds(j),j=1,15)
& /1,1,1,1,1,2,1,1,4,1,1,1,4,4,2/
data templates(22)%template_num /1100/ ! Hovmoller grid
data templates(22)%mappdslen /15/
data templates(22)%needext /.false./
data (templates(22)%mappds(j),j=1,15)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4/
data templates(23)%template_num /1101/ ! Hovmoller with stat proc
data templates(23)%mappdslen /22/
data templates(23)%needext /.false./
data (templates(23)%mappds(j),j=1,22)
& /1,1,1,1,1,2,1,1,4,1,-1,-4,1,-1,-4,4,1,1,1,4,1,4/
contains
integer function getpdsindex(number)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getpdsindex
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2001-06-28
!
! ABSTRACT: This function returns the index of specified Product
! Definition Template 4.NN (NN=number) in array templates.
!
! PROGRAM HISTORY LOG:
! 2001-06-28 Gilbert
!
! USAGE: index=getpdsindex(number)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Product Definition
! Template 4.NN that is being requested.
!
! RETURNS: Index of PDT 4.NN in array templates, if template exists.
! = -1, otherwise.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
getpdsindex=-1
do j=1,MAXTEMP
if (number.eq.templates(j)%template_num) then
getpdsindex=j
return
endif
enddo
end function
subroutine getpdstemplate(number,nummap,map,needext,iret)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getpdstemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-11
!
! ABSTRACT: This subroutine returns PDS template information for a
! specified Product Definition Template 4.NN.
! The number of entries in the template is returned along with a map
! of the number of octets occupied by each entry. Also, a flag is
! returned to indicate whether the template would need to be extended.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL getpdstemplate(number,nummap,map,needext,iret)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Product Definition
! Template 4.NN that is being requested.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the PDS.
! needext - Logical variable indicating whether the Product Defintion
! Template has to be extended.
! ierr - Error return code.
! 0 = no error
! 1 = Undefine Product Template number.
!
! REMARKS: None
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
integer,intent(out) :: nummap,map(*),iret
logical,intent(out) :: needext
iret=0
index=getpdsindex(number)
if (index.ne.-1) then
nummap=templates(index)%mappdslen
needext=templates(index)%needext
map(1:nummap)=templates(index)%mappds(1:nummap)
else
nummap=0
needext=.false.
print *,'getpdstemplate: PDS Template ',number,
& ' not defined.'
iret=1
endif
end subroutine
subroutine extpdstemplate(number,list,nummap,map)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: extpdstemplate
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2000-05-11
!
! ABSTRACT: This subroutine generates the remaining octet map for a
! given Product Definition Template, if required. Some Templates can
! vary depending on data values given in an earlier part of the
! Template, and it is necessary to know some of the earlier entry
! values to generate the full octet map of the Template.
!
! PROGRAM HISTORY LOG:
! 2000-05-11 Gilbert
!
! USAGE: CALL extpdstemplate(number,list,nummap,map)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Product Definition
! Template 4.NN that is being requested.
! list() - The list of values for each entry in the
! the Product Definition Template 4.NN.
!
! OUTPUT ARGUMENT LIST:
! nummap - Number of entries in the Template
! map() - An array containing the number of octets that each
! template entry occupies when packed up into the GDS.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number,list(*)
integer,intent(out) :: nummap,map(*)
index=getpdsindex(number)
if (index.eq.-1) return
if ( .not. templates(index)%needext ) return
nummap=templates(index)%mappdslen
map(1:nummap)=templates(index)%mappds(1:nummap)
if ( number.eq.3 ) then
N=list(27)
do i=1,N
map(nummap+i)=1
enddo
nummap=nummap+N
elseif ( number.eq.4 ) then
N=list(26)
do i=1,N
map(nummap+i)=1
enddo
nummap=nummap+N
elseif ( number.eq.8 ) then
if ( list(22).gt.1 ) then
do j=2,list(22)
do k=1,6
map(nummap+k)=map(23+k)
enddo
nummap=nummap+6
enddo
endif
elseif ( number.eq.9 ) then
if ( list(29).gt.1 ) then
do j=2,list(29)
do k=1,6
map(nummap+k)=map(30+k)
enddo
nummap=nummap+6
enddo
endif
elseif ( number.eq.10 ) then
if ( list(23).gt.1 ) then
do j=2,list(23)
do k=1,6
map(nummap+k)=map(24+k)
enddo
nummap=nummap+6
enddo
endif
elseif ( number.eq.11 ) then
if ( list(25).gt.1 ) then
do j=2,list(25)
do k=1,6
map(nummap+k)=map(26+k)
enddo
nummap=nummap+6
enddo
endif
elseif ( number.eq.12 ) then
if ( list(24).gt.1 ) then
do j=2,list(24)
do k=1,6
map(nummap+k)=map(25+k)
enddo
nummap=nummap+6
enddo
endif
elseif ( number.eq.13 ) then
if ( list(38).gt.1 ) then
do j=2,list(38)
do k=1,6
map(nummap+k)=map(39+k)
enddo
nummap=nummap+6
enddo
endif
N=list(27)
do i=1,N
map(nummap+i)=1
enddo
nummap=nummap+N
elseif ( number.eq.14 ) then
if ( list(37).gt.1 ) then
do j=2,list(37)
do k=1,6
map(nummap+k)=map(38+k)
enddo
nummap=nummap+6
enddo
endif
N=list(26)
do i=1,N
map(nummap+i)=1
enddo
nummap=nummap+N
elseif ( number.eq.30 ) then
do j=1,list(5)
map(nummap+1)=2
map(nummap+2)=2
map(nummap+3)=1
map(nummap+4)=1
map(nummap+5)=4
nummap=nummap+5
enddo
endif
end subroutine
integer function getpdtlen(number)
!$$$ SUBPROGRAM DOCUMENTATION BLOCK
! . . . .
! SUBPROGRAM: getpdtlen
! PRGMMR: Gilbert ORG: W/NP11 DATE: 2004-05-11
!
! ABSTRACT: This function returns the initial length (number of entries) in
! the "static" part of specified Product Definition Template 4.number.
!
! PROGRAM HISTORY LOG:
! 2004-05-11 Gilbert
!
! USAGE: CALL getpdtlen(number)
! INPUT ARGUMENT LIST:
! number - NN, indicating the number of the Product Definition
! Template 4.NN that is being requested.
!
! RETURNS: Number of entries in the "static" part of PDT 4.number
! OR returns 0, if requested template is not found.
!
! REMARKS: If user needs the full length of a specific template that
! contains additional entries based on values set in the "static" part
! of the PDT, subroutine extpdstemplate can be used.
!
! ATTRIBUTES:
! LANGUAGE: Fortran 90
! MACHINE: IBM SP
!
!$$$
integer,intent(in) :: number
getpdtlen=0
index=getpdsindex(number)
if (index.ne.-1) then
getpdtlen=templates(index)%mappdslen
endif
end function
end module

Some files were not shown because too many files have changed in this diff Show more