Merge branch 'feature/ECC-1620_sub-hourly' of github.com:ecmwf/eccodes into feature/ECC-1620_sub-hourly

This commit is contained in:
Eugen Betke 2024-01-11 08:10:55 +00:00
commit 7cebae4d70
115 changed files with 2094 additions and 3299 deletions

132
.cproject
View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.cross.so.debug.1887207789">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.so.debug.1887207789" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ecCodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ecCodes/Debug"/>
<entry flags="RESOLVED" kind="libraryFile" name="ecCodes" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions>
<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.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.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="${ProjName}" 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="" id="cdt.managedbuild.config.gnu.cross.so.debug.1887207789" name="Debug" parent="cdt.managedbuild.config.gnu.cross.so.debug">
<folderInfo id="cdt.managedbuild.config.gnu.cross.so.debug.1887207789." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.so.debug.416864500" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.so.debug">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1362241153" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder arguments="" buildPath="/var/tmp/cmake_build/build-eccodes" command="make" id="cdt.managedbuild.builder.gnu.cross.876773823" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="6" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.480849067" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1430529908" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.1408637585" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.19096666" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1532524478" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1903075903" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.1941013604" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1393105821" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
<option defaultValue="true" id="gnu.c.link.option.shared.1833873259" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.239826819" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1237847268" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option defaultValue="true" id="gnu.cpp.link.option.shared.343149061" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.2042650456" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1346864522" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.610978424" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.so.release.1101645981">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.so.release.1101645981" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/ecCodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/ecCodes/Release"/>
<entry flags="RESOLVED" kind="libraryFile" name="ecCodes" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions>
<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.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.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.so.release.1101645981" name="Release" parent="cdt.managedbuild.config.gnu.cross.so.release">
<folderInfo id="cdt.managedbuild.config.gnu.cross.so.release.1101645981." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.so.release.1696856780" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.so.release">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.923290480" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/ecCodes}/Release" id="cdt.managedbuild.builder.gnu.cross.1553796951" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1057888993" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1617966377" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.674178935" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.37480136" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1096096828" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1248406075" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.17815586" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1414758339" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
<option defaultValue="true" id="gnu.c.link.option.shared.1907010607" superClass="gnu.c.link.option.shared" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.160410096" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1590201569" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option defaultValue="true" id="gnu.cpp.link.option.shared.177399663" superClass="gnu.cpp.link.option.shared" valueType="boolean"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1207944287" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1698226637" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1593893847" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ecCodes.cdt.managedbuild.target.gnu.cross.so.1965317215" name="Shared Library" projectType="cdt.managedbuild.target.gnu.cross.so"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.so.debug.1887207789;cdt.managedbuild.config.gnu.cross.so.debug.1887207789.;cdt.managedbuild.tool.gnu.cross.c.compiler.480849067;cdt.managedbuild.tool.gnu.c.compiler.input.19096666">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.so.release.1101645981;cdt.managedbuild.config.gnu.cross.so.release.1101645981.;cdt.managedbuild.tool.gnu.cross.c.compiler.1057888993;cdt.managedbuild.tool.gnu.c.compiler.input.37480136">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/ecCodes"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/ecCodes"/>
</configuration>
</storageModule>
</cproject>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>eccodes</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.config.gnu.cross.so.debug.1887207789" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-766511048364220641" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="cdt.managedbuild.config.gnu.cross.so.release.1101645981" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-766511048364220641" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@ -90,3 +90,5 @@ gfs.complex.mvmu.grib2
mercator.grib2
run_length_packing.grib2
boustrophedonic.grib1
reduced_gaussian_sub_area.legacy.grib1

View File

@ -1,5 +1,6 @@
# Concept combinationOfAttributesOfTile
'UNDEF' = {attributeOfTile = [0];}
'UNMOD' = {attributeOfTile = [1];}
'SNOW' = {attributeOfTile = [2];}
'FLOOD' = {attributeOfTile = [3];}

View File

@ -21,6 +21,7 @@ meta stepHumanReadable step_human_readable(stepUnits, stepRange): hidden,no_copy
alias time.stepType=stepType;
alias time.stepRange=stepRange;
alias time.stepUnits=stepUnits;
alias time.dataDate=dataDate;
alias time.dataTime=dataTime;
alias time.startStep=startStep;

View File

@ -39,14 +39,13 @@ alias ls.CCCC=CCCC;
alias ls.YY=YY;
alias ls.GG=GG;
alias ls.gg=gg;
position endOfHeadersMarker;
position endOfHeadersMarker;
message[4] theMessage;
meta lengthOfHeaders evaluate( endOfHeadersMarker-startOfHeaders);
meta md5Headers md5(startOfHeaders,lengthOfHeaders);
meta lengthOfHeaders evaluate(endOfHeadersMarker-startOfHeaders);
meta md5Headers md5(startOfHeaders, lengthOfHeaders);
ascii[4] endMark;
ascii[4] endMark;
position totalLength;
alias ls.totalLength=totalLength;

View File

@ -14,6 +14,7 @@ if( HAVE_BUILD_TOOLS )
codes_f90_misc
grib_set_pv
grib_set_data
grib_set_data_force
bufr_ecc-1284
bufr_ecc-1019
get_native_type
@ -21,16 +22,23 @@ if( HAVE_BUILD_TOOLS )
list( APPEND tests_extra
grib_index
codes_dump
codes_scan_file
codes_load_file
grib_copy_message
bufr_copy_message
grib_get_keys
grib_get_data
grib_get_data_real4
grib_get_pl
grib_get_pv
grib_keys_iterator
grib_keys_iterator_skip
grib_multi_write
grib_multi
grib_elements
grib_nearest
grib_nearest_single
grib_nearest_four_single
grib_precision
grib_print_data
grib_set_keys
@ -42,6 +50,7 @@ if( HAVE_BUILD_TOOLS )
grib_copy_namespace
grib_read_message
grib_read_from_file
grib_read_bytes
grib_get_set_uuid
grib_clone
grib_ecc-1316
@ -67,6 +76,7 @@ else()
list( APPEND tests_sanity
grib_set_pv
grib_set_data
grib_set_data_force
codes_set_paths
codes_f90_misc
get_native_type
@ -78,8 +88,12 @@ else()
grib_get_pl
grib_get_pv
grib_keys_iterator
grib_keys_iterator_skip
grib_multi
grib_nearest
grib_elements
grib_nearest_single
grib_nearest_four_single
grib_precision
grib_print_data
grib_set_missing

View File

@ -0,0 +1,43 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program codes_load_file
use eccodes
implicit none
integer :: ifile, cnt, level, step
integer :: i, igrib, iret
character(len=32) :: infile_name = '../../data/index.grib'
call codes_open_file(ifile, infile_name, 'r')
call codes_any_load_all_from_file(ifile, cnt)
i = 45
call codes_any_new_from_loaded(i, igrib)
call codes_get(igrib, 'level', level)
call codes_get(igrib, 'stepRange', step)
print *, 'Num messages=', cnt
print *, 'Msg ',i,' level=',level, ' step=', step
call codes_release(igrib)
! Invalid msg number
i = 450
call codes_any_new_from_loaded(i, igrib, iret)
if (iret /= GRIB_INVALID_ARGUMENT) then
call codes_check(iret, 'Error', 'codes_any_new_from_loaded should have failed')
else
print *,'Invalid message index returned error (as expected)'
end if
call codes_close_file(ifile)
end program

21
examples/F90/codes_load_file.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
label='eccodes_f_codes_load_file'
temp=temp.$label.txt
# The input file is hard coded => data/index.grib
${examples_dir}/eccodes_f_codes_load_file > $temp
grep -q "Num messages= *384" $temp
grep -q "level= *700 step= *60" $temp
rm -f $temp

View File

@ -0,0 +1,43 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program codes_scan_file
use eccodes
implicit none
integer :: ifile, cnt, level, step
integer :: i, igrib, iret
character(len=32) :: infile_name = '../../data/index.grib'
call codes_open_file(ifile, infile_name, 'r')
call codes_any_scan_file(ifile,cnt)
i = 45
call codes_any_new_from_scanned_file(ifile, i, igrib)
call codes_get(igrib, 'level', level)
call codes_get(igrib, 'stepRange', step)
print *, 'Num messages=', cnt
print *, 'Msg ',i,' level=',level, ' step=', step
call codes_release(igrib)
! Invalid msg number
i = 450
call codes_any_new_from_scanned_file(ifile, i, igrib, iret)
if (iret /= GRIB_INVALID_ARGUMENT) then
call codes_check(iret, 'Error', 'codes_any_new_from_scanned_file should have failed')
else
print *,'Invalid message index returned error (as expected)'
end if
call codes_close_file(ifile)
end program

21
examples/F90/codes_scan_file.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
label='eccodes_f_codes_scan_file'
temp=temp.$label.txt
# The input file is hard coded => data/index.grib
${examples_dir}/eccodes_f_codes_scan_file > $temp
grep -q "Num messages= *384" $temp
grep -q "level= *700 step= *60" $temp
rm -f $temp

View File

@ -0,0 +1,50 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program grib_get_elements
use eccodes
implicit none
integer :: infile, igrib, i
real(4) :: value_real4
real(8) :: value_real8
real(4) :: values_real4(4)
real(8) :: values_real8(4)
integer :: array_of_indexes(4)
call codes_open_file(infile, '../../data/reduced_gaussian_pressure_level.grib1', 'r')
call codes_grib_new_from_file(infile, igrib)
array_of_indexes = [1, 0, 2, 4]
print *,'Values as REAL(4) at specific indexes'
call codes_get_element(igrib, "values", array_of_indexes, values_real4)
do i = 1, 4
print *, array_of_indexes(i), values_real4(i)
end do
print *,'Values as REAL(8) at specific indexes'
call codes_get_element(igrib, "values", array_of_indexes, values_real8)
do i = 1, 4
print *, array_of_indexes(i), values_real8(i)
end do
i = 12
print *,'The Value REAL(4) at index=',i
call codes_get_element(igrib, "values", i, value_real4)
print *, value_real4
print *,'The Value REAL(8) at index=',i
call codes_get_element(igrib, "values", i, value_real8)
print *, value_real8
call codes_release(igrib)
call codes_close_file(infile)
end program

12
examples/F90/grib_elements.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_elements

View File

@ -0,0 +1,76 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
!
program get_data_real4
use eccodes
implicit none
integer :: ifile
integer :: iret, i
real(kind=4), dimension(:), allocatable :: lats, lons, values
integer, dimension(:), allocatable :: bitmap
integer(4) :: numberOfPoints
logical :: is_missing_value
integer :: count1 = 0, count2 = 0, bitmapPresent = 0, bmp_len = 0
integer :: igrib ! message identifier
ifile = 5
call codes_open_file(ifile, '../../data/reduced_latlon_surface.grib2', 'r')
! loop on all the messages in the file
do while (.true.)
call codes_grib_new_from_file(ifile, igrib, iret)
if (iret == CODES_END_OF_FILE) exit
count1 = count1 + 1
print *, "===== Message #", count1
call codes_get(igrib, 'numberOfPoints', numberOfPoints)
call codes_get(igrib, 'bitmapPresent', bitmapPresent)
allocate (lats(numberOfPoints))
allocate (lons(numberOfPoints))
allocate (values(numberOfPoints))
if (bitmapPresent == 1) then
! get the bitmap
call codes_get_size(igrib, 'bitmap', bmp_len)
allocate (bitmap(bmp_len))
call codes_get(igrib, 'bitmap', bitmap)
end if
call codes_grib_get_data(igrib, lats, lons, values)
do i = 1, numberOfPoints
! consult bitmap to see if the i'th value is missing
is_missing_value = .false.
if (bitmapPresent == 1 .and. bitmap(i) == 0) then
is_missing_value = .true.
end if
! only print non-missing values
if (.not. is_missing_value) then
print *, lats(i), lons(i), values(i)
count2 = count2 + 1
end if
end do
print *, 'count of non-missing values=', count2
if (count2 /= 214661) then
call codes_check(-2, 'incorrect number of missing', '')
end if
deallocate (lats)
deallocate (lons)
deallocate (values)
call codes_release(igrib)
end do
call codes_close_file(ifile)
end program

View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_get_data_real4 > /dev/null

View File

@ -23,7 +23,7 @@ program index
character(len=20) :: oshortName
integer :: shortNameSize, numberSize, levelSize, stepSize
integer :: i, j, k, l
integer :: idx, igrib, count1
integer :: idx, idx1, igrib, count1
character(len=10) :: index_file = 'index.idx'
! uncomment following line to load index from file
@ -107,7 +107,10 @@ program index
! save the index to a file for later reuse
call codes_index_write(idx, index_file)
call codes_index_read(idx1, index_file)
call codes_index_release(idx)
call codes_index_release(idx1)
deallocate (level)
deallocate (shortName)

View File

@ -0,0 +1,57 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program keys_iterator_skip
use eccodes
implicit none
character(len=20) :: name_space
integer :: kiter, ifile, igrib, iret
character(len=256) :: key
character(len=256) :: value
character(len=512) :: all1
integer :: grib_count
call codes_open_file(ifile, &
'../../data/regular_latlon_surface.grib1', 'r')
! Loop on all the messages in a file
grib_count = 0
do while (.true.)
call codes_grib_new_from_file(ifile, igrib, iret)
if (iret == CODES_END_OF_FILE) exit
grib_count = grib_count + 1
write (*, *) '-- GRIB N. ', grib_count, ' --'
! Choose a namespace. E.g. "ls", "time", "parameter", "geography", "statistics"
name_space = 'ls'
call codes_keys_iterator_new(igrib, kiter, name_space)
call codes_skip_computed(kiter)
call codes_skip_coded(kiter)
call codes_skip_duplicates(kiter)
call codes_skip_read_only(kiter)
do
call codes_keys_iterator_next(kiter, iret)
if (iret .ne. CODES_SUCCESS) exit !terminate the loop
call codes_keys_iterator_get_name(kiter, key)
call codes_get(igrib, trim(key), value)
all1 = trim(key)//' = '//trim(value)
write (*, *) trim(all1)
end do
call codes_keys_iterator_delete(kiter)
call codes_release(igrib)
end do
call codes_close_file(ifile)
end program keys_iterator_skip

View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_keys_iterator_skip

View File

@ -0,0 +1,31 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
program find_nearest_4single
use eccodes
implicit none
integer :: infile, i
integer :: igrib
real(8) :: inlat = 5, inlon = 10
real(8) :: outlats(4), outlons(4)
real(8) :: values(4), distances(4)
integer(kind=kindOfInt) :: indexes(4)
call codes_open_file(infile, '../../data/reduced_gaussian_lsm.grib1', 'r')
call codes_grib_new_from_file(infile, igrib)
call codes_grib_find_nearest_four_single(igrib, .true., inlat, inlon, outlats, outlons, values, distances, indexes)
call codes_release(igrib)
call codes_close_file(infile)
print *, ' outlats outlons values distances indexes'
do i = 1, 4
write (*, '(F10.3, F10.3, F10.5, F10.3, I8)') outlats(i), outlons(i), values(i), distances(i), indexes(i)
end do
end program

View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_nearest_four_single

View File

@ -0,0 +1,30 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
program find_nearest_single
use eccodes
implicit none
integer :: infile
integer :: igrib
real(8) :: inlat = 5, inlon = 10
real(8) :: outlat, outlon
real(8) :: value, distance
integer(kind=kindOfInt) :: index
call codes_open_file(infile, '../../data/reduced_gaussian_lsm.grib1', 'r')
call codes_grib_new_from_file(infile, igrib)
call codes_grib_find_nearest_single(igrib, .true., inlat, inlon, outlat, outlon, value, distance, index)
call codes_release(igrib)
call codes_close_file(infile)
print *, ' outlat outlon value distance index'
write (*, '(F10.3, F10.3, F10.5, F10.3, I8)') outlat, outlon, value, distance, index
end program find_nearest_single

View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_nearest_single

View File

@ -0,0 +1,27 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program grib_read_bytes
use eccodes
implicit none
integer :: ifile
integer :: intsize
parameter(intsize=10000)
character, dimension(intsize) :: bufferChar
character(len=32) :: input_grib_file = '../../data/v.grib2'
call codes_open_file(ifile, input_grib_file, 'r')
! First 4 chars should be 'GRIB'
call codes_read_bytes(ifile, bufferChar, 4)
print*, bufferChar(1:5)
call codes_close_file(ifile)
end program

12
examples/F90/grib_read_bytes.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
${examples_dir}/eccodes_f_grib_read_bytes

View File

@ -0,0 +1,55 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program set_data_force
use eccodes
implicit none
integer :: outfile
integer :: i, igrib, iret, numberOfValues, cnt
real :: d, e
real(4), dimension(:), allocatable :: values_real4
real(8), dimension(:), allocatable :: values_real8
integer, parameter :: max_strsize = 200
character(len=max_strsize) :: outfile_name
call getarg(1, outfile_name)
call codes_open_file(outfile, outfile_name, 'w')
call codes_grib_new_from_samples(igrib, 'regular_ll_pl_grib1')
call codes_get_size(igrib, 'values', numberOfValues)
allocate (values_real4(numberOfValues), stat=iret)
allocate (values_real8(numberOfValues), stat=iret)
d = 10e-8
e = d
cnt = 1
do i = 1, numberOfValues
if (cnt > 100) then
e = e*10
cnt = 1
end if
values_real4(i) = d
values_real8(i) = d
d = d + e
cnt = cnt + 1
end do
call codes_set(igrib, 'bitsPerValue', 16)
call codes_set(igrib, 'bitmapPresent', 1)
! set data values
call codes_set_force(igrib, 'codedValues', values_real4)
call codes_set_force(igrib, 'codedValues', values_real8)
call codes_write(igrib, outfile)
call codes_release(igrib)
deallocate (values_real4)
deallocate (values_real8)
end program set_data_force

View File

@ -0,0 +1,16 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
. ./include.ctest.sh
OUT=temp.f_grib_set_data_force.out.grib
${examples_dir}/eccodes_f_grib_set_data_force $OUT
rm -f $OUT

View File

@ -1,59 +0,0 @@
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
CMAKE_INCLUDE_FILE=include.ctest.sh
if [ -f "$CMAKE_INCLUDE_FILE" ]; then
# This is the config file for Cmake tests
. ./$CMAKE_INCLUDE_FILE
else
set -eax
echo
echo "TEST: $0"
if [ -z "${data_dir}" ]
then
cd ../../
cpath=`pwd`
ECCODES_DEFINITION_PATH=$cpath/definitions
export ECCODES_DEFINITION_PATH
ECCODES_SAMPLES_PATH=$cpath/samples
export ECCODES_SAMPLES_PATH
tools_dir=$cpath/tools
examples_dir=$cpath/examples/F90
data_dir=$cpath/data
samples_dir=$cpath/samples
if test "x$ECCODES_TEST_WITH_VALGRIND" != "x"; then
tools_dir="valgrind --error-exitcode=1 -q $cpath/tools"
examples_dir="valgrind --error-exitcode=1 -q $cpath/examples/F90"
fi
else
echo "Skipping test $0"
exit
fi
cd "$cpath/examples/F90"
if [ -z "${GRIB_API_INCLUDE}" ]
then
GRIB_API_INCLUDE=`pwd`/src
fi
if [ -z "${GRIB_API_LIB}" ]
then
GRIB_API_LIB=`pwd`/src
fi
# Download the data needed for tests
${data_dir}/download.sh "${data_dir}"
set -u
fi

View File

@ -3,7 +3,7 @@
# Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )
# execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )
# Build the executables used by test scripts
################################################

View File

@ -1,32 +0,0 @@
CMAKE_INCLUDE_FILE=include.ctest.sh
if [ -f "$CMAKE_INCLUDE_FILE" ]; then
# This is the config file for Cmake tests
. ./$CMAKE_INCLUDE_FILE
else
set -eax
echo
echo "TEST: $0"
cpath=$TOPBUILDDIR
ECCODES_DEFINITION_PATH=$cpath/definitions
export ECCODES_DEFINITION_PATH
ECCODES_SAMPLES_PATH=$cpath/samples
export ECCODES_SAMPLES_PATH
tools_dir=$cpath/tools
examples_dir=$cpath/examples/python
data_dir=$cpath/data
examples_src=$examples_dir
PYTHONPATH=$cpath/python:$cpath/python/.libs:$PYTHONPATH
export PYTHONPATH
HAVE_MEMFS=0
ECCODES_ON_WINDOWS=0
# Download the data needed for tests
${data_dir}/download.sh "${data_dir}"
set -u
fi

View File

@ -38,9 +38,6 @@ if( HAVE_FORTRAN )
COMMAND cat ${srcdir}/eccodes_f90_head.f90 ${srcdir}/${_long_int_interface_ec} ${srcdir}/${_sizet_int_interface_ec} ${srcdir}/eccodes_f90_tail.f90 > eccodes_f90.f90
DEPENDS eccodes_f90_head.f90 eccodes_f90_tail.f90 grib_kinds.h ${_long_int_interface_ec} ${_sizet_int_interface_ec} )
#ecbuild_add_library( TARGET eccodes_f77
# SOURCES grib_fortran.c grib_f77.c
# LIBS eccodes )
# Note: $<BUILD_INTERFACE:...> will be present only while building (for the whole bundle),
# whereas $<INSTALL_INTERFACE:...> is only present once you install the package / bundle
@ -82,7 +79,7 @@ if( HAVE_FORTRAN )
ecbuild_add_resources( TARGET fortran_resources
PACK
grib_fortran_prototypes.h grib_api_constants.h grib_api_externals.h
grib_api_constants.h grib_api_externals.h
grib_api_visibility.h grib_types.f90 create_grib_f90.sh
grib_f90.f90.head grib_f90.f90.tail grib_f90_int.f90 grib_f90_long_int.f90
grib_f90_int_size_t.f90 grib_f90_long_size_t.f90

View File

@ -2597,8 +2597,8 @@
real(kind=kindOfDouble), intent(in) :: inlon
real(kind=kindOfDouble), intent(out) :: outlat
real(kind=kindOfDouble), intent(out) :: outlon
real(kind=kindOfDouble), intent(out) :: distance
real(kind=kindOfDouble), intent(out) :: value
real(kind=kindOfDouble), intent(out) :: distance
integer(kind=kindOfInt), intent(out) :: kindex
integer(kind=kindOfInt), optional, intent(out) :: status

View File

@ -5,41 +5,40 @@ void grib_check_fortran_char(char* a) {
*a='f';
}
void grib_check_fortran_char_(char* a) {grib_check_fortran_char(a);}
void grib_check_fortran_char__(char* a) {grib_check_fortran_char(a);}
void check_double(double *x,double *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_double_(double *x,double *y,char* ret) {check_double(x,y,ret);}
void check_double__(double *x,double *y,char* ret) {check_double(x,y,ret);}
void check_float(float *x,float *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_float_(float *x,float *y,char* ret) { check_float(x,y,ret); }
void check_float__(float *x,float *y,char* ret) { check_float(x,y,ret); }
void check_int(int *x,int *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_int_(int *x,int *y,char* ret) { check_int(x,y,ret); }
void check_int__(int *x,int *y,char* ret) { check_int(x,y,ret); }
void check_long(long *x,long *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_long_(long *x,long *y,char* ret) {check_long(x,y,ret);}
void check_long__(long *x,long *y,char* ret) {check_long(x,y,ret);}
void check_size_t(size_t *x,size_t *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_size_t_(size_t *x,size_t *y,char* ret) {check_size_t(x,y,ret);}
void check_size_t__(size_t *x,size_t *y,char* ret) {check_size_t(x,y,ret);}
void check_long_long(long long *x,long long *y,char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_long_long_(long long *x,long long *y,char* ret) {check_long_long(x,y,ret);}
void check_long_long__(long long *x,long long *y,char* ret) {check_long_long(x,y,ret);}

View File

@ -1,510 +0,0 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_api_internal.h"
#include "grib_fortran_prototypes.h"
int grib_read_file_(int* fid, char* buffer, size_t* nbytes) {
return grib_f_read_file_(fid,buffer,nbytes);
}
int grib_read_file__(int* fid, char* buffer, size_t* nbytes) {
return grib_f_read_file_(fid,buffer,nbytes);
}
int grib_open_file_(int* fid, char* name , char* op, int lname, int lop){
return grib_f_open_file_( fid, name , op, lname, lop);
}
int grib_open_file__(int* fid, char* name , char* op, int lname, int lop){
return grib_f_open_file_( fid, name , op, lname, lop);
}
int grib_close_file_(int* fid){
return grib_f_close_file_(fid);
}
int grib_close_file__(int* fid){
return grib_f_close_file_(fid);
}
int grib_multi_support_on_(){
return grib_f_multi_support_on_();
}
int grib_multi_support_on__(){
return grib_f_multi_support_on_();
}
int grib_multi_support_off_(){
return grib_f_multi_support_off_();
}
int grib_multi_support_off__(){
return grib_f_multi_support_off_();
}
int grib_iterator_new_(int* gid,int* iterid,int* mode) {
return grib_f_iterator_new_(gid,iterid,mode);
}
int grib_iterator_new__(int* gid,int* iterid,int* mode) {
return grib_f_iterator_new_(gid,iterid,mode);
}
int grib_iterator_next_(int* iterid,double* lat,double* lon,double* value) {
return grib_f_iterator_next_(iterid,lat,lon,value);
}
int grib_iterator_next__(int* iterid,double* lat,double* lon,double* value) {
return grib_f_iterator_next_(iterid,lat,lon,value);
}
int grib_iterator_delete_(int* iterid) {
return grib_f_iterator_delete_(iterid);
}
int grib_iterator_delete__(int* iterid) {
return grib_f_iterator_delete_(iterid);
}
int grib_keys_iterator_new__(int* gid,int* iterid,char* name_space,int len) {
return grib_f_keys_iterator_new_(gid,iterid,name_space,len);
}
int grib_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) {
return grib_f_keys_iterator_new_(gid,iterid,name_space,len);
}
int grib_keys_iterator_next_(int* iterid) {
return grib_f_keys_iterator_next_(iterid);
}
int grib_keys_iterator_next__(int* iterid) {
return grib_f_keys_iterator_next_(iterid);
}
int grib_keys_iterator_delete_(int* iterid) {
return grib_f_keys_iterator_delete_(iterid);
}
int grib_keys_iterator_delete__(int* iterid) {
return grib_f_keys_iterator_delete_(iterid);
}
int grib_gribex_mode_on_() {
grib_gribex_mode_on(0);
return GRIB_SUCCESS;
}
int grib_gribex_mode_on__() {
grib_gribex_mode_on(0);
return GRIB_SUCCESS;
}
int grib_gribex_mode_off_() {
grib_gribex_mode_off(0);
return GRIB_SUCCESS;
}
int grib_gribex_mode_off__() {
grib_gribex_mode_off(0);
return GRIB_SUCCESS;
}
int grib_skip_computed_(int* iterid) {
return grib_skip_computed_(iterid);
}
int grib_skip_computed__(int* iterid) {
return grib_skip_computed_(iterid);
}
int grib_skip_coded_(int* iterid) {
return grib_f_skip_coded_(iterid);
}
int grib_skip_coded__(int* iterid) {
return grib_f_skip_coded_(iterid);
}
int grib_skip_edition_specific_(int* iterid) {
return grib_f_skip_edition_specific_(iterid);
}
int grib_skip_edition_specific__(int* iterid) {
return grib_f_skip_edition_specific_(iterid);
}
int grib_skip_duplicates_(int* iterid) {
return grib_f_skip_duplicates_(iterid);
}
int grib_skip_duplicates__(int* iterid) {
return grib_f_skip_duplicates_(iterid);
}
int grib_skip_read_only_(int* iterid) {
return grib_f_skip_read_only_(iterid);
}
int grib_skip_read_only__(int* iterid) {
return grib_f_skip_read_only_(iterid);
}
int grib_skip_function_(int* iterid) {
return grib_f_skip_function_(iterid);
}
int grib_skip_function__(int* iterid) {
return grib_f_skip_function_(iterid);
}
int grib_keys_iterator_get_name_(int* kiter,char* name,int len) {
return grib_f_keys_iterator_get_name_(kiter,name,len);
}
int grib_keys_iterator_get_name__(int* kiter,char* name,int len) {
return grib_f_keys_iterator_get_name_(kiter,name,len);
}
int grib_keys_iterator_rewind_(int* kiter) {
return grib_f_keys_iterator_rewind_(kiter);
}
int grib_keys_iterator_rewind__(int* kiter) {
return grib_f_keys_iterator_rewind_(kiter);
}
int grib_new_from_message_(int* gid, void* buffer , size_t* bufsize){
return grib_f_new_from_message_(gid, buffer , bufsize);
}
int grib_new_from_message__(int* gid, void* buffer , size_t* bufsize){
return grib_f_new_from_message_(gid, buffer , bufsize);
}
int grib_new_from_message_copy_(int* gid, void* buffer , size_t* bufsize){
return grib_f_new_from_message_copy_(gid, buffer , bufsize);
}
int grib_new_from_message_copy__(int* gid, void* buffer , size_t* bufsize){
return grib_f_new_from_message_copy_(gid, buffer , bufsize);
}
int grib_new_from_samples_(int* gid, char* name , int lname){
return grib_f_new_from_samples_( gid, name , lname);
}
int grib_new_from_samples__(int* gid, char* name , int lname){
return grib_f_new_from_samples_( gid, name , lname);
}
int grib_clone_(int* gidsrc,int* giddest){
return grib_f_clone_(gidsrc, giddest);
}
int grib_clone__(int* gidsrc,int* giddest){
return grib_f_clone_(gidsrc, giddest);
}
int grib_new_from_file_(int* fid, int* gid){
return grib_f_new_from_file_( fid, gid);
}
int grib_new_from_file__(int* fid, int* gid){
return grib_f_new_from_file_( fid, gid);
}
int grib_release_(int* hid){
return grib_f_release_( hid);
}
int grib_release__(int* hid){
return grib_f_release_( hid);
}
int grib_dump_(int* gid){
return grib_f_dump_( gid);
}
int grib_dump__(int* gid){
return grib_f_dump_( gid);
}
int grib_get_error_string_(int* err, char* buf, int len){
return grib_f_get_error_string_(err,buf,len);
}
int grib_get_error_string__(int* err, char* buf, int len){
return grib_f_get_error_string_(err,buf,len);
}
int grib_get_size_(int* gid, char* key, int* val, int len){
return grib_f_get_size_int_( gid, key, val, len);
}
int grib_get_size__(int* gid, char* key, int* val, int len){
return grib_f_get_size_int_( gid, key, val, len);
}
int grib_get_int_(int* gid, char* key, int* val, int len){
return grib_f_get_int_( gid, key, val, len);
}
int grib_get_int__(int* gid, char* key, int* val, int len){
return grib_f_get_int_( gid, key, val, len);
}
int grib_get_int_array_(int* gid, char* key, int*val, int* size, int len){
return grib_f_get_int_array_( gid, key, val, size, len);
}
int grib_get_int_array__(int* gid, char* key, int*val, int* size, int len){
return grib_f_get_int_array_( gid, key, val, size, len);
}
int grib_set_int_array_(int* gid, char* key, int* val, int* size, int len){
return grib_f_set_int_array_( gid, key, val, size, len);
}
int grib_set_int_array__(int* gid, char* key, int* val, int* size, int len){
return grib_f_set_int_array_( gid, key, val, size, len);
}
int grib_set_int_(int* gid, char* key, int* val, int len){
return grib_f_set_int_( gid, key, val, len);
}
int grib_set_int__(int* gid, char* key, int* val, int len){
return grib_f_set_int_( gid, key, val, len);
}
int grib_set_missing_(int* gid, char* key, int len){
return grib_f_set_missing_( gid, key, len);
}
int grib_set_missing__(int* gid, char* key, int len){
return grib_f_set_missing_( gid, key, len);
}
int grib_set_real4_(int* gid, char* key, float* val, int len){
return grib_f_set_real4_( gid, key, val, len);
}
int grib_set_real4__(int* gid, char* key, float* val, int len){
return grib_f_set_real4_( gid, key, val, len);
}
int grib_get_real4_(int* gid, char* key, float* val, int len){
return grib_f_get_real4_( gid, key, val, len);
}
int grib_get_real4__(int* gid, char* key, float* val, int len){
return grib_f_get_real4_( gid, key, val, len);
}
int grib_get_real4_array_(int* gid, char* key, float* val, int* size, int len){
return grib_f_get_real4_array_( gid, key, val, size, len);
}
int grib_get_real4_element_(int* gid, char* key, int* index,float* val, int len){
return grib_f_get_real4_element_( gid, key, index,val, len);
}
int grib_get_real4_element__(int* gid, char* key,int* index, float* val, int len){
return grib_f_get_real4_element_( gid, key, index, val, len);
}
int grib_get_real4_elements__(int* gid, char* key,int* index, float* val,int* len,int size){
return grib_f_get_real4_elements_( gid, key, index, val, len,size);
}
int grib_get_real4_elements_(int* gid, char* key,int* index, float* val,int* len,int size){
return grib_f_get_real4_elements_( gid, key, index, val, len,size);
}
int grib_get_real4_array__(int* gid, char* key, float* val, int* size, int len){
return grib_f_get_real4_array_( gid, key, val, size, len);
}
int grib_set_real4_array_(int* gid, char* key, float*val, int* size, int len){
return grib_f_set_real4_array_( gid, key, val, size, len);
}
int grib_set_real4_array__(int* gid, char* key, float*val, int* size, int len){
return grib_f_set_real4_array_( gid, key, val, size, len);
}
int grib_set_real8_(int* gid, char* key, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_set_real8_( gid, key, val, len);
}
int grib_set_real8__(int* gid, char* key, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_set_real8_( gid, key, val, len);
}
int grib_get_real8_(int* gid, char* key, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_( gid, key, val, len);
}
int grib_get_real8__(int* gid, char* key, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_( gid, key, val, len);
}
int grib_get_real8_element_(int* gid, char* key,int* index, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_element_( gid, key, index,val, len);
}
int grib_get_real8_element__(int* gid, char* key,int* index, double* val, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_element_( gid, key, index,val, len);
}
int grib_get_real8_elements_(int* gid, char* key, int* index,double* val, int* len,int size){
return grib_f_get_real8_elements_( gid, key, index, val,len,size);
}
int grib_get_real8_elements__(int* gid, char* key, int* index,double* val, int* len,int size){
return grib_f_get_real8_elements_( gid, key, index, val,len,size);
}
int grib_get_real8_array_(int* gid, char* key, double*val, int* size, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_array_( gid, key, val, size, len);
}
int grib_get_real8_array__(int* gid, char* key, double*val, int* size, int len){
Assert(sizeof(double) == 8);
return grib_f_get_real8_array_( gid, key, val, size, len);
}
int grib_set_real8_array_(int* gid, char* key, double *val, int* size, int len){
Assert(sizeof(double) == 8);
return grib_f_set_real8_array_( gid, key, val, size, len);
}
int grib_set_real8_array__(int* gid, char* key, double *val, int* size, int len){
Assert(sizeof(double) == 8);
return grib_f_set_real8_array_( gid, key, val, size, len);
}
int grib_get_string_(int* gid, char* key, char* val, int len, int len2){
return grib_f_get_string_( gid, key, val, len, len2);
}
int grib_get_string__(int* gid, char* key, char* val, int len, int len2){
return grib_f_get_string_( gid, key, val, len, len2);
}
int grib_set_string_(int* gid, char* key, char* val, int len, int len2){
return grib_f_set_string_( gid, key, val, len, len2);
}
int grib_set_string__(int* gid, char* key, char* val, int len, int len2){
return grib_f_set_string_( gid, key, val, len, len2);
}
int grib_get_message_size_(int* gid, size_t *len){
return grib_f_get_message_size_( gid, len);
}
int grib_get_message_size__(int* gid, size_t *len){
return grib_f_get_message_size_( gid, len);
}
void grib_check_(int* err){
grib_f_check_(err,"","",0,0);
}
void grib_check__(int* err){
grib_f_check_(err,"","",0,0);
}
int grib_write_(int* gid, int* fid) {
return grib_f_write_(gid,fid);
}
int grib_write__(int* gid, int* fid) {
return grib_f_write_(gid,fid);
}
int grib_multi_write_(int* gid, int* fid) {
return grib_f_multi_write_(gid,fid);
}
int grib_multi_write__(int* gid, int* fid) {
return grib_f_multi_write_(gid,fid);
}
int grib_multi_append_(int* ingid, int* sec,int* mgid) {
return grib_f_multi_append_(ingid,sec,mgid);
}
int grib_multi_append__(int* ingid, int* sec,int* mgid) {
return grib_f_multi_append_(ingid,sec,mgid);
}
int grib_find_nearest_multiple_(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes, int* npoints) {
return grib_f_find_nearest_multiple_(gid,is_lsm,
inlats,inlons,outlats,outlons,values,
distances,indexes,npoints);
}
int grib_find_nearest_multiple__(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes, int* npoints) {
return grib_f_find_nearest_multiple_(gid,is_lsm,
inlats,inlons,outlats,outlons,values,
distances,indexes,npoints);
}
int grib_find_nearest_single_(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes) {
return grib_f_find_nearest_single_(gid,is_lsm,
inlats,inlons,outlats,outlons,values,
distances,indexes);
}
int grib_find_nearest_single__(int* gid,int* is_lsm,
double* inlats,double* inlons,
double* outlats,double* outlons,
double* values,double* distances,
int* indexes) {
return grib_f_find_nearest_single_(gid,is_lsm,
inlats,inlons,outlats,outlons,values,
distances,indexes);
}
int grib_copy_message_(int* gid, void* mess,size_t* len){
return grib_f_copy_message_(gid, mess,len);
}
int grib_copy_message__(int* gid, void* mess,size_t* len){
return grib_f_copy_message_(gid, mess,len);
}

View File

@ -2316,7 +2316,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'get', key)
call grib_check(iret, 'get_real4_elements', key)
end if
end subroutine grib_get_real4_elements
@ -2348,7 +2348,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'get', key)
call grib_check(iret, 'get_real8_elements', key)
end if
end subroutine grib_get_real8_elements
@ -2649,7 +2649,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'set', key)
call grib_check(iret, 'set_force_real4_array', key)
end if
end subroutine grib_set_force_real4_array
@ -2665,12 +2665,12 @@
!> @param value real(8) array value
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_set_force_real8_array(gribid, key, value, status)
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
real(kind=kindOfDouble), dimension(:), intent(in) :: value
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
real(kind=kindOfDouble), dimension(:), intent(in) :: value
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
nb_values = size(value)
iret = grib_f_set_force_real8_array(gribid, key, value, nb_values)
@ -2680,7 +2680,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'set', key)
call grib_check(iret, 'set_force_real8_array', key)
end if
end subroutine grib_set_force_real8_array
@ -2696,10 +2696,10 @@
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_set_string(gribid, key, value, status)
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
character(len=*), intent(in) :: value
character(len=*), intent(in) :: key
character(len=*), intent(in) :: value
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = grib_f_set_string(gribid, key, value)
if (iret /= 0) then
@ -2722,8 +2722,8 @@
!> @param nbytes size in bytes of the message
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_message_size_int(gribid, nbytes, status)
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfInt), intent(out) :: nbytes
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfInt), intent(out) :: nbytes
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfSize_t) :: ibytes
@ -2753,10 +2753,10 @@
!> @param nbytes size in bytes of the message
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_get_message_size_size_t(gribid, nbytes, status)
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfSize_t), intent(out) :: nbytes
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = grib_f_get_message_size(gribid, nbytes)
if (iret /= 0) then
@ -2779,7 +2779,7 @@
!> @param message array containing the coded message to be copied
!> @param status GRIB_SUCCESS if OK, integer value on error
subroutine grib_copy_message(gribid, message, status)
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfInt), intent(in) :: gribid
character(len=1), dimension(:), intent(out) :: message
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
@ -2810,7 +2810,6 @@
integer(kind=kindOfInt), intent(in) :: gribid
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_write(gribid, ifile)
@ -2834,7 +2833,7 @@
integer(kind=kindOfInt), intent(in) :: multigribid
integer(kind=kindOfInt), intent(in) :: ifile
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: iret
iret = grib_f_multi_write(multigribid, ifile)
if (present(status)) then
@ -2938,13 +2937,13 @@
inlat, inlon, outlat, outlon, &
value, distance, kindex, status)
integer(kind=kindOfInt), intent(in) :: gribid
logical, intent(in) :: is_lsm
logical, intent(in) :: is_lsm
real(kind=kindOfDouble), intent(in) :: inlat
real(kind=kindOfDouble), intent(in) :: inlon
real(kind=kindOfDouble), intent(out) :: outlat
real(kind=kindOfDouble), intent(out) :: outlon
real(kind=kindOfDouble), intent(out) :: distance
real(kind=kindOfDouble), intent(out) :: value
real(kind=kindOfDouble), intent(out) :: distance
integer(kind=kindOfInt), intent(out) :: kindex
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
@ -3058,7 +3057,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'grib_gribex_mode_on', '')
call grib_check(iret, 'gribex_mode_on', '')
end if
end subroutine grib_gribex_mode_on
@ -3078,7 +3077,7 @@
if (present(status)) then
status = iret
else
call grib_check(iret, 'grib_gribex_mode_off', '')
call grib_check(iret, 'gribex_mode_off', '')
end if
end subroutine grib_gribex_mode_off

File diff suppressed because it is too large Load Diff

View File

@ -14,45 +14,29 @@
extern "C" {
#endif
void f_sizeof(void *x,void *y, int *size) {
*size=((char*)y)-((char*)x);
}
void f_sizeof_(void *x,void *y, int *size) {
*size=((char*)y)-((char*)x);
}
void f_sizeof__(void *x,void *y, int *size) {
void f_sizeof_(void *x, void *y, int *size) {
*size=((char*)y)-((char*)x);
}
void check_double(double *x,double *y,char* ret) {
void check_double_(double *x, double* y, char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_double_(double *x,double *y,char* ret) {check_double(x,y,ret);}
void check_double__(double *x,double *y,char* ret) {check_double(x,y,ret);}
void check_float(float *x,float *y,char* ret) {
void check_float_(float* x, float* y, char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_float_(float *x,float *y,char* ret) { check_float(x,y,ret); }
void check_float__(float *x,float *y,char* ret) { check_float(x,y,ret); }
void check_int(int *x,int *y,char* ret) {
void check_int_(int* x, int* y, char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_int_(int *x,int *y,char* ret) { check_int(x,y,ret); }
void check_int__(int *x,int *y,char* ret) { check_int(x,y,ret); }
void check_long(long *x,long *y,char* ret) {
void check_long_(long* x, long * y, char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_long_(long *x,long *y,char* ret) {check_long(x,y,ret);}
void check_long__(long *x,long *y,char* ret) {check_long(x,y,ret);}
void check_size_t(size_t *x,size_t *y,char* ret) {
void check_size_t_(size_t* x, size_t* y, char* ret) {
*ret = ((char*)y)-((char*)x) == sizeof(*x) ? 't' : 'f';
}
void check_size_t_(size_t *x,size_t *y,char* ret) {check_size_t(x,y,ret);}
void check_size_t__(size_t *x,size_t *y,char* ret) {check_size_t(x,y,ret);}
#ifdef __cplusplus
}

View File

@ -1,405 +0,0 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/* grib_fortran.c */
#ifdef __cplusplus
extern "C" {
#endif
int grib_f_read_any_headers_only_from_file_(int *fid, char *buffer, size_t *nbytes);
int grib_f_read_any_headers_only_from_file__(int *fid, char *buffer, size_t *nbytes);
int grib_f_read_any_headers_only_from_file(int *fid, char *buffer, size_t *nbytes);
int grib_f_read_any_from_file_(int *fid, void* buffer, size_t *nbytes);
int grib_f_read_any_from_file__(int *fid, void* buffer, size_t *nbytes);
int grib_f_read_any_from_file(int *fid, void* buffer, size_t *nbytes);
int grib_f_write_file_(int *fid, void* buffer, size_t *nbytes);
int grib_f_write_file__(int *fid, void* buffer, size_t *nbytes);
int grib_f_write_file(int *fid, void* buffer, size_t *nbytes);
int grib_f_read_file_(int *fid, void* buffer, size_t *nbytes);
int grib_f_read_file__(int *fid, void* buffer, size_t *nbytes);
int grib_f_read_file(int *fid, void* buffer, size_t *nbytes);
int grib_f_open_file_(int *fid, char *name, char *op, int lname, int lop);
int grib_f_open_file__(int *fid, char *name, char *op, int lname, int lop);
int grib_f_open_file(int *fid, char *name, char *op, int lname, int lop);
int grib_f_close_file_(int *fid);
int grib_f_close_file__(int *fid);
int grib_f_close_file(int *fid);
void grib_f_write_on_fail(int *gid);
void grib_f_write_on_fail_(int* gid);
void grib_f_write_on_fail__(int* gid);
int grib_f_multi_support_on_(void);
int grib_f_multi_support_on__(void);
int grib_f_multi_support_on(void);
int grib_f_multi_support_off_(void);
int grib_f_multi_support_off__(void);
int grib_f_multi_support_off(void);
/* GRIB keys iterator */
int grib_f_keys_iterator_new_(int *gid, int *iterid, char *name_space, int len);
int grib_f_keys_iterator_new__(int *gid, int *iterid, char *name_space, int len);
int grib_f_keys_iterator_new(int *gid, int *iterid, char *name_space, int len);
int grib_f_keys_iterator_next_(int *iterid);
int grib_f_keys_iterator_next__(int *iterid);
int grib_f_keys_iterator_next(int *iterid);
int grib_f_keys_iterator_delete_(int *iterid);
int grib_f_keys_iterator_delete__(int *iterid);
int grib_f_keys_iterator_delete(int *iterid);
int grib_f_keys_iterator_get_name_(int *iterid, char *name, int len);
int grib_f_keys_iterator_get_name__(int *kiter, char *name, int len);
int grib_f_keys_iterator_get_name(int *kiter, char *name, int len);
int grib_f_keys_iterator_rewind_(int *kiter);
int grib_f_keys_iterator_rewind__(int *kiter);
int grib_f_keys_iterator_rewind(int *kiter);
/* BUFR keys iterator */
int codes_f_bufr_keys_iterator_new_(int *gid, int *iterid);
int codes_f_bufr_keys_iterator_new__(int *gid, int *iterid);
int codes_f_bufr_keys_iterator_new(int *gid, int *iterid);
int codes_f_bufr_keys_iterator_next_(int *iterid);
int codes_f_bufr_keys_iterator_next__(int *iterid);
int codes_f_bufr_keys_iterator_next(int *iterid);
int codes_f_bufr_keys_iterator_get_name_(int *iterid, char *name, int len);
int codes_f_bufr_keys_iterator_get_name__(int *kiter, char *name, int len);
int codes_f_bufr_keys_iterator_get_name(int *kiter, char *name, int len);
int codes_f_bufr_keys_iterator_rewind_(int *kiter);
int codes_f_bufr_keys_iterator_rewind__(int *kiter);
int codes_f_bufr_keys_iterator_rewind(int *kiter);
int codes_f_bufr_keys_iterator_delete_(int *iterid);
int codes_f_bufr_keys_iterator_delete__(int *iterid);
int codes_f_bufr_keys_iterator_delete(int *iterid);
int grib_f_gribex_mode_on_(void);
int grib_f_gribex_mode_on__(void);
int grib_f_gribex_mode_on(void);
int grib_f_gribex_mode_off_(void);
int grib_f_gribex_mode_off__(void);
int grib_f_gribex_mode_off(void);
int grib_f_skip_computed_(int *iterid);
int grib_f_skip_computed__(int *iterid);
int grib_f_skip_computed(int *iterid);
int grib_f_skip_coded_(int *iterid);
int grib_f_skip_coded__(int *iterid);
int grib_f_skip_coded(int *iterid);
int grib_f_skip_edition_specific_(int *iterid);
int grib_f_skip_edition_specific__(int *iterid);
int grib_f_skip_edition_specific(int *iterid);
int grib_f_skip_duplicates_(int *iterid);
int grib_f_skip_duplicates__(int *iterid);
int grib_f_skip_duplicates(int *iterid);
int grib_f_skip_read_only_(int *iterid);
int grib_f_skip_read_only__(int *iterid);
int grib_f_skip_read_only(int *iterid);
int grib_f_skip_function_(int *iterid);
int grib_f_skip_function__(int *iterid);
int grib_f_skip_function(int *iterid);
int grib_f_new_from_message_(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_message__(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_message(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_message_int_(int *gid, int *buffer, size_t *bufsize);
int grib_f_new_from_message_int__(int *gid, int *buffer, size_t *bufsize);
int grib_f_new_from_message_int(int *gid, int *buffer, size_t *bufsize);
int grib_f_new_from_message_copy_(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_message_copy__(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_message_copy(int *gid, void* buffer, size_t *bufsize);
int grib_f_new_from_samples_(int *gid, char *name, int lname);
int grib_f_new_from_samples__(int *gid, char *name, int lname);
int grib_f_new_from_samples(int *gid, char *name, int lname);
int codes_bufr_f_new_from_samples_(int *gid, char *name, int lname);
int codes_bufr_f_new_from_samples__(int *gid, char *name, int lname);
int codes_bufr_f_new_from_samples(int *gid, char *name, int lname);
int grib_f_clone_(int *gidsrc, int *giddest);
int grib_f_clone__(int *gidsrc, int *giddest);
int grib_f_clone(int *gidsrc, int *giddest);
int grib_f_util_sections_copy_(int *gidfrom, int *gidto, int *what, int *gidout);
int grib_f_util_sections_copy__(int *gidfrom, int *gidto, int *what, int *gidout);
int grib_f_util_sections_copy(int *gidfrom, int *gidto, int *what, int *gidout);
int grib_f_copy_namespace_(int *gidsrc, char *name, int *giddest, int len);
int grib_f_copy_namespace__(int *gidsrc, char *name, int *giddest, int len);
int grib_f_copy_namespace(int *gidsrc, char *name, int *giddest, int len);
int grib_f_copy_key_ (int *gidsrc, char *name, int *giddest, int len);
int grib_f_copy_key__(int *gidsrc, char *name, int *giddest, int len);
int grib_f_copy_key (int *gidsrc, char *name, int *giddest, int len);
int grib_f_count_in_file(int *fid, int *n);
int grib_f_count_in_file_(int *fid, int *n);
int grib_f_count_in_file__(int *fid, int *n);
int any_f_new_from_file_(int *fid, int *gid);
int any_f_new_from_file__(int *fid, int *gid);
int any_f_new_from_file(int *fid, int *gid);
int any_f_scan_file_(int* fid,int* n);
int any_f_scan_file__(int* fid,int* n);
int any_f_scan_file(int* fid,int* n);
int any_f_new_from_scanned_file_(int* fid,int* msgid,int* gid);
int any_f_new_from_scanned_file__(int* fid,int* msgid,int* gid);
int any_f_new_from_scanned_file(int* fid,int* msgid,int* gid);
int any_f_load_all_from_file_(int* fid,int* n);
int any_f_load_all_from_file__(int* fid,int* n);
int any_f_load_all_from_file(int* fid,int* n);
int any_f_new_from_loaded_(int* msgid,int* gid);
int any_f_new_from_loaded__(int* msgid,int* gid);
int any_f_new_from_loaded(int* msgid,int* gid);
int codes_f_clear_loaded_from_file_(void);
int codes_f_clear_loaded_from_file__(void);
int codes_f_clear_loaded_from_file(void);
int grib_f_new_from_file_(int *fid, int *gid);
int grib_f_new_from_file__(int *fid, int *gid);
int grib_f_new_from_file(int *fid, int *gid);
int bufr_f_new_from_file_(int *fid, int *gid);
int bufr_f_new_from_file__(int *fid, int *gid);
int bufr_f_new_from_file(int *fid, int *gid);
int grib_f_headers_only_new_from_file_(int *fid, int *gid);
int grib_f_headers_only_new_from_file__(int *fid, int *gid);
int grib_f_headers_only_new_from_file(int *fid, int *gid);
int grib_f_new_from_index_(int *iid, int *gid);
int grib_f_new_from_index__(int *iid, int *gid);
int grib_f_new_from_index(int *iid, int *gid);
int grib_f_index_new_from_file_(char *file, char *keys, int *gid, int lfile, int lkeys);
int grib_f_index_new_from_file__(char *file, char *keys, int *gid, int lfile, int lkeys);
int grib_f_index_new_from_file(char *file, char *keys, int *gid, int lfile, int lkeys);
int grib_f_index_add_file_(int* iid, char* file, int lfile);
int grib_f_index_add_file__(int* iid, char* file, int lfile);
int grib_f_index_add_file(int* iid, char* file, int lfile);
int grib_f_index_read_(char *file, int *gid, int lfile);
int grib_f_index_read__(char *file, int *gid, int lfile);
int grib_f_index_read(char *file, int *gid, int lfile);
int grib_f_index_write_(int *gid, char *file, int lfile);
int grib_f_index_write__(int *gid, char *file, int lfile);
int grib_f_index_write(int *gid, char *file, int lfile);
int grib_f_index_release_(int *hid);
int grib_f_index_release__(int *hid);
int grib_f_index_release(int *hid);
int grib_f_multi_handle_release_(int *hid);
int grib_f_multi_handle_release__(int *hid);
int grib_f_multi_handle_release(int *hid);
int grib_f_release_(int *hid);
int grib_f_release__(int *hid);
int grib_f_release(int *hid);
int grib_f_dump_(int *gid);
int grib_f_dump__(int *gid);
int grib_f_dump(int *gid);
int grib_f_get_api_version_(int* apiVersion,int len);
int grib_f_get_api_version__(int* apiVersion,int len);
int grib_f_get_api_version(int* apiVersion,int len);
int grib_f_get_error_string_(int *err, char *buf, int len);
int grib_f_get_error_string__(int *err, char *buf, int len);
int grib_f_get_error_string(int *err, char *buf, int len);
int grib_f_get_size_int_(int *gid, char *key, int *val, int len);
int grib_f_get_size_int__(int *gid, char *key, int *val, int len);
int grib_f_get_size_int(int *gid, char *key, int *val, int len);
int grib_f_get_size_long_(int *gid, char *key, long *val, int len);
int grib_f_get_size_long__(int *gid, char *key, long *val, int len);
int grib_f_get_size_long(int *gid, char *key, long *val, int len);
int grib_f_index_get_size_int_(int *gid, char *key, int *val, int len);
int grib_f_index_get_size_int__(int *gid, char *key, int *val, int len);
int grib_f_index_get_size_int(int *gid, char *key, int *val, int len);
int grib_f_index_get_size_long_(int *gid, char *key, long *val, int len);
int grib_f_index_get_size_long__(int *gid, char *key, long *val, int len);
int grib_f_index_get_size_long(int *gid, char *key, long *val, int len);
int grib_f_get_int_(int *gid, char *key, int *val, int len);
int grib_f_get_int__(int *gid, char *key, int *val, int len);
int grib_f_get_int(int *gid, char *key, int *val, int len);
int grib_f_get_long_(int *gid, char *key, long *val, int len);
int grib_f_get_long__(int *gid, char *key, long *val, int len);
int grib_f_get_long(int *gid, char *key, long *val, int len);
int grib_f_get_native_type_(int* gid, char* key, int* val, int len);
int grib_f_get_native_type__(int* gid, char* key, int* val, int len);
int grib_f_get_native_type(int* gid, char* key, int* val, int len);
int grib_f_get_int_array_(int *gid, char *key, int *val, int *size, int len);
int grib_f_get_int_array__(int *gid, char *key, int *val, int *size, int len);
int grib_f_get_int_array(int *gid, char *key, int *val, int *size, int len);
int grib_f_get_long_array_(int *gid, char *key, long *val, int *size, int len);
int grib_f_get_long_array__(int *gid, char *key, long *val, int *size, int len);
int grib_f_get_long_array(int *gid, char *key, long *val, int *size, int len);
int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_get_byte_array__(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_get_byte_array(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_index_get_string_(int *gid, char *key, char *val, int *eachsize, int *size, int len);
int grib_f_index_get_string__(int *gid, char *key, char *val, int *eachsize, int *size, int len);
int grib_f_index_get_string(int *gid, char *key, char *val, int *eachsize, int *size, int len);
int grib_f_index_get_long_(int *gid, char *key, long *val, int *size, int len);
int grib_f_index_get_long__(int *gid, char *key, long *val, int *size, int len);
int grib_f_index_get_long(int *gid, char *key, long *val, int *size, int len);
int grib_f_index_get_int_(int *gid, char *key, int *val, int *size, int len);
int grib_f_index_get_int__(int *gid, char *key, int *val, int *size, int len);
int grib_f_index_get_int(int *gid, char *key, int *val, int *size, int len);
int grib_f_index_get_real8_(int *gid, char *key, double *val, int *size, int len);
int grib_f_index_get_real8__(int *gid, char *key, double *val, int *size, int len);
int grib_f_index_get_real8(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_int_array_(int *gid, char *key, int *val, int *size, int len);
int grib_f_set_int_array__(int *gid, char *key, int *val, int *size, int len);
int grib_f_set_int_array(int *gid, char *key, int *val, int *size, int len);
int grib_f_set_long_array_(int *gid, char *key, long *val, int *size, int len);
int grib_f_set_long_array__(int *gid, char *key, long *val, int *size, int len);
int grib_f_set_long_array(int *gid, char *key, long *val, int *size, int len);
int grib_f_set_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_set_byte_array__(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_set_byte_array(int* gid, char* key, unsigned char *val, int* size, int len, int lenv);
int grib_f_set_int_(int *gid, char *key, int *val, int len);
int grib_f_set_int__(int *gid, char *key, int *val, int len);
int grib_f_set_int(int *gid, char *key, int *val, int len);
int grib_f_set_long_(int *gid, char *key, long *val, int len);
int grib_f_set_long__(int *gid, char *key, long *val, int len);
int grib_f_set_long(int *gid, char *key, long *val, int len);
int grib_f_set_missing_(int *gid, char *key, int len);
int grib_f_set_missing__(int *gid, char *key, int len);
int grib_f_set_missing(int *gid, char *key, int len);
int grib_f_is_missing_(int *gid, char *key, int *isMissing, int len);
int grib_f_is_missing__(int *gid, char *key, int *isMissing, int len);
int grib_f_is_missing(int *gid, char *key, int *isMissing, int len);
int grib_f_is_defined_(int* gid, char* key,int* isDefined,int len);
int grib_f_is_defined__(int* gid, char* key,int* isDefined,int len);
int grib_f_is_defined(int* gid, char* key,int* isDefined,int len);
int grib_f_set_real4_(int *gid, char *key, float *val, int len);
int grib_f_set_real4__(int *gid, char *key, float *val, int len);
int grib_f_set_real4(int *gid, char *key, float *val, int len);
int grib_f_get_real4_element_(int *gid, char *key, int *index, float *val, int len);
int grib_f_get_real4_element__(int *gid, char *key, int *index, float *val, int len);
int grib_f_get_real4_element(int *gid, char *key, int *index, float *val, int len);
int grib_f_get_real4_elements_(int *gid, char *key, int *index, float *val, int *size, int len);
int grib_f_get_real4_elements__(int *gid, char *key, int *index, float *val, int *len, int size);
int grib_f_get_real4_elements(int *gid, char *key, int *index, float *val, int *len, int size);
int grib_f_get_real4_(int *gid, char *key, float *val, int len);
int grib_f_get_real4__(int *gid, char *key, float *val, int len);
int grib_f_get_real4(int *gid, char *key, float *val, int len);
int grib_f_get_real4_array_(int *gid, char *key, float *val, int *size, int len);
int grib_f_get_real4_array__(int *gid, char *key, float *val, int *size, int len);
int grib_f_get_real4_array(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_real4_array_(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_real4_array__(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_real4_array(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_force_real4_array_(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_force_real4_array__(int *gid, char *key, float *val, int *size, int len);
int grib_f_set_force_real4_array(int *gid, char *key, float *val, int *size, int len);
int grib_f_index_select_real8_(int *gid, char *key, double *val, int len);
int grib_f_index_select_real8__(int *gid, char *key, double *val, int len);
int grib_f_index_select_real8(int *gid, char *key, double *val, int len);
int grib_f_index_select_string_(int *gid, char *key, char *val, int len, int vallen);
int grib_f_index_select_string__(int *gid, char *key, char *val, int len, int vallen);
int grib_f_index_select_string(int *gid, char *key, char *val, int len, int vallen);
int grib_f_index_select_int_(int *gid, char *key, int *val, int len);
int grib_f_index_select_int__(int *gid, char *key, int *val, int len);
int grib_f_index_select_int(int *gid, char *key, int *val, int len);
int grib_f_index_select_long_(int *gid, char *key, long *val, int len);
int grib_f_index_select_long__(int *gid, char *key, long *val, int len);
int grib_f_index_select_long(int *gid, char *key, long *val, int len);
int grib_f_set_real8_(int *gid, char *key, double *val, int len);
int grib_f_set_real8__(int *gid, char *key, double *val, int len);
int grib_f_set_real8(int *gid, char *key, double *val, int len);
int grib_f_get_real8_(int *gid, char *key, double *val, int len);
int grib_f_get_real8__(int *gid, char *key, double *val, int len);
int grib_f_get_real8(int *gid, char *key, double *val, int len);
int grib_f_get_real8_element_(int *gid, char *key, int *index, double *val, int len);
int grib_f_get_real8_element__(int *gid, char *key, int *index, double *val, int len);
int grib_f_get_real8_element(int *gid, char *key, int *index, double *val, int len);
int grib_f_get_real8_elements_(int *gid, char *key, int *index, double *val, int *size, int len);
int grib_f_get_real8_elements__(int *gid, char *key, int *index, double *val, int *len, int size);
int grib_f_get_real8_elements(int *gid, char *key, int *index, double *val, int *len, int size);
int grib_f_find_nearest_four_single_(int *gid, int *is_lsm, double *inlat, double *inlon, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_four_single__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_four_single(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_single_(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_single__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_single(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes);
int grib_f_find_nearest_multiple_(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints);
int grib_f_find_nearest_multiple__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints);
int grib_f_find_nearest_multiple(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints);
int grib_f_get_real8_array_(int *gid, char *key, double *val, int *size, int len);
int grib_f_get_real8_array__(int *gid, char *key, double *val, int *size, int len);
int grib_f_get_real8_array(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_real8_array_(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_real8_array__(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_real8_array(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_force_real8_array_(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_force_real8_array__(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_force_real8_array(int *gid, char *key, double *val, int *size, int len);
int grib_f_get_string_array(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_get_string_array__(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_set_string_array(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_set_string_array__(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_get_string_(int *gid, char *key, char *val, int len, int len2);
int grib_f_get_string__(int *gid, char *key, char *val, int len, int len2);
int grib_f_get_string(int *gid, char *key, char *val, int len, int len2);
int grib_f_set_string_(int *gid, char *key, char *val, int len, int len2);
int grib_f_set_string__(int *gid, char *key, char *val, int len, int len2);
int grib_f_set_string(int *gid, char *key, char *val, int len, int len2);
int grib_f_get_data_real4_(int *gid, float *lats, float *lons, float *values, size_t *size);
int grib_f_get_data_real4__(int *gid, float *lats, float *lons, float *values, size_t *size);
int grib_f_get_data_real4(int *gid, float *lats, float *lons, float *values, size_t *size);
int grib_f_get_data_real8_(int *gid, double *lats, double *lons, double *values, size_t *size);
int grib_f_get_data_real8__(int *gid, double *lats, double *lons, double *values, size_t *size);
int grib_f_get_data_real8(int *gid, double *lats, double *lons, double *values, size_t *size);
int grib_f_get_message_size_(int *gid, size_t *len);
int grib_f_get_message_size__(int *gid, size_t *len);
int grib_f_get_message_size(int *gid, size_t *len);
int grib_f_copy_message_(int *gid, void* mess, size_t *len);
int grib_f_copy_message__(int *gid, void* mess, size_t *len);
int grib_f_copy_message(int *gid, void* mess, size_t *len);
void grib_f_check_(int *err, char *call, char *str, int lencall, int lenstr);
void grib_f_check__(int *err, char *call, char *key, int lencall, int lenkey);
void grib_f_check(int *err, char *call, char *key, int lencall, int lenkey);
int grib_f_write_(int *gid, int *fid);
int grib_f_write__(int *gid, int *fid);
int grib_f_write(int *gid, int *fid);
int grib_f_multi_write_(int *gid, int *fid);
int grib_f_multi_write__(int *gid, int *fid);
int grib_f_multi_write(int *gid, int *fid);
int grib_f_multi_append_(int *ingid, int *sec, int *mgid);
int grib_f_multi_append(int *ingid, int *sec, int *mgid);
int grib_f_multi_append__(int *ingid, int *sec, int *mgid);
int codes_f_bufr_copy_data(int* gid1,int* gid2);
int codes_f_bufr_copy_data_(int* gid1,int* gid2);
int codes_f_bufr_copy_data__(int* gid1,int* gid2);
int codes_f_bufr_multi_element_constant_arrays_on_(void);
int codes_f_bufr_multi_element_constant_arrays_on__(void);
int codes_f_bufr_multi_element_constant_arrays_on(void);
int codes_f_bufr_multi_element_constant_arrays_off_(void);
int codes_f_bufr_multi_element_constant_arrays_off__(void);
int codes_f_bufr_multi_element_constant_arrays_off(void);
int grib_f_set_definitions_path_(char *path, int len);
int grib_f_set_definitions_path__(char *path, int len);
int grib_f_set_definitions_path(char *path, int len);
int grib_f_set_samples_path_(char *path, int len);
int grib_f_set_samples_path__(char *path, int len);
int grib_f_set_samples_path(char *path, int len);
int grib_f_julian_to_datetime(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_julian_to_datetime__(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_datetime_to_julian(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
int grib_f_datetime_to_julian__(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
#ifdef __cplusplus
}
#endif

BIN
samples/hdf5.tmpl Normal file

Binary file not shown.

View File

@ -286,6 +286,12 @@ static grib_hash_array_value* get_hash_array_impl(grib_handle* h, grib_action* a
full = grib_context_full_defs_path(context, master);
if (c) {
if (!full) {
grib_context_log(context, GRIB_LOG_ERROR,
"unable to find definition file %s in %s:%s:%s\nDefinition files path=\"%s\"",
self->basename, master, ecmf, local, context->grib_definition_files_path);
return NULL;
}
grib_hash_array_value* last = c;
while (last->next)
last = last->next;

View File

@ -801,7 +801,7 @@ void grib_grow_buffer(const grib_context* c, grib_buffer* b, size_t new_size);
void grib_buffer_set_ulength_bits(const grib_context* c, grib_buffer* b, size_t length_bits);
void grib_buffer_set_ulength(const grib_context* c, grib_buffer* b, size_t length);
void grib_recompute_sections_lengths(grib_section* s);
void grib_buffer_replace(grib_accessor* a, const unsigned char* data, size_t newsize, int update_lengths, int update_paddings);
int grib_buffer_replace(grib_accessor* a, const unsigned char* data, size_t newsize, int update_lengths, int update_paddings);
void grib_update_sections_lengths(grib_handle* h);
/* grib_dumper.cc*/
@ -1020,8 +1020,6 @@ int wmo_read_any_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_grib_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_bufr_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len);
int wmo_read_any_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
int wmo_read_grib_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
int wmo_read_bufr_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
@ -1162,8 +1160,6 @@ int grib_set_float_array(grib_handle* h, const char* name, const float* val, siz
int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length);
int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length);
int grib_get_long_internal(grib_handle* h, const char* name, long* val);
int grib_is_in_dump(const grib_handle* h, const char* name);
int grib_attributes_count(const grib_accessor* a, size_t* size);
int grib_get_long(const grib_handle* h, const char* name, long* val);
int grib_get_double_internal(grib_handle* h, const char* name, double* val);
int grib_get_double(const grib_handle* h, const char* name, double* val);
@ -1201,9 +1197,6 @@ int grib_get_string_array(const grib_handle* h, const char* name, char** val, si
int ecc__grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length);
int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length);
int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length);
grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list);
void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl);
int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list);
int grib_get_values(grib_handle* h, grib_values* args, size_t count);
int grib_set_values(grib_handle* h, grib_values* args, size_t count);
int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest);

View File

@ -322,7 +322,8 @@ int grib_section_adjust_sizes(grib_section* s, int update, int depth)
if (update) {
plen = length;
lret = grib_pack_long(s->aclength, &plen, &len);
Assert(lret == GRIB_SUCCESS);
if (lret != GRIB_SUCCESS)
return lret;
s->padding = 0;
}
else {

View File

@ -23,7 +23,6 @@
IMPLEMENTS = byte_count; value_count
IMPLEMENTS = byte_offset; unpack_double
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
IMPLEMENTS = pack_long; unpack_double; pack_double
MEMBERS = const char* bufrDataEncodedName
MEMBERS = const char* numberOfSubsetsName
@ -98,7 +97,6 @@ static int value_count(grib_accessor*, long*);
static void destroy(grib_context*, grib_accessor*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_bufr_data_array
{
@ -194,7 +192,7 @@ static grib_accessor_class _grib_accessor_class_bufr_data_array = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -474,11 +472,6 @@ static long next_offset(grib_accessor* a)
return a->offset;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a;

View File

@ -222,7 +222,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* params)
p = grib_expression_evaluate_string(grib_handle_of_accessor(a), expression, tmp, &s_len, &ret);
if (ret != GRIB_SUCCESS) {
grib_context_log(a->context, GRIB_LOG_FATAL,
"unable to evaluate %s as string", a->name);
"Unable to evaluate %s as string", a->name);
}
s_len = strlen(p) + 1;
pack_string(a, p, &s_len);
@ -843,7 +843,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
if (strcmp(e->cclass->name, "long") == 0) {
grib_expression_evaluate_long(hand, e, &lval); /* TDOD: check return value */
/*if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %ld\n", a->name,lval);*/
//if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %ld\n", a->name,lval);
ret = grib_pack_long(a, &lval, &len);
}
else {
@ -851,12 +851,14 @@ static int pack_expression(grib_accessor* a, grib_expression* e)
len = sizeof(tmp);
cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret);
if (ret != GRIB_SUCCESS) {
grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_codetable.pack_expression: unable to evaluate string %s to be set in %s\n", grib_expression_get_name(e), a->name);
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_codetable.%s: Unable to evaluate string %s to be set in %s",
__func__, grib_expression_get_name(e), a->name);
return ret;
}
len = strlen(cval) + 1;
/*if (hand->context->debug)
printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval);*/
//if (hand->context->debug)
// printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval);
ret = grib_pack_string(a, cval, &len);
}
return ret;

View File

@ -313,7 +313,8 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len)
grib_context_log(a->context, GRIB_LOG_DEBUG,
"grib_accessor_data_g1simple_packing : pack_double : packing %s, %d values", a->name, n_vals);
grib_buffer_replace(a, buf, buflen, 1, 1);
ret = grib_buffer_replace(a, buf, buflen, 1, 1);
if (ret != GRIB_SUCCESS) return ret;
grib_context_buffer_free(a->context, buf);

View File

@ -108,35 +108,27 @@ grib_accessor_class* grib_accessor_class_data_g2secondary_bitmap = &_grib_access
static void init(grib_accessor* a, const long v, grib_arguments* args)
{
grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a;
self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4);
}
static int value_count(grib_accessor* a, long* len)
{
grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a;
*len = 0;
*len = 0;
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, len);
}
static int pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a;
int err = 0;
long primary_len = 0;
long secondary_len = 0;
long primary_len = 0, secondary_len = 0;
double* primary_bitmap = NULL;
double* secondary_bitmap = NULL;
long i = 0;
long j = 0;
long on = 0;
long k;
long m;
double missing_value = 0;
double present_value = 0;
long expand_by = 0;
long i = 0, j = 0, on = 0, k = 0, m = 0;
double missing_value = 0, present_value = 0;
long expand_by = 0;
if (*len == 0)
return GRIB_NO_VALUES;

View File

@ -19,7 +19,6 @@
IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = init;dump
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
END_CLASS_DEF
*/
@ -39,7 +38,6 @@ static int pack_long(grib_accessor*, const long* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_g1_half_byte_codeflag
{
@ -88,7 +86,7 @@ static grib_accessor_class _grib_accessor_class_g1_half_byte_codeflag = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -150,34 +148,3 @@ static int get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
long aval = 0;
long bval = 0;
long count = 0;
size_t alen = 0;
size_t blen = 0;
int err = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != 1 || blen != 1)
return GRIB_COUNT_MISMATCH;
grib_unpack_long(a, &aval, &alen);
grib_unpack_long(b, &bval, &blen);
if (bval != aval)
return GRIB_VALUE_MISMATCH;
return GRIB_SUCCESS;
}

View File

@ -203,7 +203,15 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
grib_find_accessor(grib_handle_of_accessor(a), self->sec4_length),
&total_length,
&sec4_length);
if (total_length != *val) {
const char* cclass_name = a->cclass->name;
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s %s: Failed to set GRIB1 message length to %ld"
" (actual length=%ld)",
cclass_name, __func__, *val, total_length);
grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try encoding as GRIB2\n");
return GRIB_ENCODING_ERROR;
}
Assert(total_length == *val);
}

View File

@ -149,7 +149,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->unusedBits, tlen * 8 - *len)) != GRIB_SUCCESS)
return err;
grib_buffer_replace(a, buf, tlen, 1, 1);
err = grib_buffer_replace(a, buf, tlen, 1, 1);
if (err) return err;
grib_context_free(a->context, buf);

View File

@ -484,7 +484,7 @@ static int pack_double_array_as_long(grib_accessor* a, const double* v, size_t*
size_t numBytes = *len * (sizeof(long));
long* lValues = (long*)grib_context_malloc(c, numBytes);
if (!lValues) {
grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes\n", numBytes);
grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes", numBytes);
return GRIB_OUT_OF_MEMORY;
}
for (i = 0; i < *len; i++)

View File

@ -16,7 +16,6 @@
CLASS = accessor
SUPER = grib_accessor_class_gen
IMPLEMENTS = init;dump;get_native_type;unpack_string
IMPLEMENTS = compare
END_CLASS_DEF
*/
@ -35,7 +34,6 @@ static int get_native_type(grib_accessor*);
static int unpack_string(grib_accessor*, char*, size_t* len);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_label
{
@ -84,7 +82,7 @@ static grib_accessor_class _grib_accessor_class_label = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -116,11 +114,6 @@ static int get_native_type(grib_accessor* a)
return GRIB_TYPE_LABEL;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
return GRIB_SUCCESS;
}
static int unpack_string(grib_accessor* a, char* val, size_t* len)
{
size_t vlen = strlen(a->name);

View File

@ -8,10 +8,6 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/**************************************
* Enrico Fucile
**************************************/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
@ -21,7 +17,6 @@
SUPER = grib_accessor_class_bytes
IMPLEMENTS = init;update_size;resize; value_count
IMPLEMENTS = unpack_string; string_length
IMPLEMENTS = compare
END_CLASS_DEF
*/
@ -42,7 +37,6 @@ static int value_count(grib_accessor*, long*);
static void init(grib_accessor*, const long, grib_arguments*);
static void update_size(grib_accessor*, size_t);
static void resize(grib_accessor*,size_t);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_message
{
@ -92,7 +86,7 @@ static grib_accessor_class _grib_accessor_class_message = {
&resize, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -115,12 +109,12 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
a->length = grib_handle_of_accessor(a)->buffer->ulength - len - a->offset;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
if (a->length != b->length)
return GRIB_COUNT_MISMATCH;
return GRIB_SUCCESS;
}
// static int compare(grib_accessor* a, grib_accessor* b)
// {
// if (a->length != b->length)
// return GRIB_COUNT_MISMATCH;
// return GRIB_SUCCESS;
// }
static void update_size(grib_accessor* a, size_t new_size)
{

View File

@ -133,6 +133,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
if (v[i] > 126)
v[i] = 32;
memcpy(val, grib_handle_of_accessor(a)->buffer->data, slen);
val[i] = 0;
*len = slen;

View File

@ -15,14 +15,13 @@
START_CLASS_DEF
CLASS = accessor
SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_string;pack_string
IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = unpack_double;pack_double
IMPLEMENTS = unpack_string
IMPLEMENTS = unpack_long
IMPLEMENTS = unpack_double
IMPLEMENTS = init;dump;string_length
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
END_CLASS_DEF
*/
@ -38,9 +37,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
static int pack_long(grib_accessor*, const long* val, size_t* len);
static int pack_string(grib_accessor*, const char*, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static int unpack_string(grib_accessor*, char*, size_t* len);
@ -49,7 +45,6 @@ static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_non_alpha
{
@ -79,13 +74,13 @@ static grib_accessor_class _grib_accessor_class_non_alpha = {
0, /* get sub_section */
0, /* pack_missing */
0, /* is_missing */
&pack_long, /* pack_long */
0, /* pack_long */
&unpack_long, /* unpack_long */
&pack_double, /* pack_double */
0, /* pack_double */
0, /* pack_float */
&unpack_double, /* unpack_double */
0, /* unpack_float */
&pack_string, /* pack_string */
0, /* pack_string */
&unpack_string, /* unpack_string */
0, /* pack_string_array */
0, /* unpack_string_array */
@ -98,7 +93,7 @@ static grib_accessor_class _grib_accessor_class_non_alpha = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -171,23 +166,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
return GRIB_SUCCESS;
}
static int pack_string(grib_accessor* a, const char* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as an integer", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int pack_double(grib_accessor* a, const double* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as a double", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int unpack_long(grib_accessor* a, long* v, size_t* len)
{
char val[1024] = {0,};
@ -233,46 +211,6 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len)
return GRIB_NOT_IMPLEMENTED;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
int retval = 0;
char* aval = 0;
char* bval = 0;
int err = 0;
size_t alen = 0;
size_t blen = 0;
long count = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != blen)
return GRIB_COUNT_MISMATCH;
aval = (char*)grib_context_malloc(a->context, alen * sizeof(char));
bval = (char*)grib_context_malloc(b->context, blen * sizeof(char));
grib_unpack_string(a, aval, &alen);
grib_unpack_string(b, bval, &blen);
retval = GRIB_SUCCESS;
if (strcmp(aval, bval))
retval = GRIB_STRING_VALUE_MISMATCH;
grib_context_free(a->context, aval);
grib_context_free(b->context, bval);
return retval;
}
static long next_offset(grib_accessor* a)
{
return a->offset + a->length;

View File

@ -110,12 +110,14 @@ grib_accessor_class* grib_accessor_class_number_of_points = &_grib_accessor_clas
static void init(grib_accessor* a, const long l, grib_arguments* c)
{
int n = 0;
int n = 0;
grib_handle* hand = grib_handle_of_accessor(a);
grib_accessor_number_of_points* self = (grib_accessor_number_of_points*)a;
self->ni = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->nj = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->plpresent = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->pl = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
self->ni = grib_arguments_get_name(hand, c, n++);
self->nj = grib_arguments_get_name(hand, c, n++);
self->plpresent = grib_arguments_get_name(hand, c, n++);
self->pl = grib_arguments_get_name(hand, c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION;
a->length = 0;
@ -123,32 +125,41 @@ static void init(grib_accessor* a, const long l, grib_arguments* c)
static int unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_number_of_points* self = (grib_accessor_number_of_points*)a;
int ret = GRIB_SUCCESS;
long ni = 0, nj = 0, plpresent = 0;
size_t plsize = 0;
long* pl;
int i;
grib_accessor_number_of_points* self = (grib_accessor_number_of_points*)a;
grib_context* c = a->context;
long* pl = NULL;
int i = 0;
grib_context* c = a->context;
grib_handle* hand = grib_handle_of_accessor(a);
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->ni, &ni)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(hand, self->ni, &ni)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->nj, &nj)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(hand, self->nj, &nj)) != GRIB_SUCCESS)
return ret;
if (self->plpresent &&
((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->plpresent, &plpresent)) != GRIB_SUCCESS))
((ret = grib_get_long_internal(hand, self->plpresent, &plpresent)) != GRIB_SUCCESS))
return ret;
if (nj == 0)
if (grib_is_missing(hand, self->nj, &ret) && ret == GRIB_SUCCESS) {
grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 'missing'!", self->nj);
return GRIB_GEOCALCULUS_PROBLEM;
}
if (nj == 0) {
grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 0!", self->nj);
return GRIB_GEOCALCULUS_PROBLEM;
}
if (plpresent) {
/*reduced*/
plsize = nj;
pl = (long*)grib_context_malloc(c, sizeof(long) * plsize);
grib_get_long_array_internal(grib_handle_of_accessor(a), self->pl, pl, &plsize);
grib_get_long_array_internal(hand, self->pl, pl, &plsize);
*val = 0;
for (i = 0; i < plsize; i++)
*val += pl[i];

View File

@ -8,11 +8,6 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/**************************************
* Enrico Fucile
**************************************/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
@ -23,7 +18,6 @@
IMPLEMENTS = unpack_long
IMPLEMENTS = get_native_type
IMPLEMENTS = init;dump
IMPLEMENTS = compare
END_CLASS_DEF
*/
@ -42,7 +36,6 @@ static int get_native_type(grib_accessor*);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_position
{
@ -91,7 +84,7 @@ static grib_accessor_class _grib_accessor_class_position = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -136,9 +129,9 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
return GRIB_SUCCESS;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
if (a->offset != b->offset)
return GRIB_OFFSET_MISMATCH;
return GRIB_SUCCESS;
}
// static int compare(grib_accessor* a, grib_accessor* b)
// {
// if (a->offset != b->offset)
// return GRIB_OFFSET_MISMATCH;
// return GRIB_SUCCESS;
// }

View File

@ -22,7 +22,6 @@
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
MEMBERS = const char* key
MEMBERS = long start
MEMBERS = size_t length
@ -50,7 +49,6 @@ static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_to_double
{
@ -103,7 +101,7 @@ static grib_accessor_class _grib_accessor_class_to_double = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -242,43 +240,3 @@ static long next_offset(grib_accessor* a)
{
return a->offset + a->length;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
int retval = 0;
char* aval = 0;
char* bval = 0;
int err = 0;
size_t alen = 0;
size_t blen = 0;
long count = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != blen)
return GRIB_COUNT_MISMATCH;
aval = (char*)grib_context_malloc(a->context, alen * sizeof(char));
bval = (char*)grib_context_malloc(b->context, blen * sizeof(char));
grib_unpack_string(a, aval, &alen);
grib_unpack_string(b, bval, &blen);
retval = GRIB_SUCCESS;
if (strcmp(aval, bval))
retval = GRIB_STRING_VALUE_MISMATCH;
grib_context_free(a->context, aval);
grib_context_free(b->context, bval);
return retval;
}

View File

@ -22,7 +22,6 @@
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
MEMBERS = const char* key
MEMBERS = long start
MEMBERS = size_t length
@ -52,7 +51,6 @@ static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_to_integer
{
@ -104,7 +102,7 @@ static grib_accessor_class _grib_accessor_class_to_integer = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -239,46 +237,6 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len)
return err;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
int retval = 0;
char* aval = 0;
char* bval = 0;
int err = 0;
size_t alen = 0;
size_t blen = 0;
long count = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != blen)
return GRIB_COUNT_MISMATCH;
aval = (char*)grib_context_malloc(a->context, alen * sizeof(char));
bval = (char*)grib_context_malloc(b->context, blen * sizeof(char));
grib_unpack_string(a, aval, &alen);
grib_unpack_string(b, bval, &blen);
retval = GRIB_SUCCESS;
if (strcmp(aval, bval))
retval = GRIB_STRING_VALUE_MISMATCH;
grib_context_free(a->context, aval);
grib_context_free(b->context, bval);
return retval;
}
static long next_offset(grib_accessor* a)
{
return a->offset + a->length;

View File

@ -22,7 +22,6 @@
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
IMPLEMENTS = get_native_type
IMPLEMENTS = compare
MEMBERS = const char* key
MEMBERS = long start
MEMBERS = size_t length
@ -49,7 +48,6 @@ static long next_offset(grib_accessor*);
static int value_count(grib_accessor*, long*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_to_string
{
@ -101,7 +99,7 @@ static grib_accessor_class _grib_accessor_class_to_string = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -221,46 +219,6 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len)
return err;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
int retval = 0;
char* aval = 0;
char* bval = 0;
int err = 0;
size_t alen = 0;
size_t blen = 0;
long count = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != blen)
return GRIB_COUNT_MISMATCH;
aval = (char*)grib_context_malloc(a->context, alen * sizeof(char));
bval = (char*)grib_context_malloc(b->context, blen * sizeof(char));
grib_unpack_string(a, aval, &alen);
grib_unpack_string(b, bval, &blen);
retval = GRIB_SUCCESS;
if (strcmp(aval, bval))
retval = GRIB_STRING_VALUE_MISMATCH;
grib_context_free(a->context, aval);
grib_context_free(b->context, bval);
return retval;
}
static long next_offset(grib_accessor* a)
{
return a->offset + a->length;

View File

@ -19,7 +19,7 @@
IMPLEMENTS = unpack_double;pack_double
IMPLEMENTS = unpack_long;pack_long;destroy
IMPLEMENTS = init;dump;value_count
IMPLEMENTS = compare;get_native_type
IMPLEMENTS = get_native_type
MEMBERS=grib_darray* arr
MEMBERS=int type;
END_CLASS_DEF
@ -45,7 +45,6 @@ static int value_count(grib_accessor*, long*);
static void destroy(grib_context*, grib_accessor*);
static void dump(grib_accessor*, grib_dumper*);
static void init(grib_accessor*, const long, grib_arguments*);
static int compare(grib_accessor*, grib_accessor*);
typedef struct grib_accessor_transient_darray
{
@ -96,7 +95,7 @@ static grib_accessor_class _grib_accessor_class_transient_darray = {
0, /* resize */
0, /* nearest_smaller_value */
0, /* next accessor */
&compare, /* compare vs. another accessor */
0, /* compare vs. another accessor */
0, /* unpack only ith value (double) */
0, /* unpack only ith value (float) */
0, /* unpack a given set of elements (double) */
@ -119,23 +118,20 @@ static void init(grib_accessor* a, const long length, grib_arguments* args)
a->length = 0;
}
static void dump(grib_accessor* a, grib_dumper* dumper)
{
/* grib_accessor_transient_darray *self = (grib_accessor_transient_darray*)a; */
grib_dump_double(dumper, a, NULL);
}
static int pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
size_t i;
if (self->arr)
grib_darray_delete(a->context, self->arr);
self->arr = grib_darray_new(a->context, *len, 10);
for (i = 0; i < *len; i++)
for (size_t i = 0; i < *len; i++)
grib_darray_push(a->context, self->arr, val[i]);
return GRIB_SUCCESS;
@ -144,13 +140,12 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
size_t i;
if (self->arr)
grib_darray_delete(a->context, self->arr);
self->arr = grib_darray_new(a->context, *len, 10);
for (i = 0; i < *len; i++)
for (size_t i = 0; i < *len; i++)
grib_darray_push(a->context, self->arr, (double)val[i]);
return GRIB_SUCCESS;
@ -159,8 +154,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
static int unpack_double(grib_accessor* a, double* val, size_t* len)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
long count = 0;
size_t i;
long count = 0;
value_count(a, &count);
@ -170,17 +164,16 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
}
*len = count;
for (i = 0; i < *len; i++)
for (size_t i = 0; i < *len; i++)
val[i] = self->arr->v[i];
return GRIB_SUCCESS;
}
static int unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
long count = 0;
size_t i;
long count = 0;
value_count(a, &count);
@ -190,14 +183,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
}
*len = count;
for (i = 0; i < *len; i++)
for (size_t i = 0; i < *len; i++)
val[i] = (long)self->arr->v[i];
return GRIB_SUCCESS;
}
static void destroy(grib_context* c, grib_accessor* a)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
@ -216,51 +207,8 @@ static int value_count(grib_accessor* a, long* count)
return 0;
}
static int compare(grib_accessor* a, grib_accessor* b)
{
int retval = 0;
double* aval = 0;
double* bval = 0;
size_t alen = 0;
size_t blen = 0;
int err = 0;
long count = 0;
err = grib_value_count(a, &count);
if (err)
return err;
alen = count;
err = grib_value_count(b, &count);
if (err)
return err;
blen = count;
if (alen != blen)
return GRIB_COUNT_MISMATCH;
aval = (double*)grib_context_malloc(a->context, alen * sizeof(double));
bval = (double*)grib_context_malloc(b->context, blen * sizeof(double));
grib_unpack_double(a, aval, &alen);
grib_unpack_double(b, bval, &blen);
retval = GRIB_SUCCESS;
while (alen != 0) {
if (*bval != *aval)
retval = GRIB_DOUBLE_VALUE_MISMATCH;
alen--;
}
grib_context_free(a->context, aval);
grib_context_free(b->context, bval);
return retval;
}
static int get_native_type(grib_accessor* a)
{
grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
const grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a;
return self->type;
}

View File

@ -195,8 +195,8 @@ static void update_offsets_after(grib_accessor* a, long len)
// update_sections_lengths(s->owner->parent);
// }
void grib_buffer_replace(grib_accessor* a, const unsigned char* data,
size_t newsize, int update_lengths, int update_paddings)
int grib_buffer_replace(grib_accessor* a, const unsigned char* data,
size_t newsize, int update_lengths, int update_paddings)
{
size_t offset = a->offset;
long oldsize = grib_get_next_position_offset(a) - offset;
@ -232,11 +232,13 @@ void grib_buffer_replace(grib_accessor* a, const unsigned char* data,
update_offsets_after(a, increase);
if (update_lengths) {
grib_update_size(a, newsize);
grib_section_adjust_sizes(grib_handle_of_accessor(a)->root, 1, 0);
int err = grib_section_adjust_sizes(grib_handle_of_accessor(a)->root, 1, 0);
if (err) return err;
if (update_paddings)
grib_update_paddings(grib_handle_of_accessor(a)->root);
}
}
return GRIB_SUCCESS;
}
void grib_update_sections_lengths(grib_handle* h)

View File

@ -174,44 +174,41 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result)
static int evaluate_double(grib_expression* g, grib_handle* h, double* result)
{
grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g;
int err = 0;
char mybuf[1024] = {0,};
size_t size = 1024;
return GRIB_NOT_IMPLEMENTED;
grib_trie* list = load_dictionary(h->context, g, &err);
if ((err = grib_get_string_internal(h, e->key, mybuf, &size)) != GRIB_SUCCESS)
return err;
if (grib_trie_get(list, mybuf))
*result = 1;
else
*result = 0;
return err;
// grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g;
// int err = 0;
// char mybuf[1024] = {0,};
// size_t size = 1024;
// grib_trie* list = load_dictionary(h->context, g, &err);
// if ((err = grib_get_string_internal(h, e->key, mybuf, &size)) != GRIB_SUCCESS)
// return err;
// if (grib_trie_get(list, mybuf))
// *result = 1;
// else
// *result = 0;
// return err;
}
static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, size_t* size, int* err)
{
grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g;
char mybuf[1024] = {0,};
size_t sizebuf = 1024;
long result;
*err = GRIB_NOT_IMPLEMENTED;
return NULL;
grib_trie* list = load_dictionary(h->context, g, err);
if ((*err = grib_get_string_internal(h, e->key, mybuf, &sizebuf)) != GRIB_SUCCESS)
return NULL;
if (grib_trie_get(list, mybuf))
result = 1;
else
result = 0;
snprintf(buf, 32, "%ld", result);
*size = strlen(buf);
return buf;
// grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g;
// char mybuf[1024] = {0,};
// size_t sizebuf = 1024;
// long result;
// grib_trie* list = load_dictionary(h->context, g, err);
// if ((*err = grib_get_string_internal(h, e->key, mybuf, &sizebuf)) != GRIB_SUCCESS)
// return NULL;
// if (grib_trie_get(list, mybuf))
// result = 1;
// else
// result = 0;
// snprintf(buf, 32, "%ld", result);
// *size = strlen(buf);
// return buf;
}
static void print(grib_context* c, grib_expression* g, grib_handle* f)

View File

@ -100,9 +100,9 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
{
int ret = 0;
char b1[1024];
char b1[1024] = {0,};
size_t l1 = sizeof(b1);
char b2[1024];
char b2[1024] = {0,};
size_t l2 = sizeof(b2);
const char* v1 = NULL;
const char* v2 = NULL;

View File

@ -344,6 +344,11 @@ grib_file* grib_get_file(const char* filename, int* err)
{
grib_file* file = NULL;
if (!file_pool.current) {
*err = GRIB_IO_PROBLEM;
return NULL;
}
if (file_pool.current->name && !grib_inline_strcmp(filename, file_pool.current->name)) {
return file_pool.current;
}

View File

@ -428,6 +428,8 @@ grib_handle* codes_handle_new_from_file(grib_context* c, FILE* f, ProductKind pr
return metar_new_from_file(c, f, error);
if (product == PRODUCT_GTS)
return gts_new_from_file(c, f, error);
//if (product == PRODUCT_TAF)
// return taf_new_from_file(c, f, error);
if (product == PRODUCT_ANY)
return any_new_from_file(c, f, error);
@ -642,7 +644,7 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data,
if (grib_decode_unsigned_byte_long(secbegin, 5, 1) == 254) {
if (!gm->bitmap_section) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_handle_new_multi : cannot create handle, missing bitmap\n");
"grib_handle_new_multi : cannot create handle, missing bitmap");
return NULL;
}
gm->sections[secnum] = gm->bitmap_section;
@ -695,7 +697,7 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data,
gl = grib_handle_new_from_message(c, message, olen);
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_multi: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_multi: cannot create handle");
return NULL;
}
@ -794,7 +796,7 @@ static grib_handle* grib_handle_new_from_file_multi(grib_context* c, FILE* f, in
/* Special case for inherited bitmaps */
if (grib_decode_unsigned_byte_long(secbegin, 5, 1) == 254) {
if (!gm->bitmap_section) {
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_multi: cannot create handle, missing bitmap\n");
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_multi: cannot create handle, missing bitmap");
grib_context_free(c, data);
return NULL;
}
@ -850,7 +852,7 @@ static grib_handle* grib_handle_new_from_file_multi(grib_context* c, FILE* f, in
gl = grib_handle_new_from_message(c, data, olen);
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_multi: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_multi: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -930,7 +932,7 @@ grib_handle* gts_new_from_file(grib_context* c, FILE* f, int* error)
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "gts_new_from_file: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "gts_new_from_file: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -971,7 +973,7 @@ grib_handle* taf_new_from_file(grib_context* c, FILE* f, int* error)
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "taf_new_from_file: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "taf_new_from_file: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -1012,7 +1014,7 @@ grib_handle* metar_new_from_file(grib_context* c, FILE* f, int* error)
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "metar_new_from_file: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "metar_new_from_file: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -1080,7 +1082,7 @@ grib_handle* bufr_new_from_file(grib_context* c, FILE* f, int* error)
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "bufr_new_from_file: cannot create handle \n");
grib_context_log(c, GRIB_LOG_ERROR, "bufr_new_from_file: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -1132,7 +1134,7 @@ grib_handle* any_new_from_file(grib_context* c, FILE* f, int* error)
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "any_new_from_file : cannot create handle\n");
grib_context_log(c, GRIB_LOG_ERROR, "any_new_from_file: cannot create handle");
grib_context_free(c, data);
return NULL;
}
@ -1205,7 +1207,7 @@ static grib_handle* grib_handle_new_from_file_no_multi(grib_context* c, FILE* f,
if (!gl) {
*error = GRIB_DECODING_ERROR;
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_no_multi: cannot create handle\n");
grib_context_log(c, GRIB_LOG_ERROR, "grib_handle_new_from_file_no_multi: cannot create handle");
grib_context_free(c, data);
return NULL;
}

View File

@ -1267,57 +1267,49 @@ int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len)
return err;
}
int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len)
{
int err;
user_buffer_t u;
reader r;
// int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len)
// {
// int err;
// user_buffer_t u;
// reader r;
// u.user_buffer = buffer;
// u.buffer_size = *len;
// r.read_data = f;
// r.read = &stdio_read;
// r.alloc_data = &u;
// r.alloc = &user_provider_buffer;
// r.headers_only = 0;
// r.seek = &stdio_seek;
// r.seek_from_start = &stdio_seek_from_start;
// r.tell = &stdio_tell;
// r.offset = 0;
// r.message_size = 0;
// err = read_any_taf(&r);
// *len = r.message_size;
// return err;
// }
u.user_buffer = buffer;
u.buffer_size = *len;
r.read_data = f;
r.read = &stdio_read;
r.alloc_data = &u;
r.alloc = &user_provider_buffer;
r.headers_only = 0;
r.seek = &stdio_seek;
r.seek_from_start = &stdio_seek_from_start;
r.tell = &stdio_tell;
r.offset = 0;
r.message_size = 0;
err = read_any_taf(&r);
*len = r.message_size;
return err;
}
int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len)
{
int err;
user_buffer_t u;
reader r;
u.user_buffer = buffer;
u.buffer_size = *len;
r.read_data = f;
r.read = &stdio_read;
r.alloc_data = &u;
r.alloc = &user_provider_buffer;
r.headers_only = 0;
r.seek = &stdio_seek;
r.seek_from_start = &stdio_seek_from_start;
r.tell = &stdio_tell;
r.offset = 0;
r.message_size = 0;
err = read_any_metar(&r);
*len = r.message_size;
return err;
}
// int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len)
// {
// int err;
// user_buffer_t u;
// reader r;
// u.user_buffer = buffer;
// u.buffer_size = *len;
// r.read_data = f;
// r.read = &stdio_read;
// r.alloc_data = &u;
// r.alloc = &user_provider_buffer;
// r.headers_only = 0;
// r.seek = &stdio_seek;
// r.seek_from_start = &stdio_seek_from_start;
// r.tell = &stdio_tell;
// r.offset = 0;
// r.message_size = 0;
// err = read_any_metar(&r);
// *len = r.message_size;
// return err;
// }
/*================== */
@ -1731,7 +1723,6 @@ int grib_read_any_from_memory(grib_context* ctx, unsigned char** data, size_t* d
err = read_any(&r, /*no_alloc=*/0, 1, ECCODES_READS_BUFR, ECCODES_READS_HDF5, ECCODES_READS_WRAP);
*len = r.message_size;
*data_length = m.data_len;
*data = m.data;

View File

@ -273,19 +273,17 @@ cleanup:
return code;
}
#else
#else // HAVE_LIBJASPER
int grib_jasper_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_decode: JasPer JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_encode: JasPer JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}

View File

@ -546,13 +546,13 @@ cleanup:
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_decode: OpenJPEG JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encode: OpenJPEG JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}

View File

@ -97,12 +97,12 @@ int grib_set_long_internal(grib_handle* h, const char* name, long val)
return grib_dependency_notify_change(a);
}
grib_context_log(c, GRIB_LOG_ERROR, "unable to set %s=%ld as long (%s)",
grib_context_log(c, GRIB_LOG_ERROR, "Unable to set %s=%ld as long (%s)",
name, val, grib_get_error_message(ret));
return ret;
}
grib_context_log(c, GRIB_LOG_ERROR, "unable to find accessor %s", name);
grib_context_log(c, GRIB_LOG_ERROR, "Unable to find accessor %s", name);
return GRIB_NOT_FOUND;
}
@ -151,12 +151,12 @@ int grib_set_double_internal(grib_handle* h, const char* name, double val)
return grib_dependency_notify_change(a);
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set %s=%g as double (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s=%g as double (%s)",
name, val, grib_get_error_message(ret));
return ret;
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to find accessor %s", name);
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to find accessor %s", name);
return GRIB_NOT_FOUND;
}
@ -189,7 +189,7 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src)
iter = grib_keys_iterator_new(src, 0, name);
if (!iter) {
grib_context_log(src->context, GRIB_LOG_ERROR, "grib_copy_namespace: unable to get iterator for %s", name);
grib_context_log(src->context, GRIB_LOG_ERROR, "grib_copy_namespace: Unable to get iterator for %s", name);
return GRIB_INTERNAL_ERROR;
}
@ -378,12 +378,12 @@ int grib_set_string_internal(grib_handle* h, const char* name,
return grib_dependency_notify_change(a);
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set %s=%s as string (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s=%s as string (%s)",
name, val, grib_get_error_message(ret));
return ret;
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to find accessor %s", name);
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to find accessor %s", name);
return GRIB_NOT_FOUND;
}
@ -516,12 +516,12 @@ int grib_set_bytes_internal(grib_handle* h, const char* name, const unsigned cha
return grib_dependency_notify_change(a);
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set %s=%s as bytes (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s=%s as bytes (%s)",
name, val, grib_get_error_message(ret));
return ret;
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to find accessor %s", name);
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to find accessor %s", name);
return GRIB_NOT_FOUND;
}
@ -552,11 +552,11 @@ int grib_set_bytes(grib_handle* h, const char* name, const unsigned char* val, s
// if (a->length == 0)
// return 0;
// if ((ret = grib_pack_zero(a)) != GRIB_SUCCESS)
// grib_context_log(h->context, GRIB_LOG_ERROR, "unable to clear %s (%s)",
// grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to clear %s (%s)",
// name, grib_get_error_message(ret));
// return ret;
// }
// /*grib_context_log(h->context,GRIB_LOG_ERROR,"unable to find accessor %s",name);*/
// /*grib_context_log(h->context,GRIB_LOG_ERROR,"Unable to find accessor %s",name);*/
// return GRIB_NOT_FOUND;
// }
@ -582,12 +582,12 @@ int grib_set_missing(grib_handle* h, const char* name)
else
ret = GRIB_VALUE_CANNOT_BE_MISSING;
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set %s=missing (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s=missing (%s)",
name, grib_get_error_message(ret));
return ret;
}
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to find accessor %s", name);
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to find accessor %s", name);
return GRIB_NOT_FOUND;
}
@ -743,7 +743,7 @@ int grib_set_double_array_internal(grib_handle* h, const char* name, const doubl
int ret = 0;
if (h->context->debug) {
print_debug_info__set_array(h, "grib_set_double_array_internal", name, val, length);
print_debug_info__set_array(h, __func__, name, val, length);
}
if (length == 0) {
@ -755,7 +755,7 @@ int grib_set_double_array_internal(grib_handle* h, const char* name, const doubl
}
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set double array %s (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set double array '%s' (%s)",
name, grib_get_error_message(ret));
/*if (h->context->debug) fprintf(stderr,"ECCODES DEBUG grib_set_double_array_internal key=%s --DONE\n",name);*/
return ret;
@ -772,7 +772,7 @@ static int __grib_set_double_array(grib_handle* h, const char* name, const doubl
size_t i = 0;
if (h->context->debug) {
print_debug_info__set_array(h, "__grib_set_double_array", name, val, length);
print_debug_info__set_array(h, __func__, name, val, length);
}
if (length == 0) {
@ -928,7 +928,7 @@ int grib_set_long_array_internal(grib_handle* h, const char* name, const long* v
{
int ret = _grib_set_long_array(h, name, val, length, 0);
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR, "unable to set long array %s (%s)",
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set long array '%s' (%s)",
name, grib_get_error_message(ret));
return ret;
}
@ -944,34 +944,33 @@ int grib_get_long_internal(grib_handle* h, const char* name, long* val)
if (ret != GRIB_SUCCESS) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as long (%s)",
"Unable to get %s as long (%s)",
name, grib_get_error_message(ret));
}
return ret;
}
int grib_is_in_dump(const grib_handle* h, const char* name)
{
const grib_accessor* a = grib_find_accessor(h, name);
if (a != NULL && (a->flags & GRIB_ACCESSOR_FLAG_DUMP))
return 1;
else
return 0;
}
// int grib_is_in_dump(const grib_handle* h, const char* name)
// {
// const grib_accessor* a = grib_find_accessor(h, name);
// if (a != NULL && (a->flags & GRIB_ACCESSOR_FLAG_DUMP))
// return 1;
// else
// return 0;
// }
int grib_attributes_count(const grib_accessor* a, size_t* size)
{
if (a) {
*size = 0;
while (a->attributes[*size] != NULL) {
(*size)++;
}
return GRIB_SUCCESS;
}
return GRIB_NOT_FOUND;
}
// int grib_attributes_count(const grib_accessor* a, size_t* size)
// {
// if (a) {
// *size = 0;
// while (a->attributes[*size] != NULL) {
// (*size)++;
// }
// return GRIB_SUCCESS;
// }
// return GRIB_NOT_FOUND;
// }
int grib_get_long(const grib_handle* h, const char* name, long* val)
{
@ -1002,7 +1001,7 @@ int grib_get_double_internal(grib_handle* h, const char* name, double* val)
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as double (%s)",
"Unable to get %s as double (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1060,7 +1059,7 @@ int grib_get_double_element_internal(grib_handle* h, const char* name, int i, do
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as double element (%s)",
"Unable to get %s as double element (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1091,7 +1090,7 @@ int grib_get_double_element_set_internal(grib_handle* h, const char* name, const
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as double element set (%s)",
"Unable to get %s as double element set (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1102,7 +1101,7 @@ int grib_get_float_element_set_internal(grib_handle* h, const char* name, const
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as float element set (%s)",
"Unable to get %s as float element set (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1142,7 +1141,7 @@ int grib_get_double_elements(const grib_handle* h, const char* name, const int*
err = ecc__grib_get_size(h, act, &size);
if (err != GRIB_SUCCESS) {
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_get_double_elements: cannot get size of %s\n", name);
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Cannot get size of %s", __func__, name);
return err;
}
@ -1151,7 +1150,7 @@ int grib_get_double_elements(const grib_handle* h, const char* name, const int*
const int anIndex = index_array[j];
if (anIndex < 0 || anIndex >= size) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"grib_get_double_elements: index out of range: %d (should be between 0 and %ld)", anIndex, size - 1);
"%s: Index out of range: %d (should be between 0 and %zu)", __func__, anIndex, size - 1);
return GRIB_INVALID_ARGUMENT;
}
}
@ -1159,7 +1158,7 @@ int grib_get_double_elements(const grib_handle* h, const char* name, const int*
num_bytes = size * sizeof(double);
values = (double*)grib_context_malloc(h->context, num_bytes);
if (!values) {
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_get_double_elements: unable to allocate %ld bytes\n", num_bytes);
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Unable to allocate %zu bytes", __func__, num_bytes);
return GRIB_OUT_OF_MEMORY;
}
@ -1185,7 +1184,7 @@ int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as string (%s)",
"Unable to get %s as string (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1219,7 +1218,7 @@ int grib_get_bytes_internal(const grib_handle* h, const char* name, unsigned cha
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as bytes (%s)",
"Unable to get %s as bytes (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1545,7 +1544,7 @@ int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, si
if (ret != GRIB_SUCCESS)
grib_context_log(h->context, GRIB_LOG_ERROR,
"unable to get %s as long array (%s)",
"Unable to get %s as long array (%s)",
name, grib_get_error_message(ret));
return ret;
@ -1580,133 +1579,127 @@ int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_
return ret;
}
static void grib_clean_key_value(grib_context* c, grib_key_value_list* kv)
{
if (kv->long_value)
grib_context_free(c, kv->long_value);
kv->long_value = NULL;
if (kv->double_value)
grib_context_free(c, kv->double_value);
kv->double_value = NULL;
if (kv->string_value)
grib_context_free(c, kv->string_value);
kv->string_value = NULL;
if (kv->namespace_value)
grib_key_value_list_delete(c, kv->namespace_value);
kv->namespace_value = NULL;
kv->error = 0;
kv->has_value = 0;
kv->size = 0;
}
// static void grib_clean_key_value(grib_context* c, grib_key_value_list* kv)
// {
// if (kv->long_value)
// grib_context_free(c, kv->long_value);
// kv->long_value = NULL;
// if (kv->double_value)
// grib_context_free(c, kv->double_value);
// kv->double_value = NULL;
// if (kv->string_value)
// grib_context_free(c, kv->string_value);
// kv->string_value = NULL;
// if (kv->namespace_value)
// grib_key_value_list_delete(c, kv->namespace_value);
// kv->namespace_value = NULL;
// kv->error = 0;
// kv->has_value = 0;
// kv->size = 0;
// }
static int grib_get_key_value(grib_handle* h, grib_key_value_list* kv)
{
int err = 0;
size_t size = 0;
grib_keys_iterator* iter = NULL;
grib_key_value_list* list = NULL;
// static int grib_get_key_value(grib_handle* h, grib_key_value_list* kv)
// {
// int err = 0;
// size_t size = 0;
// grib_keys_iterator* iter = NULL;
// grib_key_value_list* list = NULL;
// if (kv->has_value)
// grib_clean_key_value(h->context, kv);
// err = grib_get_size(h, kv->name, &size);
// if (err) {
// kv->error = err;
// return err;
// }
// if (size == 0)
// size = 512;
// switch (kv->type) {
// case GRIB_TYPE_LONG:
// kv->long_value = (long*)grib_context_malloc_clear(h->context, size * sizeof(long));
// err = grib_get_long_array(h, kv->name, kv->long_value, &size);
// kv->error = err;
// break;
// case GRIB_TYPE_DOUBLE:
// kv->double_value = (double*)grib_context_malloc_clear(h->context, size * sizeof(double));
// err = grib_get_double_array(h, kv->name, kv->double_value, &size);
// kv->error = err;
// break;
// case GRIB_TYPE_STRING:
// grib_get_string_length(h, kv->name, &size);
// kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
// err = grib_get_string(h, kv->name, kv->string_value, &size);
// kv->error = err;
// break;
// case GRIB_TYPE_BYTES:
// kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
// err = grib_get_bytes(h, kv->name, (unsigned char*)kv->string_value, &size);
// kv->error = err;
// break;
// case CODES_NAMESPACE:
// iter = grib_keys_iterator_new(h, 0, kv->name);
// list = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
// kv->namespace_value = list;
// while (grib_keys_iterator_next(iter)) {
// list->name = grib_keys_iterator_get_name(iter);
// err = grib_get_native_type(h, list->name, &(list->type));
// if (err)
// return err;
// err = grib_get_key_value(h, list);
// if (err)
// return err;
// list->next = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
// list = list->next;
// }
// grib_keys_iterator_delete(iter);
// break;
// default:
// err = grib_get_native_type(h, kv->name, &(kv->type));
// if (err)
// return err;
// err = grib_get_key_value(h, kv);
// break;
// }
// kv->has_value = 1;
// return err;
// }
if (kv->has_value)
grib_clean_key_value(h->context, kv);
// grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list)
// {
// grib_key_value_list* next = list;
// grib_key_value_list* the_clone = (grib_key_value_list*)grib_context_malloc_clear(c, sizeof(grib_key_value_list));
// grib_key_value_list* p = the_clone;
// while (next && next->name) {
// p->name = grib_context_strdup(c, next->name);
// p->type = next->type;
// next = next->next;
// }
// return the_clone;
// }
err = grib_get_size(h, kv->name, &size);
if (err) {
kv->error = err;
return err;
}
if (size == 0)
size = 512;
// void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl)
// {
// grib_key_value_list* next = kvl;
// grib_key_value_list* p = NULL;
// while (next) {
// p = next->next;
// if (next->type == CODES_NAMESPACE)
// grib_key_value_list_delete(c, next->namespace_value);
// grib_clean_key_value(c, next);
// grib_context_free(c, next);
// next = p;
// }
// }
switch (kv->type) {
case GRIB_TYPE_LONG:
kv->long_value = (long*)grib_context_malloc_clear(h->context, size * sizeof(long));
err = grib_get_long_array(h, kv->name, kv->long_value, &size);
kv->error = err;
break;
case GRIB_TYPE_DOUBLE:
kv->double_value = (double*)grib_context_malloc_clear(h->context, size * sizeof(double));
err = grib_get_double_array(h, kv->name, kv->double_value, &size);
kv->error = err;
break;
case GRIB_TYPE_STRING:
grib_get_string_length(h, kv->name, &size);
kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
err = grib_get_string(h, kv->name, kv->string_value, &size);
kv->error = err;
break;
case GRIB_TYPE_BYTES:
kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
err = grib_get_bytes(h, kv->name, (unsigned char*)kv->string_value, &size);
kv->error = err;
break;
case CODES_NAMESPACE:
iter = grib_keys_iterator_new(h, 0, kv->name);
list = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
kv->namespace_value = list;
while (grib_keys_iterator_next(iter)) {
list->name = grib_keys_iterator_get_name(iter);
err = grib_get_native_type(h, list->name, &(list->type));
if (err)
return err;
err = grib_get_key_value(h, list);
if (err)
return err;
list->next = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
list = list->next;
}
grib_keys_iterator_delete(iter);
break;
default:
err = grib_get_native_type(h, kv->name, &(kv->type));
if (err)
return err;
err = grib_get_key_value(h, kv);
break;
}
kv->has_value = 1;
return err;
}
grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list)
{
grib_key_value_list* next = list;
grib_key_value_list* the_clone = (grib_key_value_list*)grib_context_malloc_clear(c, sizeof(grib_key_value_list));
grib_key_value_list* p = the_clone;
while (next && next->name) {
p->name = grib_context_strdup(c, next->name);
p->type = next->type;
next = next->next;
}
return the_clone;
}
void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl)
{
grib_key_value_list* next = kvl;
grib_key_value_list* p = NULL;
while (next) {
p = next->next;
if (next->type == CODES_NAMESPACE)
grib_key_value_list_delete(c, next->namespace_value);
grib_clean_key_value(c, next);
grib_context_free(c, next);
next = p;
}
}
int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list)
{
int ret = 0;
grib_key_value_list* kvl = list;
while (kvl) {
ret = grib_get_key_value(h, kvl);
kvl = kvl->next;
}
return ret;
}
// int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list)
// {
// int ret = 0;
// grib_key_value_list* kvl = list;
// while (kvl) {
// ret = grib_get_key_value(h, kvl);
// kvl = kvl->next;
// }
// return ret;
// }
int grib_get_values(grib_handle* h, grib_values* args, size_t count)
{
@ -1815,7 +1808,7 @@ int grib_set_values(grib_handle* h, grib_values* args, size_t count)
break;
}
/*if (args[i].error != GRIB_SUCCESS)
grib_context_log(h->context,GRIB_LOG_ERROR,"unable to set %s (%s)",
grib_context_log(h->context,GRIB_LOG_ERROR,"Unable to set %s (%s)",
args[i].name,grib_get_error_message(args[i].error)); */
}
}

View File

@ -19,6 +19,7 @@ list(APPEND test_c_bins
grib_multi_from_message
grib_clone_headers_only
grib_read_index
grib_set_large_message_fail
unit_tests
bufr_keys_iter
grib_keys_iter
@ -96,6 +97,7 @@ if( HAVE_BUILD_TOOLS )
grib_ifsParam
grib_packing_order
filter_substr
filter_transient_darray
grib_uerra
grib_ecpoint
grib_s2s
@ -143,7 +145,6 @@ if( HAVE_BUILD_TOOLS )
bufr_json_samples
bufr_ecc-359
bufr_ecc-517
bufr_rdbSubTypes
grib_efas
grib_sh_imag
grib_spectral
@ -153,14 +154,16 @@ if( HAVE_BUILD_TOOLS )
grib_grid_lambert_conformal
grib_grid_polar_stereographic
grib_grid_healpix
grib_g1monthlydate
grib_g1day_of_the_year_date
grib_g1fcperiod)
)
# These tests require data downloads
# and/or take much longer
list(APPEND tests_extra
grib_data_quality_checks
grib_set_large_message_fail
grib_g1monthlydate
grib_g1fcperiod
grib_bpv_limit
grib_complex
grib_double_cmp
@ -174,6 +177,7 @@ if( HAVE_BUILD_TOOLS )
grib_count
grib_clone_headers_only
bufr_templates
bufr_rdbSubTypes
bufr_dump_data
bufr_dump_descriptors
bufr_coordinate_descriptors
@ -188,6 +192,7 @@ if( HAVE_BUILD_TOOLS )
bufr_get
bufr_operators
bufr_filter_misc
bufr_filter_fail
bufr_filter_extract_subsets
bufr_filter_extract_datetime
bufr_filter_extract_area
@ -252,10 +257,13 @@ if( HAVE_BUILD_TOOLS )
gts_ls
gts_count
gts_compare
gts_dump
wrap
hdf5
taf
pseudo_diag
metar_ls
metar_filter
metar_get
metar_dump
metar_compare
@ -303,6 +311,7 @@ if( HAVE_BUILD_TOOLS )
grib_level
grib_indexing
grib_bitmap
grib_secondary_bitmap
grib_list
grib_second_order
grib_multi_from_message
@ -356,6 +365,10 @@ if( HAVE_BUILD_TOOLS )
TYPE SCRIPT
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
ecbuild_add_test( TARGET eccodes_t_grib_repair
TYPE SCRIPT
CONDITION ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_repair.sh )
# Note: making the test dependent on the grib files (with DEPENDS)

View File

@ -45,7 +45,7 @@ f1="syno_1.bufr"
f2="aaen_55.bufr"
echo "Test: comparing two completely different files" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}/bufr_compare $f1 $f2 >> $fLog
${tools_dir}/bufr_compare -v $f1 $f2 >> $fLog
if [ $? -eq 0 ]; then
echo "bufr_compare should have failed if files are completely different" >&2
exit 1
@ -310,6 +310,46 @@ set -e
${tools_dir}/bufr_compare -bident -v $tempIndex1 $tempIndex2
rm -f $tempIndex1 $tempIndex2
# Fail to unpack
# ---------------
bufr1=vos308014_v3_26.bufr
bufr2=aaen_55.bufr
set +e
${tools_dir}/bufr_compare $bufr1 $bufr2 > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Failed to unpack 1st message" $fLog
set +e
${tools_dir}/bufr_compare $bufr2 $bufr1 > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Failed to unpack 2nd message" $fLog
# ----------------------------------------
# Summary mode (-f)
# ----------------------------------------
set +e
${tools_dir}/bufr_compare -f aaen_55.bufr aben_55.bufr > $fLog 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep -q "Summary of different key values" $fLog
# ----------------------------------------
# Unreadable message
# ----------------------------------------
echo BUFR > $fBufrTmp
set +e
${tools_dir}/bufr_compare $fBufrTmp $fBufrTmp > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unreadable message" $fLog
# Clean up
# -------------

View File

@ -72,9 +72,38 @@ EOF
set +e
${tools_dir}/codes_bufr_filter -o $tempBufr $tempFilt $sample_bufr4 2>$tempText
status=$?
[ $status -ne 0 ]
set -e
[ $status -ne 0 ]
fgrep -q "Value (-416) out of range" $tempText
# Error conditions
# ------------------
cat > $tempFilt <<EOF
set inputOverriddenReferenceValues = { -5000, 5000 };
set unexpandedDescriptors = { 203014, 7030, 203255, 307080, 203000, 7030 };
set pack = 1;
EOF
set +e
${tools_dir}/codes_bufr_filter -o $tempBufr $tempFilt $sample_bufr4 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
fgrep -q "number of overridden reference values (2) different from number of descriptors between operator 203YYY and 203255" $tempText
cat > $tempFilt <<EOF
set inputOverriddenReferenceValues = { -50000000 }; # Value too large
set unexpandedDescriptors = { 203014, 7030, 203255, 307080, 203000, 7030 };
set pack = 1;
EOF
set +e
${tools_dir}/codes_bufr_filter -o $tempBufr $tempFilt $sample_bufr4 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
fgrep -q "does not fit in 14 bits" $tempText
# Clean up
rm -f $tempBufr $tempFilt $tempText

126
tests/bufr_filter_fail.sh Executable file
View File

@ -0,0 +1,126 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="bufr_filter_fail_test"
cd ${data_dir}/bufr
fBufrTmp=${label}".bufr.tmp"
fRules=${label}.filter
fLog=${label}".log"
tempErr=temp.$label.err
#-----------------------------------------------------------
# Test: with nonexistent keys.
#-----------------------------------------------------------
cat > $fRules <<EOF
set center="98"; #Here centre is misspelled
EOF
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if key not found" >&2
exit 1
fi
set -e
# Now repeat with -f option (do not exit on error)
${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#-----------------------------------------------------------
# Test: with not allowed key values
#-----------------------------------------------------------
cat > $fRules <<EOF
set centre=1024; #1024 is out of range (it is 8-bit only)
EOF
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if key value is not allowed" >&2
exit 1
fi
set -e
# Now repeat with -f option (do not exit on error)
${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#-----------------------------------------------------------
# Test: with invalid string key
#-----------------------------------------------------------
cat > $fRules <<EOF
set unexpandedDescriptors={1015};
set stationOrSiteName="Caesar non supra grammaticos"; # Too long
set pack=1;
write;
EOF
set +e
f="$ECCODES_SAMPLES_PATH/BUFR4.tmpl"
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if string key is invalid" >&2
exit 1
fi
set -e
# Bad filter
# -----------
set +e
${tools_dir}/bufr_filter a_non_existent_filter_file $ECCODES_SAMPLES_PATH/BUFR4.tmpl > $tempErr 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Cannot include file" $tempErr
# Close
# --------
cat > $fRules <<EOF
transient abcd = "afile";
close(abcd);
EOF
set +e
${tools_dir}/bufr_filter $fRules $ECCODES_SAMPLES_PATH/BUFR4.tmpl > $tempErr 2>&1
status=$?
set -e
[ $status -ne 0 ]
cat $tempErr
grep -q "Input output problem" $tempErr
# ------------------------
# Unreadable message
# ------------------------
cat > $fRules <<EOF
print "[edition]";
EOF
outfile=temp.$label.out
echo BUFR > $outfile
set +e
${tools_dir}/bufr_filter $fRules $outfile > $tempErr 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unreadable message" $tempErr
rm -f $outfile
# Clean up
rm -f $fLog $fRules $tempErr

View File

@ -8,16 +8,15 @@
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
set -x
. ./include.ctest.sh
cd ${data_dir}/bufr
# Define a common label for all the tmp files
label="bufr_filter_misc_test"
tempErr=temp.$label.err
cd ${data_dir}/bufr
# Create log file
fLog=${label}".log"
rm -f $fLog
@ -518,75 +517,6 @@ diff ${f}.ref ${f}.log
rm -f ${f}.ref ${f}.log
#-----------------------------------------------------------
# Test: with nonexistent keys.
#-----------------------------------------------------------
cat > $fRules <<EOF
set center="98"; #Here centre is misspelled
EOF
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
echo "Test: nonexistent keys" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if key not found" >&2
exit 1
fi
set -e
# Now repeat with -f option (do not exit on error)
${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#-----------------------------------------------------------
# Test: with not allowed key values
#-----------------------------------------------------------
cat > $fRules <<EOF
set centre=1024; #1024 is out of range (it is 8-bit only)
EOF
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
echo "Test: not allowed key values" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if key value is not allowed" >&2
exit 1
fi
set -e
# Now repeat with -f option (do not exit on error)
${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog
#-----------------------------------------------------------
# Test: with invalid string key
#-----------------------------------------------------------
cat > $fRules <<EOF
set unexpandedDescriptors={1015};
set stationOrSiteName="Caesar non supra grammaticos"; # Too long
set pack=1;
write;
EOF
set +e
f="$ECCODES_SAMPLES_PATH/BUFR4.tmpl"
echo "Test: Invalid string key" >> $fLog
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
if [ $? -eq 0 ]; then
echo "bufr_filter should have failed if string key is invalid" >&2
exit 1
fi
set -e
#----------------------------------------------------
# Test: format specifier for integer keys
#----------------------------------------------------
@ -1340,14 +1270,6 @@ diff $fRef $fLog
rm -f $fRef
# Bad filter
set +e
${tools_dir}/bufr_filter a_non_existent_filter_file $ECCODES_SAMPLES_PATH/BUFR4.tmpl > $tempErr 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Cannot include file" $tempErr
# Clean up
rm -f ${f}.log ${f}.log.ref ${f}.out $fLog $fRules

View File

@ -120,6 +120,18 @@ result=`${tools_dir}/bufr_get -p unpack:s,heightOfStation aaen_55.bufr`
[ "$result" = "0 858000" ]
# ----------------------------------------
# Unreadable message
# ----------------------------------------
echo BUFR > $fTmp
set +e
${tools_dir}/bufr_get -p edition $fTmp > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unreadable message" $fLog
# Clean up
rm -f $fLog $fTmp $res_get $tempRef

View File

@ -64,6 +64,11 @@ ${tools_dir}/bufr_ls -s satelliteID=313 -p satelliteID aaen_55.bufr > $fTmp
grep -q "313" $fTmp
# ------------------------
# Test -w
# ------------------------
${tools_dir}/bufr_ls -w count=2 syno_multi.bufr
# ------------------------
# Test corner cases
# ------------------------

View File

@ -10,8 +10,6 @@
. ./include.ctest.sh
#set -x
# Enter data dir
cd ${data_dir}/bufr
@ -26,10 +24,9 @@ touch $fLog
# Define tmp bufr file
fBufrTmp=${label}".bufr.tmp"
#----------------------------------------------------
#-----------------------------------------------
# Test: setting header for single message file
#----------------------------------------------------
#-----------------------------------------------
rm -f $fBufrTmp
f="syno_1.bufr"
@ -43,7 +40,6 @@ centre=`${tools_dir}/bufr_get -p bufrHeaderCentre $fBufrTmp`
#----------------------------------------------------
# Test: setting header for multi-message file
#----------------------------------------------------
rm -f $fBufrTmp
f="syno_multi.bufr"
@ -60,7 +56,6 @@ done
#-----------------------------------------------------
# Test: setting data values for single message file
#-----------------------------------------------------
# TODO: when ECC-37 is fixed we need to enable it.
rm -f $fBufrTmp
@ -77,7 +72,6 @@ echo "file: $f" >> $fLog
#----------------------------------------------------
# Test: setting header for multi-message file
#----------------------------------------------------
# TODO: when ECC-37 is fixed we need to enable it.
rm -f $fBufrTmp
@ -93,13 +87,22 @@ echo "file: $f" >> $fLog
#done
#-----------------------------------------------------------
# Test: with nonexistent keys.
# Test: No keys set
#-----------------------------------------------------------
set +e
${tools_dir}/bufr_set $f $fBufrTmp > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "provide some keys to set" $fLog
#-----------------------------------------------------------
# Test: with nonexistent keys
#-----------------------------------------------------------
# Key "center" does not exist!!
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
echo "Test: nonexistent keys" >> $fLog
echo "file: $f" >> $fLog
@ -117,12 +120,10 @@ ${tools_dir}/bufr_set -f -s center=98 $f $fBufrTmp 2>>$fLog 1>>$fLog
#-----------------------------------------------------------
# Test: with not allowed key values
#-----------------------------------------------------------
# Here 1024 is out of range for centre (it is 8-bit only for edition=3 files)
# Invoke without -f i.e. should fail if error encountered
set +e
f="syno_1.bufr"
echo "Test: nonexistent keys" >> $fLog
echo "file: $f" >> $fLog
@ -179,15 +180,16 @@ result=`${tools_dir}/bufr_get -p ident $fBufrTmp`
#-----------------------------------------------------------
# ECC-1359: string that can be converted to an integer
# ----------------------------------------------------------
${tools_dir}/bufr_set -s messageLength:s=333 $ECCODES_SAMPLES_PATH/BUFR4_local.tmpl $fBufrTmp
sample=$ECCODES_SAMPLES_PATH/BUFR4_local.tmpl
${tools_dir}/bufr_set -s messageLength:s=333 $sample $fBufrTmp
result=`${tools_dir}/bufr_get -p messageLength $fBufrTmp`
[ "$result" = "333" ]
#-----------------------------------------------------------
# Invalid masterTablesVersionNumber
#-----------------------------------------------------------
${tools_dir}/bufr_set -s masterTablesVersionNumber=255 $ECCODES_SAMPLES_PATH/BUFR4.tmpl $fBufrTmp
sample=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
${tools_dir}/bufr_set -s masterTablesVersionNumber=255 $sample $fBufrTmp
set +e
${tools_dir}/bufr_dump -p $fBufrTmp 2>>$fLog 1>>$fLog
if [ $? -eq 0 ]; then
@ -198,6 +200,25 @@ set -e
grep -q "unable to find definition file sequence.def.*bufr/tables/0/local/0/98/0/sequence.def" $fLog
grep -q "ECCODES ERROR.*unable to get hash value for sequences" $fLog
# ECC-1739
sample=$ECCODES_SAMPLES_PATH/BUFR3.tmpl
${tools_dir}/bufr_set -s masterTablesVersionNumber=255,localTablesVersionNumber=1 $sample $fBufrTmp
set +e
${tools_dir}/bufr_dump -p $fBufrTmp >$fLog 2>&1
status=$?
set -e
grep -q "ECCODES ERROR.*unable to get hash value for sequences" $fLog
# Unreadable message
#-----------------------------------------------------------
echo BUFR > $fBufrTmp
set +e
${tools_dir}/bufr_set -s masterTablesVersionNumber=10 $fBufrTmp /dev/null > $fLog 2>&1
status=$?
set -e
grep -q "unreadable message" $fLog
# Clean up
rm -f $fLog

View File

@ -48,5 +48,13 @@ set -e
[ $status -ne 0 ]
grep -q "Wrong message length" $tempLog
set +e
$EXEC ${test_dir}/extract_offsets nonexistentfile > $tempLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Unable to read file" $tempLog
# Clean up
rm -f $temp1 $temp2 $tempLog

View File

@ -0,0 +1,43 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="filter_transient_darray_test"
tempOut=temp.$label.out
tempRef=temp.$label.ref
tempFilt=temp.$label.filt
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
cat > $tempFilt <<EOF
transient dar = { 6, -1.6 };
print "dar as int=[dar:i]";
print "dar as dbl=[dar:d]";
set dar = {-9.99, 14.76, 15, 16, 18};
print "dar now =[dar]";
meta elem1 element(dar, 1);
print "elem1 = [elem1:d]";
EOF
${tools_dir}/grib_filter $tempFilt $sample > $tempOut
cat > $tempRef <<EOF
dar as int=6 -1
dar as dbl=6 -1.6
dar now =-9.99 14.76 15 16 18
elem1 = 14.76
EOF
diff $tempRef $tempOut
# Clean up
rm -f $tempRef $tempOut $tempFilt

View File

@ -149,6 +149,14 @@ set -e
# Raise the tolerance
${tools_dir}/grib_compare -b referenceValue -A 3.2 $infile $temp1
# Invalid value
set +e
${tools_dir}/grib_compare -A badnum $infile $temp1 >$outfile 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep -q "Invalid absolute error" $outfile
# ----------------------------------------
# ECC-355: -R with "all" option
@ -161,6 +169,23 @@ ${tools_dir}/grib_compare -b $BLACKLIST -R referenceValue=0.03,codedValues=2 $te
# Now try the "all" option with the highest relative diff value
${tools_dir}/grib_compare -b $BLACKLIST -R all=2 $temp1 $temp2
# ----------------------------------------
# Use -w switch
# ----------------------------------------
cp ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
${tools_dir}/grib_compare -w typeOfLevel=surface ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
# ----------------------------------------
# Summary mode (-f)
# ----------------------------------------
set +e
${tools_dir}/grib_compare -f ${data_dir}/tigge_cf_ecmwf.grib2 ${data_dir}/tigge_pf_ecmwf.grib2 > $outfile 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep -q "indicatorOfUnitForTimeIncrement . 7 different" $outfile
# ----------------------------------------
# ECC-651: Two-way (symmetric) comparison
# ----------------------------------------
@ -217,14 +242,14 @@ sample_g2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
# --------------------------------------------
${tools_dir}/grib_set -s scaleFactorOfFirstFixedSurface=1 $sample_g2 $temp1
set +e
${tools_dir}/grib_compare $sample_g2 $temp1 > $outfile
${tools_dir}/grib_compare -v $sample_g2 $temp1 > $outfile
status=$?
set -e
[ $status -eq 1 ]
grep -q "scaleFactorOfFirstFixedSurface is set to missing in 1st field but is not missing in 2nd field" $outfile
set +e
${tools_dir}/grib_compare $temp1 $sample_g2 > $outfile
${tools_dir}/grib_compare -v $temp1 $sample_g2 > $outfile
status=$?
set -e
[ $status -eq 1 ]
@ -271,6 +296,15 @@ set -e
[ $status -eq 1 ]
echo GRIB > $temp1
echo GRIB > $temp2
set +e
${tools_dir}/grib_compare $temp1 $temp2 > $outfile 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep "unreadable message" $outfile
# Clean up
# ---------
rm -f $temp1 $temp2

View File

@ -108,5 +108,25 @@ ${tools_dir}/grib_dump -w count=4 $file > $temp 2>&1
ECCODES_DEBUG=1 ${tools_dir}/grib_dump $data_dir/sample.grib2
# Unreadable message
#-----------------------------------------------------------
tempOut=temp.$label.out
echo GRIB > $temp
set +e
${tools_dir}/grib_dump $temp > $tempOut 2>&1
status=$?
set -e
grep -q "unreadable message" $tempOut
set +e
${tools_dir}/grib_dump -j $temp > $tempOut 2>&1
status=$?
set -e
grep -q "unreadable message" $tempOut
rm -f $tempOut
# Clean up
rm -f $temp

View File

@ -66,7 +66,6 @@ cat > $tempRef <<EOF
}
]}
EOF
cat $tempOut
diff $tempRef $tempOut
grib_check_key_equals $tempGrib dateOfForecastUsedInLocalTime '20200804'
grib_check_key_equals $tempGrib timeOfForecastUsedInLocalTime '0'
@ -76,7 +75,6 @@ grib_check_key_equals $tempGrib timeOfForecastUsedInLocalTime '0'
${tools_dir}/grib_get -n ls $tempGrib > $tempOut
# edition centre date time dataType gridType typeOfLevel level shortName packingType
echo "2 ecmf 20200805 1200 an regular_ll surface 0 t grid_simple" > $tempRef
cat $tempOut
diff -w $tempRef $tempOut
# Check "time" namespace
@ -84,7 +82,6 @@ ${tools_dir}/grib_get -n time $tempGrib > $tempOut
echo "h 20200804 0000 36" > $tempRef
diff -w $tempRef $tempOut
# numberOfForecastsUsedInLocalTime > 1
# ------------------------------------
cat > $tempFilt <<EOF

View File

@ -394,8 +394,8 @@ ${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut 2
cat $tempOut
grep "rubbish must fail" $tempOut
grep "garbage must fail" $tempOut
grep "unable to get rubbish as string" $tempOut
grep "unable to get garbage as string" $tempOut
grep "Unable to get rubbish as string" $tempOut
grep "Unable to get garbage as string" $tempOut
# Use of "abs"

View File

@ -32,5 +32,54 @@ set -e
[ $status -ne 0 ]
grep -q "Nh (Key/value not found)" $tempText
# Nearest
# ---------
set +e
${tools_dir}/grib_get -s Nj=MISSING -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Key Nj cannot be 'missing'" $tempText
set +e
${tools_dir}/grib_get -s Nj=0 -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Key Nj cannot be 0" $tempText
set +e
${tools_dir}/grib_get -l 0,0,5 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Wrong mode given" $tempText
set +e
${tools_dir}/grib_get -l 0,0,1,nonexistingmask $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
cat $tempText
grep -q "unable to open mask file" $tempText
# ------------------------
# Unreadable message
# ------------------------
outfile=temp.$label.out
echo GRIB > $outfile
set +e
${tools_dir}/grib_get -p edition $outfile /dev/null > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unreadable message" $tempText
rm -f $outfile
# Clean up
rm -f $tempText

View File

@ -35,7 +35,6 @@ ${tools_dir}/grib_index_build -N -o $tempIndex ${infile} >/dev/null
# Must remove first two lines (filename specifics)
${tools_dir}/grib_dump ${tempIndex} | sed '1,2d' > $tempOut
#cat $tempOut
cat > $tempRef <<EOF
Index keys:
@ -118,7 +117,6 @@ ${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2 2>$tempOut
status=$?
set -e
[ $status -ne 0 ]
cat $tempOut
grep -q "Indexes contained in the input files have different keys" $tempOut
rm -f $tempIndex1 $tempIndex2 $tempOut
@ -130,7 +128,6 @@ ${tools_dir}/grib_compare -v $tempIndex2 $tempIndex1 2>$tempOut
status=$?
set -e
[ $status -ne 0 ]
cat $tempOut
grep -q "Indexes contained in the input files have different keys" $tempOut
rm -f $tempIndex1 $tempIndex2 $tempOut

View File

@ -26,11 +26,11 @@ files="reduced_latlon_surface.grib1 \
regular_latlon_surface.grib2"
for f in $files; do
file=${data_dir}/$f
# Must exclude the first line of grib_get_data which is "Latitude Longitude Value"
iterator_count=`${tools_dir}/grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
numberOfPoints=`${tools_dir}/grib_get -w count=1 -p numberOfPoints $file`
[ $numberOfPoints = ${iterator_count} ]
file=${data_dir}/$f
# Must exclude the first line of grib_get_data which is "Latitude Longitude Value"
iterator_count=`${tools_dir}/grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
numberOfPoints=`${tools_dir}/grib_get -w count=1 -p numberOfPoints $file`
[ $numberOfPoints = ${iterator_count} ]
done
@ -51,7 +51,7 @@ ${tools_dir}/grib_set -s Ni=33 $samp_dir/GRIB2.tmpl $tempGrib
set +e
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
status=$?
set +e
set -e
[ $status -ne 0 ]
grep -q "Grid description is wrong or inconsistent" $tempText
@ -60,16 +60,61 @@ ${tools_dir}/grib_set -s Ni=MISSING $samp_dir/GRIB2.tmpl $tempGrib
set +e
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
status=$?
set +e
set -e
[ $status -ne 0 ]
grep -q "Grid description is wrong or inconsistent" $tempText
set +e
${tools_dir}/grib_ls -s Ni=missing -j -p latLonValues $data_dir/sample.grib2 > $tempText 2>&1
cat $tempText
status=$?
set -e
[ $status -ne 0 ]
grep -q "Key Ni cannot be 'missing' for a regular grid" $tempText
grep -q "latlonvalues: Unable to create iterator" $tempText
# -w option
${tools_dir}/grib_get_data -w count=11 $data_dir/tigge_cf_ecmwf.grib2 > $tempText
# ------------------------
# Bad key
# ------------------------
${tools_dir}/grib_get_data -f -p nonexistingkey $data_dir/sample.grib2 > $tempText
grep -q "not found" $tempText
# ------------------------
# Unreadable message
# ------------------------
echo GRIB > $tempGrib
set +e
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
cat $tempText
grep -q "unreadable message" $tempText
# Legacy Gaussian sub-area (produced by old ProdGen)
# See ECC-906:
# grib_get_data not working correctly with old-style sub-areas of reduced grids
# -------------------------------------------------
input=$data_dir/reduced_gaussian_sub_area.legacy.grib1
if [ -f "$input" ]; then
${tools_dir}/grib_get_data $input > $tempText
grib_check_key_equals $input legacyGaussSubarea 1
ECCODES_DEBUG=-1 ${tools_dir}/grib_ls -p numberOfDataPoints $input > $tempText 2>&1
grep -q "LEGACY MODE activated. Count.=253982. changed to num values.=254139" $tempText
fi
# Iterate with DEBUG on
input=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl
ECCODES_DEBUG=1 ${tools_dir}/grib_get_data $input > $tempText 2>&1
grep "global num points=6114" $tempText
# Clean up
rm -f $tempText $tempGrib

View File

@ -156,5 +156,15 @@ ECCODES_GRIB_DUMP_JPG_FILE=$tempDump ${tools_dir}/grib_copy -r $data_dir/jpeg.g
[ -f $tempDump ]
rm -f $tempDump
# Check Jasper decoding when it is disabled
if [ $HAVE_LIBJASPER -eq 0 ]; then
set +e
ECCODES_GRIB_JPEG=jasper ${tools_dir}/grib_get -n statistics $data_dir/jpeg.grib2 > $tempDump 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "JasPer JPEG support not enabled" $tempDump
fi
# Clean up
rm -f $tempFilt $tempGrib
rm -f $tempFilt $tempGrib $tempDump

View File

@ -225,6 +225,8 @@ grib_check_key_equals $file 'expver:s' '0001'
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:d $data_dir/sample.grib2
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:i $data_dir/sample.grib2
${tools_dir}/grib_get -l0,0,4 $data_dir/sample.grib2
set +e
${tools_dir}/grib_ls -l0,0,666 $data_dir/sample.grib2 > $tempText 2>&1
status=$?
@ -233,5 +235,13 @@ set -e
grep -q "Wrong mode given" $tempText
set +e
${tools_dir}/grib_ls -l0,0,1,nonexistingmask $data_dir/sample.grib2 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unable to open mask file" $tempText
# Clean up
rm -f $temp1 $temp2 $tempText $tempLog

View File

@ -15,6 +15,11 @@ REDIRECT=/dev/null
tempGrib=temp.local.$label.grib1
tempFilt=temp.local.$label.filt
if [ $ECCODES_ON_WINDOWS -eq 1 ]; then
echo "$0: This test is currently disabled on Windows"
exit 0
fi
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $tempGrib
cat > $tempFilt <<EOF
if (GRIBEXSection1Problem ) {

View File

@ -53,7 +53,7 @@ infile=${data_dir}/sample.grib2
set +e
${tools_dir}/grib_set -r -s packingType=grid_png $infile $temp > $tempErr 2>&1
set -e
grep -q "unable to set double array codedValues" $tempErr
grep -q "Unable to set double array 'codedValues'" $tempErr
# Nearest neighbour
# ----------------------

34
tests/grib_repair.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="grib_repair_test"
tempText=temp.$label.txt
tempGoodGribs=temp.$label.good.grib
tempBadGribs=temp.$label.bad.grib
if [ -e "${tools_dir}/grib_repair" ]; then
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
${tools_dir}/grib_repair $data_dir/bad.grib $tempGoodGribs $tempBadGribs > $tempText 2>&1
grep -q "Wrong message length" $tempText
count=$( ${tools_dir}/grib_count $tempGoodGribs )
[ $count -eq 1 ]
count=$( ${tools_dir}/grib_count $tempBadGribs )
[ $count -eq 3 ]
${tools_dir}/grib_ls $tempGoodGribs
${tools_dir}/grib_ls $tempBadGribs
fi
# Clean up
rm -f $tempText $tempGoodGribs $tempBadGribs

View File

@ -201,6 +201,13 @@ ${tools_dir}/grib_ls -l46,1 $temp1 > $REDIRECT
${tools_dir}/grib_ls -j -l46,1,1 $temp1 > $REDIRECT
# Encoding
input=second_ord_rbr.grib1
${tools_dir}/grib_set -s scaleValuesBy=1.01 $input $temp1
${tools_dir}/grib_dump $temp1
grib_check_key_equals $temp1 packingType grid_second_order
# Clean up
rm -f $temp_stat1 $temp_stat2
rm -f $temp1 $temp2 $temp3 $sec_ord_bmp

35
tests/grib_secondary_bitmap.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="grib_secondary_bitmap_test"
tempGribA=temp.$label.A.grib
tempGribB=temp.$label.B.grib
tempFilt=temp.$label.filt
tempLog=temp.$label.log
tempRef=temp.$label.ref
# Use a GRIB2 input with a bitmap
input=$data_dir/reduced_latlon_surface.grib2
grib_check_key_equals $input bitmapPresent 1
${tools_dir}/grib_set -s packingType=grid_simple_matrix,NC=1,NR=1 $input $tempGribA
${tools_dir}/grib_set -s matrixBitmapsPresent=1 $tempGribA $tempGribB
${tools_dir}/grib_dump -O $tempGribB
${tools_dir}/grib_dump -Dat $tempGribB
# Call pack_double and unpack_double
cat >$tempFilt<<EOF
set values = {0, 1, 9999};
print "[bitmap]";
EOF
${tools_dir}/grib_filter $tempFilt $tempGribB
rm -f $tempGribA $tempGribB $tempFilt $tempLog $tempRef

View File

@ -99,6 +99,11 @@ grib_check_key_equals $input 'typeOfProcessedData:i' '2'
${tools_dir}/grib_set -s typeOfProcessedData=rubbish $input $outfile
grib_check_key_equals $outfile 'typeOfProcessedData:i' '255' # set to default
# GDSPresent
# ------------
input=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
${tools_dir}/grib_set -s GDSPresent=1 $input $outfile
# Clean up
rm -f $outfile $temp

View File

@ -0,0 +1,70 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include <stdio.h>
#include <stdlib.h>
#undef NDEBUG
#include <assert.h>
#include "eccodes.h"
int main(int argc, char** argv)
{
int err = 0, i = 0, NUM_MISSING = 10;
codes_handle* h = NULL;
size_t values_len = 0;
long Ni = 0, Nj = 0;
double* values = NULL;
const double missing = 1.0e36;
bool use_bitmap = false;
if (argc == 2 && strcmp(argv[1], "-b")==0) {
use_bitmap = true;
}
h = codes_grib_handle_new_from_samples(NULL, "GRIB1");
assert(h);
CODES_CHECK(codes_set_double(h, "missingValue", missing), 0);
Ni = Nj = 20000;
values_len = Ni * Nj;
values = (double*)calloc(values_len, sizeof(double));
CODES_CHECK(codes_set_long(h, "Ni", Ni), 0);
CODES_CHECK(codes_set_long(h, "Nj", Nj), 0);
if (use_bitmap) {
printf("Adding a bitmap...\n");
CODES_CHECK(codes_set_long(h, "bitmapPresent", 1), 0);
for (i = 0; i < NUM_MISSING; i++) {
values[i] = missing;
}
} else {
printf("Not adding a bitmap...\n");
values[0] = 42;
values[1] = 52;
}
printf("Setting the values array...\n");
err = codes_set_double_array(h, "values", values, values_len);
if (err) {
printf("codes_set_double_array failed as expected: err=%s\n", codes_get_error_message(err));
} else {
fprintf(stderr, "Error: codes_set_double_array should have failed!\n");
return 1;
}
codes_handle_delete(h);
free(values);
return 0;
}

View File

@ -0,0 +1,23 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label='grib_set_large_message_fail_test'
temp=temp.$label.txt
$EXEC ${test_dir}/grib_set_large_message_fail > $temp 2>&1
grep -q "Failed to set GRIB1 message length" $temp
$EXEC ${test_dir}/grib_set_large_message_fail -b > $temp 2>&1
grep -q "Unable to set double array.*bitmap" $temp
# Clean up
rm -f $temp

View File

@ -64,7 +64,34 @@ set -e
# Add correct blocklist
${tools_dir}/gts_compare -b GG $gts_file $fGtsTmp
#----------------------------------------------------
# Compare using -c
#----------------------------------------------------
temp1=temp.$label.1.gts
temp2=temp.$label.2.gts
# Pick two messages which do have different contents
${tools_dir}/gts_copy -w count=1 $gts_file $temp1
${tools_dir}/gts_copy -w count=4 $gts_file $temp2
${tools_dir}/gts_compare -c theMessage $temp1 $temp2
${tools_dir}/gts_compare -c theMessage -a $temp1 $temp2
set +e
${tools_dir}/gts_compare -c ls:n $temp1 $temp2
status=$?
set -e
[ $status -eq 1 ]
set +e
${tools_dir}/gts_compare -c ls:n -a $temp1 $temp2
status=$?
set -e
[ $status -eq 1 ]
rm -f $temp1 $temp2
#----------------------------------------------------
# Test with file of the same name in a dir
#----------------------------------------------------
tempDir=temp.$label.dir
rm -fr $tempDir
mkdir $tempDir

27
tests/gts_dump.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="gts_dump_test"
fLog=${label}.log
fTmp=${label}.tmp.txt
# Enter data dir
cd ${data_dir}/gts
gts_file=EGRR20150317121020_00493212.DAT
${tools_dir}/gts_dump -w count=1 $gts_file
${tools_dir}/gts_dump -Dat $gts_file
${tools_dir}/gts_dump -OH $gts_file
# Clean up
rm -f $fLog $fTmp

View File

@ -26,6 +26,12 @@ fTmp=${label}".tmp.txt"
gts_file=EGRR20150317121020_00493212.DAT
${tools_dir}/gts_get -p TT,AA,II,CCCC,YY,GG,gg,BBB $gts_file >/dev/null
#----------------------------------------------
# Test "-w" switch
#----------------------------------------------
${tools_dir}/gts_get -p TT -w count=3 $gts_file >/dev/null
gts_file=${data_dir}/gts.grib
result=$( ${tools_dir}/grib_get -wcount=1 -p gts_CCCC -g $gts_file )
[ "$result" = "ECMG" ]

View File

@ -25,15 +25,25 @@ touch $fLog
fTmp=${label}".tmp.txt"
rm -f $fTmp
#----------------------------------------------
# Test default "ls" on all the gts data files
#----------------------------------------------
#-------------------------------------------
# Test default "ls" on the gts data file
#-------------------------------------------
gts_file=EGRR20150317121020_00493212.DAT
f=$gts_file
echo $f >> $fLog
${tools_dir}/gts_ls $f >> $fLog
#-------------------------------------------
# Test "-s" switch
#-------------------------------------------
${tools_dir}/gts_ls -s YY=abc $f >> $fLog
#-------------------------------------------
# Test "-w" switch
#-------------------------------------------
${tools_dir}/gts_ls -w AA=IY $f >> $fLog
#-------------------------------------------
# Test "-p" switch
#-------------------------------------------
@ -52,10 +62,18 @@ echo 'print "[theMessage]";' | ${tools_dir}/gts_filter - $gts_file
${tools_dir}/gts_ls -wcount=1 -p theMessage $f
gts_file=${data_dir}/gts.grib
result=$( ${tools_dir}/grib_ls -wcount=1 -p gts_CCCC -g $gts_file )
# Bad filter
set +e
${tools_dir}/gts_filter a_non_existent_filter_file $gts_file > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Cannot include file" $fLog
# Clean up
rm -f $fLog $res_ls

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