diff --git a/.clang-format b/.clang-format index 6570f09ec..1d0bd7ff4 100644 --- a/.clang-format +++ b/.clang-format @@ -4,6 +4,7 @@ AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: true AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true @@ -66,6 +67,7 @@ IncludeCategories: Priority: 3 IncludeIsMainRegex: '([-_](test|unittest))?$' IndentCaseLabels: true +IndentPPDirectives: BeforeHash IndentWidth: 4 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave diff --git a/.github/.cmake-options b/.github/.cmake-options new file mode 100644 index 000000000..213b78382 --- /dev/null +++ b/.github/.cmake-options @@ -0,0 +1 @@ +-DENABLE_EXTRA_TESTS=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8de4c92aa..f7085bcae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild) # Initialise project -project( eccodes VERSION 2.29.1 LANGUAGES CXX ) +project( eccodes VERSION 2.30.0 LANGUAGES CXX ) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -65,6 +65,11 @@ ecbuild_debug("ECCODES_BIG_ENDIAN=${ECCODES_BIG_ENDIAN}") ecbuild_debug("ECCODES_LITTLE_ENDIAN=${ECCODES_LITTLE_ENDIAN}") ecbuild_info("Operating system=${CMAKE_SYSTEM} (${EC_OS_BITS} bits)") +# Only support 64 bit operating systems +if( NOT EC_OS_BITS EQUAL "64" ) + ecbuild_critical( "Operating system ${CMAKE_SYSTEM} (${EC_OS_BITS} bits) -- ecCodes only supports 64 bit platforms" ) +endif() + ############################################################################### # some variables/options of this project @@ -315,11 +320,6 @@ if( IEEE_LE ) set( IEEE_BE 0 ) endif() -set( ECCODES_ON_LINUX_32BIT 0 ) -if( EC_OS_NAME MATCHES "linux" AND EC_OS_BITS EQUAL "32" ) - set( ECCODES_ON_LINUX_32BIT 1 ) -endif() - set( ECCODES_ON_WINDOWS 0 ) if( EC_OS_NAME MATCHES "windows" ) # Symbols need to be explicitly exported on Windows so we can link to dlls. @@ -430,11 +430,12 @@ add_subdirectory( samples ) add_subdirectory( ifs_samples ) # must come after samples # ecbuild_dont_pack( DIRS samples DONT_PACK_REGEX "*.grib" ) +ecbuild_dont_pack( FILES .cproject .project ) ecbuild_dont_pack( DIRS - experimental deprecated doxygen confluence tests/tests.ecmwf - config m4 examples/F77 src/deprecated tools/deprecated ifs_samples/grib1_mlgrib2_ieee32 - examples/examples.dev examples/extra examples/deprecated bamboo - fortran/fortranCtypes tigge/tools share/eccodes .settings ) + experimental deprecated doxygen confluence tests/deprecated tests/tests.ecmwf + src/deprecated tools/deprecated ifs_samples/grib1_mlgrib2_ieee32 + examples/examples.dev examples/extra examples/deprecated bamboo + fortran/fortranCtypes tigge/tools share/eccodes .settings ) #ecbuild_dont_pack( DIRS data/bufr DONT_PACK_REGEX "*.bufr" ) #ecbuild_dont_pack( DIRS data/tigge DONT_PACK_REGEX "*.grib" ) diff --git a/bamboo/GCC-env.sh b/bamboo/GCC-env.sh index 353a931b9..043bcd488 100644 --- a/bamboo/GCC-env.sh +++ b/bamboo/GCC-env.sh @@ -1,19 +1,19 @@ #!/bin/bash -[[ $(uname) == "Darwin" ]] && return +# [[ $(uname) == "Darwin" ]] && return # initialise module environment if it is not -if [[ ! $(command -v module > /dev/null 2>&1) ]]; then - . /usr/local/apps/module/init/bash -fi +#if [[ ! $(command -v module > /dev/null 2>&1) ]]; then +# . /usr/local/apps/module/init/bash +#fi -module unload grib_api -module unload eccodes -module unload emos -module unload fftw -module unload libemos -module unload metview +#module unload grib_api +#module unload eccodes +#module unload emos +#module unload fftw +#module unload libemos +#module unload metview -module load cmake/3.16.5 -module load aec +#module load cmake/3.16.5 +#module load aec diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 8fed17082..1cd2b1a71 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,4 +1,7 @@ # data/CMakeLists.txt +set(ECBUILD_DOWNLOAD_TIMEOUT 60) +set(ECBUILD_DOWNLOAD_RETRIES 3) + add_subdirectory(tigge) add_subdirectory(bufr) add_subdirectory(metar) diff --git a/data/bufr/CMakeLists.txt b/data/bufr/CMakeLists.txt index 148500ed9..786cf27b5 100644 --- a/data/bufr/CMakeLists.txt +++ b/data/bufr/CMakeLists.txt @@ -12,13 +12,18 @@ file(READ "bufr_ref_files.txt" bufr_refs_to_download) string(REGEX REPLACE "\n" ";" bufr_refs_to_download "${bufr_refs_to_download}") # Exceptional case: download bufr files which have to be treated specially -list(APPEND bufr_refs_to_download "vos308014_v3_26.bufr") # See test ecc-197 +list(APPEND bufr_files_to_download "vos308014_v3_26.bufr") # See test ecc-197 if( ENABLE_EXTRA_TESTS ) ecbuild_get_test_multidata( - TARGET eccodes_download_bufrs - NOCHECK - NAMES ${bufr_files_to_download} ${bufr_refs_to_download} + TARGET eccodes_download_bufrs + NOCHECK + NAMES ${bufr_files_to_download} + ) + ecbuild_get_test_multidata( + TARGET eccodes_download_bufr_refs + NOCHECK + NAMES ${bufr_refs_to_download} ) endif() diff --git a/data/bufr/bufr_ref_files.txt b/data/bufr/bufr_ref_files.txt index c1897eb28..da11a3001 100644 --- a/data/bufr/bufr_ref_files.txt +++ b/data/bufr/bufr_ref_files.txt @@ -262,110 +262,6 @@ synop_multi_subset.bufr.desc.ref aaen_55.bufr.ls.ref syno_multi.bufr.header.ref 207003.bufr.json.ref -new_207003.bufr.ref -new_aaen_55.bufr.ref -new_aben_55.bufr.ref -new_ahws_139.bufr.ref -new_airc_142.bufr.ref -new_airc_144.bufr.ref -new_airs_57.bufr.ref -new_alws_139.bufr.ref -new_amda_144.bufr.ref -new_amsa_55.bufr.ref -new_amsb_55.bufr.ref -new_amse_55.bufr.ref -new_amsu_55.bufr.ref -new_amv2_87.bufr.ref -new_amv3_87.bufr.ref -new_asbh_139.bufr.ref -new_asbl_139.bufr.ref -new_asca_139.bufr.ref -new_asch_139.bufr.ref -new_ascs_139.bufr.ref -new_aseh_139.bufr.ref -new_asel_139.bufr.ref -new_ashs_139.bufr.ref -new_atap_55.bufr.ref -new_ateu_155.bufr.ref -new_atms_201.bufr.ref -new_atov_55.bufr.ref -new_avhm_87.bufr.ref -new_avhn_87.bufr.ref -new_avhr_58.bufr.ref -new_b002_95.bufr.ref -new_b002_96.bufr.ref -new_b003_56.bufr.ref -new_b004_145.bufr.ref -new_b005_87.bufr.ref -new_b006_96.bufr.ref -new_b007_31.bufr.ref -new_bssh_170.bufr.ref -new_bssh_176.bufr.ref -new_bssh_178.bufr.ref -new_bssh_180.bufr.ref -new_btem_109.bufr.ref -new_buoy_27.bufr.ref -new_cmwi_87.bufr.ref -new_cmwn_87.bufr.ref -new_cnow_28.bufr.ref -new_cori_156.bufr.ref -new_crit_202.bufr.ref -new_emsg_87.bufr.ref -new_euwv_87.bufr.ref -new_fy3a_154.bufr.ref -new_fy3b_154.bufr.ref -new_go15_87.bufr.ref -new_goee_87.bufr.ref -new_goes_87.bufr.ref -new_grst_26.bufr.ref -new_gst4_26.bufr.ref -new_hirb_55.bufr.ref -new_hirs_55.bufr.ref -new_ias1_240.bufr.ref -new_iasi_241.bufr.ref -new_itwt_233.bufr.ref -new_j2eo_216.bufr.ref -new_j2nb_216.bufr.ref -new_jaso_214.bufr.ref -new_meta_140.bufr.ref -new_mhen_55.bufr.ref -new_mhsa_55.bufr.ref -new_mhsb_55.bufr.ref -new_mhse_55.bufr.ref -new_modi_87.bufr.ref -new_modw_87.bufr.ref -new_monw_87.bufr.ref -new_mytemp.bufr.ref -new_new.bufr.ref -new_ocea_131.bufr.ref -new_ocea_132.bufr.ref -new_ocea_133.bufr.ref -new_ocea_21.bufr.ref -new_pgps_110.bufr.ref -new_pilo_91.bufr.ref -new_s4kn_165.bufr.ref -new_ship_13.bufr.ref -new_ship_19.bufr.ref -new_ship_9.bufr.ref -new_smin_49.bufr.ref -new_smis_49.bufr.ref -new_smiu_49.bufr.ref -new_smos_203.bufr.ref -new_sn4k_165.bufr.ref -new_soil_7.bufr.ref -new_ssbt_127.bufr.ref -new_stuk_7.bufr.ref -new_syno_1.bufr.ref -new_syno_3.bufr.ref -new_syno_4.bufr.ref -new_syno_multi.bufr.ref -new_synop_multi_subset.bufr.ref -new_temp_101.bufr.ref -new_temp_102.bufr.ref -new_temp_106.bufr.ref -new_tmr7_129.bufr.ref -new_tros_31.bufr.ref -new_wavb_134.bufr.ref 311001.bufr.ref uegabe.bufr.num.ref syno.bufr.out.ref diff --git a/definitions/add_params_from_tsv.pl b/definitions/add_params_from_tsv.pl index e13b7b86e..6aa471bd4 100755 --- a/definitions/add_params_from_tsv.pl +++ b/definitions/add_params_from_tsv.pl @@ -105,38 +105,65 @@ my $lcount = 0; if ($SANITY_CHECK) { my %map_sn = (); # map of shortNames my %map_pid = (); # map of paramIds + my $sanity_error_count = 0; print "Checking sanity: uniqueness of paramId and shortName keys ...\n"; while (<>) { chomp; + $lcount++; s/\r//g; # Remove DOS carriage returns if ($first == 1) { $first = 0; next; } - $lcount++; + ($paramId, $shortName, $name, $units) = split(/\t/); - die "Error: shortName=$shortName is duplicated (line ", $lcount+1, ")\n" if (exists $map_sn{$shortName}); + die "Error: shortName=$shortName is duplicated (line $lcount)\n" if (exists $map_sn{$shortName}); $map_sn{$shortName}++; # increment count in shortName map - die "Error: paramId=$paramId is duplicated (line ", $lcount+1, ")\n" if (exists $map_pid{$paramId}); + die "Error: paramId=$paramId is duplicated (line $lcount)\n" if (exists $map_pid{$paramId}); $map_pid{$paramId}++; # increment count in paramId map - die "Error: paramId=$paramId is not an integer (line ", $lcount+1, ")\n" if (!is_integer($paramId)); + if (!is_integer($paramId)) { + warn "Error: paramId=$paramId is not an integer (line $lcount)\n"; + $sanity_error_count++; + } my $x = $dbh->selectrow_array("select * from param.param where id = ?",undef,$paramId); - die "Error: paramId=$x exists in the database (line ", $lcount+1, ")\n" if (defined $x); + if (defined $x) { + warn "Error: paramId=$x exists in the database (line $lcount)\n"; + $sanity_error_count++; + } - die "Error: Name '$name': ends in space" if ($name =~ / $/); - die "Error: Name '$name': starts with space" if ($name =~ /^ /); - - # Will die if it fails - get_db_units_code($units); + if ($name =~ / $/) { + warn "Error: Name '$name': ends in space" ; + $sanity_error_count++; + } + if ($name =~ /^ /) { + warn "Error: Name '$name': starts with space" ; + $sanity_error_count++; + } + if ($name !~ /^[A-Z0-9]/) { + warn "Error: name \"$name\" should have uppercase 1st letter or digit (line $lcount)\n"; + $sanity_error_count++; + } $x = $dbh->selectrow_array("select shortName from param.param where shortName = ?",undef,$shortName); - die "Error: shortName=$x exists in the database (line ", $lcount+1, ")\n" if (defined $x); + if (defined $x) { + warn "Error: shortName=$x exists in the database (line $lcount)\n"; + $sanity_error_count++; + } + + if (!check_units($units)) { + warn "Error: Database does not contain units=$units (line $lcount)\n"; + $sanity_error_count++; + } + } + if ($sanity_error_count == 0) { + print "\nSanity checking completed. $lcount rows checked. No errors.\n"; + } else { + die "\nSanity checking FAILED. $lcount rows checked. $sanity_error_count error(s).\n"; } - print "\nSanity checking completed. $lcount rows checked. No errors.\nExiting.\n"; exit 0; } @@ -298,6 +325,13 @@ sub centre_as_str { return "ECMWF" if ($cc eq $centre_ecmwf); return "Unknown"; } +sub check_units { + my $u = shift; + my $unit_id = $dbh->selectrow_array("select id from units where name = ?",undef,$u); + return 0 if (!$unit_id); + return 1; +} + sub get_db_units_code { my $u = shift; my $unit_id = $dbh->selectrow_array("select id from units where name = ?",undef,$u); diff --git a/definitions/dummy.am b/definitions/dummy.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/definitions/grib1/section.1.def b/definitions/grib1/section.1.def index 25829af6c..7604b56df 100644 --- a/definitions/grib1/section.1.def +++ b/definitions/grib1/section.1.def @@ -137,8 +137,6 @@ codetable[1] timeRangeIndicator ('5.table',tablesLocalDir,tablesMasterDir) = 1 : unsigned[2] numberIncludedInAverage; -meta mybits bits(numberIncludedInAverage,0,12); - unsigned[1] numberMissingFromAveragesOrAccumulations; unsigned[1] centuryOfReferenceTimeOfData; diff --git a/definitions/grib2/cfName.def b/definitions/grib2/cfName.def index 7055d11f9..4a3e6b60b 100644 --- a/definitions/grib2/cfName.def +++ b/definitions/grib2/cfName.def @@ -190,6 +190,18 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Heat flux correction +'heat_flux_correction' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Eastward sea water velocity 'eastward_sea_water_velocity' = { discipline = 10 ; diff --git a/definitions/grib2/cfVarName.def b/definitions/grib2/cfVarName.def index 27aedbe25..bb993680a 100644 --- a/definitions/grib2/cfVarName.def +++ b/definitions/grib2/cfVarName.def @@ -2453,6 +2453,33 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Potential evaporation rate +'pevr' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + } +#Potential evaporation +'peva' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Tile fraction +'tifr' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 36 ; + } +#Tile percentage +'tipe' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 37 ; + } #Mean temperature tendency due to short-wave radiation 'mttswr' = { discipline = 0 ; @@ -3633,6 +3660,162 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Sea ice volume per unit area +'sivol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow volume over sea ice per unit area +'snvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature +'sitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow temperature over sea ice +'sntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature at the sea ice and snow interface +'sisntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Underside ice temperature +'usitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice heat content +'sihc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow heat content over sea ice +'snhc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice freeboard thickness +'sifbr' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + } +#Sea ice melt pond fraction +'sipf' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond depth +'sipd' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond volume per unit area +'sipvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice fraction tendency due to parameterization +'bckinsic' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea surface salinity 'sos' = { discipline = 10 ; @@ -3981,6 +4164,174 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Bottom pressure equivalent height +'btp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Net surface upward water flux +'swfup' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux into sea water (from rivers) +'fw2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux into sea water +'vsf2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat flux correction +'hfcorr' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux correction +'fwcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux correction +'vsfcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Turbocline depth (kz=5e-4) +'turbocl' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Y-component of surface sea water velocity +'svy' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#X-component of surface sea water velocity +'svx' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward surface sea water velocity +'svn' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward surface sea water velocity +'sve' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat Content surface to 26C isotherm +'hct26' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + } +#Sea surface height tendency due to parameterization +'bckineta' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea water practical salinity 'so' = { discipline = 10 ; @@ -4045,6 +4396,190 @@ typeOfFirstFixedSurface = 168 ; typeOfSecondFixedSurface = 168 ; } +#Sea water potential temperature tendency due to newtonian relaxation +'thetaodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to newtonian relaxation +'sodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to parameterization +'bckint' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to parameterization +'bckins' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Eastward sea water velocity tendency due to parameterization +'bckine' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Northward sea water velocity tendency due to parameterization +'bckinn' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to direct bias correction +'tdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to direct bias correction +'sdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Net short wave radiation rate at sea surface +'ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind stress at 10m above sea surface +'wst10_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind speed at 10m above sea surface +'ws10_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Neutral drag coefficient at 10m above sea surface +'nd10_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Total precipitation rate at sea surface +'tprate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow precipitation rate at sea surface +'snrate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward of wind stress over sea ice +'ewst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward of wind stress over sea ice +'nwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#U-component of wind stress over sea ice +'uwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#V-component of wind stress over sea ice +'vwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Time-mean sea ice thickness 'avg_sithick' = { discipline = 10 ; @@ -4136,6 +4671,175 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea ice volume per unit area +'avg_sivol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow volume over sea ice per unit area +'avg_snvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature +'avg_sitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow temperature over sea ice +'avg_sntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature at the sea ice and snow interface +'avg_sisntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean underside ice temperature +'avg_usitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice heat content +'avg_sihc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow heat content over sea ice +'avg_snhc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice freeboard thickness +'avg_sifbr' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond fraction +'avg_sipf' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond depth +'avg_sipd' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond volume per unit area +'avg_sipvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice fraction tendency due to parameterization +'avg_bckinsic' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea surface salinity 'avg_sos' = { discipline = 10 ; @@ -4513,6 +5217,188 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean bottom pressure equivalent height +'avg_btp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net surface upward water flux +'avg_swfup' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux into sea water (from rivers) +'avg_fw2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux into sea water +'avg_vsf2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat flux correction +'avg_hfcorr' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux correction +'avg_fwcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux correction +'avg_vsfcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean turbocline depth (kz=5e-4) +'avg_turbocl' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean Y-component of surface sea water velocity +'avg_svy' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean X-component of surface sea water velocity +'avg_svx' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward surface sea water velocity +'avg_svn' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward surface sea water velocity +'avg_sve' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat content surface to 26C isotherm +'avg_hct26' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea surface height tendency due to parameterization +'avg_bckineta' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea water practical salinity 'avg_so' = { discipline = 10 ; @@ -4585,6 +5471,247 @@ typeOfSecondFixedSurface = 168 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea water potential temperature tendency due to newtonian relaxation +'avg_thetaodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to newtonian relaxation +'avg_sodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to parameterization +'avg_bckint' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to parameterization +'avg_bckins' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward sea water velocity tendency due to parameterization +'avg_bckine' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward sea water velocity tendency due to parameterization +'avg_bckinn' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to direct bias correction +'avg_tdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to direct bias correction +'avg_sdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net short wave radiation rate at sea surface +'avg_ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind stress at 10m above sea surface +'avg_10wst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind speed at 10m above sea surface +'avg_10ws_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean neutral drag coefficient at 10m above sea surface +'avg_10nd_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total precipitation rate at sea surface +'avg_tprate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow precipitation rate at sea surface +'avg_snrate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward of wind stress over sea ice +'avg_ewst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward of wind stress over sea ice +'avg_nwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean U-component of wind stress over sea ice +'avg_uwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean V-component of wind stress over sea ice +'avg_vwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-accumulated net short wave radiation at sea surface +'acc_ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated total precipitation at sea surface +'tp_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated snow precipitation at sea surface +'sn_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } #Virtual temperature 'vtmp' = { discipline = 0 ; @@ -5572,12 +6699,6 @@ parameterCategory = 1 ; parameterNumber = 40 ; } -#Potential evaporation rate -'pevpr' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 41 ; - } #Snow cover 'snowc' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/ecmf/cfVarName.def b/definitions/grib2/localConcepts/ecmf/cfVarName.def index 5a6667f58..ba0d2e0fa 100644 --- a/definitions/grib2/localConcepts/ecmf/cfVarName.def +++ b/definitions/grib2/localConcepts/ecmf/cfVarName.def @@ -17069,12 +17069,6 @@ parameterCategory = 151 ; parameterNumber = 148 ; } -#Bottom Pressure (equivalent height) -'btp' = { - discipline = 192 ; - parameterCategory = 151 ; - parameterNumber = 149 ; - } #Steric height 'sh' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/ecmf/name.def b/definitions/grib2/localConcepts/ecmf/name.def index bb408666d..31e0b0252 100644 --- a/definitions/grib2/localConcepts/ecmf/name.def +++ b/definitions/grib2/localConcepts/ecmf/name.def @@ -17069,12 +17069,6 @@ parameterCategory = 151 ; parameterNumber = 148 ; } -#Bottom Pressure (equivalent height) -'Bottom Pressure (equivalent height)' = { - discipline = 192 ; - parameterCategory = 151 ; - parameterNumber = 149 ; - } #Steric height 'Steric height' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/ecmf/paramId.def b/definitions/grib2/localConcepts/ecmf/paramId.def index 43d93d582..c8e69dd65 100644 --- a/definitions/grib2/localConcepts/ecmf/paramId.def +++ b/definitions/grib2/localConcepts/ecmf/paramId.def @@ -17069,12 +17069,6 @@ parameterCategory = 151 ; parameterNumber = 148 ; } -#Bottom Pressure (equivalent height) -'151149' = { - discipline = 192 ; - parameterCategory = 151 ; - parameterNumber = 149 ; - } #Steric height '151150' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/ecmf/shortName.def b/definitions/grib2/localConcepts/ecmf/shortName.def index 917c0fb33..95612eac9 100644 --- a/definitions/grib2/localConcepts/ecmf/shortName.def +++ b/definitions/grib2/localConcepts/ecmf/shortName.def @@ -17069,12 +17069,6 @@ parameterCategory = 151 ; parameterNumber = 148 ; } -#Bottom Pressure (equivalent height) -'btp' = { - discipline = 192 ; - parameterCategory = 151 ; - parameterNumber = 149 ; - } #Steric height 'sh' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/ecmf/units.def b/definitions/grib2/localConcepts/ecmf/units.def index 9483b29c3..f4c9645c4 100644 --- a/definitions/grib2/localConcepts/ecmf/units.def +++ b/definitions/grib2/localConcepts/ecmf/units.def @@ -17069,12 +17069,6 @@ parameterCategory = 151 ; parameterNumber = 148 ; } -#Bottom Pressure (equivalent height) -'m' = { - discipline = 192 ; - parameterCategory = 151 ; - parameterNumber = 149 ; - } #Steric height 'm' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/kwbc/name.def b/definitions/grib2/localConcepts/kwbc/name.def index b3bd218b1..3afad81b8 100644 --- a/definitions/grib2/localConcepts/kwbc/name.def +++ b/definitions/grib2/localConcepts/kwbc/name.def @@ -65,12 +65,6 @@ parameterCategory = 1 ; parameterNumber = 199 ; } -#Potential evaporation rate -'Potential evaporation rate' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 200 ; - } #Snow cover 'Snow cover' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/kwbc/paramId.def b/definitions/grib2/localConcepts/kwbc/paramId.def index 485f8288f..02115d105 100644 --- a/definitions/grib2/localConcepts/kwbc/paramId.def +++ b/definitions/grib2/localConcepts/kwbc/paramId.def @@ -65,12 +65,6 @@ parameterCategory = 1 ; parameterNumber = 199 ; } -#Potential evaporation rate -'260037' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 200 ; - } #Snow cover '260038' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/kwbc/shortName.def b/definitions/grib2/localConcepts/kwbc/shortName.def index 833599f6d..5e9f0732c 100644 --- a/definitions/grib2/localConcepts/kwbc/shortName.def +++ b/definitions/grib2/localConcepts/kwbc/shortName.def @@ -65,12 +65,6 @@ parameterCategory = 1 ; parameterNumber = 199 ; } -#Potential evaporation rate -'pevpr' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 200 ; - } #Snow cover 'snowc' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/kwbc/units.def b/definitions/grib2/localConcepts/kwbc/units.def index 149cb6c3f..e322ed2ad 100644 --- a/definitions/grib2/localConcepts/kwbc/units.def +++ b/definitions/grib2/localConcepts/kwbc/units.def @@ -65,12 +65,6 @@ parameterCategory = 1 ; parameterNumber = 199 ; } -#Potential evaporation rate -'W m**-2' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 200 ; - } #Snow cover '%' = { discipline = 0 ; diff --git a/definitions/grib2/marsLevtypeConcept.def b/definitions/grib2/marsLevtypeConcept.def index dd5ed5945..e72a2d701 100644 --- a/definitions/grib2/marsLevtypeConcept.def +++ b/definitions/grib2/marsLevtypeConcept.def @@ -36,6 +36,8 @@ scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;} 'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;} 'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=9;} +'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=20; + scaledValueOfFirstFixedSurface=0; scaleFactorOfFirstFixedSurface=0;} 'sfc' = {typeOfFirstFixedSurface=162; typeOfSecondFixedSurface=255;} 'sfc' = {typeOfFirstFixedSurface=166; typeOfSecondFixedSurface=255;} 'o3d' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=255;} @@ -49,7 +51,11 @@ 'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255; discipline=1;} 'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=255;} 'o2d' = {typeOfFirstFixedSurface=176; typeOfSecondFixedSurface=255;} +'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=160; + scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=0;} 'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176;} 'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176; discipline=1;} 'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=176;} 'sfc' = {typeOfFirstFixedSurface=177; typeOfSecondFixedSurface=255;} +'o2d' = {typeOfFirstFixedSurface=188; typeOfSecondFixedSurface=189;} + diff --git a/definitions/grib2/name.def b/definitions/grib2/name.def index 52dc0489c..3c6d23577 100644 --- a/definitions/grib2/name.def +++ b/definitions/grib2/name.def @@ -2453,6 +2453,33 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Potential evaporation rate +'Potential evaporation rate' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + } +#Potential evaporation +'Potential evaporation' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Tile fraction +'Tile fraction' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 36 ; + } +#Tile percentage +'Tile percentage' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 37 ; + } #Mean temperature tendency due to short-wave radiation 'Mean temperature tendency due to short-wave radiation' = { discipline = 0 ; @@ -3633,6 +3660,162 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Sea ice volume per unit area +'Sea ice volume per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow volume over sea ice per unit area +'Snow volume over sea ice per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature +'Sea ice temperature' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow temperature over sea ice +'Snow temperature over sea ice' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature at the sea ice and snow interface +'Sea ice temperature at the sea ice and snow interface' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Underside ice temperature +'Underside ice temperature' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice heat content +'Sea ice heat content' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow heat content over sea ice +'Snow heat content over sea ice' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice freeboard thickness +'Sea ice freeboard thickness' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + } +#Sea ice melt pond fraction +'Sea ice melt pond fraction' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond depth +'Sea ice melt pond depth' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond volume per unit area +'Sea ice melt pond volume per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice fraction tendency due to parameterization +'Sea ice fraction tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea surface salinity 'Sea surface salinity' = { discipline = 10 ; @@ -3981,6 +4164,174 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Bottom pressure equivalent height +'Bottom pressure equivalent height' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Net surface upward water flux +'Net surface upward water flux' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux into sea water (from rivers) +'Fresh water flux into sea water (from rivers)' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux into sea water +'Virtual salt flux into sea water' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat flux correction +'Heat flux correction' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux correction +'Fresh water flux correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux correction +'Virtual salt flux correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Turbocline depth (kz=5e-4) +'Turbocline depth (kz=5e-4)' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Y-component of surface sea water velocity +'Y-component of surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#X-component of surface sea water velocity +'X-component of surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward surface sea water velocity +'Northward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward surface sea water velocity +'Eastward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat Content surface to 26C isotherm +'Heat Content surface to 26C isotherm' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + } +#Sea surface height tendency due to parameterization +'Sea surface height tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea water practical salinity 'Sea water practical salinity' = { discipline = 10 ; @@ -4045,6 +4396,190 @@ typeOfFirstFixedSurface = 168 ; typeOfSecondFixedSurface = 168 ; } +#Sea water potential temperature tendency due to newtonian relaxation +'Sea water potential temperature tendency due to newtonian relaxation' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to newtonian relaxation +'Sea water salinity tendency due to newtonian relaxation' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to parameterization +'Sea water temperature tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to parameterization +'Sea water salinity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Eastward sea water velocity tendency due to parameterization +'Eastward sea water velocity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Northward sea water velocity tendency due to parameterization +'Northward sea water velocity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to direct bias correction +'Sea water temperature tendency due to direct bias correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to direct bias correction +'Sea water salinity tendency due to direct bias correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Net short wave radiation rate at sea surface +'Net short wave radiation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind stress at 10m above sea surface +'Wind stress at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind speed at 10m above sea surface +'Wind speed at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Neutral drag coefficient at 10m above sea surface +'Neutral drag coefficient at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Total precipitation rate at sea surface +'Total precipitation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow precipitation rate at sea surface +'Snow precipitation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward of wind stress over sea ice +'Eastward of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward of wind stress over sea ice +'Northward of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#U-component of wind stress over sea ice +'U-component of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#V-component of wind stress over sea ice +'V-component of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Time-mean sea ice thickness 'Time-mean sea ice thickness' = { discipline = 10 ; @@ -4136,6 +4671,175 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea ice volume per unit area +'Time-mean sea ice volume per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow volume over sea ice per unit area +'Time-mean snow volume over sea ice per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature +'Time-mean sea ice temperature' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow temperature over sea ice +'Time-mean snow temperature over sea ice' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature at the sea ice and snow interface +'Time-mean sea ice temperature at the sea ice and snow interface' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean underside ice temperature +'Time-mean underside ice temperature' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice heat content +'Time-mean sea ice heat content' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow heat content over sea ice +'Time-mean snow heat content over sea ice' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice freeboard thickness +'Time-mean sea ice freeboard thickness' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond fraction +'Time-mean sea ice melt pond fraction' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond depth +'Time-mean sea ice melt pond depth' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond volume per unit area +'Time-mean sea ice melt pond volume per unit area' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice fraction tendency due to parameterization +'Time-mean sea ice fraction tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea surface salinity 'Time-mean sea surface salinity' = { discipline = 10 ; @@ -4513,6 +5217,188 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean bottom pressure equivalent height +'Time-mean bottom pressure equivalent height' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net surface upward water flux +'Time-mean net surface upward water flux' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux into sea water (from rivers) +'Time-mean fresh water flux into sea water (from rivers)' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux into sea water +'Time-mean virtual salt flux into sea water' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat flux correction +'Time-mean heat flux correction' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux correction +'Time-mean fresh water flux correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux correction +'Time-mean virtual salt flux correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean turbocline depth (kz=5e-4) +'Time-mean turbocline depth (kz=5e-4)' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean Y-component of surface sea water velocity +'Time-mean Y-component of surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean X-component of surface sea water velocity +'Time-mean X-component of surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward surface sea water velocity +'Time-mean northward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward surface sea water velocity +'Time-mean eastward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat content surface to 26C isotherm +'Time-mean heat content surface to 26C isotherm' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea surface height tendency due to parameterization +'Time-mean sea surface height tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea water practical salinity 'Time-mean sea water practical salinity' = { discipline = 10 ; @@ -4585,6 +5471,247 @@ typeOfSecondFixedSurface = 168 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea water potential temperature tendency due to newtonian relaxation +'Time-mean sea water potential temperature tendency due to newtonian relaxation' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to newtonian relaxation +'Time-mean sea water salinity tendency due to newtonian relaxation' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to parameterization +'Time-mean sea water temperature tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to parameterization +'Time-mean sea water salinity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward sea water velocity tendency due to parameterization +'Time-mean eastward sea water velocity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward sea water velocity tendency due to parameterization +'Time-mean northward sea water velocity tendency due to parameterization' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to direct bias correction +'Time-mean sea water temperature tendency due to direct bias correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to direct bias correction +'Time-mean sea water salinity tendency due to direct bias correction' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net short wave radiation rate at sea surface +'Time-mean net short wave radiation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind stress at 10m above sea surface +'Time-mean wind stress at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind speed at 10m above sea surface +'Time-mean wind speed at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean neutral drag coefficient at 10m above sea surface +'Time-mean neutral drag coefficient at 10m above sea surface' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total precipitation rate at sea surface +'Time-mean total precipitation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow precipitation rate at sea surface +'Time-mean snow precipitation rate at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward of wind stress over sea ice +'Time-mean eastward of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward of wind stress over sea ice +'Time-mean northward of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean U-component of wind stress over sea ice +'Time-mean U-component of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean V-component of wind stress over sea ice +'Time-mean V-component of wind stress over sea ice' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-accumulated net short wave radiation at sea surface +'Time-accumulated net short wave radiation at sea surface' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated total precipitation at sea surface +'Time-accumulated total precipitation at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated snow precipitation at sea surface +'Time-accumulated snow precipitation at sea surface' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } #Virtual temperature 'Virtual temperature' = { discipline = 0 ; @@ -5572,12 +6699,6 @@ parameterCategory = 1 ; parameterNumber = 40 ; } -#Potential evaporation rate -'Potential evaporation rate' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 41 ; - } #Snow cover 'Snow cover' = { discipline = 0 ; diff --git a/definitions/grib2/paramId.def b/definitions/grib2/paramId.def index 6eeb64341..6965f3ad0 100644 --- a/definitions/grib2/paramId.def +++ b/definitions/grib2/paramId.def @@ -2453,6 +2453,33 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Potential evaporation rate +'231004' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + } +#Potential evaporation +'231005' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Tile fraction +'231006' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 36 ; + } +#Tile percentage +'231007' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 37 ; + } #Mean temperature tendency due to short-wave radiation '235001' = { discipline = 0 ; @@ -3633,6 +3660,162 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Sea ice volume per unit area +'262008' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow volume over sea ice per unit area +'262009' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature +'262010' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow temperature over sea ice +'262011' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature at the sea ice and snow interface +'262012' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Underside ice temperature +'262013' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice heat content +'262014' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow heat content over sea ice +'262015' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice freeboard thickness +'262016' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + } +#Sea ice melt pond fraction +'262017' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond depth +'262018' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond volume per unit area +'262019' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice fraction tendency due to parameterization +'262020' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea surface salinity '262100' = { discipline = 10 ; @@ -3981,6 +4164,174 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Bottom pressure equivalent height +'262129' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Net surface upward water flux +'262130' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux into sea water (from rivers) +'262131' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux into sea water +'262132' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat flux correction +'262133' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux correction +'262134' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux correction +'262135' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Turbocline depth (kz=5e-4) +'262136' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Y-component of surface sea water velocity +'262137' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#X-component of surface sea water velocity +'262138' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward surface sea water velocity +'262139' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward surface sea water velocity +'262140' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat Content surface to 26C isotherm +'262141' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + } +#Sea surface height tendency due to parameterization +'262142' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea water practical salinity '262500' = { discipline = 10 ; @@ -4045,6 +4396,190 @@ typeOfFirstFixedSurface = 168 ; typeOfSecondFixedSurface = 168 ; } +#Sea water potential temperature tendency due to newtonian relaxation +'262508' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to newtonian relaxation +'262509' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to parameterization +'262510' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to parameterization +'262511' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Eastward sea water velocity tendency due to parameterization +'262512' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Northward sea water velocity tendency due to parameterization +'262513' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to direct bias correction +'262514' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to direct bias correction +'262515' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Net short wave radiation rate at sea surface +'262900' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind stress at 10m above sea surface +'262901' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind speed at 10m above sea surface +'262902' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Neutral drag coefficient at 10m above sea surface +'262903' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Total precipitation rate at sea surface +'262904' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow precipitation rate at sea surface +'262905' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward of wind stress over sea ice +'262906' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward of wind stress over sea ice +'262907' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#U-component of wind stress over sea ice +'262908' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#V-component of wind stress over sea ice +'262909' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Time-mean sea ice thickness '263000' = { discipline = 10 ; @@ -4136,6 +4671,175 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea ice volume per unit area +'263008' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow volume over sea ice per unit area +'263009' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature +'263010' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow temperature over sea ice +'263011' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature at the sea ice and snow interface +'263012' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean underside ice temperature +'263013' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice heat content +'263014' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow heat content over sea ice +'263015' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice freeboard thickness +'263016' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond fraction +'263017' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond depth +'263018' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond volume per unit area +'263019' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice fraction tendency due to parameterization +'263020' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea surface salinity '263100' = { discipline = 10 ; @@ -4513,6 +5217,188 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean bottom pressure equivalent height +'263129' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net surface upward water flux +'263130' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux into sea water (from rivers) +'263131' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux into sea water +'263132' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat flux correction +'263133' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux correction +'263134' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux correction +'263135' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean turbocline depth (kz=5e-4) +'263136' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean Y-component of surface sea water velocity +'263137' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean X-component of surface sea water velocity +'263138' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward surface sea water velocity +'263139' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward surface sea water velocity +'263140' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat content surface to 26C isotherm +'263141' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea surface height tendency due to parameterization +'263142' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea water practical salinity '263500' = { discipline = 10 ; @@ -4585,6 +5471,247 @@ typeOfSecondFixedSurface = 168 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea water potential temperature tendency due to newtonian relaxation +'263508' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to newtonian relaxation +'263509' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to parameterization +'263510' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to parameterization +'263511' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward sea water velocity tendency due to parameterization +'263512' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward sea water velocity tendency due to parameterization +'263513' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to direct bias correction +'263514' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to direct bias correction +'263515' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net short wave radiation rate at sea surface +'263900' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind stress at 10m above sea surface +'263901' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind speed at 10m above sea surface +'263902' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean neutral drag coefficient at 10m above sea surface +'263903' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total precipitation rate at sea surface +'263904' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow precipitation rate at sea surface +'263905' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward of wind stress over sea ice +'263906' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward of wind stress over sea ice +'263907' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean U-component of wind stress over sea ice +'263908' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean V-component of wind stress over sea ice +'263909' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-accumulated net short wave radiation at sea surface +'264900' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated total precipitation at sea surface +'264904' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated snow precipitation at sea surface +'264905' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } #Virtual temperature '300012' = { discipline = 0 ; @@ -5572,12 +6699,6 @@ parameterCategory = 1 ; parameterNumber = 40 ; } -#Potential evaporation rate -'260037' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 41 ; - } #Snow cover '260038' = { discipline = 0 ; diff --git a/definitions/grib2/section.5.def b/definitions/grib2/section.5.def index 3c6c80642..49980cdbe 100644 --- a/definitions/grib2/section.5.def +++ b/definitions/grib2/section.5.def @@ -48,6 +48,7 @@ concept packingType (unknown) { "spectral_ieee" = { dataRepresentationTemplateNumber = 50000; } "grid_simple_log_preprocessing" = { dataRepresentationTemplateNumber = 61; } "bifourier_complex" = { dataRepresentationTemplateNumber = 53; spectralType=2; } + "grid_run_length" = { dataRepresentationTemplateNumber = 200; } } : dump; template dataRepresentation "grib2/template.5.[dataRepresentationTemplateNumber:l].def"; diff --git a/definitions/grib2/section.6.def b/definitions/grib2/section.6.def index b01be8b5b..5de24c487 100644 --- a/definitions/grib2/section.6.def +++ b/definitions/grib2/section.6.def @@ -50,6 +50,10 @@ if (bitMapIndicator == 255) if (dataRepresentationTemplateNumber == 2 || dataRepresentationTemplateNumber == 3) { transient missingValuesPresent = (missingValueManagementUsed != 0) : read_only; } + if (dataRepresentationTemplateNumber == 200) { + # This template can have undefined values within its Data Section + transient missingValuesPresent = 1; + } } meta md5Section6 md5(offsetSection6,section6Length); diff --git a/definitions/grib2/shortName.def b/definitions/grib2/shortName.def index cd5a31566..de493f2fe 100644 --- a/definitions/grib2/shortName.def +++ b/definitions/grib2/shortName.def @@ -2453,6 +2453,33 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Potential evaporation rate +'pevr' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + } +#Potential evaporation +'peva' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Tile fraction +'tifr' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 36 ; + } +#Tile percentage +'tipe' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 37 ; + } #Mean temperature tendency due to short-wave radiation 'mttswr' = { discipline = 0 ; @@ -3633,6 +3660,162 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Sea ice volume per unit area +'sivol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow volume over sea ice per unit area +'snvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature +'sitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow temperature over sea ice +'sntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature at the sea ice and snow interface +'sisntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Underside ice temperature +'usitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice heat content +'sihc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow heat content over sea ice +'snhc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice freeboard thickness +'sifbr' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + } +#Sea ice melt pond fraction +'sipf' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond depth +'sipd' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond volume per unit area +'sipvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice fraction tendency due to parameterization +'bckinsic' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea surface salinity 'sos' = { discipline = 10 ; @@ -3981,6 +4164,174 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Bottom pressure equivalent height +'btp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Net surface upward water flux +'swfup' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux into sea water (from rivers) +'fw2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux into sea water +'vsf2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat flux correction +'hfcorr' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux correction +'fwcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux correction +'vsfcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Turbocline depth (kz=5e-4) +'turbocl' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Y-component of surface sea water velocity +'svy' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#X-component of surface sea water velocity +'svx' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward surface sea water velocity +'svn' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward surface sea water velocity +'sve' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat Content surface to 26C isotherm +'hct26' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + } +#Sea surface height tendency due to parameterization +'bckineta' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea water practical salinity 'so' = { discipline = 10 ; @@ -4045,6 +4396,190 @@ typeOfFirstFixedSurface = 168 ; typeOfSecondFixedSurface = 168 ; } +#Sea water potential temperature tendency due to newtonian relaxation +'thetaodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to newtonian relaxation +'sodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to parameterization +'bckint' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to parameterization +'bckins' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Eastward sea water velocity tendency due to parameterization +'bckine' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Northward sea water velocity tendency due to parameterization +'bckinn' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to direct bias correction +'tdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to direct bias correction +'sdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Net short wave radiation rate at sea surface +'ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind stress at 10m above sea surface +'10wst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind speed at 10m above sea surface +'10ws_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Neutral drag coefficient at 10m above sea surface +'10nd_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Total precipitation rate at sea surface +'tprate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow precipitation rate at sea surface +'snrate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward of wind stress over sea ice +'ewst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward of wind stress over sea ice +'nwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#U-component of wind stress over sea ice +'uwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#V-component of wind stress over sea ice +'vwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Time-mean sea ice thickness 'avg_sithick' = { discipline = 10 ; @@ -4136,6 +4671,175 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea ice volume per unit area +'avg_sivol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow volume over sea ice per unit area +'avg_snvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature +'avg_sitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow temperature over sea ice +'avg_sntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature at the sea ice and snow interface +'avg_sisntemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean underside ice temperature +'avg_usitemp' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice heat content +'avg_sihc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow heat content over sea ice +'avg_snhc' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice freeboard thickness +'avg_sifbr' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond fraction +'avg_sipf' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond depth +'avg_sipd' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond volume per unit area +'avg_sipvol' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice fraction tendency due to parameterization +'avg_bckinsic' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea surface salinity 'avg_sos' = { discipline = 10 ; @@ -4513,6 +5217,188 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean bottom pressure equivalent height +'avg_btp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net surface upward water flux +'avg_swfup' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux into sea water (from rivers) +'avg_fw2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux into sea water +'avg_vsf2sw' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat flux correction +'avg_hfcorr' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux correction +'avg_fwcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux correction +'avg_vsfcorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean turbocline depth (kz=5e-4) +'avg_turbocl' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean Y-component of surface sea water velocity +'avg_svy' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean X-component of surface sea water velocity +'avg_svx' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward surface sea water velocity +'avg_svn' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward surface sea water velocity +'avg_sve' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat content surface to 26C isotherm +'avg_hct26' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea surface height tendency due to parameterization +'avg_bckineta' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea water practical salinity 'avg_so' = { discipline = 10 ; @@ -4585,6 +5471,247 @@ typeOfSecondFixedSurface = 168 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea water potential temperature tendency due to newtonian relaxation +'avg_thetaodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to newtonian relaxation +'avg_sodmp' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to parameterization +'avg_bckint' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to parameterization +'avg_bckins' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward sea water velocity tendency due to parameterization +'avg_bckine' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward sea water velocity tendency due to parameterization +'avg_bckinn' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to direct bias correction +'avg_tdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to direct bias correction +'avg_sdbiascorr' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net short wave radiation rate at sea surface +'avg_ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind stress at 10m above sea surface +'avg_10wst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind speed at 10m above sea surface +'avg_10ws_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean neutral drag coefficient at 10m above sea surface +'avg_10nd_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total precipitation rate at sea surface +'avg_tprate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow precipitation rate at sea surface +'avg_snrate_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward of wind stress over sea ice +'avg_ewst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward of wind stress over sea ice +'avg_nwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean U-component of wind stress over sea ice +'avg_uwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean V-component of wind stress over sea ice +'avg_vwst_sea' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-accumulated net short wave radiation at sea surface +'acc_ssr_sea' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated total precipitation at sea surface +'tp_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated snow precipitation at sea surface +'sn_sea' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } #Virtual temperature 'vtmp' = { discipline = 0 ; @@ -5572,12 +6699,6 @@ parameterCategory = 1 ; parameterNumber = 40 ; } -#Potential evaporation rate -'pevpr' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 41 ; - } #Snow cover 'snowc' = { discipline = 0 ; diff --git a/definitions/grib2/template.4.108.def b/definitions/grib2/template.4.108.def new file mode 100644 index 000000000..df4ad830b --- /dev/null +++ b/definitions/grib2/template.4.108.def @@ -0,0 +1,10 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.108, Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical properties + +include "grib2/template.4.parameter.def" +include "grib2/template.4.optical.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" diff --git a/definitions/grib2/template.4.109.def b/definitions/grib2/template.4.109.def new file mode 100644 index 000000000..ba75dadd6 --- /dev/null +++ b/definitions/grib2/template.4.109.def @@ -0,0 +1,11 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.109, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for generic optical properties + +include "grib2/template.4.parameter.def" +include "grib2/template.4.optical.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.eps.def" diff --git a/definitions/grib2/template.4.110.def b/definitions/grib2/template.4.110.def new file mode 100644 index 000000000..4a148ccb7 --- /dev/null +++ b/definitions/grib2/template.4.110.def @@ -0,0 +1,10 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.110 - Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical properties + +include "grib2/template.4.parameter.def" +include "grib2/template.4.optical.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.111.def b/definitions/grib2/template.4.111.def new file mode 100644 index 000000000..f2a63683b --- /dev/null +++ b/definitions/grib2/template.4.111.def @@ -0,0 +1,11 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.111, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical properties + +include "grib2/template.4.parameter.def" +include "grib2/template.4.optical.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.eps.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.62.def b/definitions/grib2/template.4.62.def new file mode 100644 index 000000000..53da724c4 --- /dev/null +++ b/definitions/grib2/template.4.62.def @@ -0,0 +1,10 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.62, Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time + +include "grib2/template.4.parameter.def" +include "grib2/template.4.tile.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.63.def b/definitions/grib2/template.4.63.def new file mode 100644 index 000000000..2b0396795 --- /dev/null +++ b/definitions/grib2/template.4.63.def @@ -0,0 +1,11 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.63, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles + +include "grib2/template.4.parameter.def" +include "grib2/template.4.tile.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.eps.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.93.def b/definitions/grib2/template.4.93.def index ba14d95d4..9ff2e882d 100644 --- a/definitions/grib2/template.4.93.def +++ b/definitions/grib2/template.4.93.def @@ -5,7 +5,9 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.postproc.def" include "grib2/template.4.generating_process.def" + #include "grib2/template.4.forecast_time.def" #include "grib2/template.4.point_in_time.def" + include "grib2/template.4.horizontal.def" include "grib2/template.4.localtime.def" diff --git a/definitions/grib2/template.4.94.def b/definitions/grib2/template.4.94.def index 0ba58bb53..26850a8c8 100644 --- a/definitions/grib2/template.4.94.def +++ b/definitions/grib2/template.4.94.def @@ -5,8 +5,10 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.postproc.def" include "grib2/template.4.generating_process.def" + #include "grib2/template.4.forecast_time.def" #include "grib2/template.4.point_in_time.def" + include "grib2/template.4.horizontal.def" include "grib2/template.4.eps.def" include "grib2/template.4.localtime.def" diff --git a/definitions/grib2/template.4.95.def b/definitions/grib2/template.4.95.def index 53d2aef4e..5ffd5e1f2 100644 --- a/definitions/grib2/template.4.95.def +++ b/definitions/grib2/template.4.95.def @@ -4,7 +4,9 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.generating_process.def" + # no template.4.forecast_time.def component in this template. + include "grib2/template.4.horizontal.def" include "grib2/template.4.localtime_statistical.def" include "grib2/template.4.localtime.def" diff --git a/definitions/grib2/template.4.96.def b/definitions/grib2/template.4.96.def index f0d086cb4..043794cf4 100644 --- a/definitions/grib2/template.4.96.def +++ b/definitions/grib2/template.4.96.def @@ -4,8 +4,10 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.generating_process.def" + #include "grib2/template.4.forecast_time.def" #include "grib2/template.4.point_in_time.def" + include "grib2/template.4.horizontal.def" include "grib2/template.4.eps.def" include "grib2/template.4.localtime_statistical.def" diff --git a/definitions/grib2/template.4.97.def b/definitions/grib2/template.4.97.def index 67b315ff1..1ea736ac7 100644 --- a/definitions/grib2/template.4.97.def +++ b/definitions/grib2/template.4.97.def @@ -5,8 +5,10 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.postproc.def" include "grib2/template.4.generating_process.def" + #include "grib2/template.4.forecast_time.def" #include "grib2/template.4.point_in_time.def" + include "grib2/template.4.horizontal.def" include "grib2/template.4.localtime_statistical.def" include "grib2/template.4.localtime.def" diff --git a/definitions/grib2/template.4.98.def b/definitions/grib2/template.4.98.def index 12e70affe..453f6689d 100644 --- a/definitions/grib2/template.4.98.def +++ b/definitions/grib2/template.4.98.def @@ -5,8 +5,10 @@ include "grib2/template.4.parameter.def" include "grib2/template.4.postproc.def" include "grib2/template.4.generating_process.def" + #include "grib2/template.4.forecast_time.def" #include "grib2/template.4.point_in_time.def" + include "grib2/template.4.horizontal.def" include "grib2/template.4.eps.def" include "grib2/template.4.localtime_statistical.def" diff --git a/definitions/grib2/template.4.circular_cluster.def b/definitions/grib2/template.4.circular_cluster.def index 7db252798..f6e2cade4 100644 --- a/definitions/grib2/template.4.circular_cluster.def +++ b/definitions/grib2/template.4.circular_cluster.def @@ -5,43 +5,41 @@ unsigned[1] clusterIdentifier : dump; alias number=clusterIdentifier; # Number of cluster to which the high resolution control belongs -unsigned[1] numberOfClusterHighResolution : dump; +unsigned[1] numberOfClusterHighResolution : dump; # Number of cluster to which the low resolution control belongs -unsigned[1] numberOfClusterLowResolution : dump; +unsigned[1] numberOfClusterLowResolution : dump; # Total number of clusters -unsigned[1] totalNumberOfClusters : dump; +unsigned[1] totalNumberOfClusters : dump; alias totalNumber=totalNumberOfClusters; # Clustering method codetable[1] clusteringMethod ('4.8.table',masterDir,localDir) : dump; # Latitude of central point in cluster domain -unsigned[4] latitudeOfCentralPointInClusterDomain : dump; +unsigned[4] latitudeOfCentralPointInClusterDomain : dump; # Longitude of central point in cluster domain -unsigned[4] longitudeOfCentralPointInClusterDomain : dump; +unsigned[4] longitudeOfCentralPointInClusterDomain : dump; # Radius of cluster domain unsigned[4] radiusOfClusterDomain : dump ; # NC - Number of forecasts in the cluster -unsigned[1] numberOfForecastsInTheCluster : dump; +unsigned[1] numberOfForecastsInTheCluster : dump; alias NC = numberOfForecastsInTheCluster; # Scale factor of standard deviation in the cluster unsigned[1] scaleFactorOfStandardDeviation : edition_specific ; alias scaleFactorOfStandardDeviationInTheCluster=scaleFactorOfStandardDeviation; - # Scaled value of standard deviation in the cluster unsigned[4] scaledValueOfStandardDeviation : dump ; alias scaledValueOfStandardDeviationInTheCluster=scaledValueOfStandardDeviation; - # Scale factor of distance of the cluster from ensemble mean -unsigned[1] scaleFactorOfDistanceFromEnsembleMean : dump; +unsigned[1] scaleFactorOfDistanceFromEnsembleMean : dump; # Scaled value of distance of the cluster from ensemble mean -unsigned[4] scaleFactorOfDistanceFromEnsembleMean : dump; +unsigned[4] scaledValueOfDistanceFromEnsembleMean : dump; diff --git a/definitions/grib2/template.4.localtime.def b/definitions/grib2/template.4.localtime.def index 926c86770..01491217c 100644 --- a/definitions/grib2/template.4.localtime.def +++ b/definitions/grib2/template.4.localtime.def @@ -3,6 +3,11 @@ remove is_localtime; transient is_localtime=1; +alias defaultStepUnits = one; # 1 means Hour. See code table 4.4 +template_nofail default_step_units "grib2/localConcepts/[centre:s]/default_step_units.def"; +codetable[1] stepUnits 'stepUnits.table' = defaultStepUnits : transient,dump,no_copy; +alias time.stepUnits = stepUnits; + # Method used to calculate the field value at the local time specified in section 1 codetable[1] localTimeMethod ('4.248.table',masterDir,localDir)=255 : dump; @@ -45,7 +50,7 @@ localTimeForecastList list(numberOfForecastsUsedInLocalTime) unsigned[4] timeIncrement=0 : dump; } -alias ls.time=dataTime; +alias ls.time = dataTime; # See ECC-707 transient lsdate_bug = 1: hidden; transient lstime_bug = 1: hidden; @@ -78,6 +83,10 @@ if (numberOfForecastsUsedInLocalTime == 1) { alias mars.time = timeOfForecastUsedInLocalTime : dump; alias mars.step = endStep; + alias time.dataDate = dateOfForecastUsedInLocalTime; + alias time.dataTime = timeOfForecastUsedInLocalTime; + alias time.endStep = endStep; + } if (numberOfForecastsUsedInLocalTime > 1) { meta selectedFcIndex closest_date(dataDate, dataTime, @@ -106,5 +115,10 @@ if (numberOfForecastsUsedInLocalTime > 1) { alias mars.date = dateOfForecastUsedInLocalTime : dump; alias mars.time = timeOfForecastUsedInLocalTime : dump; alias mars.step = endStep; + + alias time.dataDate = dateOfForecastUsedInLocalTime; + alias time.dataTime = timeOfForecastUsedInLocalTime; + alias time.endStep = endStep; + } } diff --git a/definitions/grib2/template.4.rectangular_cluster.def b/definitions/grib2/template.4.rectangular_cluster.def index 4d1208658..1d4f359f8 100644 --- a/definitions/grib2/template.4.rectangular_cluster.def +++ b/definitions/grib2/template.4.rectangular_cluster.def @@ -47,4 +47,3 @@ unsigned[1] scaleFactorOfDistanceFromEnsembleMean : dump ; # Scaled value of distance of the cluster from ensemble mean unsigned[4] scaledValueOfDistanceFromEnsembleMean : dump ; - diff --git a/definitions/grib2/template.5.53.def b/definitions/grib2/template.5.53.def index 9c52a8513..2ca21b70f 100644 --- a/definitions/grib2/template.5.53.def +++ b/definitions/grib2/template.5.53.def @@ -1,7 +1,7 @@ # (C) Copyright 2005- ECMWF. # TEMPLATE 5.53, BiFourier coefficients data - complex packing -# Spectral data for limited area models \u2013 complex packing +# Spectral data for limited area models - complex packing include "grib2/template.5.packing.def"; diff --git a/definitions/grib2/template.7.200.def b/definitions/grib2/template.7.200.def index 36116f1e5..c38ae31fc 100644 --- a/definitions/grib2/template.7.200.def +++ b/definitions/grib2/template.7.200.def @@ -24,5 +24,7 @@ meta values data_apply_bitmap(codedValues, alias data.packedValues = codedValues; template statistics "common/statistics_grid.def"; -template missing_values "common/missing_values_grid.def"; +# This template can have undefined values within its Data Section +meta numberOfMissing count_missing(bitmap,unusedBitsInBitmap,numberOfDataPoints,one) : dump; +alias numberOfMissingValues=numberOfMissing; diff --git a/definitions/grib2/template.7.53.def b/definitions/grib2/template.7.53.def index ad4642bbf..e12e83b19 100644 --- a/definitions/grib2/template.7.53.def +++ b/definitions/grib2/template.7.53.def @@ -1,7 +1,6 @@ # (C) Copyright 2005- ECMWF. -# TEMPLATE 7.53, BiFourier coefficients - complex packing -# Spectral data for limited area models \u2013 complex packing +# TEMPLATE 7.53, Bi-Fourier: Spectral data for limited area models - complex packing constant biFourierCoefficients = 1; constant complexPacking = 1; @@ -39,9 +38,10 @@ meta codedValues data_g2bifourier_packing( numberOfValues ): read_only; -meta values data_apply_bitmap(codedValues, - bitmap, - missingValue, - binaryScaleFactor, - numberOfDataPoints, - numberOfValues) : dump; +meta values data_apply_bitmap( + codedValues, + bitmap, + missingValue, + binaryScaleFactor, + numberOfDataPoints, + numberOfValues) : dump; diff --git a/definitions/grib2/units.def b/definitions/grib2/units.def index 833208e24..af0f728a6 100644 --- a/definitions/grib2/units.def +++ b/definitions/grib2/units.def @@ -2453,6 +2453,33 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Potential evaporation rate +'kg m**-2 s**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + } +#Potential evaporation +'kg m**-2' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 143 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Tile fraction +'Proportion' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 36 ; + } +#Tile percentage +'%' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 37 ; + } #Mean temperature tendency due to short-wave radiation 'K s**-1' = { discipline = 0 ; @@ -3633,6 +3660,162 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Sea ice volume per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow volume over sea ice per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow temperature over sea ice +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice temperature at the sea ice and snow interface +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Underside ice temperature +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice heat content +'J m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow heat content over sea ice +'J m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice freeboard thickness +'m' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + } +#Sea ice melt pond fraction +'Proportion' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond depth +'m' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice melt pond volume per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Sea ice fraction tendency due to parameterization +'s**-1' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea surface salinity 'Numeric' = { discipline = 10 ; @@ -3981,6 +4164,174 @@ scaledValueOfSecondFixedSurface = missing() ; scaleFactorOfSecondFixedSurface = missing() ; } +#Bottom pressure equivalent height +'m' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Net surface upward water flux +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux into sea water (from rivers) +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux into sea water +'g kg**-1 m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat flux correction +'W m**-2' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Fresh water flux correction +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Virtual salt flux correction +'g kg**-1 m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Turbocline depth (kz=5e-4) +'m' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Y-component of surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#X-component of surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Heat Content surface to 26C isotherm +'J m**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + } +#Sea surface height tendency due to parameterization +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Sea water practical salinity '10**-3' = { discipline = 10 ; @@ -4045,6 +4396,190 @@ typeOfFirstFixedSurface = 168 ; typeOfSecondFixedSurface = 168 ; } +#Sea water potential temperature tendency due to newtonian relaxation +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to newtonian relaxation +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to parameterization +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to parameterization +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Eastward sea water velocity tendency due to parameterization +'m s**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Northward sea water velocity tendency due to parameterization +'m s**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water temperature tendency due to direct bias correction +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Sea water salinity tendency due to direct bias correction +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + } +#Net short wave radiation rate at sea surface +'W m**-2' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind stress at 10m above sea surface +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Wind speed at 10m above sea surface +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Neutral drag coefficient at 10m above sea surface +'dimensionless' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Total precipitation rate at sea surface +'kg m**-2 s**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Snow precipitation rate at sea surface +'kg m**-2 s**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Eastward of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#Northward of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#U-component of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } +#V-component of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + } #Time-mean sea ice thickness 'm' = { discipline = 10 ; @@ -4136,6 +4671,175 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea ice volume per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow volume over sea ice per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow temperature over sea ice +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice temperature at the sea ice and snow interface +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 175 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean underside ice temperature +'K' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 8 ; + typeOfFirstFixedSurface = 176 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice heat content +'J m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 176 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow heat content over sea ice +'J m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 173 ; + typeOfSecondFixedSurface = 175 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice freeboard thickness +'m' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 160 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = 0 ; + scaleFactorOfSecondFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond fraction +'Proportion' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond depth +'m' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice melt pond volume per unit area +'m**3 m**-2' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 188 ; + typeOfSecondFixedSurface = 189 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea ice fraction tendency due to parameterization +'s**-1' = { + discipline = 10 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea surface salinity 'Numeric' = { discipline = 10 ; @@ -4513,6 +5217,188 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Time-mean bottom pressure equivalent height +'m' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 9 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net surface upward water flux +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 13 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux into sea water (from rivers) +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux into sea water +'g kg**-1 m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 32 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat flux correction +'W m**-2' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fresh water flux correction +'kg m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 31 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean virtual salt flux correction +'g kg**-1 m**-2 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 33 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean turbocline depth (kz=5e-4) +'m' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 171 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 5 ; + scaleFactorOfFirstFixedSurface = 4 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean Y-component of surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean X-component of surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 16 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 15 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 14 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean heat content surface to 26C isotherm +'J m**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 22 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 20 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = 29915 ; + scaleFactorOfSecondFixedSurface = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea surface height tendency due to parameterization +'m s**-1' = { + discipline = 10 ; + parameterCategory = 3 ; + parameterNumber = 19 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean sea water practical salinity '10**-3' = { discipline = 10 ; @@ -4585,6 +5471,247 @@ typeOfSecondFixedSurface = 168 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean sea water potential temperature tendency due to newtonian relaxation +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 34 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to newtonian relaxation +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 35 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to parameterization +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 36 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to parameterization +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward sea water velocity tendency due to parameterization +'m s**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward sea water velocity tendency due to parameterization +'m s**-2' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 39 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water temperature tendency due to direct bias correction +'K s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 40 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean sea water salinity tendency due to direct bias correction +'g kg**-1 s**-1' = { + discipline = 10 ; + parameterCategory = 4 ; + parameterNumber = 41 ; + typeOfFirstFixedSurface = 168 ; + typeOfSecondFixedSurface = 168 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean net short wave radiation rate at sea surface +'W m**-2' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind stress at 10m above sea surface +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 49 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean wind speed at 10m above sea surface +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean neutral drag coefficient at 10m above sea surface +'dimensionless' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 29 ; + typeOfFirstFixedSurface = 102 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 10 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total precipitation rate at sea surface +'kg m**-2 s**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean snow precipitation rate at sea surface +'kg m**-2 s**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eastward of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 50 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean northward of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 51 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean U-component of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean V-component of wind stress over sea ice +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 53 ; + typeOfFirstFixedSurface = 174 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = missing() ; + scaleFactorOfFirstFixedSurface = missing() ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 0 ; + } +#Time-accumulated net short wave radiation at sea surface +'J m**-2' = { + discipline = 0 ; + parameterCategory = 4 ; + parameterNumber = 9 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated total precipitation at sea surface +'kg m**-2' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 52 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } +#Time-accumulated snow precipitation at sea surface +'kg m**-2' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 160 ; + typeOfSecondFixedSurface = 255 ; + scaledValueOfFirstFixedSurface = 0 ; + scaleFactorOfFirstFixedSurface = 0 ; + scaledValueOfSecondFixedSurface = missing() ; + scaleFactorOfSecondFixedSurface = missing() ; + typeOfStatisticalProcessing = 1 ; + } #Virtual temperature 'K' = { discipline = 0 ; @@ -5572,12 +6699,6 @@ parameterCategory = 1 ; parameterNumber = 40 ; } -#Potential evaporation rate -'W m**-2' = { - discipline = 0 ; - parameterCategory = 1 ; - parameterNumber = 41 ; - } #Snow cover '%' = { discipline = 0 ; diff --git a/definitions/mars/class.table b/definitions/mars/class.table index 516e43217..6e8a0aa27 100644 --- a/definitions/mars/class.table +++ b/definitions/mars/class.table @@ -43,6 +43,8 @@ 42 ef EFAS (European flood awareness system) 43 gf GLOFAS (Global flood awareness system) 44 gg Greenhouse Gases +45 ml Machine learning +46 d1 Destination Earth 99 te Test 100 at Austria 101 be Belgium diff --git a/python/CMakeLists.txt b/deprecated/python/CMakeLists.txt similarity index 100% rename from python/CMakeLists.txt rename to deprecated/python/CMakeLists.txt diff --git a/python/Makefile.am b/deprecated/python/Makefile.am similarity index 100% rename from python/Makefile.am rename to deprecated/python/Makefile.am diff --git a/python/README b/deprecated/python/README similarity index 100% rename from python/README rename to deprecated/python/README diff --git a/python/README.swig b/deprecated/python/README.swig similarity index 100% rename from python/README.swig rename to deprecated/python/README.swig diff --git a/python/compare_iterator_values.sh b/deprecated/python/compare_iterator_values.sh similarity index 100% rename from python/compare_iterator_values.sh rename to deprecated/python/compare_iterator_values.sh diff --git a/python/create_errors.py.sh b/deprecated/python/create_errors.py.sh similarity index 100% rename from python/create_errors.py.sh rename to deprecated/python/create_errors.py.sh diff --git a/python/eccodes/__init__.py b/deprecated/python/eccodes/__init__.py similarity index 100% rename from python/eccodes/__init__.py rename to deprecated/python/eccodes/__init__.py diff --git a/python/eccodes/eccodes.py b/deprecated/python/eccodes/eccodes.py similarity index 100% rename from python/eccodes/eccodes.py rename to deprecated/python/eccodes/eccodes.py diff --git a/python/extrules.am b/deprecated/python/extrules.am similarity index 100% rename from python/extrules.am rename to deprecated/python/extrules.am diff --git a/python/grib_errors.h b/deprecated/python/grib_errors.h similarity index 100% rename from python/grib_errors.h rename to deprecated/python/grib_errors.h diff --git a/python/grib_interface.c b/deprecated/python/grib_interface.c similarity index 100% rename from python/grib_interface.c rename to deprecated/python/grib_interface.c diff --git a/python/grib_interface.h b/deprecated/python/grib_interface.h similarity index 100% rename from python/grib_interface.h rename to deprecated/python/grib_interface.h diff --git a/python/gribapi.c b/deprecated/python/gribapi.c similarity index 100% rename from python/gribapi.c rename to deprecated/python/gribapi.c diff --git a/python/gribapi/__init__.py b/deprecated/python/gribapi/__init__.py similarity index 100% rename from python/gribapi/__init__.py rename to deprecated/python/gribapi/__init__.py diff --git a/python/gribapi/errors.py b/deprecated/python/gribapi/errors.py similarity index 100% rename from python/gribapi/errors.py rename to deprecated/python/gribapi/errors.py diff --git a/python/gribapi/gribapi.py b/deprecated/python/gribapi/gribapi.py similarity index 100% rename from python/gribapi/gribapi.py rename to deprecated/python/gribapi/gribapi.py diff --git a/python/gribapi_swig.i b/deprecated/python/gribapi_swig.i similarity index 100% rename from python/gribapi_swig.i rename to deprecated/python/gribapi_swig.i diff --git a/python/gribapi_swig.py b/deprecated/python/gribapi_swig.py similarity index 100% rename from python/gribapi_swig.py rename to deprecated/python/gribapi_swig.py diff --git a/python/numpy.i b/deprecated/python/numpy.i similarity index 100% rename from python/numpy.i rename to deprecated/python/numpy.i diff --git a/python/run_tests.sh b/deprecated/python/run_tests.sh similarity index 100% rename from python/run_tests.sh rename to deprecated/python/run_tests.sh diff --git a/python/setup.py.autotools.in b/deprecated/python/setup.py.autotools.in similarity index 100% rename from python/setup.py.autotools.in rename to deprecated/python/setup.py.autotools.in diff --git a/python/setup.py.in b/deprecated/python/setup.py.in similarity index 100% rename from python/setup.py.in rename to deprecated/python/setup.py.in diff --git a/python/swig_wrap_numpy.c b/deprecated/python/swig_wrap_numpy.c similarity index 100% rename from python/swig_wrap_numpy.c rename to deprecated/python/swig_wrap_numpy.c diff --git a/python/swig_wrap_numpy.py b/deprecated/python/swig_wrap_numpy.py similarity index 100% rename from python/swig_wrap_numpy.py rename to deprecated/python/swig_wrap_numpy.py diff --git a/python/test_extra.py b/deprecated/python/test_extra.py similarity index 100% rename from python/test_extra.py rename to deprecated/python/test_extra.py diff --git a/python/test_general.py b/deprecated/python/test_general.py similarity index 100% rename from python/test_general.py rename to deprecated/python/test_general.py diff --git a/python/test_index.py b/deprecated/python/test_index.py similarity index 100% rename from python/test_index.py rename to deprecated/python/test_index.py diff --git a/python/test_iterator.py b/deprecated/python/test_iterator.py similarity index 100% rename from python/test_iterator.py rename to deprecated/python/test_iterator.py diff --git a/python/test_keysiterator.py b/deprecated/python/test_keysiterator.py similarity index 100% rename from python/test_keysiterator.py rename to deprecated/python/test_keysiterator.py diff --git a/eccodes_config.h.in b/eccodes_config.h.in index 3341c4682..d80a4554d 100644 --- a/eccodes_config.h.in +++ b/eccodes_config.h.in @@ -53,7 +53,6 @@ #cmakedefine ECCODES_HAVE_REALPATH #cmakedefine ECCODES_HAVE_FSYNC #cmakedefine ECCODES_HAVE_FDATASYNC -#cmakedefine ECCODES_ON_LINUX_32BIT #if defined(EC_HAVE_ASSERT_H) || defined(ECCODES_HAVE_ASSERT_H) #define HAVE_ASSERT_H 1 diff --git a/examples/C/CMakeLists.txt b/examples/C/CMakeLists.txt index bafdb2dfc..539077c2b 100644 --- a/examples/C/CMakeLists.txt +++ b/examples/C/CMakeLists.txt @@ -148,7 +148,7 @@ foreach( test ${tests_extra} ) TYPE SCRIPT CONDITION ENABLE_EXTRA_TESTS COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh - TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs ) + TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs eccodes_download_bufr_refs ) endforeach() # Tests which are conditional diff --git a/examples/C/ecmwf_link.sh b/examples/C/ecmwf_link.sh deleted file mode 100755 index f8180b1e4..000000000 --- a/examples/C/ecmwf_link.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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. - -set -ex - -CC=xlc -FC=xlf - -jasper_lib="-I/usr/local/lib/metaps/lib/grib_api/jasper/include -L/usr/local/lib/metaps/lib/grib_api/jasper/lib -ljasper" -grib_api_lib="-I/usr/local/lib/metaps/lib/grib_api/new/include -L/usr/local/lib/metaps/lib/grib_api/new/lib -lgrib_api" - -$CC -o multi multi.c $jasper_lib $grib_api_lib -lm - -./multi > /dev/null - -$FC -o multi_fortran multi_fortran.F $jasper_lib $grib_api_lib - -./multi_fortran > /dev/null - - diff --git a/examples/C/grib_get_keys.c b/examples/C/grib_get_keys.c index f17f9458d..537c719ea 100644 --- a/examples/C/grib_get_keys.c +++ b/examples/C/grib_get_keys.c @@ -22,7 +22,8 @@ int main(int argc, char** argv) { int err = 0; - double* values = NULL; + float* fvalues = NULL; /* data values as floats */ + double* dvalues = NULL; /* data values as doubles */ size_t values_len = 0; size_t i = 0, len = 0; @@ -37,7 +38,8 @@ int main(int argc, char** argv) long numberOfPointsAlongAParallel; long numberOfPointsAlongAMeridian; - double average = 0; + double daverage = 0; + float faverage = 0; char* packingType = NULL; FILE* in = NULL; @@ -104,20 +106,27 @@ int main(int argc, char** argv) /* get the size of the values array*/ CODES_CHECK(codes_get_size(h, "values", &values_len), 0); - values = (double*)malloc(values_len * sizeof(double)); + fvalues = (float*)malloc(values_len * sizeof(float)); + dvalues = (double*)malloc(values_len * sizeof(double)); /* get data values*/ - CODES_CHECK(codes_get_double_array(h, "values", values, &values_len), 0); + CODES_CHECK(codes_get_float_array(h, "values", fvalues, &values_len), 0); + CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0); - average = 0; - for (i = 0; i < values_len; i++) - average += values[i]; + faverage = 0; + daverage = 0; + for (i = 0; i < values_len; i++) { + faverage += fvalues[i]; + daverage += dvalues[i]; + } - average /= (double)values_len; + faverage /= (float)values_len; + daverage /= (double)values_len; - free(values); - - printf("There are %d values, average is %g\n", (int)values_len, average); + free(fvalues); + free(dvalues); + printf("There are %zu values, double average is %g\n", values_len, daverage); + printf("There are %zu values, float average is %f\n", values_len, faverage); { int eq = 0; diff --git a/examples/C/grib_set_missing.sh b/examples/C/grib_set_missing.sh index 1be3f5a8f..baef5d073 100755 --- a/examples/C/grib_set_missing.sh +++ b/examples/C/grib_set_missing.sh @@ -15,9 +15,11 @@ tempGrib="out_surface_level.grib2" ${examples_dir}/c_grib_set_missing # Check the keys have been set to MISSING -sf=`${tools_dir}/grib_get -p scaleFactorOfFirstFixedSurface $tempGrib` -[ "$sf" = "MISSING" ] -sf=`${tools_dir}/grib_get -p scaledValueOfFirstFixedSurface $tempGrib` -[ "$sf" = "MISSING" ] +if [ -f "${tools_dir}/grib_get" ]; then + sf=`${tools_dir}/grib_get -p scaleFactorOfFirstFixedSurface $tempGrib` + [ "$sf" = "MISSING" ] + sf=`${tools_dir}/grib_get -p scaledValueOfFirstFixedSurface $tempGrib` + [ "$sf" = "MISSING" ] +fi rm -f $tempGrib diff --git a/examples/F90/CMakeLists.txt b/examples/F90/CMakeLists.txt index ce522de09..dd52ca843 100644 --- a/examples/F90/CMakeLists.txt +++ b/examples/F90/CMakeLists.txt @@ -97,25 +97,25 @@ else() get_product_kind ) endif() -foreach( tool ${tests_sanity} ) - ecbuild_add_test( TARGET eccodes_f_${tool} - SOURCES ${tool}.f90 +foreach( atest ${tests_sanity} ) + ecbuild_add_test( TARGET eccodes_f_${atest} + SOURCES ${atest}.f90 LINKER_LANGUAGE Fortran LIBS eccodes_f90 eccodes CONDITION HAVE_FORTRAN LABELS "sanity" RESOURCES bufr_read_scatterometer_f.ref - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh ) + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${atest}.sh ) endforeach() -foreach( tool ${tests_extra} ) - ecbuild_add_test( TARGET eccodes_f_${tool} - SOURCES ${tool}.f90 +foreach( atest ${tests_extra} ) + ecbuild_add_test( TARGET eccodes_f_${atest} + SOURCES ${atest}.f90 LINKER_LANGUAGE Fortran LIBS eccodes_f90 eccodes CONDITION HAVE_FORTRAN AND ENABLE_EXTRA_TESTS RESOURCES bufr_read_scatterometer_f.ref - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh - TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs ) + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${atest}.sh + TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs eccodes_download_bufr_refs ) endforeach() # Test for CCSDS (AEC) packing @@ -123,7 +123,7 @@ ecbuild_add_test( TARGET eccodes_f_grib_set_packing SOURCES grib_set_packing.f90 LINKER_LANGUAGE Fortran LIBS eccodes_f90 eccodes - CONDITION HAVE_AEC AND HAVE_FORTRAN + CONDITION HAVE_BUILD_TOOLS AND HAVE_AEC AND HAVE_FORTRAN COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_set_packing.sh ) # Executables without a shell script diff --git a/examples/F90/grib_get_pv.f90 b/examples/F90/grib_get_pv.f90 index eda580ffa..230d81575 100644 --- a/examples/F90/grib_get_pv.f90 +++ b/examples/F90/grib_get_pv.f90 @@ -16,12 +16,12 @@ program grib_get_pv integer :: infile integer :: igrib integer :: PVPresent, nb_pv - real, dimension(:), allocatable :: pv + real(kind=8), dimension(:), allocatable :: pv call codes_open_file(infile, '../../data/reduced_gaussian_model_level.grib1', 'r') - ! A new grib message is loaded from file - ! igrib is the grib id to be used in subsequent calls + ! A new GRIB message is loaded from file + ! igrib is the message id to be used in subsequent calls call codes_grib_new_from_file(infile, igrib) ! Get PVPresent to see if the 'pv' array is there diff --git a/experimental/templates/dummy.am b/experimental/templates/dummy.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index f8a3fc08a..e3ce24556 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -2761,36 +2761,20 @@ int grib_f_get_real4(int* gid, char* key, float* val, int len){ return grib_f_get_real4_( gid, key, val, 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) { grib_handle *h = get_handle(*gid); int err = GRIB_SUCCESS; char buf[1024]; size_t lsize = *size; - double* val8 = NULL; - size_t i; - if(!h) return GRIB_INVALID_GRIB; - - if(*size) - val8 = (double*)grib_context_malloc(h->context,(*size)*(sizeof(double))); - else - val8 = (double*)grib_context_malloc(h->context,sizeof(double)); - - if(!val8) return GRIB_OUT_OF_MEMORY; - - err = grib_get_double_array(h, cast_char(buf,key,len), val8, &lsize); - if (err) { - grib_context_free(h->context,val8); - return err; + if(!h){ + return GRIB_INVALID_GRIB; + }else{ + err = grib_get_float_array(h, cast_char(buf,key,len), val, &lsize); + *size = lsize; + return err; } - - for(i=0;icontext,val8); - - return err; } int grib_f_get_real4_array__(int* gid, char* key, float* val, int* size, int len){ return grib_f_get_real4_array_( gid, key, val, size, len); @@ -2800,7 +2784,7 @@ int grib_f_get_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) { grib_handle *h = get_handle(*gid); int err = GRIB_SUCCESS; diff --git a/python/dummy.am b/python/dummy.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/accessor.class b/src/accessor.class index 697bade54..ff66f4760 100644 --- a/src/accessor.class +++ b/src/accessor.class @@ -4,12 +4,14 @@ static int pack_missing(grib_accessor*); static int is_missing(grib_accessor*); static int pack_bytes(grib_accessor*, const unsigned char*, size_t* len); static int pack_double(grib_accessor*, const double* val, size_t* len); +static int pack_float(grib_accessor*, const float* 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 pack_string_array(grib_accessor*, const char**, size_t* len); static int pack_expression(grib_accessor*, grib_expression*); static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* 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); static int unpack_string_array(grib_accessor*, char**, size_t* len); @@ -31,7 +33,9 @@ static int nearest_smaller_value (grib_accessor*, double, double*); static grib_accessor* next(grib_accessor*, int); static int compare(grib_accessor*, grib_accessor*); static int unpack_double_element(grib_accessor*, size_t i, double* val); +static int unpack_float_element(grib_accessor*, size_t i, float* val); static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); +static int unpack_float_element_set(grib_accessor*, const size_t* index_array, size_t len, float* val_array); static int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len); static int clear(grib_accessor*); static grib_accessor* make_clone(grib_accessor*, grib_section*, int*); @@ -66,7 +70,9 @@ static grib_accessor_class _grib_accessor_class_NAME = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + &pack_float, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ &pack_string_array, /* grib_pack array procedures string */ @@ -82,7 +88,9 @@ static grib_accessor_class _grib_accessor_class_NAME = { &next, /* next accessor */ &compare, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + &unpack_float_element, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + &unpack_float_element_set, /* unpack a given set of elements */ &unpack_double_subarray, /* unpack a subarray */ &clear, /* clear */ &make_clone, /* clone accessor */ diff --git a/src/accessor_class_hierarchy.txt b/src/accessor_class_hierarchy.txt index 180f6edbf..2fdf983e3 100644 --- a/src/accessor_class_hierarchy.txt +++ b/src/accessor_class_hierarchy.txt @@ -1,6 +1,7 @@ Accessor Class Hierarchy. Generated by src/make_accessor_class_hierarchy_dirs.sh + |-grib_accessor_class_forward |-grib_accessor_class_gen |---grib_accessor_class_abstract_long_vector |-----grib_accessor_class_g1step_range @@ -17,11 +18,11 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh |-----grib_accessor_class_mars_param |-----grib_accessor_class_mars_step |-----grib_accessor_class_sprintf + |-----grib_accessor_class_trim |---grib_accessor_class_assert |---grib_accessor_class_bits |---grib_accessor_class_blob |---grib_accessor_class_box - |---grib_accessor_class_bufr_data |---grib_accessor_class_bufr_data_array |---grib_accessor_class_bufr_data_element |---grib_accessor_class_bufr_elements_table @@ -40,6 +41,7 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh |-------grib_accessor_class_padtoeven |-------grib_accessor_class_padtomultiple |-------grib_accessor_class_section_padding + |---grib_accessor_class_change_alternative_row_scanning |---grib_accessor_class_change_scanning_direction |---grib_accessor_class_codetable_title |---grib_accessor_class_codetable_units @@ -61,6 +63,7 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh |-------grib_accessor_class_statistics |-------grib_accessor_class_statistics_spectral |-------grib_accessor_class_vector + |-----grib_accessor_class_closest_date |-----grib_accessor_class_divdouble |-----grib_accessor_class_from_scale_factor_scaled_value |-----grib_accessor_class_g1area @@ -170,10 +173,12 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh |---grib_accessor_class_number_of_values_data_raw_packing |---grib_accessor_class_pack_bufr_values |---grib_accessor_class_position + |---grib_accessor_class_proj_string |---grib_accessor_class_raw |---grib_accessor_class_section |---grib_accessor_class_section_pointer |---grib_accessor_class_smart_table_column + |---grib_accessor_class_step_human_readable |---grib_accessor_class_to_double |-----grib_accessor_class_sexagesimal2decimal |---grib_accessor_class_to_integer @@ -193,6 +198,7 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh |-----grib_accessor_class_data_g22order_packing |-----grib_accessor_class_data_png_packing |-----grib_accessor_class_data_raw_packing + |-----grib_accessor_class_data_run_length_packing |-----grib_accessor_class_data_simple_packing |-------grib_accessor_class_data_complex_packing |---------grib_accessor_class_data_g1complex_packing diff --git a/src/action_class_concept.cc b/src/action_class_concept.cc index 36fbefde1..8631da30a 100644 --- a/src/action_class_concept.cc +++ b/src/action_class_concept.cc @@ -21,7 +21,7 @@ SUPER = action_class_gen IMPLEMENTS = dump IMPLEMENTS = destroy - MEMBERS = grib_concept_value* concept + MEMBERS = grib_concept_value* concept_value MEMBERS = char* basename MEMBERS = char* masterDir MEMBERS = char* localDir @@ -46,7 +46,7 @@ static void destroy (grib_context*,grib_action*); typedef struct grib_action_concept { - grib_action act; + grib_action act; /* Members defined in gen */ long len; grib_arguments* params; diff --git a/src/action_class_hierarchy.txt b/src/action_class_hierarchy.txt index 132ec468d..6c311c70c 100644 --- a/src/action_class_hierarchy.txt +++ b/src/action_class_hierarchy.txt @@ -1,5 +1,5 @@ - Action Class Hierarchy + |action |-action_class_alias |-action_class_assert diff --git a/src/bufr_util.cc b/src/bufr_util.cc index 6c9dfa9f1..fb7cea585 100644 --- a/src/bufr_util.cc +++ b/src/bufr_util.cc @@ -211,7 +211,7 @@ static int bufr_decode_rdb_keys(const void* message, long offset_section2, codes /* The ECMWF BUFR local use section */ static int bufr_decode_extra_rdb_keys(const void* message, long offset_section2, codes_bufr_header* hdr) { - int isSatelliteType = 0; + bool isSatelliteType = false; long start = 0; const long offset_keyData = offset_section2 + 6; const long offset_keyMore = offset_section2 + 19; /* 8 bytes long */ @@ -223,7 +223,7 @@ static int bufr_decode_extra_rdb_keys(const void* message, long offset_section2, DebugAssert(hdr->ecmwfLocalSectionPresent); if (hdr->rdbType == 2 || hdr->rdbType == 3 || hdr->rdbType == 8 || hdr->rdbType == 12) { - isSatelliteType = 1; + isSatelliteType = true; } if (isSatelliteType || hdr->numberOfSubsets > 1) { hdr->isSatellite = 1; @@ -844,7 +844,7 @@ static char* codes_bufr_header_get_centre_name(long edition, long centre_code) int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* val, size_t* len) { static const char* NOT_FOUND = "not_found"; - int isEcmwfLocal = 0; + bool isEcmwfLocal = false; Assert(bh); Assert(key); *len = strlen(NOT_FOUND); /*By default*/ diff --git a/src/codes_util.cc b/src/codes_util.cc index 14f966f35..b5c5ddd57 100644 --- a/src/codes_util.cc +++ b/src/codes_util.cc @@ -86,44 +86,44 @@ char* codes_getenv(const char* name) const char* old_name = name; /* Test the most commonly used variables first */ - if (STR_EQ(name, "ECCODES_SAMPLES_PATH")) + if (STR_EQUAL(name, "ECCODES_SAMPLES_PATH")) old_name = "GRIB_SAMPLES_PATH"; - else if (STR_EQ(name, "ECCODES_DEFINITION_PATH")) + else if (STR_EQUAL(name, "ECCODES_DEFINITION_PATH")) old_name = "GRIB_DEFINITION_PATH"; - else if (STR_EQ(name, "ECCODES_DEBUG")) + else if (STR_EQUAL(name, "ECCODES_DEBUG")) old_name = "GRIB_API_DEBUG"; - else if (STR_EQ(name, "ECCODES_FAIL_IF_LOG_MESSAGE")) + else if (STR_EQUAL(name, "ECCODES_FAIL_IF_LOG_MESSAGE")) old_name = "GRIB_API_FAIL_IF_LOG_MESSAGE"; - else if (STR_EQ(name, "ECCODES_GRIB_WRITE_ON_FAIL")) + else if (STR_EQUAL(name, "ECCODES_GRIB_WRITE_ON_FAIL")) old_name = "GRIB_API_WRITE_ON_FAIL"; - else if (STR_EQ(name, "ECCODES_GRIB_LARGE_CONSTANT_FIELDS")) + else if (STR_EQUAL(name, "ECCODES_GRIB_LARGE_CONSTANT_FIELDS")) old_name = "GRIB_API_LARGE_CONSTANT_FIELDS"; - else if (STR_EQ(name, "ECCODES_NO_ABORT")) + else if (STR_EQUAL(name, "ECCODES_NO_ABORT")) old_name = "GRIB_API_NO_ABORT"; - else if (STR_EQ(name, "ECCODES_GRIBEX_MODE_ON")) + else if (STR_EQUAL(name, "ECCODES_GRIBEX_MODE_ON")) old_name = "GRIB_GRIBEX_MODE_ON"; - else if (STR_EQ(name, "ECCODES_GRIB_IEEE_PACKING")) + else if (STR_EQUAL(name, "ECCODES_GRIB_IEEE_PACKING")) old_name = "GRIB_IEEE_PACKING"; - else if (STR_EQ(name, "ECCODES_IO_BUFFER_SIZE")) + else if (STR_EQUAL(name, "ECCODES_IO_BUFFER_SIZE")) old_name = "GRIB_API_IO_BUFFER_SIZE"; - else if (STR_EQ(name, "ECCODES_LOG_STREAM")) + else if (STR_EQUAL(name, "ECCODES_LOG_STREAM")) old_name = "GRIB_API_LOG_STREAM"; - else if (STR_EQ(name, "ECCODES_GRIB_NO_BIG_GROUP_SPLIT")) + else if (STR_EQUAL(name, "ECCODES_GRIB_NO_BIG_GROUP_SPLIT")) old_name = "GRIB_API_NO_BIG_GROUP_SPLIT"; - else if (STR_EQ(name, "ECCODES_GRIB_NO_SPD")) + else if (STR_EQUAL(name, "ECCODES_GRIB_NO_SPD")) old_name = "GRIB_API_NO_SPD"; - else if (STR_EQ(name, "ECCODES_GRIB_KEEP_MATRIX")) + else if (STR_EQUAL(name, "ECCODES_GRIB_KEEP_MATRIX")) old_name = "GRIB_API_KEEP_MATRIX"; - else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_DEFINITION_PATH")) + else if (STR_EQUAL(name, "_ECCODES_ECMWF_TEST_DEFINITION_PATH")) old_name = "_GRIB_API_ECMWF_TEST_DEFINITION_PATH"; - else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_SAMPLES_PATH")) + else if (STR_EQUAL(name, "_ECCODES_ECMWF_TEST_SAMPLES_PATH")) old_name = "_GRIB_API_ECMWF_TEST_SAMPLES_PATH"; - else if (STR_EQ(name, "ECCODES_GRIB_JPEG")) + else if (STR_EQUAL(name, "ECCODES_GRIB_JPEG")) old_name = "GRIB_JPEG"; - else if (STR_EQ(name, "ECCODES_GRIB_DUMP_JPG_FILE")) + else if (STR_EQUAL(name, "ECCODES_GRIB_DUMP_JPG_FILE")) old_name = "GRIB_DUMP_JPG_FILE"; - else if (STR_EQ(name, "ECCODES_PRINT_MISSING")) + else if (STR_EQUAL(name, "ECCODES_PRINT_MISSING")) old_name = "GRIB_PRINT_MISSING"; result = getenv(old_name); @@ -194,3 +194,23 @@ int codes_flush_sync_close_file(FILE* f) } return GRIB_SUCCESS; } + +// Return 1 if input date is valid. Otherwise 0 +int is_date_valid(long year, long month, long day, long hour, long minute, double second) +{ + // Convert input date to Julian number + double result = 0; // Julian number in units of days + long year1, month1, day1, hour1, minute1, lSecond1; + + // For validating the date/time, we specify seconds as an integer + long lSecond = (long)second; + grib_datetime_to_julian(year, month, day, hour, minute, lSecond, &result); + + // Check conversion worked by going other way + grib_julian_to_datetime(result, &year1, &month1, &day1, &hour1, &minute1, &lSecond1); + if (year1 != year || month1 != month || day1 != day || minute1 != minute || lSecond1 != lSecond) { + return 0; // bad date + } + + return 1; +} diff --git a/src/dummy.am b/src/dummy.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/eccodes.cc b/src/eccodes.cc index feffc5b04..a7984b396 100644 --- a/src/eccodes.cc +++ b/src/eccodes.cc @@ -337,6 +337,7 @@ int codes_get_double(const grib_handle* h, const char* key, double* value) { return grib_get_double(h, key, value); } + int codes_get_double_element(const grib_handle* h, const char* key, int i, double* value) { return grib_get_double_element(h, key, i, value); @@ -345,6 +346,15 @@ int codes_get_double_elements(const grib_handle* h, const char* key, const int* { return grib_get_double_elements(h, key, index_array, size, value); } +int codes_get_float_element(const grib_handle* h, const char* key, int i, float* value) +{ + return grib_get_float_element(h, key, i, value); +} +int codes_get_float_elements(const grib_handle* h, const char* key, const int* index_array, long size, float* value) +{ + return grib_get_float_elements(h, key, index_array, size, value); +} + int codes_get_string(const grib_handle* h, const char* key, char* mesg, size_t* length) { return grib_get_string(h, key, mesg, length); @@ -361,6 +371,10 @@ int codes_get_double_array(const grib_handle* h, const char* key, double* vals, { return grib_get_double_array(h, key, vals, length); } +int codes_get_float_array(const grib_handle* h, const char* key, float* vals, size_t* length) +{ + return grib_get_float_array(h, key, vals, length); +} int codes_get_long_array(const grib_handle* h, const char* key, long* vals, size_t* length) { return grib_get_long_array(h, key, vals, length); @@ -385,6 +399,7 @@ int codes_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes, { return grib_set_bytes(h, key, bytes, length); } + int codes_set_double_array(grib_handle* h, const char* key, const double* vals, size_t length) { return grib_set_double_array(h, key, vals, length); @@ -393,6 +408,15 @@ int codes_set_force_double_array(grib_handle* h, const char* key, const double* { return grib_set_force_double_array(h, key, vals, length); } +int codes_set_float_array(grib_handle* h, const char* key, const float* vals, size_t length) +{ + return grib_set_float_array(h, key, vals, length); +} +int codes_set_force_float_array(grib_handle* h, const char* key, const float* vals, size_t length) +{ + return grib_set_force_float_array(h, key, vals, length); +} + int codes_set_long_array(grib_handle* h, const char* key, const long* vals, size_t length) { return grib_set_long_array(h, key, vals, length); @@ -468,10 +492,16 @@ int codes_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_ { return grib_keys_iterator_get_long(kiter, v, len); } + int codes_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len) { return grib_keys_iterator_get_double(kiter, v, len); } +int codes_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len) +{ + return grib_keys_iterator_get_float(kiter, v, len); +} + int codes_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len) { return grib_keys_iterator_get_string(kiter, v, len); diff --git a/src/eccodes.h b/src/eccodes.h index 68f97b58b..cb47d8ca0 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -28,19 +28,19 @@ extern "C" { /* sections */ #define CODES_SECTION_PRODUCT GRIB_SECTION_PRODUCT -#define CODES_SECTION_GRID GRIB_SECTION_GRID -#define CODES_SECTION_LOCAL GRIB_SECTION_LOCAL -#define CODES_SECTION_DATA GRIB_SECTION_DATA -#define CODES_SECTION_BITMAP GRIB_SECTION_BITMAP +#define CODES_SECTION_GRID GRIB_SECTION_GRID +#define CODES_SECTION_LOCAL GRIB_SECTION_LOCAL +#define CODES_SECTION_DATA GRIB_SECTION_DATA +#define CODES_SECTION_BITMAP GRIB_SECTION_BITMAP /* LOG MODES -Log mode for information for processing information +Log mode for processing information */ -#define CODES_LOG_INFO GRIB_LOG_INFO +#define CODES_LOG_INFO GRIB_LOG_INFO #define CODES_LOG_WARNING GRIB_LOG_WARNING -#define CODES_LOG_ERROR GRIB_LOG_ERROR -#define CODES_LOG_FATAL GRIB_LOG_FATAL -#define CODES_LOG_DEBUG GRIB_LOG_DEBUG +#define CODES_LOG_ERROR GRIB_LOG_ERROR +#define CODES_LOG_FATAL GRIB_LOG_FATAL +#define CODES_LOG_DEBUG GRIB_LOG_DEBUG /* Types */ #define CODES_TYPE_UNDEFINED GRIB_TYPE_UNDEFINED @@ -74,6 +74,9 @@ Log mode for information for processing information #define CODES_NEAREST_SAME_DATA GRIB_NEAREST_SAME_DATA #define CODES_NEAREST_SAME_POINT GRIB_NEAREST_SAME_POINT +/* Geoiterator flags */ +#define CODES_GEOITERATOR_NO_VALUES GRIB_GEOITERATOR_NO_VALUES + /*! Iteration is carried out on all the keys available in the message \ingroup keys_iterator \see codes_keys_iterator_new @@ -194,7 +197,7 @@ The codes_index is the structure giving indexed access to messages in a file. /*! index structure to access messages in a file. * \ingroup codes_index * \struct codes_index -*/ + */ typedef struct grib_index codes_index; /** @@ -343,74 +346,74 @@ The codes_handle is the structure giving access to parsed message values by keys */ /*! @{*/ /** -* Counts the messages contained in a file resource. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param n : the number of messages in the file -* @return 0 if OK, integer value on error -*/ + * Counts the messages contained in a file resource. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param n : the number of messages in the file + * @return 0 if OK, integer value on error + */ int codes_count_in_file(codes_context* c, FILE* f, int* n); /** -* Counts the messages contained in a file. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param filename : the path to the file -* @param n : the number of messages in the file -* @return 0 if OK, integer value on error -*/ + * Counts the messages contained in a file. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param filename : the path to the file + * @param n : the number of messages in the file + * @return 0 if OK, integer value on error + */ int codes_count_in_filename(codes_context* c, const char* filename, int* n); /** -* Create a handle from a file resource. -* The file is read until a message is found. The message is then copied. -* Remember always to delete the handle when it is not needed anymore to avoid -* memory leaks. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param product : the kind of product e.g. PRODUCT_GRIB, PRODUCT_BUFR -* @param error : error code set if the returned handle is NULL and the end of file is not reached -* @return the new handle, NULL if the resource is invalid or a problem is encountered -*/ + * Create a handle from a file resource. + * The file is read until a message is found. The message is then copied. + * Remember always to delete the handle when it is not needed anymore to avoid + * memory leaks. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param product : the kind of product e.g. PRODUCT_GRIB, PRODUCT_BUFR + * @param error : error code set if the returned handle is NULL and the end of file is not reached + * @return the new handle, NULL if the resource is invalid or a problem is encountered + */ codes_handle* codes_handle_new_from_file(codes_context* c, FILE* f, ProductKind product, int* error); /** -* Create a GRIB handle from a file resource. -* The file is read until a GRIB message is found. The message is then copied. -* Remember always to delete the handle when it is not needed anymore to avoid -* memory leaks. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param error : error code set if the returned handle is NULL and the end of file is not reached -* @return the new handle, NULL if the resource is invalid or a problem is encountered -*/ + * Create a GRIB handle from a file resource. + * The file is read until a GRIB message is found. The message is then copied. + * Remember always to delete the handle when it is not needed anymore to avoid + * memory leaks. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param error : error code set if the returned handle is NULL and the end of file is not reached + * @return the new handle, NULL if the resource is invalid or a problem is encountered + */ codes_handle* codes_grib_handle_new_from_file(codes_context* c, FILE* f, int* error); /** -* Create a BUFR handle from a file resource. -* The file is read until a BUFR message is found. The message is then copied. -* Remember always to delete the handle when it is not needed anymore to avoid -* memory leaks. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param error : error code set if the returned handle is NULL and the end of file is not reached -* @return the new handle, NULL if the resource is invalid or a problem is encountered -*/ + * Create a BUFR handle from a file resource. + * The file is read until a BUFR message is found. The message is then copied. + * Remember always to delete the handle when it is not needed anymore to avoid + * memory leaks. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param error : error code set if the returned handle is NULL and the end of file is not reached + * @return the new handle, NULL if the resource is invalid or a problem is encountered + */ codes_handle* codes_bufr_handle_new_from_file(codes_context* c, FILE* f, int* error); /** -* Write a coded message to a file. -* -* @param h : codes_handle to be written -* @param file : name of the output file -* @param mode : mode -* @return 0 if OK, integer value on error -*/ + * Write a coded message to a file. + * + * @param h : codes_handle to be written + * @param file : name of the output file + * @param mode : mode + * @return 0 if OK, integer value on error + */ int codes_write_message(const codes_handle* h, const char* file, const char* mode); codes_handle* codes_grib_util_sections_copy(codes_handle* hfrom, codes_handle* hto, int what, int* err); @@ -418,38 +421,38 @@ codes_string_list* codes_grib_util_get_param_id(const char* mars_param); codes_string_list* codes_grib_util_get_mars_param(const char* param_id); /** -* Create a handle from a user message in memory. The message will not be freed at the end. -* The message will be copied as soon as a modification is needed. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message in memory. The message will not be freed at the end. + * The message will be copied as soon as a modification is needed. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ codes_handle* codes_handle_new_from_message(codes_context* c, const void* data, size_t data_len); /** -* Create a handle from a user message in memory. The message will not be freed at the end. -* The message will be copied as soon as a modification is needed. -* This function works also with GRIB multi-field messages. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @param error : error code -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message in memory. The message will not be freed at the end. + * The message will be copied as soon as a modification is needed. + * This function works also with GRIB multi-field messages. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @param error : error code + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ codes_handle* codes_grib_handle_new_from_multi_message(codes_context* c, void** data, size_t* data_len, int* error); /** -* Create a handle from a user message. The message is copied and will be freed with the handle -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message. The message is copied and will be freed with the handle + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ codes_handle* codes_handle_new_from_message_copy(codes_context* c, const void* data, size_t data_len); @@ -486,20 +489,20 @@ codes_handle* codes_handle_new_from_samples(codes_context* c, const char* sample /** -* Clone an existing handle using the context of the original handle, -* The message is copied and reparsed -* -* @param h : The handle to be cloned -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Clone an existing handle using the context of the original handle, + * The message is copied and reparsed + * + * @param h : The handle to be cloned + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ codes_handle* codes_handle_clone(const codes_handle* h); /** -* Frees a handle, also frees the message if it is not a user message -* @see codes_handle_new_from_message -* @param h : The handle to be deleted -* @return 0 if OK, integer value on error -*/ + * Frees a handle, also frees the message if it is not a user message + * @see codes_handle_new_from_message + * @param h : The handle to be deleted + * @return 0 if OK, integer value on error + */ int codes_handle_delete(codes_handle* h); /** @@ -552,25 +555,25 @@ int codes_grib_multi_handle_write(codes_multi_handle* mh, FILE* f); /*! \defgroup handling_coded_messages Handling coded messages */ /*! @{ */ /** -* getting the message attached to a handle -* -* @param h : the handle to which the buffer should be gathered -* @param message : the pointer to be set to the handle's data -* @param message_length : On exit, the message size in number of bytes -* @return 0 if OK, integer value on error -*/ + * getting the message attached to a handle + * + * @param h : the handle to which the buffer should be gathered + * @param message : the pointer to be set to the handle's data + * @param message_length : On exit, the message size in number of bytes + * @return 0 if OK, integer value on error + */ int codes_get_message(const codes_handle* h, const void** message, size_t* message_length); /** -* getting a copy of the message attached to a handle -* -* @param h : the handle to which the buffer should be returned -* @param message : the pointer to the data buffer to be filled -* @param message_length : On entry, the size in number of bytes of the allocated empty message. -* On exit, the actual message length in number of bytes -* @return 0 if OK, integer value on error -*/ + * getting a copy of the message attached to a handle + * + * @param h : the handle to which the buffer should be returned + * @param message : the pointer to the data buffer to be filled + * @param message_length : On entry, the size in number of bytes of the allocated empty message. + * On exit, the actual message length in number of bytes + * @return 0 if OK, integer value on error + */ int codes_get_message_copy(const codes_handle* h, void* message, size_t* message_length); /*! @} */ @@ -578,140 +581,140 @@ int codes_get_message_copy(const codes_handle* h, void* message, size_t* message /*! @{ */ /*! -* \brief Create a new geoiterator from a GRIB handle, using current geometry and values. -* -* \param h : the handle from which the geoiterator will be created -* \param flags : flags for future use. -* \param error : error code -* \return the new geoiterator, NULL if no geoiterator can be created -*/ + * \brief Create a new geoiterator from a GRIB handle, using current geometry and values. + * + * \param h : the handle from which the geoiterator will be created + * \param flags : flags for future use. + * \param error : error code + * \return the new geoiterator, NULL if no geoiterator can be created + */ codes_iterator* codes_grib_iterator_new(const codes_handle* h, unsigned long flags, int* error); /** -* Get latitude/longitude and data values for a GRIB message. -* The latitudes, longitudes and values arrays must be properly allocated by the caller. -* Their required dimension can be obtained by getting the value of the integer key "numberOfPoints". -* -* @param h : handle from which geography and data values are taken -* @param lats : returned array of latitudes -* @param lons : returned array of longitudes -* @param values : returned array of data values -* @return 0 if OK, integer value on error -*/ + * Get latitude/longitude and data values for a GRIB message. + * The latitudes, longitudes and values arrays must be properly allocated by the caller. + * Their required dimension can be obtained by getting the value of the integer key "numberOfPoints". + * + * @param h : handle from which geography and data values are taken + * @param lats : returned array of latitudes + * @param lons : returned array of longitudes + * @param values : returned array of data values + * @return 0 if OK, integer value on error + */ int codes_grib_get_data(const codes_handle* h, double* lats, double* lons, double* values); /** -* Get the next value from a geoiterator. -* -* @param i : the geoiterator -* @param lat : on output latitude in degree -* @param lon : on output longitude in degree -* @param value : on output value of the point -* @return positive value if successful, 0 if no more data are available -*/ + * Get the next value from a geoiterator. + * + * @param i : the geoiterator + * @param lat : on output latitude in degree + * @param lon : on output longitude in degree + * @param value : on output value of the point + * @return positive value if successful, 0 if no more data are available + */ int codes_grib_iterator_next(codes_iterator* i, double* lat, double* lon, double* value); /** -* Get the previous value from a geoiterator. -* -* @param i : the geoiterator -* @param lat : on output latitude in degree -* @param lon : on output longitude in degree -* @param value : on output value of the point* -* @return positive value if successful, 0 if no more data are available -*/ + * Get the previous value from a geoiterator. + * + * @param i : the geoiterator + * @param lat : on output latitude in degree + * @param lon : on output longitude in degree + * @param value : on output value of the point* + * @return positive value if successful, 0 if no more data are available + */ int codes_grib_iterator_previous(codes_iterator* i, double* lat, double* lon, double* value); /** -* Test procedure for values in a geoiterator. -* -* @param i : the geoiterator -* @return boolean, 1 if the iterator still nave next values, 0 otherwise -*/ + * Test procedure for values in a geoiterator. + * + * @param i : the geoiterator + * @return boolean, 1 if the iterator still nave next values, 0 otherwise + */ int codes_grib_iterator_has_next(codes_iterator* i); /** -* Test procedure for values in a geoiterator. -* -* @param i : the geoiterator -* @return 0 if OK, integer value on error -*/ + * Test procedure for values in a geoiterator. + * + * @param i : the geoiterator + * @return 0 if OK, integer value on error + */ int codes_grib_iterator_reset(codes_iterator* i); /** -* Frees the geoiterator from memory. -* -* @param i : the geoiterator -* @return 0 if OK, integer value on error -*/ + * Frees the geoiterator from memory. + * + * @param i : the geoiterator + * @return 0 if OK, integer value on error + */ int codes_grib_iterator_delete(codes_iterator* i); /*! -* \brief Create a new nearest neighbour object from a handle, using current geometry. -* -* \param h : the handle from which the nearest object will be created -* \param error : error code -* \return the new nearest, NULL if no nearest can be created -*/ + * \brief Create a new nearest neighbour object from a handle, using current geometry. + * + * \param h : the handle from which the nearest object will be created + * \param error : error code + * \return the new nearest, NULL if no nearest can be created + */ codes_nearest* codes_grib_nearest_new(const codes_handle* h, int* error); /** -* Find the 4 nearest points of a latitude longitude point. -* The flags are provided to speed up the process of searching. If you are -* sure that the point you are asking for is not changing from a call -* to another you can use CODES_NEAREST_SAME_POINT. The same is valid for -* the grid. Flags can be used together doing a bitwise OR. -* The distances are given in kilometres. -* -* @param nearest : nearest structure -* @param h : handle from which geography and data values are taken -* @param inlat : latitude of the point to search for -* @param inlon : longitude of the point to search for -* @param flags : CODES_NEAREST_SAME_POINT, CODES_NEAREST_SAME_GRID -* @param outlats : returned array of latitudes of the nearest points -* @param outlons : returned array of longitudes of the nearest points -* @param values : returned array of data values of the nearest points -* @param distances : returned array of distances from the nearest points -* @param indexes : returned array of indexes of the nearest points -* @param len : size of the arrays -* @return 0 if OK, integer value on error -*/ + * Find the 4 nearest points of a latitude longitude point. + * The flags are provided to speed up the process of searching. If you are + * sure that the point you are asking for is not changing from a call + * to another you can use CODES_NEAREST_SAME_POINT. The same is valid for + * the grid. Flags can be used together doing a bitwise OR. + * The distances are given in kilometres. + * + * @param nearest : nearest structure + * @param h : handle from which geography and data values are taken + * @param inlat : latitude of the point to search for + * @param inlon : longitude of the point to search for + * @param flags : CODES_NEAREST_SAME_POINT, CODES_NEAREST_SAME_GRID + * @param outlats : returned array of latitudes of the nearest points + * @param outlons : returned array of longitudes of the nearest points + * @param values : returned array of data values of the nearest points + * @param distances : returned array of distances from the nearest points + * @param indexes : returned array of indexes of the nearest points + * @param len : size of the arrays + * @return 0 if OK, integer value on error + */ int codes_grib_nearest_find(codes_nearest* nearest, const codes_handle* h, double inlat, double inlon, unsigned long flags, double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); /** -* Frees a nearest object from memory -* -* @param nearest : the nearest -* @return 0 if OK, integer value on error -*/ + * Frees a nearest object from memory + * + * @param nearest : the nearest + * @return 0 if OK, integer value on error + */ int codes_grib_nearest_delete(codes_nearest* nearest); /** -* Find the nearest point of a set of points whose latitudes and longitudes -* are given in the inlats, inlons arrays respectively. -* If the flag is_lsm is 1 the nearest land point is returned and the -* GRIB passed as handle (h) is considered a land sea mask. -* The land nearest point is the nearest point with land sea mask value>=0.5. -* If no nearest land points are found the nearest value is returned. -* If the flag is_lsm is 0 the nearest point is returned. -* values, distances, indexes (in the "values" array) for the nearest points (ilons,ilats) -* are returned. -* The distances are given in kilometres. -* -* @param h : handle from which geography and data values are taken -* @param is_lsm : lsm flag (1-> nearest land, 0-> nearest) -* @param inlats : latitudes of the points to search for -* @param inlons : longitudes of the points to search for -* @param npoints : number of points (size of the inlats,inlons,outlats,outlons,values,distances,indexes arrays) -* @param outlats : returned array of latitudes of the nearest points -* @param outlons : returned array of longitudes of the nearest points -* @param values : returned array of data values of the nearest points -* @param distances : returned array of distances from the nearest points -* @param indexes : returned array of indexes of the nearest points -* @return 0 if OK, integer value on error -*/ + * Find the nearest point of a set of points whose latitudes and longitudes + * are given in the inlats, inlons arrays respectively. + * If the flag is_lsm is 1 the nearest land point is returned and the + * GRIB passed as handle (h) is considered a land sea mask. + * The land nearest point is the nearest point with land sea mask value>=0.5. + * If no nearest land points are found the nearest value is returned. + * If the flag is_lsm is 0 the nearest point is returned. + * values, distances, indexes (in the "values" array) for the nearest points (ilons,ilats) + * are returned. + * The distances are given in kilometres. + * + * @param h : handle from which geography and data values are taken + * @param is_lsm : lsm flag (1-> nearest land, 0-> nearest) + * @param inlats : latitudes of the points to search for + * @param inlons : longitudes of the points to search for + * @param npoints : number of points (size of the inlats,inlons,outlats,outlons,values,distances,indexes arrays) + * @param outlats : returned array of latitudes of the nearest points + * @param outlons : returned array of longitudes of the nearest points + * @param values : returned array of data values of the nearest points + * @param distances : returned array of distances from the nearest points + * @param indexes : returned array of indexes of the nearest points + * @return 0 if OK, integer value on error + */ int codes_grib_nearest_find_multiple(const codes_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, @@ -722,262 +725,267 @@ int codes_grib_nearest_find_multiple(const codes_handle* h, int is_lsm, /*! \defgroup get_set Accessing header and data values */ /*! @{ */ /** -* Get the number offset of a key, in a message if several keys of the same name -* are present, the offset of the last one is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param offset : the address of a size_t where the offset will be set -* @return 0 if OK, integer value on error -*/ + * Get the number offset of a key, in a message if several keys of the same name + * are present, the offset of the last one is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param offset : the address of a size_t where the offset will be set + * @return 0 if OK, integer value on error + */ int codes_get_offset(const codes_handle* h, const char* key, size_t* offset); /** -* Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param size : the address of a size_t where the size will be set -* @return 0 if OK, integer value on error -*/ + * Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param size : the address of a size_t where the size will be set + * @return 0 if OK, integer value on error + */ int codes_get_size(const codes_handle* h, const char* key, size_t* size); /** -* Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param length : the address of a size_t where the length will be set -* @return 0 if OK, integer value on error -*/ + * Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param length : the address of a size_t where the length will be set + * @return 0 if OK, integer value on error + */ int codes_get_length(const codes_handle* h, const char* key, size_t* length); /** -* Get a long value from a key, if several keys of the same name are present, the last one is returned -* @see codes_set_long -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param value : the address of a long where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get a long value from a key, if several keys of the same name are present, the last one is returned + * @see codes_set_long + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param value : the address of a long where the data will be retrieved + * @return 0 if OK, integer value on error + */ int codes_get_long(const codes_handle* h, const char* key, long* value); /** -* Get a double value from a key, if several keys of the same name are present, the last one is returned -* @see codes_set_double -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param value : the address of a double where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get a double value from a key, if several keys of the same name are present, the last one is returned + * @see codes_set_double + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param value : the address of a double where the data will be retrieved + * @return 0 if OK, integer value on error + */ int codes_get_double(const codes_handle* h, const char* key, double* value); /** -* Get as double the i-th element of the "key" array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param i : zero-based index -* @param value : the address of a double where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get as double the i-th element of the "key" array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param i : zero-based index + * @param value : the address of a double where the data will be retrieved + * @return 0 if OK, integer value on error + */ int codes_get_double_element(const codes_handle* h, const char* key, int i, double* value); +int codes_get_float_element(const codes_handle* h, const char* key, int i, float* value); /** -* Get as double array the elements of the "key" array whose indexes are listed in the input array "index_array" -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param index_array : zero-based array of indexes -* @param size : size of the index_array and value arrays -* @param value : the double array for the data values -* @return 0 if OK, integer value on error -*/ + * Get as double array the elements of the "key" array whose indexes are listed in the input array "index_array" + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param index_array : zero-based array of indexes + * @param size : size of the index_array and value arrays + * @param value : the double array for the data values + * @return 0 if OK, integer value on error + */ int codes_get_double_elements(const codes_handle* h, const char* key, const int* index_array, long size, double* value); +int codes_get_float_elements(const codes_handle* h, const char* key, const int* index_array, long size, float* value); /** -* Get a string value from a key, if several keys of the same name are present, the last one is returned -* @see codes_set_string -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param mesg : the address of a string where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output -* @return 0 if OK, integer value on error -*/ + * Get a string value from a key, if several keys of the same name are present, the last one is returned + * @see codes_set_string + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param mesg : the address of a string where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output + * @return 0 if OK, integer value on error + */ int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t* length); /** -* Get string array values from a key. If several keys of the same name are present, the last one is returned -* @see codes_set_string_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a string array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output -* @return 0 if OK, integer value on error -*/ + * Get string array values from a key. If several keys of the same name are present, the last one is returned + * @see codes_set_string_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a string array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output + * @return 0 if OK, integer value on error + */ int codes_get_string_array(const codes_handle* h, const char* key, char** vals, size_t* length); /** -* Get raw bytes values from a key. If several keys of the same name are present, the last one is returned -* @see codes_set_bytes -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param bytes : the address of a byte array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output -* @return 0 if OK, integer value on error -*/ + * Get raw bytes values from a key. If several keys of the same name are present, the last one is returned + * @see codes_set_bytes + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param bytes : the address of a byte array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output + * @return 0 if OK, integer value on error + */ int codes_get_bytes(const codes_handle* h, const char* key, unsigned char* bytes, size_t* length); /** -* Get double array values from a key. If several keys of the same name are present, the last one is returned -* @see codes_set_double_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a double array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output -* @return 0 if OK, integer value on error -*/ + * Get double array values from a key. If several keys of the same name are present, the last one is returned + * @see codes_set_double_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a double array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output + * @return 0 if OK, integer value on error + */ int codes_get_double_array(const codes_handle* h, const char* key, double* vals, size_t* length); +int codes_get_float_array(const codes_handle* h, const char* key, float* vals, size_t* length); /** -* Get long array values from a key. If several keys of the same name are present, the last one is returned -* @see codes_set_long_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a long array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output -* @return 0 if OK, integer value on error -*/ + * Get long array values from a key. If several keys of the same name are present, the last one is returned + * @see codes_set_long_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a long array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output + * @return 0 if OK, integer value on error + */ int codes_get_long_array(const codes_handle* h, const char* key, long* vals, size_t* length); /* setting data */ /** -* Copy the keys belonging to a given namespace from a source handle to a destination handle -* -* -* @param dest : destination handle -* @param name : namespace -* @param src : source handle -* @return 0 if OK, integer value on error -*/ + * Copy the keys belonging to a given namespace from a source handle to a destination handle + * + * + * @param dest : destination handle + * @param name : namespace + * @param src : source handle + * @return 0 if OK, integer value on error + */ int codes_copy_namespace(codes_handle* dest, const char* name, codes_handle* src); /** -* Set a long value from a key. If several keys of the same name are present, the last one is set -* @see codes_get_long -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param val : a long where the data will be read -* @return 0 if OK, integer value on error -*/ + * Set a long value from a key. If several keys of the same name are present, the last one is set + * @see codes_get_long + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param val : a long where the data will be read + * @return 0 if OK, integer value on error + */ int codes_set_long(codes_handle* h, const char* key, long val); /** -* Set a double value from a key. If several keys of the same name are present, the last one is set -* @see codes_get_double -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param val : a double where the data will be read -* @return 0 if OK, integer value on error -*/ + * Set a double value from a key. If several keys of the same name are present, the last one is set + * @see codes_get_double + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param val : a double where the data will be read + * @return 0 if OK, integer value on error + */ int codes_set_double(codes_handle* h, const char* key, double val); /** -* Set a string value from a key. If several keys of the same name are present, the last one is set -* @see codes_get_string -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param mesg : the address of a string where the data will be read -* @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output -* @return 0 if OK, integer value on error -*/ + * Set a string value from a key. If several keys of the same name are present, the last one is set + * @see codes_get_string + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param mesg : the address of a string where the data will be read + * @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output + * @return 0 if OK, integer value on error + */ int codes_set_string(codes_handle* h, const char* key, const char* mesg, size_t* length); /** -* Set a bytes array from a key. If several keys of the same name are present, the last one is set -* @see codes_get_bytes -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param bytes : the address of a byte array where the data will be read -* @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output -* @return 0 if OK, integer value on error -*/ + * Set a bytes array from a key. If several keys of the same name are present, the last one is set + * @see codes_get_bytes + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param bytes : the address of a byte array where the data will be read + * @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output + * @return 0 if OK, integer value on error + */ int codes_set_bytes(codes_handle* h, const char* key, const unsigned char* bytes, size_t* length); /** -* Set a double array from a key. If several keys of the same name are present, the last one is set -* @see codes_get_double_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a double array where the data will be read -* @param length : a size_t that contains the length of the byte array on input -* @return 0 if OK, integer value on error -*/ + * Set a double array from a key. If several keys of the same name are present, the last one is set + * @see codes_get_double_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a double array where the data will be read + * @param length : a size_t that contains the length of the byte array on input + * @return 0 if OK, integer value on error + */ int codes_set_double_array(codes_handle* h, const char* key, const double* vals, size_t length); +int codes_set_float_array(codes_handle* h, const char* key, const float* vals, size_t length); /** -* Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues. -* Use with great caution!! -*/ + * Same as codes_set_double_array but allows setting of READ-ONLY keys like codedValues. + * Use with great caution!! + */ int codes_set_force_double_array(codes_handle* h, const char* key, const double* vals, size_t length); +int codes_set_force_float_array(codes_handle* h, const char* key, const float* vals, size_t length); /** -* Set a long array from a key. If several keys of the same name are present, the last one is set -* @see codes_get_long_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a long array where the data will be read -* @param length : a size_t that contains the length of the long array on input -* @return 0 if OK, integer value on error -*/ + * Set a long array from a key. If several keys of the same name are present, the last one is set + * @see codes_get_long_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a long array where the data will be read + * @param length : a size_t that contains the length of the long array on input + * @return 0 if OK, integer value on error + */ int codes_set_long_array(codes_handle* h, const char* key, const long* vals, size_t length); /** -* Set a string array from a key. If several keys of the same name are present, the last one is set -* @see codes_get_long_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a string array where the data will be read -* @param length : a size_t that contains the length of the array on input -* @return 0 if OK, integer value on error -*/ + * Set a string array from a key. If several keys of the same name are present, the last one is set + * @see codes_get_long_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a string array where the data will be read + * @param length : a size_t that contains the length of the array on input + * @return 0 if OK, integer value on error + */ int codes_set_string_array(codes_handle* h, const char* key, const char** vals, size_t length); /*! @} */ /** -* Print all keys, with the context print procedure and dump mode to a resource -* -* @param h : the handle to be printed -* @param out : output file handle -* @param mode : Examples of available dump modes: debug wmo -* @param option_flags : all the CODES_DUMP_FLAG_x flags can be used -* @param arg : used to provide a format to output data (experimental) -*/ + * Print all keys, with the context print procedure and dump mode to a resource + * + * @param h : the handle to be printed + * @param out : output file handle + * @param mode : Examples of available dump modes: debug wmo + * @param option_flags : all the CODES_DUMP_FLAG_x flags can be used + * @param arg : used to provide a format to output data (experimental) + */ void codes_dump_content(const codes_handle* h, FILE* out, const char* mode, unsigned long option_flags, void* arg); /** -* Print all keys from the parsed definition files available in a context -* -* @param f : the File used to print the keys on -* @param c : the context that contains the cached definition files to be printed -*/ + * Print all keys from the parsed definition files available in a context + * + * @param f : the File used to print the keys on + * @param c : the context that contains the cached definition files to be printed + */ void codes_dump_action_tree(codes_context* c, FILE* f); /*! \defgroup context The context object @@ -988,79 +996,79 @@ void codes_dump_action_tree(codes_context* c, FILE* f); /*! @{ */ /** -* ecCodes free procedure, format of a procedure referenced in the context that is used to free memory -* -* @param c : the context where the memory freeing will apply -* @param data : pointer to the data to be freed -* must match @see codes_malloc_proc -*/ + * ecCodes free procedure, format of a procedure referenced in the context that is used to free memory + * + * @param c : the context where the memory freeing will apply + * @param data : pointer to the data to be freed + * must match @see codes_malloc_proc + */ typedef void (*codes_free_proc)(const codes_context* c, void* data); /** -* ecCodes malloc procedure, format of a procedure referenced in the context that is used to allocate memory -* @param c : the context where the memory allocation will apply -* @param length : length to be allocated in number of bytes -* @return a pointer to the allocated memory, NULL if no memory can be allocated -* must match @see codes_free_proc -*/ + * ecCodes malloc procedure, format of a procedure referenced in the context that is used to allocate memory + * @param c : the context where the memory allocation will apply + * @param length : length to be allocated in number of bytes + * @return a pointer to the allocated memory, NULL if no memory can be allocated + * must match @see codes_free_proc + */ typedef void* (*codes_malloc_proc)(const codes_context* c, size_t length); /** -* ecCodes realloc procedure, format of a procedure referenced in the context that is used to reallocate memory -* @param c : the context where the memory allocation will apply -* @param data : pointer to the data to be reallocated -* @param length : length to be allocated in number of bytes -* @return a pointer to the allocated memory -*/ + * ecCodes realloc procedure, format of a procedure referenced in the context that is used to reallocate memory + * @param c : the context where the memory allocation will apply + * @param data : pointer to the data to be reallocated + * @param length : length to be allocated in number of bytes + * @return a pointer to the allocated memory + */ typedef void* (*codes_realloc_proc)(const codes_context* c, void* data, size_t length); /** -* ecCodes log procedure, format of a procedure referenced in the context that is used to log internal messages -* -* @param c : the context where the logging will apply -* @param level : the log level, as defined in log modes -* @param mesg : the message to be logged -*/ + * ecCodes log procedure, format of a procedure referenced in the context that is used to log internal messages + * + * @param c : the context where the logging will apply + * @param level : the log level, as defined in log modes + * @param mesg : the message to be logged + */ typedef void (*codes_log_proc)(const codes_context* c, int level, const char* mesg); /** -* ecCodes print procedure, format of a procedure referenced in the context that is used to print external messages -* -* @param c : the context where the logging will apply -* @param descriptor : the structure to be printed on, must match the implementation -* @param mesg : the message to be printed -*/ + * ecCodes print procedure, format of a procedure referenced in the context that is used to print external messages + * + * @param c : the context where the logging will apply + * @param descriptor : the structure to be printed on, must match the implementation + * @param mesg : the message to be printed + */ typedef void (*codes_print_proc)(const codes_context* c, void* descriptor, const char* mesg); /** -* ecCodes data read procedure, format of a procedure referenced in the context that is used to read from a stream in a resource -* -* @param c : the context where the read will apply -* @param ptr : the resource -* @param size : size to read -* @param stream : the stream -* @return size read -*/ + * ecCodes data read procedure, format of a procedure referenced in the context that is used to read from a stream in a resource + * + * @param c : the context where the read will apply + * @param ptr : the resource + * @param size : size to read + * @param stream : the stream + * @return size read + */ typedef size_t (*codes_data_read_proc)(const codes_context* c, void* ptr, size_t size, void* stream); /** -* ecCodes data write procedure, format of a procedure referenced in the context that is used to write to a stream from a resource -* -* @param c : the context where the write will apply -* @param ptr : the resource -* @param size : size to read -* @param stream : the stream -* @return size written -*/ + * ecCodes data write procedure, format of a procedure referenced in the context that is used to write to a stream from a resource + * + * @param c : the context where the write will apply + * @param ptr : the resource + * @param size : size to read + * @param stream : the stream + * @return size written + */ typedef size_t (*codes_data_write_proc)(const codes_context* c, const void* ptr, size_t size, void* stream); /** -* ecCodes data tell procedure, format of a procedure referenced in the context that is used to tell the current position in a stream -* -* @param c : the context where the tell will apply -* @param stream : the stream -* @return the position in the stream -*/ + * ecCodes data tell procedure, format of a procedure referenced in the context that is used to tell the current position in a stream + * + * @param c : the context where the tell will apply + * @param stream : the stream + * @return the position in the stream + */ typedef off_t (*codes_data_tell_proc)(const codes_context* c, void* stream); /** @@ -1076,65 +1084,65 @@ typedef off_t (*codes_data_tell_proc)(const codes_context* c, void* stream); typedef off_t (*codes_data_seek_proc)(const codes_context* c, off_t offset, int whence, void* stream); /** -* ecCodes data eof procedure, format of a procedure referenced in the context that is used to test end of file -* -* @param c : the context where the tell will apply -* @param stream : the stream -* @return the position in the stream -*/ + * ecCodes data eof procedure, format of a procedure referenced in the context that is used to test end of file + * + * @param c : the context where the tell will apply + * @param stream : the stream + * @return the position in the stream + */ typedef int (*codes_data_eof_proc)(const codes_context* c, void* stream); /** -* Get the static default context -* -* @return the default context, NULL it the context is not available -*/ + * Get the static default context + * + * @return the default context, NULL it the context is not available + */ codes_context* codes_context_get_default(void); /** -* Frees the cached definition files of the context -* -* @param c : the context to be deleted -*/ + * Frees the cached definition files of the context + * + * @param c : the context to be deleted + */ void codes_context_delete(codes_context* c); /** -* Set the GTS header mode on. -* The GTS headers will be preserved. -* -* @param c : the context -*/ + * Set the GTS header mode on. + * The GTS headers will be preserved. + * + * @param c : the context + */ void codes_gts_header_on(codes_context* c); /** -* Set the GTS header mode off. -* The GTS headers will be deleted. -* -* @param c : the context -*/ + * Set the GTS header mode off. + * The GTS headers will be deleted. + * + * @param c : the context + */ void codes_gts_header_off(codes_context* c); /** -* Set the GRIBEX mode on. -* GRIB files will be compatible with GRIBEX. -* -* @param c : the context -*/ + * Set the GRIBEX mode on. + * GRIB files will be compatible with GRIBEX. + * + * @param c : the context + */ void codes_gribex_mode_on(codes_context* c); /** -* Get the GRIBEX mode. -* -* @param c : the context -*/ + * Get the GRIBEX mode. + * + * @param c : the context + */ int codes_get_gribex_mode(codes_context* c); /** -* Set the GRIBEX mode off. -* GRIB files won't be always compatible with GRIBEX. -* -* @param c : the context -*/ + * Set the GRIBEX mode off. + * GRIB files won't be always compatible with GRIBEX. + * + * @param c : the context + */ void codes_gribex_mode_off(codes_context* c); @@ -1159,73 +1167,73 @@ void codes_context_set_definitions_path(codes_context* c, const char* path); void codes_context_set_samples_path(codes_context* c, const char* path); /** -* Sets memory procedures of the context -* -* @param c : the context to be modified -* @param p_malloc : the memory allocation procedure to be set @see codes_malloc_proc -* @param p_free : the memory freeing procedure to be set @see codes_free_proc -* @param p_realloc : the memory reallocation procedure to be set @see codes_realloc_proc -*/ -void codes_context_set_memory_proc(codes_context* c, codes_malloc_proc p_malloc, + * Sets memory procedures of the context + * + * @param c : the context to be modified + * @param p_malloc : the memory allocation procedure to be set @see codes_malloc_proc + * @param p_free : the memory freeing procedure to be set @see codes_free_proc + * @param p_realloc : the memory reallocation procedure to be set @see codes_realloc_proc + */ +void codes_context_set_memory_proc(codes_context* c, codes_malloc_proc p_malloc, codes_free_proc p_free, codes_realloc_proc p_realloc); /** -* Sets memory procedures of the context for persistent data -* -* @param c : the context to be modified -* @param griballoc : the memory allocation procedure to be set @see codes_malloc_proc -* @param gribfree : the memory freeing procedure to be set @see codes_free_proc -*/ + * Sets memory procedures of the context for persistent data + * + * @param c : the context to be modified + * @param griballoc : the memory allocation procedure to be set @see codes_malloc_proc + * @param gribfree : the memory freeing procedure to be set @see codes_free_proc + */ void codes_context_set_persistent_memory_proc(codes_context* c, codes_malloc_proc p_malloc, codes_free_proc p_free); /** -* Sets memory procedures of the context for large buffers -* -* @param c : the context to be modified -* @param p_malloc : the memory allocation procedure to be set @see codes_malloc_proc -* @param p_free : the memory freeing procedure to be set @see codes_free_proc -* @param p_free : the memory reallocation procedure to be set @see codes_realloc_proc -*/ -void codes_context_set_buffer_memory_proc(codes_context* c, codes_malloc_proc p_malloc, + * Sets memory procedures of the context for large buffers + * + * @param c : the context to be modified + * @param p_malloc : the memory allocation procedure to be set @see codes_malloc_proc + * @param p_free : the memory freeing procedure to be set @see codes_free_proc + * @param p_free : the memory reallocation procedure to be set @see codes_realloc_proc + */ +void codes_context_set_buffer_memory_proc(codes_context* c, codes_malloc_proc p_malloc, codes_free_proc p_free, codes_realloc_proc p_realloc); /** -* Sets the context printing procedure used for user interaction -* -* @param c : the context to be modified -* @param p_print : the printing procedure to be set @see codes_print_proc -*/ + * Sets the context printing procedure used for user interaction + * + * @param c : the context to be modified + * @param p_print : the printing procedure to be set @see codes_print_proc + */ void codes_context_set_print_proc(codes_context* c, codes_print_proc p_print); /** -* Sets the context logging procedure used for system (warning, errors, infos ...) messages -* -* @param c : the context to be modified -* @param p_log : the logging procedure to be set @see codes_log_proc -*/ + * Sets the context logging procedure used for system (warning, errors, infos ...) messages + * + * @param c : the context to be modified + * @param p_log : the logging procedure to be set @see codes_log_proc + */ void codes_context_set_logging_proc(codes_context* c, codes_log_proc p_log); /** -* Turn on support for multi-fields in single GRIB messages -* -* @param c : the context to be modified -*/ + * Turn on support for multi-fields in single GRIB messages + * + * @param c : the context to be modified + */ void codes_grib_multi_support_on(codes_context* c); /** -* Turn off support for multi-fields in single GRIB messages -* -* @param c : the context to be modified -*/ + * Turn off support for multi-fields in single GRIB messages + * + * @param c : the context to be modified + */ void codes_grib_multi_support_off(codes_context* c); /** -* Reset file handle in multiple GRIB field support mode -* -* @param c : the context to be modified -* @param f : the file pointer -*/ + * Reset file handle in multiple GRIB field support mode + * + * @param c : the context to be modified + * @param f : the file pointer + */ void codes_grib_multi_support_reset_file(codes_context* c, FILE* f); char* codes_samples_path(const codes_context* c); @@ -1233,32 +1241,32 @@ char* codes_definition_path(const codes_context* c); /*! @} */ /** -* Get the API version -* -* @return API version -*/ + * Get the API version + * + * @return API version + */ long codes_get_api_version(void); /** -* Get the Git version control SHA1 identifier -* -* @return character string with SHA1 identifier -*/ + * Get the Git version control SHA1 identifier + * + * @return character string with SHA1 identifier + */ const char* codes_get_git_sha1(void); const char* codes_get_build_date(void); /** -* Get the package name -* -* @return character string with package name -*/ + * Get the package name + * + * @return character string with package name + */ const char* codes_get_package_name(void); /** -* Prints the API version -* -*/ + * Prints the API version + * + */ void codes_print_api_version(FILE* out); /*! \defgroup keys_iterator Iterating on keys names @@ -1268,13 +1276,13 @@ attributes or by the namespace they belong to. */ /*! @{ */ /*! Create a new iterator from a valid and initialised handle. -* @param h : the handle whose keys you want to iterate -* @param filter_flags : flags to filter out some of the keys through their attributes -* @param name_space : if not null the iteration is carried out only on -* keys belonging to the namespace passed. (NULL for all the keys) -* @return keys iterator ready to iterate through keys according to filter_flags -* and namespace -*/ + * @param h : the handle whose keys you want to iterate + * @param filter_flags : flags to filter out some of the keys through their attributes + * @param name_space : if not null the iteration is carried out only on + * keys belonging to the namespace passed. (NULL for all the keys) + * @return keys iterator ready to iterate through keys according to filter_flags + * and namespace + */ codes_keys_iterator* codes_keys_iterator_new(codes_handle* h, unsigned long filter_flags, const char* name_space); /* codes_bufr_copy_data copies all the values in the data section that are present in the same position in the data tree @@ -1287,34 +1295,35 @@ int codes_bufr_copy_data(codes_handle* hin, codes_handle* hout); /*! Step to the next item from the keys iterator. -* @param kiter : valid codes_keys_iterator -* @return 1 if next iterator exists, 0 if no more elements to iterate on -*/ + * @param kiter : valid codes_keys_iterator + * @return 1 if next iterator exists, 0 if no more elements to iterate on + */ int codes_keys_iterator_next(codes_keys_iterator* kiter); /*! get the key name from the keys iterator -* @param kiter : valid codes_keys_iterator -* @return key name -*/ + * @param kiter : valid codes_keys_iterator + * @return key name + */ const char* codes_keys_iterator_get_name(const codes_keys_iterator* kiter); /*! Delete the keys iterator. -* @param kiter : valid codes_keys_iterator -* @return 0 if OK, integer value on error -*/ + * @param kiter : valid codes_keys_iterator + * @return 0 if OK, integer value on error + */ int codes_keys_iterator_delete(codes_keys_iterator* kiter); /*! Rewind the keys iterator. -* @param kiter : valid codes_keys_iterator -* @return 0 if OK, integer value on error -*/ + * @param kiter : valid codes_keys_iterator + * @return 0 if OK, integer value on error + */ int codes_keys_iterator_rewind(codes_keys_iterator* kiter); int codes_keys_iterator_set_flags(codes_keys_iterator* kiter, unsigned long flags); int codes_keys_iterator_get_long(const codes_keys_iterator* kiter, long* v, size_t* len); int codes_keys_iterator_get_double(const codes_keys_iterator* kiter, double* v, size_t* len); +int codes_keys_iterator_get_float(const codes_keys_iterator* kiter, float* v, size_t* len); int codes_keys_iterator_get_string(const codes_keys_iterator* kiter, char* v, size_t* len); int codes_keys_iterator_get_bytes(const codes_keys_iterator* kiter, unsigned char* v, size_t* len); @@ -1324,17 +1333,17 @@ void codes_update_sections_lengths(codes_handle* h); /** -* Convert an error code into a string -* @param code : the error code -* @return the error message -*/ + * Convert an error code into a string + * @param code : the error code + * @return the error message + */ const char* codes_get_error_message(int code); const char* codes_get_type_name(int type); int codes_get_native_type(const codes_handle* h, const char* name, int* type); void codes_check(const char* call, const char* file, int line, int e, const char* msg); -#define CODES_CHECK(a, msg) GRIB_CHECK(a, msg) +#define CODES_CHECK(a, msg) GRIB_CHECK(a, msg) #define CODES_CHECK_NOLINE(a, msg) GRIB_CHECK_NOLINE(a, msg) @@ -1374,36 +1383,36 @@ int codes_check_message_footer(const void* bytes, size_t length, ProductKind pro /* --------------------------------------- */ -#define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL -#define CODES_UTIL_GRID_SPEC_ROTATED_LL GRIB_UTIL_GRID_SPEC_ROTATED_LL -#define CODES_UTIL_GRID_SPEC_REGULAR_GG GRIB_UTIL_GRID_SPEC_REGULAR_GG -#define CODES_UTIL_GRID_SPEC_ROTATED_GG GRIB_UTIL_GRID_SPEC_ROTATED_GG -#define CODES_UTIL_GRID_SPEC_REDUCED_GG GRIB_UTIL_GRID_SPEC_REDUCED_GG -#define CODES_UTIL_GRID_SPEC_SH GRIB_UTIL_GRID_SPEC_SH -#define CODES_UTIL_GRID_SPEC_REDUCED_LL GRIB_UTIL_GRID_SPEC_REDUCED_LL -#define CODES_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC -#define CODES_UTIL_GRID_SPEC_REDUCED_ROTATED_GG GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG -#define CODES_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA -#define CODES_UTIL_GRID_SPEC_LAMBERT_CONFORMAL GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL -#define CODES_UTIL_GRID_SPEC_UNSTRUCTURED GRIB_UTIL_GRID_SPEC_UNSTRUCTURED +#define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL +#define CODES_UTIL_GRID_SPEC_ROTATED_LL GRIB_UTIL_GRID_SPEC_ROTATED_LL +#define CODES_UTIL_GRID_SPEC_REGULAR_GG GRIB_UTIL_GRID_SPEC_REGULAR_GG +#define CODES_UTIL_GRID_SPEC_ROTATED_GG GRIB_UTIL_GRID_SPEC_ROTATED_GG +#define CODES_UTIL_GRID_SPEC_REDUCED_GG GRIB_UTIL_GRID_SPEC_REDUCED_GG +#define CODES_UTIL_GRID_SPEC_SH GRIB_UTIL_GRID_SPEC_SH +#define CODES_UTIL_GRID_SPEC_REDUCED_LL GRIB_UTIL_GRID_SPEC_REDUCED_LL +#define CODES_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC +#define CODES_UTIL_GRID_SPEC_REDUCED_ROTATED_GG GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG +#define CODES_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA +#define CODES_UTIL_GRID_SPEC_LAMBERT_CONFORMAL GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL +#define CODES_UTIL_GRID_SPEC_UNSTRUCTURED GRIB_UTIL_GRID_SPEC_UNSTRUCTURED -#define CODES_UTIL_PACKING_TYPE_SAME_AS_INPUT GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT -#define CODES_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX -#define CODES_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE -#define CODES_UTIL_PACKING_TYPE_JPEG GRIB_UTIL_PACKING_TYPE_JPEG -#define CODES_UTIL_PACKING_TYPE_GRID_COMPLEX GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX -#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE -#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX -#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER -#define CODES_UTIL_PACKING_TYPE_CCSDS GRIB_UTIL_PACKING_TYPE_CCSDS -#define CODES_UTIL_PACKING_TYPE_IEEE GRIB_UTIL_PACKING_TYPE_IEEE -#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT -#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED +#define CODES_UTIL_PACKING_TYPE_SAME_AS_INPUT GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT +#define CODES_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX +#define CODES_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE +#define CODES_UTIL_PACKING_TYPE_JPEG GRIB_UTIL_PACKING_TYPE_JPEG +#define CODES_UTIL_PACKING_TYPE_GRID_COMPLEX GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX +#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE +#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX +#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER +#define CODES_UTIL_PACKING_TYPE_CCSDS GRIB_UTIL_PACKING_TYPE_CCSDS +#define CODES_UTIL_PACKING_TYPE_IEEE GRIB_UTIL_PACKING_TYPE_IEEE +#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT +#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED -#define CODES_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT -#define CODES_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES -#define CODES_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT -#define CODES_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR +#define CODES_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT +#define CODES_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES +#define CODES_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT +#define CODES_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR codes_handle* codes_grib_util_set_spec(codes_handle* h, diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index fd2f74ba3..4aced8486 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -1,5 +1,7 @@ +#pragma once + #ifdef ECCODES_ON_WINDOWS -#include + #include #endif /* action.cc */ @@ -115,6 +117,7 @@ int grib_pack_missing(grib_accessor* a); int grib_pack_zero(grib_accessor* a); int grib_is_missing_internal(grib_accessor* a); int grib_pack_double(grib_accessor* a, const double* v, size_t* len); +int grib_pack_float(grib_accessor* a, const float* v, size_t* len); int grib_pack_expression(grib_accessor* a, grib_expression* e); int grib_pack_string(grib_accessor* a, const char* v, size_t* len); int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len); @@ -123,12 +126,16 @@ int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len); int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len); int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_t len); int grib_unpack_double(grib_accessor* a, double* v, size_t* len); +int grib_unpack_float(grib_accessor* a, float* v, size_t* len); int grib_unpack_double_element(grib_accessor* a, size_t i, double* v); int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array); +int grib_unpack_float_element(grib_accessor* a, size_t i, float* v); +int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, size_t len, float* val_array); int grib_unpack_string(grib_accessor* a, char* v, size_t* len); int grib_unpack_string_array(grib_accessor* a, char** v, size_t* len); int grib_accessors_list_unpack_long(grib_accessors_list* al, long* val, size_t* buffer_len); int grib_accessors_list_unpack_double(grib_accessors_list* al, double* val, size_t* buffer_len); +int grib_accessors_list_unpack_float(grib_accessors_list* al, float* val, size_t* buffer_len); int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_t* buffer_len); int grib_unpack_long(grib_accessor* a, long* v, size_t* len); long grib_accessor_get_native_type(grib_accessor* a); @@ -831,7 +838,9 @@ int grib_nearest_smaller_ieee_float(double a, double* ret); unsigned long grib_ieee64_to_long(double x); double grib_long_to_ieee64(unsigned long x); -int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val); +// ECC-1467 +//int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val); +//int grib_ieee_decode_array_float(grib_context* c, unsigned char* buf, size_t nvals, int bytes, float* val); int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes, unsigned char* buf); /* grib_accessor_class_reference_value_error.cc*/ @@ -1070,12 +1079,11 @@ void grib_multi_support_reset(grib_context* c); /* grib_header_compute.cc*/ void print_math(grib_math* m); -grib_math* grib_math_clone(grib_context* c, grib_math* m); void grib_math_delete(grib_context* c, grib_math* m); grib_math* grib_math_new(grib_context* c, const char* formula, int* err); /* grib_hash_keys.cc*/ -const struct grib_keys_hash* grib_keys_hash_get(const char *str, size_t len); +const struct grib_keys_hash* grib_keys_hash_get(const char* str, size_t len); grib_itrie* grib_hash_keys_new(grib_context* c, int* count); void grib_hash_keys_delete(grib_itrie* t); int grib_hash_keys_get_id(grib_itrie* t, const char* key); @@ -1145,6 +1153,7 @@ grib_accessor* grib_keys_iterator_get_accessor(grib_keys_iterator* kiter); int grib_keys_iterator_delete(grib_keys_iterator* kiter); int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len); int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); int grib_keys_iterator_get_native_type(const grib_keys_iterator* kiter); @@ -1226,6 +1235,9 @@ int grib_set_flag(grib_handle* h, const char* name, unsigned long flag); int grib_set_double_array_internal(grib_handle* h, const char* name, const double* val, size_t length); int grib_set_force_double_array(grib_handle* h, const char* name, const double* val, size_t length); int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length); +int grib_set_float_array_internal(grib_handle* h, const char* name, const float* val, size_t length); +int grib_set_force_float_array(grib_handle* h, const char* name, const float* val, size_t length); +int grib_set_float_array(grib_handle* h, const char* name, const float* val, size_t length); 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); @@ -1236,10 +1248,16 @@ 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); int grib_get_double_element_internal(grib_handle* h, const char* name, int i, double* val); int grib_get_double_element(const grib_handle* h, const char* name, int i, double* val); +int grib_get_float_element(const grib_handle* h, const char* name, int i, float* val); + int grib_get_double_element_set_internal(grib_handle* h, const char* name, const size_t* index_array, size_t len, double* val_array); int grib_get_double_element_set(const grib_handle* h, const char* name, const size_t* index_array, size_t len, double* val_array); +int grib_get_float_element_set_internal(grib_handle* h, const char* name, const size_t* index_array, size_t len, float* val_array); +int grib_get_float_element_set(const grib_handle* h, const char* name, const size_t* index_array, size_t len, float* val_array); + int grib_points_get_values(grib_handle* h, grib_points* points, double* val); int grib_get_double_elements(const grib_handle* h, const char* name, const int* index_array, long len, double* val_array); +int grib_get_float_elements(const grib_handle* h, const char* name, const int* index_array, long len, float* val_array); int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t* length); int grib_get_string(const grib_handle* h, const char* name, char* val, size_t* length); int grib_get_bytes_internal(const grib_handle* h, const char* name, unsigned char* val, size_t* length); @@ -1247,8 +1265,12 @@ int grib_get_bytes(const grib_handle* h, const char* name, unsigned char* val, s int grib_get_native_type(const grib_handle* h, const char* name, int* type); const char* grib_get_accessor_class_name(grib_handle* h, const char* name); int ecc__grib_get_double_array_internal(const grib_handle* h, grib_accessor* a, double* val, size_t buffer_len, size_t* decoded_length); + int grib_get_double_array_internal(const grib_handle* h, const char* name, double* val, size_t* length); int grib_get_double_array(const grib_handle* h, const char* name, double* val, size_t* length); +int grib_get_float_array_internal(const grib_handle* h, const char* name, float* val, size_t* length); +int grib_get_float_array(const grib_handle* h, const char* name, float* val, size_t* length); + int ecc__grib_get_string_length(grib_accessor* a, size_t* size); int grib_get_string_length(const grib_handle* h, const char* name, size_t* size); int ecc__grib_get_size(const grib_handle* h, grib_accessor* a, size_t* size); @@ -1341,13 +1363,13 @@ int grib_nearest_get_radius(grib_handle* h, double* radiusInKm); void grib_binary_search(const double xx[], const size_t n, double x, size_t* ju, size_t* jl); int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, double* values, double* distances, int* indexes); int grib_nearest_find_generic(grib_nearest* nearest, grib_handle* h, double inlat, double inlon, unsigned long flags, - const char* values_keyname, const char* Ni_keyname, const char* Nj_keyname, - double** out_lats, - int* out_lats_count, - double** out_lons, - int* out_lons_count, - double** out_distances, - double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); + const char* values_keyname, const char* Ni_keyname, const char* Nj_keyname, + double** out_lats, + int* out_lats_count, + double** out_lons, + int* out_lons_count, + double** out_distances, + double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); /* grib_nearest_class.cc*/ grib_nearest* grib_nearest_factory(grib_handle* h, grib_arguments* args); @@ -1427,6 +1449,7 @@ int path_is_directory(const char* filename); char* codes_getenv(const char* name); int codes_check_grib_ieee_packing_value(int value); int codes_flush_sync_close_file(FILE* f); +int is_date_valid(long year, long month, long day, long hour, long minute, double second); /* grib_util.cc*/ grib_handle* grib_util_sections_copy(grib_handle* hfrom, grib_handle* hto, int what, int* err); @@ -1434,7 +1457,6 @@ grib_string_list* grib_util_get_param_id(const char* mars_param); grib_string_list* grib_util_get_mars_param(const char* param_id); grib_handle* grib_util_set_spec(grib_handle* h, const grib_util_grid_spec* spec, const grib_util_packing_spec* packing_spec, int flags, const double* data_values, size_t data_values_count, int* err); grib_handle* grib_util_set_spec2(grib_handle* h, const grib_util_grid_spec2* spec, const grib_util_packing_spec* packing_spec, int flags, const double* data_values, size_t data_values_count, int* err); -int grib_moments(grib_handle* h, double east, double north, double west, double south, int order, double* moments, long* count); int parse_keyval_string(const char* grib_tool, char* arg, int values_required, int default_type, grib_values values[], int* count); int grib2_is_PDTN_EPS(long productDefinitionTemplateNumber); int grib2_is_PDTN_Chemical(long productDefinitionTemplateNumber); @@ -1468,8 +1490,8 @@ int string_ends_with(const char* str1, const char* str2); int string_count_char(const char* str, char c); const char* codes_get_product_name(ProductKind product); const char* grib_get_type_name(int type); -char* string_replace_char(char *str, char oldc, char newc); -void string_remove_char(char * str, char c); +char* string_replace_char(char* str, char oldc, char newc); +void string_remove_char(char* str, char c); /* functions.cc*/ long grib_op_eq(long a, long b); @@ -1528,7 +1550,8 @@ int grib_encode_size_tb(unsigned char* p, size_t val, long* bitp, long nb); /* grib_bits_any_endian_simple.cc*/ int grib_decode_long_array(const unsigned char* p, long* bitp, long bitsPerValue, size_t n_vals, long* val); -int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerValue, double reference_value, double s, double d, size_t n_vals, double* val); +//int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerValue, double reference_value, double s, double d, size_t n_vals, double* val); +//int grib_decode_float_array(const unsigned char* p, long* bitp, long bitsPerValue, double reference_value, double s, double d, size_t n_vals, float* val); int grib_decode_double_array_complex(const unsigned char* p, long* bitp, long nbits, double reference_value, double s, double* d, size_t size, double* val); int grib_encode_long_array(size_t n_vals, const long* val, long bits_per_value, unsigned char* p, long* off); int grib_encode_double_array(size_t n_vals, const double* val, long bits_per_value, double reference_value, double d, double divisor, unsigned char* p, long* off); diff --git a/src/grib_accessor.cc b/src/grib_accessor.cc index 148005780..44e5fe0ea 100644 --- a/src/grib_accessor.cc +++ b/src/grib_accessor.cc @@ -14,7 +14,7 @@ * * ***************************************************************************/ -#include "grib_api_internal.h" +#include "grib_accessor.h" /* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* 0 means input strings are equal and 1 means not equal */ @@ -98,6 +98,19 @@ int grib_pack_double(grib_accessor* a, const double* v, size_t* len) return 0; } +int grib_pack_float(grib_accessor* a, const float* v, size_t* len) +{ + grib_accessor_class* c = a->cclass; + while (c) { + if (c->pack_float) { + return c->pack_float(a, v, len); + } + c = c->super ? *(c->super) : NULL; + } + DebugAssert(0); + return 0; +} + int grib_pack_expression(grib_accessor* a, grib_expression* e) { grib_accessor_class* c = a->cclass; @@ -209,6 +222,32 @@ int grib_unpack_double(grib_accessor* a, double* v, size_t* len) return 0; } +int grib_unpack_float(grib_accessor* a, float* v, size_t* len) +{ + grib_accessor_class* c = a->cclass; + while (c) { + /* printf("grib_accessor.c grib_unpack_float:: c->name=%s\n",c->name); */ + if (c->unpack_float) { + return c->unpack_float(a, v, len); + } + c = c->super ? *(c->super) : NULL; + } + DebugAssert(0); + return 0; +} + +template <> +int grib_unpack(grib_accessor* a, double* v, size_t* len) +{ + return grib_unpack_double(a, v, len); +} + +template <> +int grib_unpack(grib_accessor* a, float* v, size_t* len) +{ + return grib_unpack_float(a, v, len); +} + int grib_unpack_double_element(grib_accessor* a, size_t i, double* v) { grib_accessor_class* c = a->cclass; @@ -220,6 +259,18 @@ int grib_unpack_double_element(grib_accessor* a, size_t i, double* v) } return GRIB_NOT_IMPLEMENTED; } +int grib_unpack_float_element(grib_accessor* a, size_t i, float* v) +{ + /* grib_accessor_class* c = a->cclass; + * while (c) { + * if (c->unpack_float_element) { + * return c->unpack_float_element(a, i, v); + * } + * c = c->super ? *(c->super) : NULL; + * } + */ + return GRIB_NOT_IMPLEMENTED; +} /* Get the values for the indices passed in. * The length of the 'index_array' argument should be 'len' and 'val_array' should also contain at least 'len' elements @@ -236,6 +287,20 @@ int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, } return GRIB_NOT_IMPLEMENTED; } +int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, size_t len, float* val_array) +{ + /* + *grib_accessor_class* c = a->cclass; + *DebugAssert(len > 0); + *while (c) { + * if (c->unpack_float_element_set) { + * return c->unpack_float_element_set(a, index_array, len, val_array); + * } + * c = c->super ? *(c->super) : NULL; + *} + */ + return GRIB_NOT_IMPLEMENTED; +} int grib_unpack_string(grib_accessor* a, char* v, size_t* len) { @@ -298,6 +363,23 @@ int grib_accessors_list_unpack_double(grib_accessors_list* al, double* val, size return err; } +int grib_accessors_list_unpack_float(grib_accessors_list* al, float* val, size_t* buffer_len) +{ + int err = GRIB_SUCCESS; + size_t unpacked_len = 0; + size_t len = 0; + + while (al && err == GRIB_SUCCESS) { + len = *buffer_len - unpacked_len; + err = grib_unpack_float(al->accessor, val + unpacked_len, &len); + unpacked_len += len; + al = al->next; + } + + *buffer_len = unpacked_len; + return err; +} + int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_t* buffer_len) { int err = GRIB_SUCCESS; diff --git a/src/grib_accessor.h b/src/grib_accessor.h new file mode 100644 index 000000000..f91b6312b --- /dev/null +++ b/src/grib_accessor.h @@ -0,0 +1,5 @@ +# pragma once + +#include "grib_api_internal.h" + +template int grib_unpack(grib_accessor* a, T* v, size_t* len); diff --git a/src/grib_accessor_class_abstract_long_vector.cc b/src/grib_accessor_class_abstract_long_vector.cc index 337a23f85..b411df584 100644 --- a/src/grib_accessor_class_abstract_long_vector.cc +++ b/src/grib_accessor_class_abstract_long_vector.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_abstract_long_vector = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_abstract_long_vector = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_abstract_vector.cc b/src/grib_accessor_class_abstract_vector.cc index ef601c3c1..1e15ee282 100644 --- a/src/grib_accessor_class_abstract_vector.cc +++ b/src/grib_accessor_class_abstract_vector.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_abstract_vector = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_abstract_vector = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_apply_operators.cc b/src/grib_accessor_class_apply_operators.cc index 2f7c9a5d3..e03007b42 100644 --- a/src/grib_accessor_class_apply_operators.cc +++ b/src/grib_accessor_class_apply_operators.cc @@ -126,7 +126,9 @@ static grib_accessor_class _grib_accessor_class_apply_operators = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -142,7 +144,9 @@ static grib_accessor_class _grib_accessor_class_apply_operators = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -161,6 +165,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -175,7 +181,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -263,7 +271,7 @@ static int get_native_type(grib_accessor* a) size_t compute_size_AO(const long* descriptors, size_t numberOfDescriptors) { - int i = 0; + size_t i = 0; size_t sizeAO = numberOfDescriptors; int extraElement = 0; int X, F, Y; @@ -653,7 +661,7 @@ static int unpack_string_array(grib_accessor* a, char** val, size_t* len) { grib_accessor_apply_operators* self = (grib_accessor_apply_operators*)a; int ret = 0; - int i = 0; + size_t i = 0; grib_context* c = a->context; ret = apply_operators(a); diff --git a/src/grib_accessor_class_array.cc b/src/grib_accessor_class_array.cc index 97e7077f9..321411730 100644 --- a/src/grib_accessor_class_array.cc +++ b/src/grib_accessor_class_array.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_array = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_array = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_ascii.cc b/src/grib_accessor_class_ascii.cc index 985719457..ccac8bbd5 100644 --- a/src/grib_accessor_class_ascii.cc +++ b/src/grib_accessor_class_ascii.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_ascii = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_ascii = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,6 +122,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -167,17 +175,18 @@ static int get_native_type(grib_accessor* a) static int unpack_string(grib_accessor* a, char* val, size_t* len) { - int i = 0; + size_t i = 0; grib_handle* hand = grib_handle_of_accessor(a); + const size_t alen = a->length; - if (len[0] < (a->length + 1)) { - grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s it contains %ld values", + if (len[0] < (alen + 1)) { + grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%zu) for %s, it contains %ld values", len[0], a->name, a->length + 1); len[0] = 0; return GRIB_ARRAY_TOO_SMALL; } - for (i = 0; i < a->length; i++) + for (i = 0; i < alen; i++) val[i] = hand->buffer->data[a->offset + i]; val[i] = 0; len[0] = i; @@ -186,16 +195,17 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) static int pack_string(grib_accessor* a, const char* val, size_t* len) { - int i = 0; + size_t i = 0; grib_handle* hand = grib_handle_of_accessor(a); - if (len[0] > (a->length) + 1) { + const size_t alen = a->length; + if (len[0] > (alen + 1)) { grib_context_log(a->context, GRIB_LOG_ERROR, - "pack_string: Wrong size (%lu) for %s it contains %ld values", len[0], a->name, a->length + 1); + "pack_string: Wrong size (%zu) for %s, it contains %ld values", len[0], a->name, a->length + 1); len[0] = 0; return GRIB_BUFFER_TOO_SMALL; } - for (i = 0; i < a->length; i++) { + for (i = 0; i < alen; i++) { if (i < len[0]) hand->buffer->data[a->offset + i] = val[i]; else diff --git a/src/grib_accessor_class_assert.cc b/src/grib_accessor_class_assert.cc index 9c07fb6fe..9a73a67ae 100644 --- a/src/grib_accessor_class_assert.cc +++ b/src/grib_accessor_class_assert.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_assert = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_assert = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bit.cc b/src/grib_accessor_class_bit.cc index 26c0e9726..5a646ddaf 100644 --- a/src/grib_accessor_class_bit.cc +++ b/src/grib_accessor_class_bit.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_bit = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_bit = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bitmap.cc b/src/grib_accessor_class_bitmap.cc index 922634318..5a16b0ef1 100644 --- a/src/grib_accessor_class_bitmap.cc +++ b/src/grib_accessor_class_bitmap.cc @@ -9,6 +9,8 @@ */ #include "grib_api_internal.h" +#include + /* This is used by make_class.pl @@ -18,6 +20,7 @@ IMPLEMENTS = next_offset IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set + IMPLEMENTS = unpack_float IMPLEMENTS = unpack_long IMPLEMENTS = unpack_string IMPLEMENTS = init;dump;update_size @@ -40,6 +43,7 @@ or edit "accessor.class" and rerun ./make_class.pl */ static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* 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); static long next_offset(grib_accessor*); @@ -86,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_bitmap = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -102,7 +108,9 @@ static grib_accessor_class _grib_accessor_class_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -124,6 +132,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -136,6 +145,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -238,8 +249,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +template +int unpack(grib_accessor* a, T* val, size_t* len) { + static_assert(std::is_floating_point::value, "Requires floating points numbers"); long pos = a->offset * 8; long tlen; long i; @@ -251,18 +264,28 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; if (*len < tlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %ld values", a->name, tlen); + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %ld values", a->name, tlen); *len = 0; return GRIB_ARRAY_TOO_SMALL; } for (i = 0; i < tlen; i++) { - val[i] = (double)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); + val[i] = (T)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); } *len = tlen; return GRIB_SUCCESS; } +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + static int unpack_double_element(grib_accessor* a, size_t idx, double* val) { long pos = a->offset * 8; diff --git a/src/grib_accessor_class_bits.cc b/src/grib_accessor_class_bits.cc index 0257f5792..62a21bdb3 100644 --- a/src/grib_accessor_class_bits.cc +++ b/src/grib_accessor_class_bits.cc @@ -96,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_bits = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -112,7 +114,9 @@ static grib_accessor_class _grib_accessor_class_bits = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -132,6 +136,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -145,7 +151,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bits_per_value.cc b/src/grib_accessor_class_bits_per_value.cc index b040db6c3..f6b69cda6 100644 --- a/src/grib_accessor_class_bits_per_value.cc +++ b/src/grib_accessor_class_bits_per_value.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_bits_per_value = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_bits_per_value = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_blob.cc b/src/grib_accessor_class_blob.cc index 841f15209..13c49cc27 100644 --- a/src/grib_accessor_class_blob.cc +++ b/src/grib_accessor_class_blob.cc @@ -68,7 +68,9 @@ static grib_accessor_class _grib_accessor_class_blob = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -84,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_blob = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -143,7 +151,7 @@ static int get_native_type(grib_accessor* a) static int unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) { - if (*len < a->length) { + if (*len < (size_t)a->length) { *len = a->length; return GRIB_ARRAY_TOO_SMALL; } diff --git a/src/grib_accessor_class_box.cc b/src/grib_accessor_class_box.cc index 5e4c2e18b..4b31b9889 100644 --- a/src/grib_accessor_class_box.cc +++ b/src/grib_accessor_class_box.cc @@ -68,7 +68,9 @@ static grib_accessor_class _grib_accessor_class_box = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -84,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_box = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -108,7 +112,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_budgdate.cc b/src/grib_accessor_class_budgdate.cc index b3ed12e7c..24d354b7b 100644 --- a/src/grib_accessor_class_budgdate.cc +++ b/src/grib_accessor_class_budgdate.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_budgdate = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_budgdate = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_data_array.cc b/src/grib_accessor_class_bufr_data_array.cc index 222e9194e..222de3299 100644 --- a/src/grib_accessor_class_bufr_data_array.cc +++ b/src/grib_accessor_class_bufr_data_array.cc @@ -178,7 +178,9 @@ static grib_accessor_class _grib_accessor_class_bufr_data_array = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -194,7 +196,9 @@ static grib_accessor_class _grib_accessor_class_bufr_data_array = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -211,6 +215,8 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -225,7 +231,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -743,7 +751,12 @@ static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bu modifiedWidth = bd->width; grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + modifiedWidth); - grib_encode_string(buff->data, pos, modifiedWidth / 8, stringValues->v[ival]); + err = grib_encode_string(buff->data, pos, modifiedWidth / 8, stringValues->v[ival]); + if (err) { + grib_context_log(c, GRIB_LOG_ERROR, "encode_string_array: %s. Failed to encode '%s'", + bd->shortName, stringValues->v[ival]); + return err; + } width = n > 1 ? modifiedWidth : 0; grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + 6); @@ -752,7 +765,12 @@ static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bu grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + width * n); for (j = 0; j < n; j++) { k = self->iss_list->v[j]; - grib_encode_string(buff->data, pos, width / 8, stringValues->v[k]); + err = grib_encode_string(buff->data, pos, width / 8, stringValues->v[k]); + if (err) { + grib_context_log(c, GRIB_LOG_ERROR, "encode_string_array: %s. Failed to encode '%s'", + bd->shortName, stringValues->v[k]); + return err; + } } } return err; @@ -798,8 +816,8 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu double min = 0, max = 0, maxAllowed, minAllowed; double* v = NULL; double* values = NULL; - int thereIsAMissing = 0; - int is_constant; + bool thereIsAMissing = false; + bool is_constant = true; double val0; /* ECC-379, ECC-830 */ const int dont_fail_if_out_of_range = self->set_to_missing_if_out_of_range; @@ -845,7 +863,7 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu grib_set_bits_on(buff->data, pos, modifiedWidth); } else { - grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).", + grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06ld). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).", bd->shortName, bd->code, *v, minAllowed, maxAllowed); return GRIB_OUT_OF_RANGE; /* ECC-611 */ } @@ -864,16 +882,16 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu return GRIB_ARRAY_TOO_SMALL; values = (double*)grib_context_malloc_clear(c, sizeof(double) * nvals); val0 = dvalues->v[self->iss_list->v[0]]; - is_constant = 1; + is_constant = true; for (i = 0; i < nvals; i++) { values[i] = dvalues->v[self->iss_list->v[i]]; if (val0 != values[i]) - is_constant = 0; + is_constant = false; } v = values; /* encoding a range with constant values*/ - if (is_constant == 1) { + if (is_constant) { localWidth = 0; grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + modifiedWidth); if (*v == GRIB_MISSING_DOUBLE) { @@ -891,7 +909,7 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu ii = 0; while (ii < nvals && *v == GRIB_MISSING_DOUBLE) { - thereIsAMissing = 1; + thereIsAMissing = true; v++; ii++; } @@ -932,17 +950,17 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu index_of_max = ii; } if (*v == GRIB_MISSING_DOUBLE) - thereIsAMissing = 1; + thereIsAMissing = true; ii++; v++; } if (max > maxAllowed && max != GRIB_MISSING_DOUBLE) { - grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Maximum value (value[%lu]=%g) out of range (maxAllowed=%g).", + grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06ld). Maximum value (value[%lu]=%g) out of range (maxAllowed=%g).", bd->shortName, bd->code, index_of_max, max, maxAllowed); return GRIB_OUT_OF_RANGE; } if (min < minAllowed && min != GRIB_MISSING_DOUBLE) { - grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Minimum value (value[%lu]=%g) out of range (minAllowed=%g).", + grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06ld). Minimum value (value[%lu]=%g) out of range (minAllowed=%g).", bd->shortName, bd->code, index_of_min, min, minAllowed); return GRIB_OUT_OF_RANGE; } @@ -962,7 +980,7 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu localWidth++; } else { - if (thereIsAMissing == 1) + if (thereIsAMissing) localWidth = 1; else localWidth = 0; @@ -1034,7 +1052,7 @@ static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bu grib_set_bits_on(buff->data, pos, modifiedWidth); } else { - grib_context_log(c, GRIB_LOG_ERROR, "encode_double_value: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).", + grib_context_log(c, GRIB_LOG_ERROR, "encode_double_value: %s (%06ld). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).", bd->shortName, bd->code, value, minAllowed, maxAllowed); return GRIB_OUT_OF_RANGE; } @@ -1057,8 +1075,10 @@ static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bu len = bd->width / 8; grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + bd->width); - - grib_encode_string(buff->data, pos, len, sval); + err = grib_encode_string(buff->data, pos, len, sval); + if (err) { + grib_context_log(c, GRIB_LOG_ERROR, "encode_string_value: %s. Failed to encode '%s'", bd->shortName, sval); + } return err; } diff --git a/src/grib_accessor_class_bufr_data_element.cc b/src/grib_accessor_class_bufr_data_element.cc index 75efd13e6..5dbd0ef96 100644 --- a/src/grib_accessor_class_bufr_data_element.cc +++ b/src/grib_accessor_class_bufr_data_element.cc @@ -110,7 +110,9 @@ static grib_accessor_class _grib_accessor_class_bufr_data_element = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ &pack_string_array, /* grib_pack array procedures string */ @@ -126,7 +128,9 @@ static grib_accessor_class _grib_accessor_class_bufr_data_element = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ &make_clone, /* clone accessor */ @@ -143,6 +147,8 @@ static void init_class(grib_accessor_class* c) c->byte_count = (*(c->super))->byte_count; c->byte_offset = (*(c->super))->byte_offset; c->sub_section = (*(c->super))->sub_section; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_bytes = (*(c->super))->pack_bytes; c->unpack_bytes = (*(c->super))->unpack_bytes; c->pack_expression = (*(c->super))->pack_expression; @@ -153,7 +159,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; } @@ -448,7 +456,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) value_count(a, &count); - if (*len < count) + if (*len < (size_t)count) return GRIB_ARRAY_TOO_SMALL; if (self->compressedData) { @@ -477,7 +485,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) value_count(a, &count); - if (*len < count) + if (*len < (size_t)count) return GRIB_ARRAY_TOO_SMALL; if (self->compressedData) { @@ -589,11 +597,11 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) { /* ECC-415 */ grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_SUCCESS; - long count = 0; + int ret = GRIB_SUCCESS; + long count = 0; value_count(a, &count); - if (idx >= count) { + if (idx >= (size_t)count) { return GRIB_INTERNAL_ERROR; } diff --git a/src/grib_accessor_class_bufr_elements_table.cc b/src/grib_accessor_class_bufr_elements_table.cc index 41dc8f4ec..14fb769e2 100644 --- a/src/grib_accessor_class_bufr_elements_table.cc +++ b/src/grib_accessor_class_bufr_elements_table.cc @@ -109,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_bufr_elements_table = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -125,7 +127,9 @@ static grib_accessor_class _grib_accessor_class_bufr_elements_table = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -147,6 +151,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -161,7 +167,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_extract_area_subsets.cc b/src/grib_accessor_class_bufr_extract_area_subsets.cc index b7ef42e7b..5d2176daa 100644 --- a/src/grib_accessor_class_bufr_extract_area_subsets.cc +++ b/src/grib_accessor_class_bufr_extract_area_subsets.cc @@ -87,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_area_subsets = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -103,7 +105,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_area_subsets = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -142,7 +148,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_extract_datetime_subsets.cc b/src/grib_accessor_class_bufr_extract_datetime_subsets.cc index 297030ac3..8a2aee911 100644 --- a/src/grib_accessor_class_bufr_extract_datetime_subsets.cc +++ b/src/grib_accessor_class_bufr_extract_datetime_subsets.cc @@ -73,7 +73,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_datetime_subsets = &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -89,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_datetime_subsets = 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_extract_subsets.cc b/src/grib_accessor_class_bufr_extract_subsets.cc index de287fb04..d618e9f4d 100644 --- a/src/grib_accessor_class_bufr_extract_subsets.cc +++ b/src/grib_accessor_class_bufr_extract_subsets.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_subsets = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_bufr_extract_subsets = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_group.cc b/src/grib_accessor_class_bufr_group.cc index 84623ef97..350ce034b 100644 --- a/src/grib_accessor_class_bufr_group.cc +++ b/src/grib_accessor_class_bufr_group.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_bufr_group = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_bufr_group = { &next, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,7 +115,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_simple_thinning.cc b/src/grib_accessor_class_bufr_simple_thinning.cc index 4496fa263..9d3544122 100644 --- a/src/grib_accessor_class_bufr_simple_thinning.cc +++ b/src/grib_accessor_class_bufr_simple_thinning.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_bufr_simple_thinning = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_bufr_simple_thinning = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufr_string_values.cc b/src/grib_accessor_class_bufr_string_values.cc index 93c827e16..ba78d3c77 100644 --- a/src/grib_accessor_class_bufr_string_values.cc +++ b/src/grib_accessor_class_bufr_string_values.cc @@ -87,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_bufr_string_values = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ &pack_string_array, /* grib_pack array procedures string */ @@ -103,7 +105,9 @@ static grib_accessor_class _grib_accessor_class_bufr_string_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_bytes = (*(c->super))->pack_bytes; c->unpack_bytes = (*(c->super))->unpack_bytes; c->pack_expression = (*(c->super))->pack_expression; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bufrdc_expanded_descriptors.cc b/src/grib_accessor_class_bufrdc_expanded_descriptors.cc index b284da343..77115dfe1 100644 --- a/src/grib_accessor_class_bufrdc_expanded_descriptors.cc +++ b/src/grib_accessor_class_bufrdc_expanded_descriptors.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_bufrdc_expanded_descriptors = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_bufrdc_expanded_descriptors = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -123,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_bytes.cc b/src/grib_accessor_class_bytes.cc index 5ecf84ad0..4dd770a06 100644 --- a/src/grib_accessor_class_bytes.cc +++ b/src/grib_accessor_class_bytes.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_bytes = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_bytes = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -159,11 +167,11 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) { unsigned char* p = NULL; char* s = v; - int i; + long i = 0; const long length = grib_byte_count(a); const long slength = 2 * length; - if (*len < slength) { + if (*len < (size_t)slength) { *len = slength; return GRIB_ARRAY_TOO_SMALL; } diff --git a/src/grib_accessor_class_change_alternative_row_scanning.cc b/src/grib_accessor_class_change_alternative_row_scanning.cc index a780ec82b..c561e4818 100644 --- a/src/grib_accessor_class_change_alternative_row_scanning.cc +++ b/src/grib_accessor_class_change_alternative_row_scanning.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_change_alternative_row_scanning &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_change_alternative_row_scanning 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -187,8 +195,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) return err; - if (size > Ni * Nj) { - grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: wrong values size!=Ni*Nj (%ld!=%ld*%ld)", size, Ni, Nj); + if ( size > (size_t)(Ni * Nj) ) { + grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: wrong values size!=Ni*Nj (%zu!=%ld*%ld)", size, Ni, Nj); return GRIB_WRONG_ARRAY_SIZE; } diff --git a/src/grib_accessor_class_change_scanning_direction.cc b/src/grib_accessor_class_change_scanning_direction.cc index f7bb4a97e..dd480fb77 100644 --- a/src/grib_accessor_class_change_scanning_direction.cc +++ b/src/grib_accessor_class_change_scanning_direction.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_change_scanning_direction = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_change_scanning_direction = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -123,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -139,7 +145,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_check_internal_version.cc b/src/grib_accessor_class_check_internal_version.cc index a9ed47c26..6e7e1d9ba 100644 --- a/src/grib_accessor_class_check_internal_version.cc +++ b/src/grib_accessor_class_check_internal_version.cc @@ -68,7 +68,9 @@ static grib_accessor_class _grib_accessor_class_check_internal_version = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -84,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_check_internal_version = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_closest_date.cc b/src/grib_accessor_class_closest_date.cc index 417378473..b735e3aed 100644 --- a/src/grib_accessor_class_closest_date.cc +++ b/src/grib_accessor_class_closest_date.cc @@ -91,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_closest_date = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -107,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_closest_date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -130,6 +134,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -145,7 +151,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_codeflag.cc b/src/grib_accessor_class_codeflag.cc index f3ced0315..4f2eba341 100644 --- a/src/grib_accessor_class_codeflag.cc +++ b/src/grib_accessor_class_codeflag.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_codeflag = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_codeflag = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -168,7 +176,10 @@ static int grib_get_codeflag(grib_accessor* a, long code, char* codename) int err = 0; err = grib_recompose_name(grib_handle_of_accessor(a), NULL, self->tablename, fname, 1); - if (err) strncpy(fname, self->tablename, 1023); + if (err) { + strncpy(fname, self->tablename, sizeof(fname)-1); + fname[sizeof(fname)-1] = '\0'; + } if ((filename = grib_context_full_defs_path(a->context, fname)) == NULL) { grib_context_log(a->context, GRIB_LOG_WARNING, "Cannot open flag table %s", filename); diff --git a/src/grib_accessor_class_codetable.cc b/src/grib_accessor_class_codetable.cc index 356758a23..8b525e246 100644 --- a/src/grib_accessor_class_codetable.cc +++ b/src/grib_accessor_class_codetable.cc @@ -121,7 +121,9 @@ static grib_accessor_class _grib_accessor_class_codetable = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -137,7 +139,9 @@ static grib_accessor_class _grib_accessor_class_codetable = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -158,7 +162,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -171,7 +177,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_codetable_title.cc b/src/grib_accessor_class_codetable_title.cc index 648c5db7e..897a7b2b2 100644 --- a/src/grib_accessor_class_codetable_title.cc +++ b/src/grib_accessor_class_codetable_title.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_codetable_title = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_codetable_title = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_codetable_units.cc b/src/grib_accessor_class_codetable_units.cc index 1f40b46ad..9f1d40e0a 100644 --- a/src/grib_accessor_class_codetable_units.cc +++ b/src/grib_accessor_class_codetable_units.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_codetable_units = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_codetable_units = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_concept.cc b/src/grib_accessor_class_concept.cc index 9fb598f3b..f89072177 100644 --- a/src/grib_accessor_class_concept.cc +++ b/src/grib_accessor_class_concept.cc @@ -86,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_concept = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -102,7 +104,9 @@ static grib_accessor_class _grib_accessor_class_concept = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,6 +124,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -342,6 +350,31 @@ static int cmpstringp(const void* p1, const void* p2) return strcmp(*(char* const*)p1, *(char* const*)p2); } +static bool blacklisted(grib_handle* h, long edition, const char* concept_name, const char* concept_value) +{ + if ( strcmp(concept_name, "packingType")==0 ) { + char input_packing_type[100]; + size_t len = sizeof(input_packing_type); + if (strstr(concept_value, "SPD")) { + return true; + } + if (edition == 2 && strstr(concept_value, "grid_run_length")) { + return true; + } + if (edition == 1 && (strstr(concept_value, "ccsds") || strstr(concept_value, "jpeg"))) { + return true; + } + grib_get_string(h, "packingType", input_packing_type, &len); + if (strstr(input_packing_type,"grid_") && !strstr(concept_value,"grid_")) { + return true; + } + if (strstr(input_packing_type,"spectral_") && !strstr(concept_value,"spectral_")) { + return true; + } + } + return false; +} + static int grib_concept_apply(grib_accessor* a, const char* name) { int err = 0; @@ -379,11 +412,11 @@ static int grib_concept_apply(grib_accessor* a, const char* name) } if (strcmp(act->name, "paramId") == 0 && string_to_long(name, &dummy) == GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, - "Please check the Parameter Database 'https://apps.ecmwf.int/codes/grib/param-db/?id=%s'", name); + "Please check the Parameter Database 'https://codes.ecmwf.int/grib/param-db/?id=%s'", name); } if (strcmp(act->name, "shortName") == 0) { grib_context_log(h->context, GRIB_LOG_ERROR, - "Please check the Parameter Database 'https://apps.ecmwf.int/codes/grib/param-db/'"); + "Please check the Parameter Database 'https://codes.ecmwf.int/grib/param-db/'"); } /* Create a list of all possible values for this concept and sort it */ @@ -397,16 +430,20 @@ static int grib_concept_apply(grib_accessor* a, const char* name) /* Only print out all concepts if fewer than MAX_NUM_CONCEPT_VALUES. * Printing out all values for concepts like paramId would be silly! */ if (concept_count < MAX_NUM_CONCEPT_VALUES) { - fprintf(stderr, "Here are the possible values for concept %s:\n", act->name); + fprintf(stderr, "Here are some possible values for concept %s:\n", act->name); qsort(&all_concept_vals, concept_count, sizeof(char*), cmpstringp); for (i = 0; i < concept_count; ++i) { if (all_concept_vals[i]) { - int print_it = 1; + bool print_it = true; if (i > 0 && all_concept_vals[i - 1] && strcmp(all_concept_vals[i], all_concept_vals[i - 1]) == 0) { - print_it = 0; /* skip duplicate entries */ + print_it = false; /* skip duplicate entries */ } - if (print_it) + if (blacklisted(h, editionNumber, act->name, all_concept_vals[i])) { + print_it = false; + } + if (print_it) { fprintf(stderr, "\t%s\n", all_concept_vals[i]); + } } } } diff --git a/src/grib_accessor_class_constant.cc b/src/grib_accessor_class_constant.cc index dd9fc9c5a..6c5bbda84 100644 --- a/src/grib_accessor_class_constant.cc +++ b/src/grib_accessor_class_constant.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_constant = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_constant = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,7 +121,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_count_file.cc b/src/grib_accessor_class_count_file.cc index 73d7644fd..ad40e2cbe 100644 --- a/src/grib_accessor_class_count_file.cc +++ b/src/grib_accessor_class_count_file.cc @@ -70,7 +70,9 @@ static grib_accessor_class _grib_accessor_class_count_file = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -86,7 +88,9 @@ static grib_accessor_class _grib_accessor_class_count_file = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,7 +114,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_count_missing.cc b/src/grib_accessor_class_count_missing.cc index 99b7d0943..b7c2b66e3 100644 --- a/src/grib_accessor_class_count_missing.cc +++ b/src/grib_accessor_class_count_missing.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_count_missing = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_count_missing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_count_total.cc b/src/grib_accessor_class_count_total.cc index 81e3dfd1a..cf5ed7972 100644 --- a/src/grib_accessor_class_count_total.cc +++ b/src/grib_accessor_class_count_total.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_count_total = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_count_total = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_2order_packing.cc b/src/grib_accessor_class_data_2order_packing.cc index 4648390ee..5d93ef8f8 100644 --- a/src/grib_accessor_class_data_2order_packing.cc +++ b/src/grib_accessor_class_data_2order_packing.cc @@ -124,7 +124,9 @@ static grib_accessor_class _grib_accessor_class_data_2order_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -140,7 +142,9 @@ static grib_accessor_class _grib_accessor_class_data_2order_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -163,6 +167,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -178,7 +184,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_apply_bitmap.cc b/src/grib_accessor_class_data_apply_bitmap.cc index c41b74eb6..91686bafc 100644 --- a/src/grib_accessor_class_data_apply_bitmap.cc +++ b/src/grib_accessor_class_data_apply_bitmap.cc @@ -8,7 +8,9 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_api_internal_cpp.h" +#include +#include /* This is used by make_class.pl @@ -18,6 +20,7 @@ SUPER = grib_accessor_class_gen IMPLEMENTS = init IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set + IMPLEMENTS = unpack_float IMPLEMENTS = pack_double IMPLEMENTS = value_count IMPLEMENTS = dump;get_native_type @@ -43,6 +46,7 @@ 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 unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void dump(grib_accessor*, grib_dumper*); static void init(grib_accessor*, const long, grib_arguments*); @@ -87,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -103,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -124,6 +132,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -138,6 +147,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -180,86 +191,6 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - - size_t i = 0; - size_t j = 0; - size_t n_vals = 0; - long nn = 0; - int err = 0; - size_t coded_n_vals = 0; - double* coded_vals = NULL; - double missing_value = 0; - - err = grib_value_count(a, &nn); - n_vals = nn; - if (err) - return err; - - if (!grib_find_accessor(grib_handle_of_accessor(a), self->bitmap)) - return grib_get_double_array(grib_handle_of_accessor(a), self->coded_values, val, len); - - if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &coded_n_vals)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) - return err; - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if (coded_n_vals == 0) { - for (i = 0; i < n_vals; i++) - val[i] = missing_value; - - *len = n_vals; - return GRIB_SUCCESS; - } - - if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->bitmap, val, &n_vals)) != GRIB_SUCCESS) - return err; - - coded_vals = (double*)grib_context_malloc(a->context, coded_n_vals * sizeof(double)); - if (coded_vals == NULL) - return GRIB_OUT_OF_MEMORY; - - if ((err = grib_get_double_array(grib_handle_of_accessor(a), self->coded_values, coded_vals, &coded_n_vals)) != GRIB_SUCCESS) { - grib_context_free(a->context, coded_vals); - return err; - } - - grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_class_data_apply_bitmap: unpack_double : creating %s, %d values", - a->name, n_vals); - - for (i = 0; i < n_vals; i++) { - if (val[i] == 0) { - val[i] = missing_value; - } - else { - val[i] = coded_vals[j++]; - if (j > coded_n_vals) { - grib_context_free(a->context, coded_vals); - grib_context_log(a->context, GRIB_LOG_ERROR, - "grib_accessor_class_data_apply_bitmap [%s]:" - " unpack_double : number of coded values does not match bitmap %ld %ld", - a->name, coded_n_vals, n_vals); - - return GRIB_ARRAY_TOO_SMALL; - } - } - } - - *len = n_vals; - - grib_context_free(a->context, coded_vals); - return err; -} - static int unpack_double_element(grib_accessor* a, size_t idx, double* val) { grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; @@ -447,6 +378,99 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return err; } +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; + + size_t i = 0; + size_t j = 0; + size_t n_vals = 0; + long nn = 0; + int err = 0; + size_t coded_n_vals = 0; + T* coded_vals = NULL; + double missing_value = 0; + + err = grib_value_count(a, &nn); + n_vals = nn; + if (err) + return err; + + if (!grib_find_accessor(grib_handle_of_accessor(a), self->bitmap)) + return grib_get_array(grib_handle_of_accessor(a), self->coded_values, val, len); + + if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &coded_n_vals)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) + return err; + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if (coded_n_vals == 0) { + for (i = 0; i < n_vals; i++) + val[i] = missing_value; + + *len = n_vals; + return GRIB_SUCCESS; + } + + if ((err = grib_get_array_internal(grib_handle_of_accessor(a), self->bitmap, val, &n_vals)) != GRIB_SUCCESS) + return err; + + coded_vals = (T*)grib_context_malloc(a->context, coded_n_vals * sizeof(T)); + if (coded_vals == NULL) + return GRIB_OUT_OF_MEMORY; + + if ((err = grib_get_array(grib_handle_of_accessor(a), self->coded_values, coded_vals, &coded_n_vals)) != GRIB_SUCCESS) { + grib_context_free(a->context, coded_vals); + return err; + } + + grib_context_log(a->context, GRIB_LOG_DEBUG, + "grib_accessor_class_data_apply_bitmap: %s : creating %s, %d values", + __func__, + a->name, n_vals); + + for (i = 0; i < n_vals; i++) { + if (val[i] == 0) { + val[i] = missing_value; + } + else { + val[i] = coded_vals[j++]; + if (j > coded_n_vals) { + grib_context_free(a->context, coded_vals); + grib_context_log(a->context, GRIB_LOG_ERROR, + "grib_accessor_class_data_apply_bitmap [%s]:" + " %s : number of coded values does not match bitmap %ld %ld", + a->name, __func__, coded_n_vals, n_vals); + + return GRIB_ARRAY_TOO_SMALL; + } + } + } + + *len = n_vals; + + grib_context_free(a->context, coded_vals); + return err; +} + +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + static int get_native_type(grib_accessor* a) { /* grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; diff --git a/src/grib_accessor_class_data_apply_boustrophedonic.cc b/src/grib_accessor_class_data_apply_boustrophedonic.cc index 5d5486e95..c512cc4a3 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic.cc +++ b/src/grib_accessor_class_data_apply_boustrophedonic.cc @@ -18,6 +18,7 @@ SUPER = grib_accessor_class_gen IMPLEMENTS = init IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set + IMPLEMENTS = unpack_float IMPLEMENTS = pack_double IMPLEMENTS = value_count IMPLEMENTS = dump;get_native_type @@ -42,6 +43,7 @@ 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 unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void dump(grib_accessor*, grib_dumper*); static void init(grib_accessor*, const long, grib_arguments*); @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +105,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -122,6 +128,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,6 +143,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -172,14 +181,15 @@ static int value_count(grib_accessor* a, long* numberOfPoints) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +template +static int unpack(grib_accessor* a, T* val, size_t* len) { grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; size_t plSize = 0; long* pl = 0; double* values = 0; double* pvalues = 0; - double* pval = 0; + T* pval = 0; size_t valuesSize = 0; long i, j; int ret; @@ -266,6 +276,16 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + static int unpack_double_element(grib_accessor* a, size_t idx, double* val) { size_t size; diff --git a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc b/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc index 84c6163ae..a1aa5c812 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc +++ b/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc @@ -90,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic_bitma 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -106,7 +108,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic_bitma 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -127,6 +131,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -141,6 +147,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_apply_gdsnotpresent.cc b/src/grib_accessor_class_data_apply_gdsnotpresent.cc index 7998dafdc..1e7c38e57 100644 --- a/src/grib_accessor_class_data_apply_gdsnotpresent.cc +++ b/src/grib_accessor_class_data_apply_gdsnotpresent.cc @@ -94,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_gdsnotpresent = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -110,7 +112,9 @@ static grib_accessor_class _grib_accessor_class_data_apply_gdsnotpresent = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -131,6 +135,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -146,7 +152,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_ccsds_packing.cc b/src/grib_accessor_class_data_ccsds_packing.cc index 370053fed..a96625e3d 100644 --- a/src/grib_accessor_class_data_ccsds_packing.cc +++ b/src/grib_accessor_class_data_ccsds_packing.cc @@ -8,7 +8,8 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_api_internal_cpp.h" +#include /* This is used by make_class.pl @@ -18,6 +19,7 @@ SUPER = grib_accessor_class_values IMPLEMENTS = init IMPLEMENTS = unpack_double + IMPLEMENTS = unpack_float IMPLEMENTS = pack_double IMPLEMENTS = unpack_double_element;unpack_double_element_set IMPLEMENTS = value_count @@ -49,6 +51,7 @@ or edit "accessor.class" and rerun ./make_class.pl static int pack_double(grib_accessor*, const double* val, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); @@ -101,7 +104,9 @@ static grib_accessor_class _grib_accessor_class_data_ccsds_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -117,7 +122,9 @@ static grib_accessor_class _grib_accessor_class_data_ccsds_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -140,6 +147,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -154,6 +162,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -191,7 +201,11 @@ static int value_count(grib_accessor* a, long* count) #include -static const char* aec_get_error_message(int code) +#ifndef LIBAEC_DLL_EXPORTED + #error Version of libaec appears to be too old. Please upgrade. +#endif + +const char* aec_get_error_message(int code) { if (code == AEC_MEM_ERROR) return "AEC_MEM_ERROR"; if (code == AEC_DATA_ERROR) return "AEC_DATA_ERROR"; @@ -200,7 +214,8 @@ static const char* aec_get_error_message(int code) if (code == AEC_OK) return "AEC_OK"; return "Unknown error code"; } -static void print_aec_stream_info(struct aec_stream* strm, const char* func) + +void print_aec_stream_info(struct aec_stream* strm, const char* func) { fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.flags=%u\n", func, strm->flags); fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.bits_per_sample=%u\n", func, strm->bits_per_sample); @@ -210,128 +225,14 @@ static void print_aec_stream_info(struct aec_stream* strm, const char* func) fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.avail_in=%lu\n", func, strm->avail_in); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; - grib_handle* hand = grib_handle_of_accessor(a); - - int err = GRIB_SUCCESS, i = 0; - size_t buflen = 0; - struct aec_stream strm; - double bscale = 0; - double dscale = 0; - unsigned char* buf = NULL; - size_t n_vals = 0; - size_t size = 0; - unsigned char* decoded = NULL; - /*unsigned char* p = NULL;*/ - long pos = 0; - long nn = 0; - - long binary_scale_factor = 0; - long decimal_scale_factor = 0; - double reference_value = 0; - long bits_per_value = 0; - long bits8; - - long ccsds_flags; - long ccsds_block_size; - long ccsds_rsi; - - self->dirty = 0; - - if ((err = grib_value_count(a, &nn)) != GRIB_SUCCESS) - return err; - n_vals = nn; - - if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_double_internal(hand, self->reference_value, &reference_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(hand, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(hand, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) - return err; - - /* ECC-477: Don't call grib_get_long_internal to suppress error message being output */ - if ((err = grib_get_long(hand, self->ccsds_flags, &ccsds_flags)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long_internal(hand, self->ccsds_block_size, &ccsds_block_size)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(hand, self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS) - return err; - - /* TODO: This should be called upstream */ - if (*len < n_vals) - return GRIB_ARRAY_TOO_SMALL; - - /* Special case */ - if (bits_per_value == 0) { - for (i = 0; i < n_vals; i++) - val[i] = reference_value; - *len = n_vals; - return GRIB_SUCCESS; - } - - bscale = grib_power(binary_scale_factor, 2); - dscale = grib_power(-decimal_scale_factor, 10); - - buflen = grib_byte_count(a); - buf = (unsigned char*)hand->buffer->data; - buf += grib_byte_offset(a); - - strm.flags = ccsds_flags; - strm.bits_per_sample = bits_per_value; - strm.block_size = ccsds_block_size; - strm.rsi = ccsds_rsi; - - strm.next_in = buf; - strm.avail_in = buflen; - - bits8 = ((bits_per_value + 7) / 8) * 8; - size = n_vals * ((bits_per_value + 7) / 8); - decoded = (unsigned char*)grib_context_buffer_malloc_clear(a->context, size); - if (!decoded) { - err = GRIB_OUT_OF_MEMORY; - goto cleanup; - } - strm.next_out = decoded; - strm.avail_out = size; - - if (hand->context->debug) print_aec_stream_info(&strm, "unpack_double"); - - if ((err = aec_buffer_decode(&strm)) != AEC_OK) { - grib_context_log(a->context, GRIB_LOG_ERROR, "CCSDS unpack_double: aec_buffer_decode error %d (%s)\n", - err, aec_get_error_message(err)); - err = GRIB_ENCODING_ERROR; - goto cleanup; - } - - /* printf("bscale=%g dscale=%g reference_value=%g\n",bscale,dscale,reference_value); */ - pos = 0; -#if 0 - p = decoded; - for (i = 0; i < n_vals; i++) { - val[i] = (double)(((grib_decode_unsigned_long(p, &pos, bits8) * bscale) + reference_value) * dscale); - } -#endif - /* ECC-1427: Performance improvement */ - grib_decode_double_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val); - *len = n_vals; - -cleanup: - grib_context_buffer_free(a->context, decoded); - return err; -} - static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; grib_handle* hand = grib_handle_of_accessor(a); - int err = GRIB_SUCCESS, i = 0, is_constant_field = 0; - size_t buflen = 0; + int err = GRIB_SUCCESS; + size_t buflen = 0, i = 0; + bool is_constant_field = false; unsigned char* buf = NULL; unsigned char* encoded = NULL; @@ -373,7 +274,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_get_long_internal(hand, self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS) return err; - /* Special case */ + // Special case if (*len == 0) { grib_buffer_replace(a, NULL, 0, 1, 1); return GRIB_SUCCESS; @@ -391,11 +292,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } if (min == max) { - is_constant_field = 1; + is_constant_field = true; } else { if (bits_per_value == 0) { - /* ECC-1202: A non-constant field with bitsPerValue==0! */ - bits_per_value = 24; /* Set sane value */ + // ECC-1202: A non-constant field with bitsPerValue==0! + bits_per_value = 24; //Set sane value } } @@ -415,7 +316,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_set_long_internal(hand, self->number_of_values, n_vals)) != GRIB_SUCCESS) return err; - bits_per_value = 0; /* ECC-1387 */ + bits_per_value = 0; // ECC-1387 if ((err = grib_set_long_internal(hand, self->bits_per_value, bits_per_value)) != GRIB_SUCCESS) return err; @@ -446,7 +347,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } } else { - int last = 127; /* last must be a parameter coming from the def file*/ + int last = 127; // last must be a parameter coming from the def file double range = 0; double minrange = 0, maxrange = 0; double unscaled_max = 0; @@ -506,11 +407,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) buflen++; } } - /* buflen = n_vals*(bits_per_value/8);*/ + // buflen = n_vals*(bits_per_value/8); grib_context_log(a->context, GRIB_LOG_DEBUG,"CCSDS pack_double: packing %s, %d values", a->name, n_vals); - /*ECC-1431: GRIB2: CCSDS encoding failure AEC_STREAM_ERROR*/ + // ECC-1431: GRIB2: CCSDS encoding failure AEC_STREAM_ERROR buflen += buflen / 20 + 256; buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context, buflen); @@ -522,7 +423,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_set_double_internal(hand, self->reference_value, reference_value)) != GRIB_SUCCESS) return err; { - /* Make sure we can decode it again */ + // Make sure we can decode it again double ref = 1e-100; grib_get_double_internal(hand, self->reference_value, &ref); Assert(ref == reference_value); @@ -544,10 +445,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) strm.next_in = encoded; strm.avail_in = bits8 / 8 * n_vals; - /* - This does not support spherical harmonics, and treats 24 differently than: - see http://cdo.sourcearchive.com/documentation/1.5.1.dfsg.1-1/cgribexlib_8c_source.html - */ + // This does not support spherical harmonics, and treats 24 differently than: + // see http://cdo.sourcearchive.com/documentation/1.5.1.dfsg.1-1/cgribexlib_8c_source.html + if (hand->context->debug) print_aec_stream_info(&strm, "pack_double"); if ((err = aec_buffer_encode(&strm)) != AEC_OK) { @@ -557,10 +457,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) goto cleanup; } - /* - printf("n_vals = %ld, bits8 = %ld\n", n_vals, bits8); - printf("in %ld out => %zu\n", bits8/8*n_vals, buflen); - */ + //printf("n_vals = %ld, bits8 = %ld\n", n_vals, bits8); + //printf("in %ld out => %zu\n", bits8/8*n_vals, buflen); buflen = strm.total_out; grib_buffer_replace(a, buf, buflen, 1, 1); @@ -577,9 +475,131 @@ cleanup: return err; } +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; + grib_handle* hand = grib_handle_of_accessor(a); + + int err = GRIB_SUCCESS, i = 0; + size_t buflen = 0; + struct aec_stream strm; + double bscale = 0; + double dscale = 0; + unsigned char* buf = NULL; + size_t n_vals = 0; + size_t size = 0; + unsigned char* decoded = NULL; + // unsigned char* p = NULL; + long pos = 0; + long nn = 0; + + long binary_scale_factor = 0; + long decimal_scale_factor = 0; + double reference_value = 0; + long bits_per_value = 0; + long bits8; + + long ccsds_flags; + long ccsds_block_size; + long ccsds_rsi; + + self->dirty = 0; + + if ((err = grib_value_count(a, &nn)) != GRIB_SUCCESS) + return err; + n_vals = nn; + + if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(hand, self->reference_value, &reference_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(hand, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(hand, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) + return err; + + // ECC-477: Don't call grib_get_long_internal to suppress error message being output + if ((err = grib_get_long(hand, self->ccsds_flags, &ccsds_flags)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long_internal(hand, self->ccsds_block_size, &ccsds_block_size)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(hand, self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS) + return err; + + // TODO(masn): This should be called upstream + if (*len < n_vals) + return GRIB_ARRAY_TOO_SMALL; + + // Special case + if (bits_per_value == 0) { + for (i = 0; i < n_vals; i++) + val[i] = reference_value; + *len = n_vals; + return GRIB_SUCCESS; + } + + bscale = grib_power(binary_scale_factor, 2); + dscale = grib_power(-decimal_scale_factor, 10); + + buflen = grib_byte_count(a); + buf = (unsigned char*)hand->buffer->data; + buf += grib_byte_offset(a); + + strm.flags = ccsds_flags; + strm.bits_per_sample = bits_per_value; + strm.block_size = ccsds_block_size; + strm.rsi = ccsds_rsi; + + strm.next_in = buf; + strm.avail_in = buflen; + + bits8 = ((bits_per_value + 7) / 8) * 8; + size = n_vals * ((bits_per_value + 7) / 8); + decoded = (unsigned char*)grib_context_buffer_malloc_clear(a->context, size); + if (!decoded) { + err = GRIB_OUT_OF_MEMORY; + goto cleanup; + } + strm.next_out = decoded; + strm.avail_out = size; + + if (hand->context->debug) print_aec_stream_info(&strm, "unpack_*"); + + if ((err = aec_buffer_decode(&strm)) != AEC_OK) { + grib_context_log(a->context, GRIB_LOG_ERROR, "CCSDS %s: aec_buffer_decode error %d (%s)\n", + __func__, err, aec_get_error_message(err)); + err = GRIB_ENCODING_ERROR; + goto cleanup; + } + + pos = 0; + + // ECC-1427: Performance improvement + //grib_decode_float_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val); + grib_decode_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val); + *len = n_vals; + +cleanup: + grib_context_buffer_free(a->context, decoded); + return err; +} + +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + static int unpack_double_element(grib_accessor* a, size_t idx, double* val) { - /* The index idx relates to codedValues NOT values! */ + // The index idx relates to codedValues NOT values! grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; grib_handle* hand = grib_handle_of_accessor(a); int err = 0; @@ -593,7 +613,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) if ((err = grib_get_double_internal(hand, self->reference_value, &reference_value)) != GRIB_SUCCESS) return err; - /* Special case of constant field */ + // Special case of constant field if (bits_per_value == 0) { *val = reference_value; return GRIB_SUCCESS; @@ -629,7 +649,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array if ((err = grib_get_double_internal(hand, self->reference_value, &reference_value)) != GRIB_SUCCESS) return err; - /* Special case of constant field */ + // Special case of constant field if (bits_per_value == 0) { for (i = 0; i < len; i++) { val_array[i] = reference_value; @@ -637,7 +657,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } - /* GRIB-564: The indexes in index_array relate to codedValues NOT values! */ + // GRIB-564: The indexes in index_array relate to codedValues NOT values! err = grib_get_size(grib_handle_of_accessor(a), "codedValues", &size); if (err) return err; @@ -655,6 +675,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array for (i = 0; i < len; i++) { val_array[i] = values[index_array[i]]; } + grib_context_free(a->context, values); return GRIB_SUCCESS; } @@ -667,12 +688,17 @@ static void print_error_feature_not_enabled(grib_context* c) "grib_accessor_data_ccsds_packing: CCSDS support not enabled. " "Please rebuild with -DENABLE_AEC=ON (Adaptive Entropy Coding library)"); } +static int pack_double(grib_accessor* a, const double* val, size_t* len) +{ + print_error_feature_not_enabled(a->context); + return GRIB_FUNCTIONALITY_NOT_ENABLED; +} static int unpack_double(grib_accessor* a, double* val, size_t* len) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +static int unpack_float(grib_accessor* a, float* val, size_t* len) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; diff --git a/src/grib_accessor_class_data_complex_packing.cc b/src/grib_accessor_class_data_complex_packing.cc index 4fbc7f101..3b45cb480 100644 --- a/src/grib_accessor_class_data_complex_packing.cc +++ b/src/grib_accessor_class_data_complex_packing.cc @@ -8,8 +8,8 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -#include "grib_optimize_decimal_factor.h" +#include "grib_api_internal_cpp.h" +#include #include /* This is used by make_class.pl @@ -18,6 +18,7 @@ CLASS = accessor SUPER = grib_accessor_class_data_simple_packing IMPLEMENTS = unpack_double + IMPLEMENTS = unpack_float IMPLEMENTS = pack_double IMPLEMENTS = value_count IMPLEMENTS = init @@ -48,6 +49,7 @@ or edit "accessor.class" and rerun ./make_class.pl static int pack_double(grib_accessor*, const double* val, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); @@ -110,7 +112,9 @@ static grib_accessor_class _grib_accessor_class_data_complex_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -126,7 +130,9 @@ static grib_accessor_class _grib_accessor_class_data_complex_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -149,6 +155,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -164,7 +171,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -225,222 +234,6 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - - size_t i = 0; - int ret = GRIB_SUCCESS; - long hcount = 0; - long lcount = 0; - long hpos = 0; - long lup = 0; - long mmax = 0; - long n_vals = 0; - double* scals = NULL; - double *pscals = NULL, *pval = NULL; - - double s = 0; - double d = 0; - double laplacianOperator = 0; - unsigned char* buf = NULL; - unsigned char* hres = NULL; - unsigned char* lres = NULL; - unsigned long packed_offset; - long lpos = 0; - - long maxv = 0; - long GRIBEX_sh_bug_present = 0; - long ieee_floats = 0; - - long offsetdata = 0; - long bits_per_value = 0; - double reference_value = 0; - long binary_scale_factor = 0; - long decimal_scale_factor = 0; - - long sub_j = 0; - long sub_k = 0; - long sub_m = 0; - long pen_j = 0; - long pen_k = 0; - long pen_m = 0; - - double operat = 0; - int bytes; - int err = 0; - - decode_float_proc decode_float = NULL; - - err = grib_value_count(a, &n_vals); - if (err) - return err; - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((ret = grib_get_long_internal(gh, self->offsetdata, &offsetdata)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(gh, self->reference_value, &reference_value)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(gh, self->GRIBEX_sh_bug_present, &GRIBEX_sh_bug_present)) != GRIB_SUCCESS) - return ret; - - /* ECC-774: don't use grib_get_long_internal */ - if ((ret = grib_get_long(gh, self->ieee_floats, &ieee_floats)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_double_internal(gh, self->laplacianOperator, &laplacianOperator)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->sub_j, &sub_j)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->sub_k, &sub_k)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->sub_m, &sub_m)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->pen_j, &pen_j)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->pen_k, &pen_k)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(gh, self->pen_m, &pen_m)) != GRIB_SUCCESS) - return ret; - - self->dirty = 0; - - switch (ieee_floats) { - case 0: - decode_float = grib_long_to_ibm; - bytes = 4; - break; - case 1: - decode_float = grib_long_to_ieee; - bytes = 4; - break; - case 2: - decode_float = grib_long_to_ieee64; - bytes = 8; - break; - default: - return GRIB_NOT_IMPLEMENTED; - } - - Assert(sub_j == sub_k); - Assert(sub_j == sub_m); - Assert(pen_j == pen_k); - Assert(pen_j == pen_m); - - buf = (unsigned char*)gh->buffer->data; - - maxv = pen_j + 1; - - buf += grib_byte_offset(a); - hres = buf; - lres = buf; - - if (pen_j == sub_j) { - n_vals = (pen_j + 1) * (pen_j + 2); - d = grib_power(-decimal_scale_factor, 10); - grib_ieee_decode_array(a->context, buf, n_vals, bytes, val); - if (d) { - for (i = 0; i < n_vals; i++) - val[i] *= d; - } - return 0; - } - - packed_offset = grib_byte_offset(a) + bytes * (sub_k + 1) * (sub_k + 2); - - lpos = 8 * (packed_offset - offsetdata); - - s = grib_power(binary_scale_factor, 2); - d = grib_power(-decimal_scale_factor, 10); - - scals = (double*)grib_context_malloc(a->context, maxv * sizeof(double)); - Assert(scals); - - scals[0] = 0; - for (i = 1; i < maxv; i++) { - operat = pow(i * (i + 1), laplacianOperator); - if (operat != 0) - scals[i] = (1.0 / operat); - else { - grib_context_log(a->context, GRIB_LOG_WARNING, - "COMPLEX_PACKING : problem with operator div by zero at index %d of %d \n", - i, maxv); - scals[i] = 0; - } - } - - /* - printf("UNPACKING LAPLACE=%.20f\n",laplacianOperator); - printf("packed offset=%ld\n",packed_offset); - for(i=0;i 0) { - lup = mmax; - if (sub_k >= 0) { - for (hcount = 0; hcount < sub_k + 1; hcount++) { - val[i++] = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); - val[i++] = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); - - if (GRIBEX_sh_bug_present && hcount == sub_k) { - /* bug in ecmwf data, last row (K+1)is scaled but should not */ - val[i - 2] *= scals[lup]; - val[i - 1] *= scals[lup]; - } - lup++; - } - sub_k--; - } - - pscals = scals + lup; - pval = val + i; -#if FAST_BIG_ENDIAN - grib_decode_double_array_complex(lres, - &lpos, bits_per_value, - reference_value, s, pscals, (maxv - hcount) * 2, pval); - i += (maxv - hcount) * 2; -#else - (void)pscals; /* suppress gcc warning */ - (void)pval; /* suppress gcc warning */ - for (lcount = hcount; lcount < maxv; lcount++) { - val[i++] = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value) * scals[lup]; - val[i++] = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value) * scals[lup]; - /* These values should always be zero, but as they are packed, - it is necessary to force them back to zero */ - if (mmax == 0) - val[i - 1] = 0; - lup++; - } -#endif - - maxv--; - hcount = 0; - mmax++; - } - - Assert(*len >= i); - *len = i; - - grib_context_free(a->context, scals); - - return ret; -} - #define MAXVAL(a, b) a > b ? a : b static double calculate_pfactor(grib_context* ctx, const double* spectralField, long fieldTruncation, long subsetTruncation) @@ -913,3 +706,234 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return ret; } + + +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; + grib_handle* gh = grib_handle_of_accessor(a); + + size_t i = 0; + int ret = GRIB_SUCCESS; + long hcount = 0; + long lcount = 0; + long hpos = 0; + long lup = 0; + long mmax = 0; + long n_vals = 0; + T* scals = NULL; + T* pscals = NULL, *pval = NULL; + + double s = 0; + double d = 0; + double laplacianOperator = 0; + unsigned char* buf = NULL; + unsigned char* hres = NULL; + unsigned char* lres = NULL; + unsigned long packed_offset; + long lpos = 0; + + long maxv = 0; + long GRIBEX_sh_bug_present = 0; + long ieee_floats = 0; + + long offsetdata = 0; + long bits_per_value = 0; + double reference_value = 0; + long binary_scale_factor = 0; + long decimal_scale_factor = 0; + + long sub_j = 0; + long sub_k = 0; + long sub_m = 0; + long pen_j = 0; + long pen_k = 0; + long pen_m = 0; + + T operat = 0; + int bytes; + int err = 0; + + decode_float_proc decode_float = NULL; + + err = grib_value_count(a, &n_vals); + if (err) + return err; + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((ret = grib_get_long_internal(gh, self->offsetdata, &offsetdata)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_double_internal(gh, self->reference_value, &reference_value)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(gh, self->GRIBEX_sh_bug_present, &GRIBEX_sh_bug_present)) != GRIB_SUCCESS) + return ret; + + /* ECC-774: don't use grib_get_long_internal */ + if ((ret = grib_get_long(gh, self->ieee_floats, &ieee_floats)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_double_internal(gh, self->laplacianOperator, &laplacianOperator)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->sub_j, &sub_j)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->sub_k, &sub_k)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->sub_m, &sub_m)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->pen_j, &pen_j)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->pen_k, &pen_k)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(gh, self->pen_m, &pen_m)) != GRIB_SUCCESS) + return ret; + + self->dirty = 0; + + switch (ieee_floats) { + case 0: + decode_float = grib_long_to_ibm; + bytes = 4; + break; + case 1: + decode_float = grib_long_to_ieee; + bytes = 4; + break; + case 2: + decode_float = grib_long_to_ieee64; + bytes = 8; + break; + default: + return GRIB_NOT_IMPLEMENTED; + } + + Assert(sub_j == sub_k); + Assert(sub_j == sub_m); + Assert(pen_j == pen_k); + Assert(pen_j == pen_m); + + buf = (unsigned char*)gh->buffer->data; + + maxv = pen_j + 1; + + buf += grib_byte_offset(a); + hres = buf; + lres = buf; + + if (pen_j == sub_j) { + n_vals = (pen_j + 1) * (pen_j + 2); + d = grib_power(-decimal_scale_factor, 10); + + grib_ieee_decode_array(a->context, buf, n_vals, bytes, val); + if (d) { + for (i = 0; i < n_vals; i++) + val[i] *= d; + } + return 0; + } + + + packed_offset = grib_byte_offset(a) + bytes * (sub_k + 1) * (sub_k + 2); + + lpos = 8 * (packed_offset - offsetdata); + + s = grib_power(binary_scale_factor, 2); + d = grib_power(-decimal_scale_factor, 10); + + scals = (T*)grib_context_malloc(a->context, maxv * sizeof(T)); + Assert(scals); + + scals[0] = 0; + for (i = 1; i < maxv; i++) { + operat = pow(i * (i + 1), laplacianOperator); + if (operat != 0) + scals[i] = (1.0 / operat); + else { + grib_context_log(a->context, GRIB_LOG_WARNING, + "COMPLEX_PACKING : problem with operator div by zero at index %d of %d \n", + i, maxv); + scals[i] = 0; + } + } + + /* + printf("UNPACKING LAPLACE=%.20f\n",laplacianOperator); + printf("packed offset=%ld\n",packed_offset); + for(i=0;i 0) { + lup = mmax; + if (sub_k >= 0) { + for (hcount = 0; hcount < sub_k + 1; hcount++) { + val[i++] = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); + val[i++] = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); + + if (GRIBEX_sh_bug_present && hcount == sub_k) { + /* bug in ecmwf data, last row (K+1)is scaled but should not */ + val[i - 2] *= scals[lup]; + val[i - 1] *= scals[lup]; + } + lup++; + } + sub_k--; + } + + pscals = scals + lup; + pval = val + i; +#if FAST_BIG_ENDIAN + grib_decode_double_array_complex(lres, + &lpos, bits_per_value, + reference_value, s, pscals, (maxv - hcount) * 2, pval); + i += (maxv - hcount) * 2; +#else + (void)pscals; /* suppress gcc warning */ + (void)pval; /* suppress gcc warning */ + for (lcount = hcount; lcount < maxv; lcount++) { + val[i++] = d * (T)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value) * scals[lup]; + val[i++] = d * (T)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value) * scals[lup]; + /* These values should always be zero, but as they are packed, + it is necessary to force them back to zero */ + if (mmax == 0) + val[i - 1] = 0; + lup++; + } +#endif + + maxv--; + hcount = 0; + mmax++; + } + + Assert(*len >= i); + *len = i; + + grib_context_free(a->context, scals); + + return ret; +} + +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} diff --git a/src/grib_accessor_class_data_dummy_field.cc b/src/grib_accessor_class_data_dummy_field.cc index 072d64dae..0ca1b5508 100644 --- a/src/grib_accessor_class_data_dummy_field.cc +++ b/src/grib_accessor_class_data_dummy_field.cc @@ -99,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_data_dummy_field = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -115,7 +117,9 @@ static grib_accessor_class _grib_accessor_class_data_dummy_field = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -138,6 +142,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -153,7 +159,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1complex_packing.cc b/src/grib_accessor_class_data_g1complex_packing.cc index 1e7dec871..e7a57cd85 100644 --- a/src/grib_accessor_class_data_g1complex_packing.cc +++ b/src/grib_accessor_class_data_g1complex_packing.cc @@ -106,7 +106,9 @@ static grib_accessor_class _grib_accessor_class_data_g1complex_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -122,7 +124,9 @@ static grib_accessor_class _grib_accessor_class_data_g1complex_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -146,7 +150,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -162,7 +168,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc b/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc index c369429a1..23220df88 100644 --- a/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc @@ -124,7 +124,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_constant_wid 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -140,7 +142,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_constant_wid 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -163,6 +167,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -177,6 +183,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc index b39a32ac2..df99452a0 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -144,7 +144,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_exte 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -160,7 +162,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_exte 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -183,6 +187,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -197,6 +203,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1second_order_general_packing.cc b/src/grib_accessor_class_data_g1second_order_general_packing.cc index 7f8d7892e..fe16c187d 100644 --- a/src/grib_accessor_class_data_g1second_order_general_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_general_packing.cc @@ -121,7 +121,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_pack 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -137,7 +139,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_pack 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -160,6 +164,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -175,7 +181,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc b/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc index 9f4401b32..4eb575515 100644 --- a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc @@ -121,7 +121,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_row_by_row_p 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -137,7 +139,9 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_row_by_row_p 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -160,6 +164,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -175,7 +181,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1secondary_bitmap.cc b/src/grib_accessor_class_data_g1secondary_bitmap.cc index 697cdfc33..aa34acbd7 100644 --- a/src/grib_accessor_class_data_g1secondary_bitmap.cc +++ b/src/grib_accessor_class_data_g1secondary_bitmap.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_data_g1secondary_bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_data_g1secondary_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1shsimple_packing.cc b/src/grib_accessor_class_data_g1shsimple_packing.cc index c9429dd76..c519f3deb 100644 --- a/src/grib_accessor_class_data_g1shsimple_packing.cc +++ b/src/grib_accessor_class_data_g1shsimple_packing.cc @@ -70,7 +70,9 @@ static grib_accessor_class _grib_accessor_class_data_g1shsimple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -86,7 +88,9 @@ static grib_accessor_class _grib_accessor_class_data_g1shsimple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,6 +114,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g1simple_packing.cc b/src/grib_accessor_class_data_g1simple_packing.cc index 58bae890c..e423de516 100644 --- a/src/grib_accessor_class_data_g1simple_packing.cc +++ b/src/grib_accessor_class_data_g1simple_packing.cc @@ -94,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_data_g1simple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -110,7 +112,9 @@ static grib_accessor_class _grib_accessor_class_data_g1simple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -133,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -149,7 +155,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -288,7 +296,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) return GRIB_SUCCESS; break; case GRIB_INVALID_BPV: - grib_context_log(a->context, GRIB_LOG_ERROR, "unable to compute packing parameters. Invalid bits per value\n"); + grib_context_log(a->context, GRIB_LOG_ERROR, "unable to compute packing parameters. Invalid bits per value"); return ret; case GRIB_SUCCESS: break; diff --git a/src/grib_accessor_class_data_g22order_packing.cc b/src/grib_accessor_class_data_g22order_packing.cc index 7220f42a6..ae3a6d9e3 100644 --- a/src/grib_accessor_class_data_g22order_packing.cc +++ b/src/grib_accessor_class_data_g22order_packing.cc @@ -8,7 +8,9 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ + #include "grib_api_internal.h" +#include /* This is used by make_class.pl @@ -18,6 +20,7 @@ SUPER = grib_accessor_class_values IMPLEMENTS = init IMPLEMENTS = unpack_double + IMPLEMENTS = unpack_float IMPLEMENTS = pack_double IMPLEMENTS = unpack_double_element;unpack_double_element_set IMPLEMENTS = value_count @@ -57,6 +60,7 @@ or edit "accessor.class" and rerun ./make_class.pl static int pack_double(grib_accessor*, const double* val, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); @@ -119,7 +123,9 @@ static grib_accessor_class _grib_accessor_class_data_g22order_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -135,7 +141,9 @@ static grib_accessor_class _grib_accessor_class_data_g22order_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -158,6 +166,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -172,6 +181,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -345,7 +356,7 @@ static int spatial_difference (grib_context *c, unsigned long* vals, long len, } #endif -static int post_process(grib_context* c, long* vals, long len, long order, long bias, const unsigned long extras[2]) +int post_process(grib_context* c, long* vals, long len, long order, long bias, const unsigned long extras[2]) { unsigned long last, penultimate, j = 0; Assert(order > 0); @@ -446,9 +457,262 @@ static int de_spatial_difference (grib_context *c, unsigned long* vals, long le } #endif -static int unpack_double(grib_accessor* a, double* val, size_t* len) + +static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_g22order_packing* self = (grib_accessor_data_g22order_packing*)a; + grib_handle* gh = grib_handle_of_accessor(a); + + size_t i = 0; + size_t j = 0; + size_t n_vals = *len; + + int err = 0; + + unsigned char* buf = NULL; + unsigned char* buf_ref = NULL; + unsigned char* buf_width = NULL; + unsigned char* buf_length = NULL; + unsigned char* buf_vals = NULL; + + double d = 0; + double divisor = 0; + + unsigned long* sec_val = NULL; + unsigned long* group_val = NULL; + + double max; + double min; + + long length_p = 0; + long ref_p = 0; + long width_p = 0; + long vals_p = 0; + + size_t nv = 0; + size_t buf_size = 0; + + long bits_per_value = 0; + + double reference_value = 0; + + long nvals_per_group = 0; + long nbits_per_group_val = 0; + long group_ref_val = 0; + + long binary_scale_factor; + long decimal_scale_factor; + long typeOfOriginalFieldValues; + long groupSplittingMethodUsed; + long missingValueManagementUsed; + long primaryMissingValueSubstitute; + long secondaryMissingValueSubstitute; + long numberOfGroupsOfDataValues; + long referenceForGroupWidths; + long numberOfBitsUsedForTheGroupWidths; + long referenceForGroupLengths; + long lengthIncrementForTheGroupLengths; + long trueLengthOfLastGroup; + long numberOfBitsUsedForTheScaledGroupLengths; + long orderOfSpatialDifferencing; + long numberOfOctetsExtraDescriptors; + + long maxgrw; + long maxgrl; + char packingType[254] = {0,}; + size_t slen = 254; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((err = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->typeOfOriginalFieldValues, &typeOfOriginalFieldValues)) != GRIB_SUCCESS) + return err; + + //if((err = grib_get_long_internal(gh,self->groupSplittingMethodUsed,&groupSplittingMethodUsed )) != GRIB_SUCCESS) return err; + //Key groupSplittingMethodUsed uses Code table 5.4 which has two entries: + // * 0 Row by row splitting + // * 1 General group splitting + // * We only support General group splitting + groupSplittingMethodUsed = 1; + + if ((err = grib_get_long_internal(gh, self->missingValueManagementUsed, &missingValueManagementUsed)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->primaryMissingValueSubstitute, &primaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->secondaryMissingValueSubstitute, &secondaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, &numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, &numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->orderOfSpatialDifferencing, &orderOfSpatialDifferencing)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfOctetsExtraDescriptors, &numberOfOctetsExtraDescriptors)) != GRIB_SUCCESS) + return err; + + self->dirty = 1; + + referenceForGroupWidths = 0; + referenceForGroupLengths = 0; + lengthIncrementForTheGroupLengths = 1; + numberOfBitsUsedForTheGroupWidths = 4; + numberOfBitsUsedForTheScaledGroupLengths = 10; + + /* calculation of integer array */ + sec_val = (unsigned long*)grib_context_malloc(a->context, (n_vals) * sizeof(long)); + if (!sec_val) + return GRIB_OUT_OF_MEMORY; + + d = grib_power(decimal_scale_factor, 10); + + max = val[0]; + min = max; + for (i = 0; i < n_vals; i++) { + if (val[i] > max) + max = val[i]; + else if (val[i] < min) + min = val[i]; + } + min *= d; + max *= d; + + if (grib_get_nearest_smaller_value(gh, self->reference_value, min, &reference_value) != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "unable to find nearest_smaller_value of %g for %s", min, self->reference_value); + return GRIB_INTERNAL_ERROR; + } + + binary_scale_factor = grib_get_binary_scale_fact(max, reference_value, bits_per_value, &err); + if (err != GRIB_SUCCESS) + return err; + divisor = grib_power(-binary_scale_factor, 2); + + for (i = 0; i < n_vals; i++) + sec_val[i] = (unsigned long)((((val[i] * d) - reference_value) * divisor) + 0.5); + + group_val = sec_val; + + maxgrw = calc_pow_2(numberOfBitsUsedForTheGroupWidths); + maxgrl = calc_pow_2(numberOfBitsUsedForTheScaledGroupLengths); + + numberOfGroupsOfDataValues = 0; + nv = n_vals; + vals_p = 0; + + while (find_next_group(group_val, nv, maxgrw, maxgrl, &nbits_per_group_val, &nvals_per_group, &group_ref_val) == GRIB_SUCCESS) { + numberOfGroupsOfDataValues++; + nv -= nvals_per_group; + group_val += nvals_per_group; + vals_p += nbits_per_group_val * nvals_per_group; + } + + trueLengthOfLastGroup = nvals_per_group; + + buf_size = (7 + (numberOfGroupsOfDataValues * bits_per_value)) / 8; + buf_size += (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths)) / 8; + buf_size += (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths)) / 8; + + buf_size += (vals_p / 8) + ((vals_p % 8) ? 1 : 0); + + buf = (unsigned char*)grib_context_malloc_clear(a->context, buf_size); + + buf_ref = buf; + buf_width = buf_ref + (7 + (numberOfGroupsOfDataValues * bits_per_value)) / 8; + buf_length = buf_width + (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths)) / 8; + buf_vals = buf_length + (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths)) / 8; + + nv = n_vals; + group_val = sec_val; + vals_p = 0; + ref_p = 0; + width_p = 0; + length_p = 0; + i = 0; + + while (find_next_group(group_val, nv, maxgrw, maxgrl, &nbits_per_group_val, &nvals_per_group, &group_ref_val) == GRIB_SUCCESS) { + grib_encode_unsigned_longb(buf_ref, group_ref_val, &ref_p, bits_per_value); + grib_encode_unsigned_longb(buf_width, nbits_per_group_val, &width_p, numberOfBitsUsedForTheGroupWidths); + grib_encode_unsigned_longb(buf_length, nvals_per_group, &length_p, numberOfBitsUsedForTheScaledGroupLengths); + + if (nbits_per_group_val) + for (j = 0; j < nvals_per_group; j++) { + grib_encode_unsigned_longb(buf_vals, sec_val[i + j] - group_ref_val, &vals_p, nbits_per_group_val); + } + i += nvals_per_group; + group_val += nvals_per_group; + nv -= nvals_per_group; + } + + /*fprintf(stdout,"spatial pack_double:: %ld bytes %lu marked\n", (ref_p+7)/8 + (width_p+7)/8 + (length_p+7)/8 + (vals_p+7)/8, buf_size);*/ + + grib_buffer_replace(a, buf, buf_size, 1, 1); + grib_context_free(a->context, buf); + grib_context_free(a->context, sec_val); + + if ((err = grib_set_long_internal(gh, self->bits_per_value, bits_per_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_double_internal(gh, self->reference_value, reference_value)) != GRIB_SUCCESS) + return err; + { + /* Make sure we can decode it again */ + double ref = 1e-100; + grib_get_double_internal(gh, self->reference_value, &ref); + Assert(ref == reference_value); + } + if ((err = grib_set_long_internal(gh, self->binary_scale_factor, binary_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->decimal_scale_factor, decimal_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->typeOfOriginalFieldValues, typeOfOriginalFieldValues)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->groupSplittingMethodUsed, groupSplittingMethodUsed)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->missingValueManagementUsed, missingValueManagementUsed)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->primaryMissingValueSubstitute, primaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->secondaryMissingValueSubstitute, secondaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->numberOfGroupsOfDataValues, numberOfGroupsOfDataValues)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->referenceForGroupWidths, referenceForGroupWidths)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->referenceForGroupLengths, referenceForGroupLengths)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->lengthIncrementForTheGroupLengths, lengthIncrementForTheGroupLengths)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->trueLengthOfLastGroup, trueLengthOfLastGroup)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) + return err; + + err = grib_get_string(gh, "packingType", packingType, &slen); + if (!err && strcmp(packingType, "grid_complex_spatial_differencing") == 0) { + if ((err = grib_set_long_internal(gh, self->orderOfSpatialDifferencing, 0)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(gh, self->numberOfOctetsExtraDescriptors, 0)) != GRIB_SUCCESS) + return err; + } + + /* ECC-259: Set correct number of values */ + if ((err = grib_set_long_internal(gh, self->numberOfValues, *len)) != GRIB_SUCCESS) + return err; + + return GRIB_SUCCESS; +} + + +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating points numbers"); + grib_accessor_data_g22order_packing* self = (grib_accessor_data_g22order_packing*)a; size_t i = 0; size_t j = 0; @@ -475,8 +739,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) long group_ref_val = 0; long bits_per_value = 0; - double binary_s = 0; - double decimal_s = 0; + T binary_s = 0; + T decimal_s = 0; double reference_value = 0; long binary_scale_factor; @@ -694,254 +958,14 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +static int unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_data_g22order_packing* self = (grib_accessor_data_g22order_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); + return unpack(a, val, len); +} - size_t i = 0; - size_t j = 0; - size_t n_vals = *len; - - int err = 0; - - unsigned char* buf = NULL; - unsigned char* buf_ref = NULL; - unsigned char* buf_width = NULL; - unsigned char* buf_length = NULL; - unsigned char* buf_vals = NULL; - - double d = 0; - double divisor = 0; - - unsigned long* sec_val = NULL; - unsigned long* group_val = NULL; - - double max; - double min; - - long length_p = 0; - long ref_p = 0; - long width_p = 0; - long vals_p = 0; - - size_t nv = 0; - size_t buf_size = 0; - - long bits_per_value = 0; - - double reference_value = 0; - - long nvals_per_group = 0; - long nbits_per_group_val = 0; - long group_ref_val = 0; - - long binary_scale_factor; - long decimal_scale_factor; - long typeOfOriginalFieldValues; - long groupSplittingMethodUsed; - long missingValueManagementUsed; - long primaryMissingValueSubstitute; - long secondaryMissingValueSubstitute; - long numberOfGroupsOfDataValues; - long referenceForGroupWidths; - long numberOfBitsUsedForTheGroupWidths; - long referenceForGroupLengths; - long lengthIncrementForTheGroupLengths; - long trueLengthOfLastGroup; - long numberOfBitsUsedForTheScaledGroupLengths; - long orderOfSpatialDifferencing; - long numberOfOctetsExtraDescriptors; - - long maxgrw; - long maxgrl; - char packingType[254] = {0,}; - size_t slen = 254; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((err = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->typeOfOriginalFieldValues, &typeOfOriginalFieldValues)) != GRIB_SUCCESS) - return err; - - /*if((err = grib_get_long_internal(gh,self->groupSplittingMethodUsed,&groupSplittingMethodUsed )) != GRIB_SUCCESS) return err;*/ - /* Key groupSplittingMethodUsed uses Code table 5.4 which has two entries: - * 0 Row by row splitting - * 1 General group splitting - * We only support General group splitting - */ - groupSplittingMethodUsed = 1; - - if ((err = grib_get_long_internal(gh, self->missingValueManagementUsed, &missingValueManagementUsed)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->primaryMissingValueSubstitute, &primaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->secondaryMissingValueSubstitute, &secondaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, &numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, &numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->orderOfSpatialDifferencing, &orderOfSpatialDifferencing)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfOctetsExtraDescriptors, &numberOfOctetsExtraDescriptors)) != GRIB_SUCCESS) - return err; - - self->dirty = 1; - - referenceForGroupWidths = 0; - referenceForGroupLengths = 0; - lengthIncrementForTheGroupLengths = 1; - numberOfBitsUsedForTheGroupWidths = 4; - numberOfBitsUsedForTheScaledGroupLengths = 10; - - /* calculation of integer array */ - sec_val = (unsigned long*)grib_context_malloc(a->context, (n_vals) * sizeof(long)); - if (!sec_val) - return GRIB_OUT_OF_MEMORY; - - d = grib_power(decimal_scale_factor, 10); - - max = val[0]; - min = max; - for (i = 0; i < n_vals; i++) { - if (val[i] > max) - max = val[i]; - else if (val[i] < min) - min = val[i]; - } - min *= d; - max *= d; - - if (grib_get_nearest_smaller_value(gh, self->reference_value, min, &reference_value) != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "unable to find nearest_smaller_value of %g for %s", min, self->reference_value); - return GRIB_INTERNAL_ERROR; - } - - binary_scale_factor = grib_get_binary_scale_fact(max, reference_value, bits_per_value, &err); - if (err != GRIB_SUCCESS) - return err; - divisor = grib_power(-binary_scale_factor, 2); - - for (i = 0; i < n_vals; i++) - sec_val[i] = (unsigned long)((((val[i] * d) - reference_value) * divisor) + 0.5); - - group_val = sec_val; - - maxgrw = calc_pow_2(numberOfBitsUsedForTheGroupWidths); - maxgrl = calc_pow_2(numberOfBitsUsedForTheScaledGroupLengths); - - numberOfGroupsOfDataValues = 0; - nv = n_vals; - vals_p = 0; - - while (find_next_group(group_val, nv, maxgrw, maxgrl, &nbits_per_group_val, &nvals_per_group, &group_ref_val) == GRIB_SUCCESS) { - numberOfGroupsOfDataValues++; - nv -= nvals_per_group; - group_val += nvals_per_group; - vals_p += nbits_per_group_val * nvals_per_group; - } - - trueLengthOfLastGroup = nvals_per_group; - - buf_size = (7 + (numberOfGroupsOfDataValues * bits_per_value)) / 8; - buf_size += (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths)) / 8; - buf_size += (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths)) / 8; - - buf_size += (vals_p / 8) + ((vals_p % 8) ? 1 : 0); - - buf = (unsigned char*)grib_context_malloc_clear(a->context, buf_size); - - buf_ref = buf; - buf_width = buf_ref + (7 + (numberOfGroupsOfDataValues * bits_per_value)) / 8; - buf_length = buf_width + (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths)) / 8; - buf_vals = buf_length + (7 + (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths)) / 8; - - nv = n_vals; - group_val = sec_val; - vals_p = 0; - ref_p = 0; - width_p = 0; - length_p = 0; - i = 0; - - while (find_next_group(group_val, nv, maxgrw, maxgrl, &nbits_per_group_val, &nvals_per_group, &group_ref_val) == GRIB_SUCCESS) { - grib_encode_unsigned_longb(buf_ref, group_ref_val, &ref_p, bits_per_value); - grib_encode_unsigned_longb(buf_width, nbits_per_group_val, &width_p, numberOfBitsUsedForTheGroupWidths); - grib_encode_unsigned_longb(buf_length, nvals_per_group, &length_p, numberOfBitsUsedForTheScaledGroupLengths); - - if (nbits_per_group_val) - for (j = 0; j < nvals_per_group; j++) { - grib_encode_unsigned_longb(buf_vals, sec_val[i + j] - group_ref_val, &vals_p, nbits_per_group_val); - } - i += nvals_per_group; - group_val += nvals_per_group; - nv -= nvals_per_group; - } - - /*fprintf(stdout,"spatial pack_double:: %ld bytes %lu marked\n", (ref_p+7)/8 + (width_p+7)/8 + (length_p+7)/8 + (vals_p+7)/8, buf_size);*/ - - grib_buffer_replace(a, buf, buf_size, 1, 1); - grib_context_free(a->context, buf); - grib_context_free(a->context, sec_val); - - if ((err = grib_set_long_internal(gh, self->bits_per_value, bits_per_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_double_internal(gh, self->reference_value, reference_value)) != GRIB_SUCCESS) - return err; - { - /* Make sure we can decode it again */ - double ref = 1e-100; - grib_get_double_internal(gh, self->reference_value, &ref); - Assert(ref == reference_value); - } - if ((err = grib_set_long_internal(gh, self->binary_scale_factor, binary_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->decimal_scale_factor, decimal_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->typeOfOriginalFieldValues, typeOfOriginalFieldValues)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->groupSplittingMethodUsed, groupSplittingMethodUsed)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->missingValueManagementUsed, missingValueManagementUsed)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->primaryMissingValueSubstitute, primaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->secondaryMissingValueSubstitute, secondaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->numberOfGroupsOfDataValues, numberOfGroupsOfDataValues)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->referenceForGroupWidths, referenceForGroupWidths)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->referenceForGroupLengths, referenceForGroupLengths)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->lengthIncrementForTheGroupLengths, lengthIncrementForTheGroupLengths)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->trueLengthOfLastGroup, trueLengthOfLastGroup)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) - return err; - - err = grib_get_string(gh, "packingType", packingType, &slen); - if (!err && strcmp(packingType, "grid_complex_spatial_differencing") == 0) { - if ((err = grib_set_long_internal(gh, self->orderOfSpatialDifferencing, 0)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(gh, self->numberOfOctetsExtraDescriptors, 0)) != GRIB_SUCCESS) - return err; - } - - /* ECC-259: Set correct number of values */ - if ((err = grib_set_long_internal(gh, self->numberOfValues, *len)) != GRIB_SUCCESS) - return err; - - return GRIB_SUCCESS; +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); } static int unpack_double_element(grib_accessor* a, size_t idx, double* val) diff --git a/src/grib_accessor_class_data_g2bifourier_packing.cc b/src/grib_accessor_class_data_g2bifourier_packing.cc index 09e6005fb..1e2335c0f 100644 --- a/src/grib_accessor_class_data_g2bifourier_packing.cc +++ b/src/grib_accessor_class_data_g2bifourier_packing.cc @@ -120,7 +120,9 @@ static grib_accessor_class _grib_accessor_class_data_g2bifourier_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -136,7 +138,9 @@ static grib_accessor_class _grib_accessor_class_data_g2bifourier_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -159,6 +163,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -174,7 +180,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g2complex_packing.cc b/src/grib_accessor_class_data_g2complex_packing.cc index 32cf3c92a..363c4d88a 100644 --- a/src/grib_accessor_class_data_g2complex_packing.cc +++ b/src/grib_accessor_class_data_g2complex_packing.cc @@ -99,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_data_g2complex_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -115,7 +117,9 @@ static grib_accessor_class _grib_accessor_class_data_g2complex_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -138,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -154,7 +160,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g2secondary_bitmap.cc b/src/grib_accessor_class_data_g2secondary_bitmap.cc index bb3cdbb12..7756962f6 100644 --- a/src/grib_accessor_class_data_g2secondary_bitmap.cc +++ b/src/grib_accessor_class_data_g2secondary_bitmap.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_data_g2secondary_bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_data_g2secondary_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g2shsimple_packing.cc b/src/grib_accessor_class_data_g2shsimple_packing.cc index 1dbbb7b2c..8f5d6d981 100644 --- a/src/grib_accessor_class_data_g2shsimple_packing.cc +++ b/src/grib_accessor_class_data_g2shsimple_packing.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_data_g2shsimple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_data_g2shsimple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,6 +121,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g2simple_packing.cc b/src/grib_accessor_class_data_g2simple_packing.cc index 5880821e7..0adaf67bb 100644 --- a/src/grib_accessor_class_data_g2simple_packing.cc +++ b/src/grib_accessor_class_data_g2simple_packing.cc @@ -88,7 +88,9 @@ static grib_accessor_class _grib_accessor_class_data_g2simple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -104,7 +106,9 @@ static grib_accessor_class _grib_accessor_class_data_g2simple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -127,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -142,7 +148,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc b/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc index 3a65a7f60..55549fdd9 100644 --- a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc +++ b/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc @@ -103,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_data_g2simple_packing_with_prepr 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -119,7 +121,9 @@ static grib_accessor_class _grib_accessor_class_data_g2simple_packing_with_prepr 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -142,6 +146,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -157,7 +163,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_jpeg2000_packing.cc b/src/grib_accessor_class_data_jpeg2000_packing.cc index 866a80bfe..9b813dd6d 100644 --- a/src/grib_accessor_class_data_jpeg2000_packing.cc +++ b/src/grib_accessor_class_data_jpeg2000_packing.cc @@ -109,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_data_jpeg2000_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -125,7 +127,9 @@ static grib_accessor_class _grib_accessor_class_data_jpeg2000_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -148,6 +152,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -162,6 +168,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_png_packing.cc b/src/grib_accessor_class_data_png_packing.cc index 455a26dbb..0485b2b21 100644 --- a/src/grib_accessor_class_data_png_packing.cc +++ b/src/grib_accessor_class_data_png_packing.cc @@ -102,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_data_png_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -118,7 +120,9 @@ static grib_accessor_class _grib_accessor_class_data_png_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -141,6 +145,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -155,6 +161,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -372,15 +380,15 @@ cleanup: return err; } -static int is_constant(const double* values, size_t n_vals) +static bool is_constant(const double* values, size_t n_vals) { - int isConstant = 1; + bool isConstant = true; double v = 0; size_t i; for (i = 0; i < n_vals; i++) { if (i == 0) v = values[i]; else if (v != values[i]) { - isConstant = 0; + isConstant = false; break; } } @@ -391,7 +399,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; - int err = GRIB_SUCCESS, is_constant_field = 0; + int err = GRIB_SUCCESS; + bool is_constant_field = false; int i, j; size_t buflen = 0; diff --git a/src/grib_accessor_class_data_raw_packing.cc b/src/grib_accessor_class_data_raw_packing.cc index 4439e28e9..acceae597 100644 --- a/src/grib_accessor_class_data_raw_packing.cc +++ b/src/grib_accessor_class_data_raw_packing.cc @@ -11,7 +11,7 @@ * Enrico Fucile ****************************/ -#include "grib_api_internal.h" +#include "grib_api_internal_cpp.h" #define PRE_PROCESSING_NONE 0 #define PRE_PROCESSING_DIFFERENCE 1 @@ -89,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_data_raw_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -105,7 +107,9 @@ static grib_accessor_class _grib_accessor_class_data_raw_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -128,6 +132,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -142,6 +148,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -202,7 +210,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if (*len < nvals) return GRIB_ARRAY_TOO_SMALL; - code = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); + code = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); *len = nvals; diff --git a/src/grib_accessor_class_data_run_length_packing.cc b/src/grib_accessor_class_data_run_length_packing.cc index f5dca1094..d8ecdaba2 100644 --- a/src/grib_accessor_class_data_run_length_packing.cc +++ b/src/grib_accessor_class_data_run_length_packing.cc @@ -18,6 +18,7 @@ SUPER = grib_accessor_class_values IMPLEMENTS = init IMPLEMENTS = unpack_double + IMPLEMENTS = pack_double IMPLEMENTS = value_count MEMBERS=const char* number_of_values MEMBERS=const char* bits_per_value @@ -39,6 +40,7 @@ or edit "accessor.class" and rerun ./make_class.pl */ +static int pack_double(grib_accessor*, const double* val, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); @@ -49,63 +51,68 @@ typedef struct grib_accessor_data_run_length_packing grib_accessor att; /* Members defined in gen */ /* Members defined in values */ - int carg; + int carg; const char* seclen; const char* offsetdata; const char* offsetsection; int dirty; /* Members defined in data_run_length_packing */ - const char* number_of_values; - const char* bits_per_value; - const char* max_level_value; - const char* number_of_level_values; - const char* decimal_scale_factor; - const char* level_values; + const char* number_of_values; + const char* bits_per_value; + const char* max_level_value; + const char* number_of_level_values; + const char* decimal_scale_factor; + const char* level_values; } grib_accessor_data_run_length_packing; extern grib_accessor_class* grib_accessor_class_values; static grib_accessor_class _grib_accessor_class_data_run_length_packing = { - &grib_accessor_class_values, /* super */ - "data_run_length_packing", /* name */ - sizeof(grib_accessor_data_run_length_packing), /* size */ - 0, /* inited */ - &init_class, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* free mem */ - 0, /* describes himself */ - 0, /* get length of section */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* grib_pack procedures long */ - 0, /* grib_pack procedures long */ - 0, /* grib_pack procedures long */ - 0, /* grib_unpack procedures long */ - 0, /* grib_pack procedures double */ - &unpack_double, /* grib_unpack procedures double */ - 0, /* grib_pack procedures string */ - 0, /* grib_unpack procedures string */ - 0, /* grib_pack array procedures string */ - 0, /* grib_unpack array procedures string */ - 0, /* grib_pack procedures bytes */ - 0, /* grib_unpack procedures bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ + &grib_accessor_class_values, /* super */ + "data_run_length_packing", /* name */ + sizeof(grib_accessor_data_run_length_packing), /* size */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* init */ + 0, /* post_init */ + 0, /* free mem */ + 0, /* describes himself */ + 0, /* get length of section */ + 0, /* get length of string */ + &value_count, /* get number of values */ + 0, /* get number of bytes */ + 0, /* get offset to bytes */ + 0, /* get native type */ + 0, /* get sub_section */ + 0, /* grib_pack procedures long */ + 0, /* grib_pack procedures long */ + 0, /* grib_pack procedures long */ + 0, /* grib_unpack procedures long */ + &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ + &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ + 0, /* grib_pack procedures string */ + 0, /* grib_unpack procedures string */ + 0, /* grib_pack array procedures string */ + 0, /* grib_unpack array procedures string */ + 0, /* grib_pack procedures bytes */ + 0, /* grib_unpack procedures bytes */ + 0, /* pack_expression */ + 0, /* notify_change */ + 0, /* update_size */ + 0, /* preferred_size */ + 0, /* resize */ + 0, /* nearest_smaller_value */ + 0, /* next accessor */ + 0, /* compare vs. another accessor */ + 0, /* unpack only ith value */ + 0, /* unpack only ith value */ + 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ + 0, /* unpack a subarray */ + 0, /* clear */ + 0, /* clone accessor */ }; @@ -114,36 +121,40 @@ grib_accessor_class* grib_accessor_class_data_run_length_packing = &_grib_access static void init_class(grib_accessor_class* c) { - c->dump = (*(c->super))->dump; - c->next_offset = (*(c->super))->next_offset; - c->string_length = (*(c->super))->string_length; - c->byte_count = (*(c->super))->byte_count; - c->byte_offset = (*(c->super))->byte_offset; - c->get_native_type = (*(c->super))->get_native_type; - c->sub_section = (*(c->super))->sub_section; - c->pack_missing = (*(c->super))->pack_missing; - c->is_missing = (*(c->super))->is_missing; - c->pack_long = (*(c->super))->pack_long; - c->unpack_long = (*(c->super))->unpack_long; - c->pack_double = (*(c->super))->pack_double; - c->pack_string = (*(c->super))->pack_string; - c->unpack_string = (*(c->super))->unpack_string; - c->pack_string_array = (*(c->super))->pack_string_array; - c->unpack_string_array = (*(c->super))->unpack_string_array; - c->pack_bytes = (*(c->super))->pack_bytes; - c->unpack_bytes = (*(c->super))->unpack_bytes; - c->pack_expression = (*(c->super))->pack_expression; - c->notify_change = (*(c->super))->notify_change; - c->update_size = (*(c->super))->update_size; - c->preferred_size = (*(c->super))->preferred_size; - c->resize = (*(c->super))->resize; - c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; - c->next = (*(c->super))->next; - c->compare = (*(c->super))->compare; - c->unpack_double_element = (*(c->super))->unpack_double_element; - c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; - c->clear = (*(c->super))->clear; - c->make_clone = (*(c->super))->make_clone; + c->dump = (*(c->super))->dump; + c->next_offset = (*(c->super))->next_offset; + c->string_length = (*(c->super))->string_length; + c->byte_count = (*(c->super))->byte_count; + c->byte_offset = (*(c->super))->byte_offset; + c->get_native_type = (*(c->super))->get_native_type; + c->sub_section = (*(c->super))->sub_section; + c->pack_missing = (*(c->super))->pack_missing; + c->is_missing = (*(c->super))->is_missing; + c->pack_long = (*(c->super))->pack_long; + c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; + c->pack_string = (*(c->super))->pack_string; + c->unpack_string = (*(c->super))->unpack_string; + c->pack_string_array = (*(c->super))->pack_string_array; + c->unpack_string_array = (*(c->super))->unpack_string_array; + c->pack_bytes = (*(c->super))->pack_bytes; + c->unpack_bytes = (*(c->super))->unpack_bytes; + c->pack_expression = (*(c->super))->pack_expression; + c->notify_change = (*(c->super))->notify_change; + c->update_size = (*(c->super))->update_size; + c->preferred_size = (*(c->super))->preferred_size; + c->resize = (*(c->super))->resize; + c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; + c->next = (*(c->super))->next; + c->compare = (*(c->super))->compare; + c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; + c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; + c->clear = (*(c->super))->clear; + c->make_clone = (*(c->super))->make_clone; } /* END_CLASS_IMP */ @@ -183,6 +194,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) double level_scale_factor = 0; double* levels = NULL; unsigned char* buf = NULL; + double missingValue = 9999.0; if ((err = grib_get_long_internal(gh, self->seclen, &seclen)) != GRIB_SUCCESS) return err; @@ -196,6 +208,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) return err; + if ((err = grib_get_double(gh, "missingValue", &missingValue)) != GRIB_SUCCESS) + return err; level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values); level_values_size = number_of_level_values; @@ -206,7 +220,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) number_of_compressed_values = ((seclen - 5) * 8) / bits_per_value; if (number_of_compressed_values == 0 || max_level_value == 0) { for (i = 0; i < number_of_values; i++) { - val[i] = GRIB_MISSING_DOUBLE; + val[i] = missingValue; } return GRIB_SUCCESS; } @@ -220,7 +234,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } level_scale_factor = grib_power(-decimal_scale_factor, 10.0); levels = (double*)grib_context_malloc_clear(a->context, sizeof(double) * (number_of_level_values + 1)); - levels[0] = 0; + levels[0] = missingValue; for (i = 0; i < number_of_level_values; i++) { levels[i + 1] = level_values[i] * level_scale_factor; } @@ -262,3 +276,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } return err; } + +static int pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_context_log(a->context, GRIB_LOG_ERROR, "Changing the packing type to 'grid_run_length' is not implemented."); + return GRIB_NOT_IMPLEMENTED; +} diff --git a/src/grib_accessor_class_data_secondary_bitmap.cc b/src/grib_accessor_class_data_secondary_bitmap.cc index 4a3bbc01e..e914ecd4a 100644 --- a/src/grib_accessor_class_data_secondary_bitmap.cc +++ b/src/grib_accessor_class_data_secondary_bitmap.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_data_secondary_bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_data_secondary_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_sh_packed.cc b/src/grib_accessor_class_data_sh_packed.cc index e7c5da5d6..0d78b879a 100644 --- a/src/grib_accessor_class_data_sh_packed.cc +++ b/src/grib_accessor_class_data_sh_packed.cc @@ -107,7 +107,9 @@ static grib_accessor_class _grib_accessor_class_data_sh_packed = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -123,7 +125,9 @@ static grib_accessor_class _grib_accessor_class_data_sh_packed = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -147,6 +151,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -162,7 +168,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_sh_unpacked.cc b/src/grib_accessor_class_data_sh_unpacked.cc index 050534e86..baacec961 100644 --- a/src/grib_accessor_class_data_sh_unpacked.cc +++ b/src/grib_accessor_class_data_sh_unpacked.cc @@ -107,7 +107,9 @@ static grib_accessor_class _grib_accessor_class_data_sh_unpacked = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -123,7 +125,9 @@ static grib_accessor_class _grib_accessor_class_data_sh_unpacked = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -147,6 +151,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -162,7 +168,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_shsimple_packing.cc b/src/grib_accessor_class_data_shsimple_packing.cc index 211ac4a32..643e2e035 100644 --- a/src/grib_accessor_class_data_shsimple_packing.cc +++ b/src/grib_accessor_class_data_shsimple_packing.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_data_shsimple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_data_shsimple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_data_simple_packing.cc b/src/grib_accessor_class_data_simple_packing.cc index b0bc13e6f..672b24b70 100644 --- a/src/grib_accessor_class_data_simple_packing.cc +++ b/src/grib_accessor_class_data_simple_packing.cc @@ -12,7 +12,7 @@ * Enrico Fucile *******************************/ -#include "grib_api_internal.h" +#include "grib_api_internal_cpp.h" #include "grib_optimize_decimal_factor.h" #include @@ -23,7 +23,7 @@ CLASS = accessor SUPER = grib_accessor_class_values IMPLEMENTS = init - IMPLEMENTS = unpack_double + IMPLEMENTS = unpack_double;unpack_float IMPLEMENTS = unpack_double_element;unpack_double_element_set IMPLEMENTS = unpack_double_subarray IMPLEMENTS = pack_double @@ -54,6 +54,7 @@ or edit "accessor.class" and rerun ./make_class.pl static int pack_double(grib_accessor*, const double* val, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* val, size_t* len); static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); @@ -108,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_data_simple_packing = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -124,7 +127,9 @@ static grib_accessor_class _grib_accessor_class_data_simple_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ &unpack_double_subarray, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -147,6 +152,7 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -161,6 +167,8 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; + c->unpack_float_element = (*(c->super))->unpack_float_element; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; } @@ -313,6 +321,155 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + + grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; + grib_handle* gh = grib_handle_of_accessor(a); + unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; + + size_t i = 0; + int err = 0; + size_t n_vals = 0; + long pos = 0; + long count = 0; + + double reference_value; + long binary_scale_factor; + long bits_per_value; + long decimal_scale_factor; + long offsetBeforeData; + double s = 0; + double d = 0; + double units_factor = 1.0; + double units_bias = 0.0; + + err = grib_value_count(a, &count); + if (err) + return err; + n_vals = count; + + if (*len < n_vals) { + *len = (long)n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((err = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return err; + + /* + * check we don't decode bpv > max(ulong) as it is + * not currently supported by the algorithm + */ + if (bits_per_value > (sizeof(long) * 8)) { + return GRIB_INVALID_BPV; + } + + if (self->units_factor && + (grib_get_double_internal(gh, self->units_factor, &units_factor) == GRIB_SUCCESS)) { + grib_set_double_internal(gh, self->units_factor, 1.0); + } + + if (self->units_bias && + (grib_get_double_internal(gh, self->units_bias, &units_bias) == GRIB_SUCCESS)) { + grib_set_double_internal(gh, self->units_bias, 0.0); + } + + if (n_vals == 0) { + *len = 0; + return GRIB_SUCCESS; + } + + self->dirty = 0; + + if ((err = grib_get_double_internal(gh, self->reference_value, &reference_value)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) + return err; + + /* Special case */ + + if (bits_per_value == 0) { + for (i = 0; i < n_vals; i++) + val[i] = reference_value; + *len = n_vals; + return GRIB_SUCCESS; + } + + s = grib_power(binary_scale_factor, 2); + d = grib_power(-decimal_scale_factor, 10); + + grib_context_log(a->context, GRIB_LOG_DEBUG, + "grib_accessor_data_simple_packing: unpack_double : creating %s, %d values", + a->name, n_vals); + + offsetBeforeData = grib_byte_offset(a); + buf += offsetBeforeData; + + /*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */ + + /* ECC-941 */ + if (!a->context->ieee_packing) { + /* Must turn off this check when the environment variable ECCODES_GRIB_IEEE_PACKING is on */ + long offsetAfterData = 0; + err = grib_get_long(gh, "offsetAfterData", &offsetAfterData); + if (!err && offsetAfterData > offsetBeforeData) { + const long valuesSize = (bits_per_value * n_vals) / 8; /*in bytes*/ + if (offsetBeforeData + valuesSize > offsetAfterData) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Data section size mismatch: offset before data=%ld, offset after data=%ld (num values=%ld, bits per value=%ld)", + offsetBeforeData, offsetAfterData, n_vals, bits_per_value); + return GRIB_DECODING_ERROR; + } + } +#if 0 + if (offsetBeforeData == offsetAfterData) { + /* Crazy case: Constant field with bitsPerValue > 0 */ + for (i = 0; i < n_vals; i++) + val[i] = reference_value; + *len = n_vals; + return GRIB_SUCCESS; + } +#endif + } + + grib_context_log(a->context, GRIB_LOG_DEBUG, + "unpack_double: calling outline function : bpv %d, rv : %g, sf : %d, dsf : %d ", + bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); + grib_decode_array(buf, &pos, bits_per_value, reference_value, s, d, n_vals, val); + + *len = (long)n_vals; + + if (units_factor != 1.0) { + if (units_bias != 0.0) + for (i = 0; i < n_vals; i++) + val[i] = val[i] * units_factor + units_bias; + else + for (i = 0; i < n_vals; i++) + val[i] *= units_factor; + } + else if (units_bias != 0.0) + for (i = 0; i < n_vals; i++) + val[i] += units_bias; + return err; +} + +static int unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +static int unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned char* buf, long pos, size_t n_vals) { grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; @@ -422,7 +579,7 @@ static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned c grib_context_log(a->context, GRIB_LOG_DEBUG, "unpack_double: calling outline function : bpv %d, rv : %g, sf : %d, dsf : %d ", bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); - grib_decode_double_array(buf, &pos, bits_per_value, reference_value, s, d, n_vals, val); + grib_decode_array(buf, &pos, bits_per_value, reference_value, s, d, n_vals, val); *len = (long)n_vals; @@ -460,22 +617,6 @@ static int unpack_double_subarray(grib_accessor* a, double* val, size_t start, s return _unpack_double(a, val, plen, buf, pos, nvals); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - size_t nvals = 0; - long pos = 0; - int err = 0; - long count = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - nvals = count; - - return _unpack_double(a, val, len, buf, pos, nvals); -} - #if GRIB_IBMPOWER67_OPT #define restrict #include "minmax_val.cc" diff --git a/src/grib_accessor_class_decimal_precision.cc b/src/grib_accessor_class_decimal_precision.cc index 44a23956a..0d5bbd6c7 100644 --- a/src/grib_accessor_class_decimal_precision.cc +++ b/src/grib_accessor_class_decimal_precision.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_decimal_precision = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_decimal_precision = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_dictionary.cc b/src/grib_accessor_class_dictionary.cc index 93da5e4de..f239ccdfb 100644 --- a/src/grib_accessor_class_dictionary.cc +++ b/src/grib_accessor_class_dictionary.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_dictionary = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_dictionary = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_dirty.cc b/src/grib_accessor_class_dirty.cc index d5b37fcf5..b94270be0 100644 --- a/src/grib_accessor_class_dirty.cc +++ b/src/grib_accessor_class_dirty.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_dirty = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_dirty = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_divdouble.cc b/src/grib_accessor_class_divdouble.cc index 1349259c8..dda267300 100644 --- a/src/grib_accessor_class_divdouble.cc +++ b/src/grib_accessor_class_divdouble.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_divdouble = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_divdouble = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_double.cc b/src/grib_accessor_class_double.cc index e9a3430b2..62a4aea5b 100644 --- a/src/grib_accessor_class_double.cc +++ b/src/grib_accessor_class_double.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_double = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_double = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_element.cc b/src/grib_accessor_class_element.cc index 355cdf477..4b3c15973 100644 --- a/src/grib_accessor_class_element.cc +++ b/src/grib_accessor_class_element.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_element = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_element = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_evaluate.cc b/src/grib_accessor_class_evaluate.cc index 33f5d1e9d..1099e4099 100644 --- a/src/grib_accessor_class_evaluate.cc +++ b/src/grib_accessor_class_evaluate.cc @@ -70,7 +70,9 @@ static grib_accessor_class _grib_accessor_class_evaluate = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -86,7 +88,9 @@ static grib_accessor_class _grib_accessor_class_evaluate = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_expanded_descriptors.cc b/src/grib_accessor_class_expanded_descriptors.cc index 7eb3ff68f..66c56c9ae 100644 --- a/src/grib_accessor_class_expanded_descriptors.cc +++ b/src/grib_accessor_class_expanded_descriptors.cc @@ -101,7 +101,9 @@ static grib_accessor_class _grib_accessor_class_expanded_descriptors = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -117,7 +119,9 @@ static grib_accessor_class _grib_accessor_class_expanded_descriptors = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -137,6 +141,8 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -152,7 +158,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_forward.cc b/src/grib_accessor_class_forward.cc index dd07dd037..da816334a 100644 --- a/src/grib_accessor_class_forward.cc +++ b/src/grib_accessor_class_forward.cc @@ -65,7 +65,9 @@ static grib_accessor_class _grib_accessor_class_forward = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -81,7 +83,9 @@ static grib_accessor_class _grib_accessor_class_forward = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -105,7 +109,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -121,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_from_scale_factor_scaled_value.cc b/src/grib_accessor_class_from_scale_factor_scaled_value.cc index daa2e1257..ef4b30cf2 100644 --- a/src/grib_accessor_class_from_scale_factor_scaled_value.cc +++ b/src/grib_accessor_class_from_scale_factor_scaled_value.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_from_scale_factor_scaled_value = 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_from_scale_factor_scaled_value = 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,6 +122,8 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1_half_byte_codeflag.cc b/src/grib_accessor_class_g1_half_byte_codeflag.cc index 671524de9..6d819c2b7 100644 --- a/src/grib_accessor_class_g1_half_byte_codeflag.cc +++ b/src/grib_accessor_class_g1_half_byte_codeflag.cc @@ -73,7 +73,9 @@ static grib_accessor_class _grib_accessor_class_g1_half_byte_codeflag = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -89,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_g1_half_byte_codeflag = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,7 +114,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1_message_length.cc b/src/grib_accessor_class_g1_message_length.cc index 9608477e3..9eb10664e 100644 --- a/src/grib_accessor_class_g1_message_length.cc +++ b/src/grib_accessor_class_g1_message_length.cc @@ -73,7 +73,9 @@ static grib_accessor_class _grib_accessor_class_g1_message_length = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -89,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_g1_message_length = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1_section4_length.cc b/src/grib_accessor_class_g1_section4_length.cc index cbbbaf2fd..6e114daaf 100644 --- a/src/grib_accessor_class_g1_section4_length.cc +++ b/src/grib_accessor_class_g1_section4_length.cc @@ -73,7 +73,9 @@ static grib_accessor_class _grib_accessor_class_g1_section4_length = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -89,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_g1_section4_length = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1area.cc b/src/grib_accessor_class_g1area.cc index f329098ce..616797efd 100644 --- a/src/grib_accessor_class_g1area.cc +++ b/src/grib_accessor_class_g1area.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_g1area = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_g1area = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,6 +124,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1bitmap.cc b/src/grib_accessor_class_g1bitmap.cc index ff54949f2..bee7e21bc 100644 --- a/src/grib_accessor_class_g1bitmap.cc +++ b/src/grib_accessor_class_g1bitmap.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_g1bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_g1bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1date.cc b/src/grib_accessor_class_g1date.cc index 8da7889f0..4113e3fa1 100644 --- a/src/grib_accessor_class_g1date.cc +++ b/src/grib_accessor_class_g1date.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_g1date = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_g1date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -121,7 +125,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1day_of_the_year_date.cc b/src/grib_accessor_class_g1day_of_the_year_date.cc index ea420ec73..c14fa427a 100644 --- a/src/grib_accessor_class_g1day_of_the_year_date.cc +++ b/src/grib_accessor_class_g1day_of_the_year_date.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_g1day_of_the_year_date = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_g1day_of_the_year_date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1end_of_interval_monthly.cc b/src/grib_accessor_class_g1end_of_interval_monthly.cc index 30cc178d0..b47b659b4 100644 --- a/src/grib_accessor_class_g1end_of_interval_monthly.cc +++ b/src/grib_accessor_class_g1end_of_interval_monthly.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_g1end_of_interval_monthly = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_g1end_of_interval_monthly = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1fcperiod.cc b/src/grib_accessor_class_g1fcperiod.cc index 85ccc337f..e0ad74979 100644 --- a/src/grib_accessor_class_g1fcperiod.cc +++ b/src/grib_accessor_class_g1fcperiod.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_g1fcperiod = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_g1fcperiod = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1forecastmonth.cc b/src/grib_accessor_class_g1forecastmonth.cc index 780dd899c..62bb3a7f2 100644 --- a/src/grib_accessor_class_g1forecastmonth.cc +++ b/src/grib_accessor_class_g1forecastmonth.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_g1forecastmonth = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_g1forecastmonth = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1monthlydate.cc b/src/grib_accessor_class_g1monthlydate.cc index cbfcf755c..a3b47807e 100644 --- a/src/grib_accessor_class_g1monthlydate.cc +++ b/src/grib_accessor_class_g1monthlydate.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_g1monthlydate = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_g1monthlydate = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc b/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc index 1efab6619..c643f2a55 100644 --- a/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc +++ b/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc @@ -86,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_comp 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -102,7 +104,9 @@ static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_comp 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -142,7 +148,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc b/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc index ba51e9f42..9b8a3d772 100644 --- a/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc +++ b/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_simp 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_simp 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g1step_range.cc b/src/grib_accessor_class_g1step_range.cc index b015e6c64..308929d46 100644 --- a/src/grib_accessor_class_g1step_range.cc +++ b/src/grib_accessor_class_g1step_range.cc @@ -100,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_g1step_range = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -116,7 +118,9 @@ static grib_accessor_class _grib_accessor_class_g1step_range = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -135,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -149,7 +155,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -491,7 +499,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) size_t stepTypeLen = 20; if (self->stepType) { - ret = grib_get_string_internal(grib_handle_of_accessor(a), self->stepType, stepType, &stepTypeLen); + ret = grib_get_string_internal(h, self->stepType, stepType, &stepTypeLen); if (ret) return ret; } @@ -570,12 +578,18 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) } off = p1_accessor->offset * 8; /* Note: here we assume the key P2 is one octet and immediately follows P1. Hence 16 bits */ - if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_long %s=%ld (as two octets)\n", p1_accessor->name, P1); + ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, P1, &off, 16); if (ret != 0) return ret; + if (h->context->debug) { + long dp1,dp2; + grib_get_long(h, self->p1, &dp1); + grib_get_long(h, self->p2, &dp2); + fprintf(stderr, "ECCODES DEBUG pack_string: P1=%ld P2=%ld (as two octets => %ld)\n", dp1, dp2, P1); + } + if (ounit != unit) ret = grib_set_long_internal(h, self->unit, unit); @@ -614,16 +628,25 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) /* Note: case for timeRangeIndicator of 10 * We assume the key P2 is one octet and immediately follows P1. Hence 16 bits */ - if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_long %s=%ld (as two octets)\n", p1_accessor->name, P1); ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, P1, &off, 16); if (ret != 0) return ret; + if (h->context->debug) { + long dp1,dp2; + grib_get_long(h, self->p1, &dp1); + grib_get_long(h, self->p2, &dp2); + fprintf(stderr, "ECCODES DEBUG pack_string: P1=%ld P2=%ld (as two octets => %ld)\n", dp1, dp2, P1); + } + if (ounit != unit) ret = grib_set_long_internal(h, self->unit, unit); } + if (ret == GRIB_WRONG_STEP) { + grib_context_log(h->context, GRIB_LOG_ERROR, + "Failed to set %s=%s: Keys P1 and P2 are one octet each (Range 0 to 255)", a->name, val); + } return ret; } diff --git a/src/grib_accessor_class_g1verificationdate.cc b/src/grib_accessor_class_g1verificationdate.cc index f8969233c..651f9d322 100644 --- a/src/grib_accessor_class_g1verificationdate.cc +++ b/src/grib_accessor_class_g1verificationdate.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_g1verificationdate = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_g1verificationdate = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2_aerosol.cc b/src/grib_accessor_class_g2_aerosol.cc index 8974efb57..2c36e96c9 100644 --- a/src/grib_accessor_class_g2_aerosol.cc +++ b/src/grib_accessor_class_g2_aerosol.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_g2_aerosol = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_g2_aerosol = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -191,7 +199,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) ret = grib_get_string(hand, self->stepType, stepType, &slen); Assert(ret == GRIB_SUCCESS); - eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); + //eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); + eps = grib_is_defined(hand, "perturbationNumber"); if (!strcmp(stepType, "instant")) isInstant = 1; diff --git a/src/grib_accessor_class_g2_chemical.cc b/src/grib_accessor_class_g2_chemical.cc index d5edd07a9..48360f124 100644 --- a/src/grib_accessor_class_g2_chemical.cc +++ b/src/grib_accessor_class_g2_chemical.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_g2_chemical = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_g2_chemical = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -199,7 +207,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) ret = grib_get_string(hand, self->stepType, stepType, &slen); Assert(ret == GRIB_SUCCESS); - eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); + eps = grib_is_defined(hand, "perturbationNumber"); + //eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); if (!strcmp(stepType, "instant")) isInstant = 1; diff --git a/src/grib_accessor_class_g2_eps.cc b/src/grib_accessor_class_g2_eps.cc index 7dc3a09ab..949d4bc25 100644 --- a/src/grib_accessor_class_g2_eps.cc +++ b/src/grib_accessor_class_g2_eps.cc @@ -8,12 +8,8 @@ * 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 @@ -87,7 +83,9 @@ static grib_accessor_class _grib_accessor_class_g2_eps = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -103,7 +101,9 @@ static grib_accessor_class _grib_accessor_class_g2_eps = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -125,7 +125,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -141,7 +143,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -165,12 +169,18 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) { grib_accessor_g2_eps* self = (grib_accessor_g2_eps*)a; long productDefinitionTemplateNumber = 0; + int err = 0; + grib_handle* hand = grib_handle_of_accessor(a); - grib_get_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); + err = grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); + if (err) return err; *val = 0; - if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber)) + if (grib_is_defined(hand, "perturbationNumber")) { *val = 1; + } + //if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber)) + // *val = 1; return GRIB_SUCCESS; } @@ -206,10 +216,10 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_ENCODING_ERROR; } - /* eps or stream=(enda or elda or ewla) */ + // eps or stream=(enda or elda or ewla) if (eps || stream == 1030 || stream == 1249 || stream == 1250) { if (isInstant) { - /* type=em || type=es */ + // type=em || type=es if (type == 17) { productDefinitionTemplateNumberNew = 2; derivedForecast = 0; @@ -223,7 +233,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } else { - /* type=em || type=es */ + // type=em || type=es if (type == 17) { productDefinitionTemplateNumberNew = 12; derivedForecast = 0; @@ -246,7 +256,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } - /* Adjust for chemical species */ + // Adjust for chemical species if (chemical == 1) { if (eps == 1) { if (isInstant) { @@ -266,20 +276,20 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } - /* Adjust for aerosols */ + // Adjust for aerosols if (aerosol == 1) { if (eps == 1) { if (isInstant) { productDefinitionTemplateNumberNew = 45; } else { - /*productDefinitionTemplateNumberNew = 47; This PDT is deprecated */ + //productDefinitionTemplateNumberNew = 47; This PDT is deprecated productDefinitionTemplateNumberNew = 85; } } else { if (isInstant) { - productDefinitionTemplateNumberNew = 48; /*44 is deprecated*/ + productDefinitionTemplateNumberNew = 48; //44 is deprecated*/ } else { productDefinitionTemplateNumberNew = 46; diff --git a/src/grib_accessor_class_g2_mars_labeling.cc b/src/grib_accessor_class_g2_mars_labeling.cc index 6ba578906..b11cbb30a 100644 --- a/src/grib_accessor_class_g2_mars_labeling.cc +++ b/src/grib_accessor_class_g2_mars_labeling.cc @@ -98,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_g2_mars_labeling = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -114,7 +116,9 @@ static grib_accessor_class _grib_accessor_class_g2_mars_labeling = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -135,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -149,7 +155,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2bitmap.cc b/src/grib_accessor_class_g2bitmap.cc index a024ea268..c17da753b 100644 --- a/src/grib_accessor_class_g2bitmap.cc +++ b/src/grib_accessor_class_g2bitmap.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_g2bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_g2bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2bitmap_present.cc b/src/grib_accessor_class_g2bitmap_present.cc index d4385763a..93201529f 100644 --- a/src/grib_accessor_class_g2bitmap_present.cc +++ b/src/grib_accessor_class_g2bitmap_present.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_g2bitmap_present = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_g2bitmap_present = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2date.cc b/src/grib_accessor_class_g2date.cc index 01f7a56c8..d3523dfbe 100644 --- a/src/grib_accessor_class_g2date.cc +++ b/src/grib_accessor_class_g2date.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_g2date = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_g2date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2end_step.cc b/src/grib_accessor_class_g2end_step.cc index 1f69a7a60..a450bec15 100644 --- a/src/grib_accessor_class_g2end_step.cc +++ b/src/grib_accessor_class_g2end_step.cc @@ -109,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_g2end_step = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -125,7 +127,9 @@ static grib_accessor_class _grib_accessor_class_g2end_step = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -147,7 +151,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -163,7 +169,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2grid.cc b/src/grib_accessor_class_g2grid.cc index b4eebb957..fba5d7ccc 100644 --- a/src/grib_accessor_class_g2grid.cc +++ b/src/grib_accessor_class_g2grid.cc @@ -90,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_g2grid = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -106,7 +108,9 @@ static grib_accessor_class _grib_accessor_class_g2grid = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -129,6 +133,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -144,7 +150,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2latlon.cc b/src/grib_accessor_class_g2latlon.cc index 0f05a3efb..ff9adf7db 100644 --- a/src/grib_accessor_class_g2latlon.cc +++ b/src/grib_accessor_class_g2latlon.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_g2latlon = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_g2latlon = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2level.cc b/src/grib_accessor_class_g2level.cc index 9cb95ecb0..0f137ea20 100644 --- a/src/grib_accessor_class_g2level.cc +++ b/src/grib_accessor_class_g2level.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_g2level = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_g2level = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,6 +121,8 @@ static void init_class(grib_accessor_class* c) c->get_native_type = (*(c->super))->get_native_type; c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -143,12 +151,13 @@ static void init_class(grib_accessor_class* c) static void init(grib_accessor* a, const long l, grib_arguments* c) { grib_accessor_g2level* self = (grib_accessor_g2level*)a; + grib_handle* hand = grib_handle_of_accessor(a); int n = 0; - self->type_first = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->scale_first = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->value_first = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->pressure_units = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->type_first = grib_arguments_get_name(hand, c, n++); + self->scale_first = grib_arguments_get_name(hand, c, n++); + self->value_first = grib_arguments_get_name(hand, c, n++); + self->pressure_units = grib_arguments_get_name(hand, c, n++); } static void dump(grib_accessor* a, grib_dumper* dumper) @@ -160,6 +169,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) { int ret = 0; grib_accessor_g2level* self = (grib_accessor_g2level*)a; + grib_handle* hand = grib_handle_of_accessor(a); long type_first = 0; long scale_first = 0; @@ -169,20 +179,20 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) double v; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->type_first, &type_first)) != GRIB_SUCCESS) + if ((ret = grib_get_long_internal(hand, self->type_first, &type_first)) != GRIB_SUCCESS) return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->scale_first, &scale_first)) != GRIB_SUCCESS) + if ((ret = grib_get_long_internal(hand, self->scale_first, &scale_first)) != GRIB_SUCCESS) return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->value_first, &value_first)) != GRIB_SUCCESS) + if ((ret = grib_get_long_internal(hand, self->value_first, &value_first)) != GRIB_SUCCESS) return ret; - if ((ret = grib_get_string_internal(grib_handle_of_accessor(a), self->pressure_units, pressure_units, &pressure_units_len)) != GRIB_SUCCESS) + if ((ret = grib_get_string_internal(hand, self->pressure_units, pressure_units, &pressure_units_len)) != GRIB_SUCCESS) return ret; if (value_first == GRIB_MISSING_LONG) { *val = 0; return GRIB_SUCCESS; } - /* value = value_first * 10 ^ -scale_first */ + // value = value_first * 10 ^ -scale_first if (*len < 1) return GRIB_WRONG_ARRAY_SIZE; @@ -190,7 +200,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) v = value_first; if (scale_first != GRIB_MISSING_LONG) { - /* GRIB-637 Potential vorticity surface */ + // GRIB-637 Potential vorticity surface if (type_first == 109) { scale_first -= 6; } @@ -206,14 +216,14 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } switch (type_first) { - case 100: /* Isobaric surface (Pa) */ + case 100: // Isobaric surface (Pa) if (!strcmp(pressure_units, "hPa")) { - long x = v / 100.0; /* 1 hPa = 100 Pa */ + long x = v / 100.0; // 1 hPa = 100 Pa if (scale_first == 0 && x == 0) { - /* Switch to Pa instead of hPa as the value is less than a hectoPascal */ + // Switch to Pa instead of hPa as the value is less than a hectoPascal char pa[] = "Pa"; size_t lpa = strlen(pa); - if ((ret = grib_set_string_internal(grib_handle_of_accessor(a), self->pressure_units, pa, &lpa)) != GRIB_SUCCESS) + if ((ret = grib_set_string_internal(hand, self->pressure_units, pa, &lpa)) != GRIB_SUCCESS) return ret; } else { @@ -233,7 +243,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) double dval = 0; int ret = unpack_double(a, &dval, len); if (ret == GRIB_SUCCESS) { - *val = (long)(dval + 0.5); /* round up */ + *val = (long)(dval + 0.5); // round up } return ret; } @@ -241,6 +251,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_g2level* self = (grib_accessor_g2level*)a; + grib_handle* hand = grib_handle_of_accessor(a); int ret = 0; double value_first = *val; long scale_first = 0; @@ -251,14 +262,14 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if (*len != 1) return GRIB_WRONG_ARRAY_SIZE; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->type_first, &type_first)) != GRIB_SUCCESS) + if ((ret = grib_get_long_internal(hand, self->type_first, &type_first)) != GRIB_SUCCESS) return ret; - if ((ret = grib_get_string_internal(grib_handle_of_accessor(a), self->pressure_units, pressure_units, &pressure_units_len)) != GRIB_SUCCESS) + if ((ret = grib_get_string_internal(hand, self->pressure_units, pressure_units, &pressure_units_len)) != GRIB_SUCCESS) return ret; switch (type_first) { - case 100: /* Pa */ + case 100: // Pa if (!strcmp(pressure_units, "hPa")) value_first *= 100; break; @@ -266,20 +277,20 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) default: break; } - /* - * final = scaled_value * 10 ^ -scale_factor - * = scaled_value / (10^scale_factor) - * - * Choose 2 decimal places - */ + // + // final = scaled_value * 10 ^ -scale_factor + // = scaled_value / (10^scale_factor) + // + // Choose 2 decimal places + // scale_first = 2; value_first *= 100; value_first = value_first + 0.5; /* round up */ if (type_first > 9) { - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->scale_first, scale_first)) != GRIB_SUCCESS) + if ((ret = grib_set_long_internal(hand, self->scale_first, scale_first)) != GRIB_SUCCESS) return ret; - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->value_first, (long)value_first)) != GRIB_SUCCESS) + if ((ret = grib_set_long_internal(hand, self->value_first, (long)value_first)) != GRIB_SUCCESS) return ret; } @@ -303,15 +314,14 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) if (*len != 1) return GRIB_WRONG_ARRAY_SIZE; - /*Not sure if this is necessary - * if (value_first == GRIB_MISSING_LONG) { - * if ((ret=grib_set_missing_internal(hand, self->scale_first)) != GRIB_SUCCESS) - * return ret; - * if ((ret=grib_set_missing_internal(hand, self->value_first)) != GRIB_SUCCESS) - * return ret; - * return GRIB_SUCCESS; - * } - */ + // Not sure if this is necessary + // if (value_first == GRIB_MISSING_LONG) { + // if ((ret=grib_set_missing_internal(hand, self->scale_first)) != GRIB_SUCCESS) + // return ret; + // if ((ret=grib_set_missing_internal(hand, self->value_first)) != GRIB_SUCCESS) + // return ret; + // return GRIB_SUCCESS; + // } if ((ret = grib_get_long_internal(hand, self->type_first, &type_first)) != GRIB_SUCCESS) return ret; @@ -320,14 +330,14 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return ret; switch (type_first) { - case 100: /* Pa */ + case 100: // Pa scale_first = 0; if (!strcmp(pressure_units, "hPa")) value_first *= 100; break; case 109: if ((ret = grib_get_long(hand, "levelFactor", &levelFactor)) == GRIB_SUCCESS) { - /* See ECC-1081 */ + // See ECC-1081 scale_first = levelFactor; } @@ -335,16 +345,15 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) break; } - /* ECC-530: - * The pack_long function can get called when key "typeOfSecondFixedSurface" is - * changed (via the trigger rule in the definitions). That can have an undesired - * side-effect that it sets the scale factor and scaled value keys - * (e.g. scaleFactorOfFirstFixedSurface, scaledValueOfFirstFixedSurface) - * overwriting their previous values. - * In this scenario we do not want to change the scale/value. - * However when the user directly sets the level or when we are changing edition, then - * we do want to change the scale/value. - */ + // ECC-530: + // The pack_long function can get called when key "typeOfSecondFixedSurface" is + // changed (via the trigger rule in the definitions). That can have an undesired + // side-effect that it sets the scale factor and scaled value keys + // (e.g. scaleFactorOfFirstFixedSurface, scaledValueOfFirstFixedSurface) + // overwriting their previous values. + // In this scenario we do not want to change the scale/value. + // However when the user directly sets the level or when we are changing edition, then + // we do want to change the scale/value. #if 0 if (hand->loader && hand->loader->changing_edition==0) { change_scale_and_value = 0; @@ -365,10 +374,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) static int is_missing(grib_accessor* a) { grib_accessor_g2level* self = (grib_accessor_g2level*)a; + grib_handle* hand = grib_handle_of_accessor(a); int err = 0; int ret = 0; - ret = grib_is_missing(grib_handle_of_accessor(a), self->scale_first, &err) + - grib_is_missing(grib_handle_of_accessor(a), self->value_first, &err); + ret = grib_is_missing(hand, self->scale_first, &err) + + grib_is_missing(hand, self->value_first, &err); return ret; } diff --git a/src/grib_accessor_class_g2lon.cc b/src/grib_accessor_class_g2lon.cc index 8b45e6935..03baff9bf 100644 --- a/src/grib_accessor_class_g2lon.cc +++ b/src/grib_accessor_class_g2lon.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_g2lon = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_g2lon = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,6 +118,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_g2step_range.cc b/src/grib_accessor_class_g2step_range.cc index 70f26fc2e..d99950c79 100644 --- a/src/grib_accessor_class_g2step_range.cc +++ b/src/grib_accessor_class_g2step_range.cc @@ -83,7 +83,9 @@ static grib_accessor_class _grib_accessor_class_g2step_range = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -99,7 +101,9 @@ static grib_accessor_class _grib_accessor_class_g2step_range = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_gaussian_grid_name.cc b/src/grib_accessor_class_gaussian_grid_name.cc index c7f323999..2906cf77a 100644 --- a/src/grib_accessor_class_gaussian_grid_name.cc +++ b/src/grib_accessor_class_gaussian_grid_name.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_gaussian_grid_name = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_gaussian_grid_name = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_gds_is_present.cc b/src/grib_accessor_class_gds_is_present.cc index a0229cbc5..bb5e2910c 100644 --- a/src/grib_accessor_class_gds_is_present.cc +++ b/src/grib_accessor_class_gds_is_present.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_gds_is_present = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_gds_is_present = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,7 +123,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -135,7 +141,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_gds_not_present_bitmap.cc b/src/grib_accessor_class_gds_not_present_bitmap.cc index 83409e239..40700c089 100644 --- a/src/grib_accessor_class_gds_not_present_bitmap.cc +++ b/src/grib_accessor_class_gds_not_present_bitmap.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_gds_not_present_bitmap = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_gds_not_present_bitmap = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -124,6 +128,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -139,7 +145,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_gen.cc b/src/grib_accessor_class_gen.cc index 627dcddd3..8b112c6a8 100644 --- a/src/grib_accessor_class_gen.cc +++ b/src/grib_accessor_class_gen.cc @@ -14,6 +14,10 @@ * Shahram Najm * ***************************************************************************/ #include "grib_api_internal.h" +#include +#include +#include + /* This is used by make_class.pl @@ -21,6 +25,7 @@ CLASS = accessor IMPLEMENTS = unpack_long;pack_long; clear IMPLEMENTS = unpack_double;pack_double;unpack_double_element;unpack_double_element_set + IMPLEMENTS = unpack_float IMPLEMENTS = unpack_string;pack_string IMPLEMENTS = unpack_string_array;pack_string_array IMPLEMENTS = unpack_bytes;pack_bytes @@ -56,6 +61,7 @@ static int pack_string_array(grib_accessor*, const char**, size_t* len); static int pack_expression(grib_accessor*, grib_expression*); static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); static int unpack_double(grib_accessor*, double* val, size_t* len); +static int unpack_float(grib_accessor*, float* 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); static int unpack_string_array(grib_accessor*, char**, size_t* len); @@ -108,7 +114,9 @@ static grib_accessor_class _grib_accessor_class_gen = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + &unpack_float, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ &pack_string_array, /* grib_pack array procedures string */ @@ -124,7 +132,9 @@ static grib_accessor_class _grib_accessor_class_gen = { &next, /* next accessor */ &compare, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ + 0, /* unpack only ith value */ &unpack_double_element_set, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ &unpack_double_subarray, /* unpack a subarray */ &clear, /* clear */ &make_clone, /* clone accessor */ @@ -304,7 +314,8 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len) return GRIB_NOT_IMPLEMENTED; } -static int unpack_double(grib_accessor* a, double* v, size_t* len) +template +static int unpack(grib_accessor* a, T* v, size_t* len) { int type = GRIB_TYPE_UNDEFINED; if (a->cclass->unpack_long && a->cclass->unpack_long != &unpack_long) { @@ -312,7 +323,7 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len) size_t l = 1; grib_unpack_long(a, &val, &l); *v = val; - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to double", a->name); + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, typeid(T).name()); return GRIB_SUCCESS; } @@ -329,7 +340,7 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len) } } - grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack %s as double", a->name); + grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack as %s", a->name); if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); } @@ -337,6 +348,16 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len) return GRIB_NOT_IMPLEMENTED; } +static int unpack_double(grib_accessor* a, double* v, size_t* len) +{ + return unpack(a, v, len); +} + +static int unpack_float(grib_accessor* a, float* v, size_t* len) +{ + return unpack(a, v, len); +} + static int unpack_string(grib_accessor* a, char* v, size_t* len) { if (a->cclass->unpack_double && a->cclass->unpack_double != &unpack_double) { @@ -355,7 +376,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) grib_unpack_long(a, &val, &l); snprintf(v, 64, "%ld", val); *len = strlen(v); - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to string \n", a->name); + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to string\n", a->name); return GRIB_SUCCESS; } diff --git a/src/grib_accessor_class_gen.h b/src/grib_accessor_class_gen.h new file mode 100644 index 000000000..5e8355c1f --- /dev/null +++ b/src/grib_accessor_class_gen.h @@ -0,0 +1,53 @@ +// ECC-1467 + +#pragma once + +#include "grib_api_internal_cpp.h" +#include +#include + +template +class GribAccessorClassGen { +public: + static int unpack(grib_accessor* a, T* v, size_t* len); +}; + +template <> int GribAccessorClassGen::unpack(grib_accessor* a, long* v, size_t* len); +template <> int GribAccessorClassGen::unpack(grib_accessor* a, char* v, size_t* len); +template <> int GribAccessorClassGen::unpack(grib_accessor* a, float* v, size_t* len); + + +template +int GribAccessorClassGen::unpack(grib_accessor* a, T* v, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + int type = GRIB_TYPE_UNDEFINED; + if (a->cclass->unpack_long && a->cclass->unpack_long != &GribAccessorClassGen::unpack) { + long val = 0; + size_t l = 1; + grib_unpack_long(a, &val, &l); + *v = val; + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, typeid(T).name()); + return GRIB_SUCCESS; + } + + if (a->cclass->unpack_string && a->cclass->unpack_string != &GribAccessorClassGen::unpack) { + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + grib_unpack_string(a, val, &l); + + *v = strtod(val, &last); + if (*last == 0) { /* conversion of string to double worked */ + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name); + return GRIB_SUCCESS; + } + } + + grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack %s as %s", a->name, typeid(T).name()); + if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); + } + + return GRIB_NOT_IMPLEMENTED; +} diff --git a/src/grib_accessor_class_getenv.cc b/src/grib_accessor_class_getenv.cc index a62258b72..bf2db877c 100644 --- a/src/grib_accessor_class_getenv.cc +++ b/src/grib_accessor_class_getenv.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_getenv = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_getenv = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_global_gaussian.cc b/src/grib_accessor_class_global_gaussian.cc index 37bd565a1..d36c2a59b 100644 --- a/src/grib_accessor_class_global_gaussian.cc +++ b/src/grib_accessor_class_global_gaussian.cc @@ -91,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_global_gaussian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -107,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_global_gaussian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -130,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -146,7 +152,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -324,8 +332,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) lats = (double*)grib_context_malloc(c, sizeof(double) * N * 2); if (!lats) { - grib_context_log(c, GRIB_LOG_FATAL, - "global_gaussian pack_long: Memory allocation error: %ld bytes", sizeof(double) * N * 2); + grib_context_log(c, GRIB_LOG_ERROR, + "global_gaussian pack_long: Memory allocation error: %zu bytes", sizeof(double) * N * 2); return GRIB_OUT_OF_MEMORY; } if ((ret = grib_get_gaussian_latitudes(N, lats)) != GRIB_SUCCESS) diff --git a/src/grib_accessor_class_group.cc b/src/grib_accessor_class_group.cc index 996ba0a60..6e7f4dd85 100644 --- a/src/grib_accessor_class_group.cc +++ b/src/grib_accessor_class_group.cc @@ -89,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_group = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -105,7 +107,9 @@ static grib_accessor_class _grib_accessor_class_group = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -122,6 +126,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_gts_header.cc b/src/grib_accessor_class_gts_header.cc index 7c9638935..d47ef0328 100644 --- a/src/grib_accessor_class_gts_header.cc +++ b/src/grib_accessor_class_gts_header.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_gts_header = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_gts_header = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_hash_array.cc b/src/grib_accessor_class_hash_array.cc index 8e330c7b1..7eefe3c29 100644 --- a/src/grib_accessor_class_hash_array.cc +++ b/src/grib_accessor_class_hash_array.cc @@ -90,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_hash_array = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -106,7 +108,9 @@ static grib_accessor_class _grib_accessor_class_hash_array = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -124,6 +128,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -234,10 +242,10 @@ static grib_hash_array_value* find_hash_value(grib_accessor* a, int* err) static int unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_hash_array_value* ha = 0; + grib_hash_array_value* ha = 0; grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - int err = 0; - int i; + int err = 0; + size_t i = 0; if (!self->ha) { ha = find_hash_value(a, &err); diff --git a/src/grib_accessor_class_headers_only.cc b/src/grib_accessor_class_headers_only.cc index 4bf18ad87..5626d582d 100644 --- a/src/grib_accessor_class_headers_only.cc +++ b/src/grib_accessor_class_headers_only.cc @@ -66,7 +66,9 @@ static grib_accessor_class _grib_accessor_class_headers_only = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -82,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_headers_only = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -105,7 +109,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -121,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_ibmfloat.cc b/src/grib_accessor_class_ibmfloat.cc index f07ecb48f..70a523347 100644 --- a/src/grib_accessor_class_ibmfloat.cc +++ b/src/grib_accessor_class_ibmfloat.cc @@ -87,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_ibmfloat = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -103,7 +105,9 @@ static grib_accessor_class _grib_accessor_class_ibmfloat = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -123,6 +127,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_ieeefloat.cc b/src/grib_accessor_class_ieeefloat.cc index 8e8b023e5..599145a8d 100644 --- a/src/grib_accessor_class_ieeefloat.cc +++ b/src/grib_accessor_class_ieeefloat.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_ieeefloat = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_ieeefloat = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,6 +119,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_ifs_param.cc b/src/grib_accessor_class_ifs_param.cc index df9d29e17..6e00e5913 100644 --- a/src/grib_accessor_class_ifs_param.cc +++ b/src/grib_accessor_class_ifs_param.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_ifs_param = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_ifs_param = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int16.cc b/src/grib_accessor_class_int16.cc index a4e5bdc3d..0e46a4a88 100644 --- a/src/grib_accessor_class_int16.cc +++ b/src/grib_accessor_class_int16.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int16 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int16 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int16_little_endian.cc b/src/grib_accessor_class_int16_little_endian.cc index a735589fe..34375162e 100644 --- a/src/grib_accessor_class_int16_little_endian.cc +++ b/src/grib_accessor_class_int16_little_endian.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int16_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int16_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int32.cc b/src/grib_accessor_class_int32.cc index c8b9d4bac..d45dd6115 100644 --- a/src/grib_accessor_class_int32.cc +++ b/src/grib_accessor_class_int32.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int32 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int32 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int32_little_endian.cc b/src/grib_accessor_class_int32_little_endian.cc index 09b96d0f7..a91e18253 100644 --- a/src/grib_accessor_class_int32_little_endian.cc +++ b/src/grib_accessor_class_int32_little_endian.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int32_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int32_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int64.cc b/src/grib_accessor_class_int64.cc index e4c226a55..5bfdba96e 100644 --- a/src/grib_accessor_class_int64.cc +++ b/src/grib_accessor_class_int64.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int64 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int64 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int64_little_endian.cc b/src/grib_accessor_class_int64_little_endian.cc index 56a650c26..acba5952d 100644 --- a/src/grib_accessor_class_int64_little_endian.cc +++ b/src/grib_accessor_class_int64_little_endian.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int64_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int64_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_int8.cc b/src/grib_accessor_class_int8.cc index 409e58218..25f1e9e4e 100644 --- a/src/grib_accessor_class_int8.cc +++ b/src/grib_accessor_class_int8.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_int8 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_int8 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_iterator.cc b/src/grib_accessor_class_iterator.cc index 8ba156099..8eab065b9 100644 --- a/src/grib_accessor_class_iterator.cc +++ b/src/grib_accessor_class_iterator.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_iterator = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_iterator = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,7 +115,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_julian_date.cc b/src/grib_accessor_class_julian_date.cc index 54f0b436f..2ce59d6be 100644 --- a/src/grib_accessor_class_julian_date.cc +++ b/src/grib_accessor_class_julian_date.cc @@ -97,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_julian_date = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -113,7 +115,9 @@ static grib_accessor_class _grib_accessor_class_julian_date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -134,6 +138,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -146,7 +152,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_julian_day.cc b/src/grib_accessor_class_julian_day.cc index 7c746d1d5..332fc3c8a 100644 --- a/src/grib_accessor_class_julian_day.cc +++ b/src/grib_accessor_class_julian_day.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_julian_day = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_julian_day = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_ksec1expver.cc b/src/grib_accessor_class_ksec1expver.cc index 06d54f836..41c61980e 100644 --- a/src/grib_accessor_class_ksec1expver.cc +++ b/src/grib_accessor_class_ksec1expver.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_ksec1expver = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_ksec1expver = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,7 +114,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_label.cc b/src/grib_accessor_class_label.cc index 4451c6ce1..9eecba906 100644 --- a/src/grib_accessor_class_label.cc +++ b/src/grib_accessor_class_label.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_label = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_label = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -108,7 +112,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_laplacian.cc b/src/grib_accessor_class_laplacian.cc index 6258e3b35..293f216f4 100644 --- a/src/grib_accessor_class_laplacian.cc +++ b/src/grib_accessor_class_laplacian.cc @@ -86,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_laplacian = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -102,7 +104,9 @@ static grib_accessor_class _grib_accessor_class_laplacian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -124,6 +128,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -139,7 +145,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_latitudes.cc b/src/grib_accessor_class_latitudes.cc index 90f6601bf..1eefcff4c 100644 --- a/src/grib_accessor_class_latitudes.cc +++ b/src/grib_accessor_class_latitudes.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_latitudes = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_latitudes = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -188,11 +196,11 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) { grib_context* c = a->context; grib_accessor_latitudes* self = (grib_accessor_latitudes*)a; - int ret = 0; - double* v = val; - double dummyLon = 0, dummyVal = 0; - size_t size = 0; - long count = 0; + int ret = 0; + double* v = val; + double dummyLon = 0; + size_t size = 0; + long count = 0; grib_iterator* iter = NULL; self->save = 1; @@ -221,7 +229,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } - iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &ret); + // ECC-1525 Performance: We do not need the values to be decoded + iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret != GRIB_SUCCESS) { if (iter) grib_iterator_delete(iter); @@ -229,7 +238,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } - while (grib_iterator_next(iter, v++, &dummyLon, &dummyVal)) {} + while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} grib_iterator_delete(iter); *len = size; @@ -275,13 +284,15 @@ static int get_distinct(grib_accessor* a, double** val, long* len) double prev; double* v = NULL; double* v1 = NULL; - double dummyLon = 0, dummyVal = 0; + double dummyLon = 0; int ret = 0; int i; long jScansPositively = 0; /* default: north to south */ size_t size = *len; grib_context* c = a->context; - grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &ret); + + // Performance: We do not need the values to be decoded + grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret != GRIB_SUCCESS) { if (iter) grib_iterator_delete(iter); @@ -295,7 +306,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len) } *val = v; - while (grib_iterator_next(iter, v++, &dummyLon, &dummyVal)) {} + while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} grib_iterator_delete(iter); v = *val; diff --git a/src/grib_accessor_class_latlon_increment.cc b/src/grib_accessor_class_latlon_increment.cc index 5fe4f3e0e..4c5953800 100644 --- a/src/grib_accessor_class_latlon_increment.cc +++ b/src/grib_accessor_class_latlon_increment.cc @@ -87,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_latlon_increment = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -103,7 +105,9 @@ static grib_accessor_class _grib_accessor_class_latlon_increment = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,6 +130,8 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -141,7 +147,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_latlonvalues.cc b/src/grib_accessor_class_latlonvalues.cc index 5e2cfd9ac..3eca92da0 100644 --- a/src/grib_accessor_class_latlonvalues.cc +++ b/src/grib_accessor_class_latlonvalues.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_latlonvalues = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_latlonvalues = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,6 +115,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_library_version.cc b/src/grib_accessor_class_library_version.cc index 8872c8a1c..c6c0dc791 100644 --- a/src/grib_accessor_class_library_version.cc +++ b/src/grib_accessor_class_library_version.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_library_version = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_library_version = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -121,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_local_definition.cc b/src/grib_accessor_class_local_definition.cc index 5240eb129..e1dc84f16 100644 --- a/src/grib_accessor_class_local_definition.cc +++ b/src/grib_accessor_class_local_definition.cc @@ -94,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_local_definition = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -110,7 +112,9 @@ static grib_accessor_class _grib_accessor_class_local_definition = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -132,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -148,7 +154,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -230,8 +238,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_ENCODING_ERROR; } - if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber)) + if (grib_is_defined(hand, "perturbationNumber")) { eps = 1; + } + //if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber)) + // eps = 1; switch (localDefinitionNumber) { case 0: @@ -247,12 +258,12 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) productDefinitionTemplateNumberNew = 0; break; - case 1: /* MARS labelling */ - case 36: /* MARS labelling for long window 4Dvar system */ - case 40: /* MARS labeling with domain and model (for LAM) */ - case 42: /* LC-WFV: Wave forecast verification */ + case 1: // MARS labelling + case 36: // MARS labelling for long window 4Dvar system + case 40: // MARS labeling with domain and model (for LAM) + case 42: // LC-WFV: Wave forecast verification if (isInstant) { - /* type=em || type=es */ + // type=em || type=es if (type == 17) { productDefinitionTemplateNumberNew = 2; derivedForecast = 0; @@ -260,7 +271,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) else if (type == 18) { productDefinitionTemplateNumberNew = 2; derivedForecast = 4; - /* eps or enda or elda or ewla */ + // eps or enda or elda or ewla } else if (eps == 1 || stream == 1030 || stream == 1249 || stream == 1250) { productDefinitionTemplateNumberNew = 1; @@ -270,7 +281,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } else { - /* type=em || type=es */ + // type=em || type=es if (type == 17) { productDefinitionTemplateNumberNew = 12; derivedForecast = 0; @@ -278,7 +289,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) else if (type == 18) { productDefinitionTemplateNumberNew = 12; derivedForecast = 4; - /* eps or enda or elda or ewla */ + // eps or enda or elda or ewla } else if (eps == 1 || stream == 1030 || stream == 1249 || stream == 1250) { productDefinitionTemplateNumberNew = 11; @@ -288,7 +299,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } break; - case 41: /* EFAS: uses post-processing templates */ + case 41: // EFAS: uses post-processing templates if (isInstant) { if (eps == 1) productDefinitionTemplateNumberNew = 71; @@ -296,7 +307,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) productDefinitionTemplateNumberNew = 70; } else { - /* non-instantaneous: accum etc */ + // non-instantaneous: accum etc if (eps == 1) productDefinitionTemplateNumberNew = 73; else @@ -304,12 +315,12 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } break; - case 15: /* Seasonal forecast data */ - case 16: /* Seasonal forecast monthly mean data */ - case 12: /* Seasonal forecast monthly mean data for lagged systems */ - case 18: /* Multianalysis ensemble data */ - case 26: /* MARS labelling or ensemble forecast data */ - case 30: /* Forecasting Systems with Variable Resolution */ + case 15: // Seasonal forecast data + case 16: // Seasonal forecast monthly mean data + case 12: // Seasonal forecast monthly mean data for lagged systems + case 18: // Multianalysis ensemble data + case 26: // MARS labelling or ensemble forecast data + case 30: // Forecasting Systems with Variable Resolution if (isInstant) { productDefinitionTemplateNumberNew = 1; } @@ -318,21 +329,21 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } break; - case 5: /* Forecast probability data */ - case 7: /* Sensitivity data */ - case 9: /* Singular vectors and ensemble perturbations */ - case 11: /* Supplementary data used by the analysis */ - case 14: /* Brightness temperature */ - case 20: /* 4D variational increments */ - case 21: /* Sensitive area predictions */ - case 23: /* Coupled atmospheric, wave and ocean means */ - case 24: /* Satellite Channel Number Data */ + case 5: // Forecast probability data + case 7: // Sensitivity data + case 9: // Singular vectors and ensemble perturbations + case 11: // Supplementary data used by the analysis + case 14: // Brightness temperature + case 20: // 4D variational increments + case 21: // Sensitive area predictions + case 23: // Coupled atmospheric, wave and ocean means + case 24: // Satellite Channel Number Data case 25: - case 28: /* COSMO local area EPS */ - case 38: /* 4D variational increments for long window 4Dvar system */ - case 39: /* 4DVar model errors for long window 4Dvar system */ - case 60: /* Ocean data analysis */ - case 192: /* Multiple ECMWF local definitions */ + case 28: // COSMO local area EPS + case 38: // 4D variational increments for long window 4Dvar system + case 39: // 4DVar model errors for long window 4Dvar system + case 60: // Ocean data analysis + case 192: // Multiple ECMWF local definitions if (isInstant) { productDefinitionTemplateNumberNew = 0; } @@ -343,17 +354,17 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) default: #ifdef DEBUG - /* In test & development mode, fail so we remember to adjust PDTN */ + // In test & development mode, fail so we remember to adjust PDTN grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_local_definition: Invalid localDefinitionNumber %d", localDefinitionNumber); return GRIB_ENCODING_ERROR; #endif - /* ECC-1253: Do not fail in operations. Leave PDTN as is */ + // ECC-1253: Do not fail in operations. Leave PDTN as is productDefinitionTemplateNumberNew = productDefinitionTemplateNumber; break; } - /* Adjust for atmospheric chemical constituents */ + // Adjust for atmospheric chemical constituents if (chemical == 1) { if (eps == 1) { if (isInstant) { @@ -372,7 +383,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } } - /* Adjust for atmospheric chemical constituents based on a distribution function */ + // Adjust for atmospheric chemical constituents based on a distribution function if (chemical_distfn == 1) { if (eps == 1) { if (isInstant) { @@ -392,7 +403,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } - /* Adjust for atmospheric chemical constituents with source or sink */ + // Adjust for atmospheric chemical constituents with source or sink if (chemical_srcsink == 1) { if (eps == 1) { if (isInstant) { @@ -412,27 +423,27 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } - /* Adjust for aerosols */ + // Adjust for aerosols if (aerosol == 1) { if (eps == 1) { if (isInstant) { productDefinitionTemplateNumberNew = 45; } else { - /*productDefinitionTemplateNumberNew = 47; This PDT is deprecated */ + //productDefinitionTemplateNumberNew = 47; This PDT is deprecated productDefinitionTemplateNumberNew = 85; } } else { if (isInstant) { - productDefinitionTemplateNumberNew = 48; /*44 is deprecated*/ + productDefinitionTemplateNumberNew = 48; //44 is deprecated*/ } else { productDefinitionTemplateNumberNew = 46; } } } - /* Adjust for optical properties of aerosol */ + // Adjust for optical properties of aerosol if (aerosol_optical == 1) { if (eps == 1) { if (isInstant) { diff --git a/src/grib_accessor_class_long.cc b/src/grib_accessor_class_long.cc index c3f562be3..6f5babcde 100644 --- a/src/grib_accessor_class_long.cc +++ b/src/grib_accessor_class_long.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_long = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_long = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,6 +116,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_long_vector.cc b/src/grib_accessor_class_long_vector.cc index e53adb057..b5389b512 100644 --- a/src/grib_accessor_class_long_vector.cc +++ b/src/grib_accessor_class_long_vector.cc @@ -83,7 +83,9 @@ static grib_accessor_class _grib_accessor_class_long_vector = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -99,7 +101,9 @@ static grib_accessor_class _grib_accessor_class_long_vector = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -121,6 +125,8 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_longitudes.cc b/src/grib_accessor_class_longitudes.cc index 03f08f6be..09f4bf87b 100644 --- a/src/grib_accessor_class_longitudes.cc +++ b/src/grib_accessor_class_longitudes.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_longitudes = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_longitudes = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -165,9 +173,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) grib_accessor_longitudes* self = (grib_accessor_longitudes*)a; int ret = 0; double* v = val; - double dummyLat = 0, dummyVal = 0; - size_t size = 0; - long count = 0; + double dummyLat = 0; + size_t size = 0; + long count = 0; grib_iterator* iter = NULL; self->save = 1; @@ -197,7 +205,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } - iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &ret); + // ECC-1525 Performance: We do not need the values to be decoded + iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret != GRIB_SUCCESS) { if (iter) grib_iterator_delete(iter); @@ -205,7 +214,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } - while (grib_iterator_next(iter, &dummyLat, v++, &dummyVal)) {} + while (grib_iterator_next(iter, &dummyLat, v++, NULL)) {} grib_iterator_delete(iter); *len = size; @@ -250,12 +259,14 @@ static int get_distinct(grib_accessor* a, double** val, long* len) double prev; double* v = NULL; double* v1 = NULL; - double dummyLat = 0, dummyVal = 0; + double dummyLat = 0; int ret = 0; int i; size_t size = *len; grib_context* c = a->context; - grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &ret); + + // Performance: We do not need the values to be decoded + grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret != GRIB_SUCCESS) { if (iter) grib_iterator_delete(iter); @@ -269,7 +280,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len) } *val = v; - while (grib_iterator_next(iter, &dummyLat, v++, &dummyVal)) {} + while (grib_iterator_next(iter, &dummyLat, v++, NULL)) {} grib_iterator_delete(iter); v = *val; diff --git a/src/grib_accessor_class_lookup.cc b/src/grib_accessor_class_lookup.cc index 8389872cb..e8ce7af09 100644 --- a/src/grib_accessor_class_lookup.cc +++ b/src/grib_accessor_class_lookup.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_lookup = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_lookup = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_mars_param.cc b/src/grib_accessor_class_mars_param.cc index ba26e4600..d5c6da1fd 100644 --- a/src/grib_accessor_class_mars_param.cc +++ b/src/grib_accessor_class_mars_param.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_mars_param = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_mars_param = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_mars_step.cc b/src/grib_accessor_class_mars_step.cc index 7c351591f..bdf0715c9 100644 --- a/src/grib_accessor_class_mars_step.cc +++ b/src/grib_accessor_class_mars_step.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_mars_step = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_mars_step = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_md5.cc b/src/grib_accessor_class_md5.cc index 14f2f9bc5..e5ea8177e 100644 --- a/src/grib_accessor_class_md5.cc +++ b/src/grib_accessor_class_md5.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_md5 = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_md5 = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_message.cc b/src/grib_accessor_class_message.cc index 055d735b8..11d430127 100644 --- a/src/grib_accessor_class_message.cc +++ b/src/grib_accessor_class_message.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_message = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_message = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_message_copy.cc b/src/grib_accessor_class_message_copy.cc index c80ff9970..ed6d43c9b 100644 --- a/src/grib_accessor_class_message_copy.cc +++ b/src/grib_accessor_class_message_copy.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_message_copy = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_message_copy = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_missing.cc b/src/grib_accessor_class_missing.cc index d9f1d9214..d6eb6af52 100644 --- a/src/grib_accessor_class_missing.cc +++ b/src/grib_accessor_class_missing.cc @@ -93,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_missing = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -109,7 +111,9 @@ static grib_accessor_class _grib_accessor_class_missing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ diff --git a/src/grib_accessor_class_nearest.cc b/src/grib_accessor_class_nearest.cc index 811a4ac28..329c2b8b5 100644 --- a/src/grib_accessor_class_nearest.cc +++ b/src/grib_accessor_class_nearest.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_nearest = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_nearest = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_non_alpha.cc b/src/grib_accessor_class_non_alpha.cc index 11004a611..6eb316d6b 100644 --- a/src/grib_accessor_class_non_alpha.cc +++ b/src/grib_accessor_class_non_alpha.cc @@ -86,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_non_alpha = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -102,7 +104,9 @@ static grib_accessor_class _grib_accessor_class_non_alpha = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,6 +123,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_number_of_coded_values.cc b/src/grib_accessor_class_number_of_coded_values.cc index eb45eb745..df2c48f5a 100644 --- a/src/grib_accessor_class_number_of_coded_values.cc +++ b/src/grib_accessor_class_number_of_coded_values.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_number_of_coded_values = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_number_of_coded_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_number_of_points.cc b/src/grib_accessor_class_number_of_points.cc index 45568de1c..f5e35590a 100644 --- a/src/grib_accessor_class_number_of_points.cc +++ b/src/grib_accessor_class_number_of_points.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_number_of_points = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_number_of_points = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_number_of_points_gaussian.cc b/src/grib_accessor_class_number_of_points_gaussian.cc index e343eeb3a..17e4d03af 100644 --- a/src/grib_accessor_class_number_of_points_gaussian.cc +++ b/src/grib_accessor_class_number_of_points_gaussian.cc @@ -92,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_number_of_points_gaussian = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -108,7 +110,9 @@ static grib_accessor_class _grib_accessor_class_number_of_points_gaussian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -132,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -148,7 +154,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -320,13 +328,14 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len); static int unpack_long(grib_accessor* a, long* val, size_t* len) { - int ret = GRIB_SUCCESS; + int err = GRIB_SUCCESS; long support_legacy = 1; grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; grib_handle* h = grib_handle_of_accessor(a); - if ((ret = grib_get_long_internal(h, self->support_legacy, &support_legacy)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->support_legacy, &support_legacy)) != GRIB_SUCCESS) + return err; + if (support_legacy == 1) return unpack_long_with_legacy_support(a, val, len); else @@ -336,7 +345,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) /* New algorithm */ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) { - int ret = GRIB_SUCCESS; + int err = GRIB_SUCCESS; int is_global = 0; long ni = 0, nj = 0, plpresent = 0, order = 0; size_t plsize = 0; @@ -352,14 +361,14 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; grib_context* c = a->context; - if ((ret = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_long_internal(h, self->nj, &nj)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->nj, &nj)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_long_internal(h, self->plpresent, &plpresent)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->plpresent, &plpresent)) != GRIB_SUCCESS) + return err; if (nj == 0) return GRIB_GEOCALCULUS_PROBLEM; @@ -375,19 +384,19 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) double lon_first_row = 0, lon_last_row = 0; /*reduced*/ - if ((ret = grib_get_long_internal(h, self->order, &order)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lat_first, &lat_first)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lon_first, &lon_first)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lat_last, &lat_last)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lon_last, &lon_last)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->order, &order)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lat_first, &lat_first)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lon_first, &lon_first)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lat_last, &lat_last)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lon_last, &lon_last)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) + return err; pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize); plsave = pl; @@ -415,6 +424,10 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) *val = 0; for (j = 0; j < nj; j++) { row_count = 0; + if (pl[j] == 0) { + grib_context_log(h->context, GRIB_LOG_ERROR, "Invalid pl array: entry at index=%d is zero", j); + return GRIB_GEOCALCULUS_PROBLEM; + } grib_get_reduced_row_wrapper(h, pl[j], lon_first, lon_last, &row_count, &ilon_first, &ilon_last); lon_first_row = ((ilon_first)*360.0) / pl[j]; lon_last_row = ((ilon_last)*360.0) / pl[j]; @@ -437,13 +450,13 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) if (plsave) grib_context_free(c, plsave); - return ret; + return err; } /* With Legacy support */ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len) { - int ret = GRIB_SUCCESS; + int err = GRIB_SUCCESS; int is_global = 0; long ni = 0, nj = 0, plpresent = 0, order = 0; size_t plsize = 0; @@ -460,14 +473,14 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; grib_context* c = a->context; - if ((ret = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_long_internal(h, self->nj, &nj)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->nj, &nj)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_long_internal(h, self->plpresent, &plpresent)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->plpresent, &plpresent)) != GRIB_SUCCESS) + return err; if (nj == 0) return GRIB_GEOCALCULUS_PROBLEM; @@ -483,19 +496,19 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* double lon_first_row = 0, lon_last_row = 0; /*reduced*/ - if ((ret = grib_get_long_internal(h, self->order, &order)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lat_first, &lat_first)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lon_first, &lon_first)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lat_last, &lat_last)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_double_internal(h, self->lon_last, &lon_last)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_internal(h, self->order, &order)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lat_first, &lat_first)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lon_first, &lon_first)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lat_last, &lat_last)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, self->lon_last, &lon_last)) != GRIB_SUCCESS) + return err; - if ((ret = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) + return err; pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize); plsave = pl; @@ -535,6 +548,10 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* #if EFDEBUG printf("-- %d ", j); #endif + if (pl[j] == 0) { + grib_context_log(h->context, GRIB_LOG_ERROR, "Invalid pl array: entry at index=%d is zero", j); + return GRIB_GEOCALCULUS_PROBLEM; + } grib_get_reduced_row_wrapper(h, pl[j], lon_first, lon_last, &row_count, &ilon_first, &ilon_last); #if 0 if ( row_count != pl[j] ) { @@ -585,5 +602,5 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* } } - return ret; + return err; } diff --git a/src/grib_accessor_class_number_of_values.cc b/src/grib_accessor_class_number_of_values.cc index 7c38437c0..fb84b7fa4 100644 --- a/src/grib_accessor_class_number_of_values.cc +++ b/src/grib_accessor_class_number_of_values.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_number_of_values = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_number_of_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -122,7 +126,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_number_of_values_data_raw_packing.cc b/src/grib_accessor_class_number_of_values_data_raw_packing.cc index 42ad656df..be6ff1899 100644 --- a/src/grib_accessor_class_number_of_values_data_raw_packing.cc +++ b/src/grib_accessor_class_number_of_values_data_raw_packing.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_number_of_values_data_raw_packin 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_number_of_values_data_raw_packin 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -123,7 +127,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -139,7 +145,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_octahedral_gaussian.cc b/src/grib_accessor_class_octahedral_gaussian.cc index d6db8565d..dc88d329a 100644 --- a/src/grib_accessor_class_octahedral_gaussian.cc +++ b/src/grib_accessor_class_octahedral_gaussian.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_octahedral_gaussian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_octahedral_gaussian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,7 +121,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_octet_number.cc b/src/grib_accessor_class_octet_number.cc index bd4b3f4e5..9650e09e0 100644 --- a/src/grib_accessor_class_octet_number.cc +++ b/src/grib_accessor_class_octet_number.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_octet_number = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_octet_number = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_offset_file.cc b/src/grib_accessor_class_offset_file.cc index 44c9af50b..d923c87c2 100644 --- a/src/grib_accessor_class_offset_file.cc +++ b/src/grib_accessor_class_offset_file.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_offset_file = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_offset_file = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,6 +117,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_offset_values.cc b/src/grib_accessor_class_offset_values.cc index 95fde2dbb..e72d892f4 100644 --- a/src/grib_accessor_class_offset_values.cc +++ b/src/grib_accessor_class_offset_values.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_offset_values = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_offset_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,6 +119,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_pack_bufr_values.cc b/src/grib_accessor_class_pack_bufr_values.cc index 690d7f0ed..b51f90021 100644 --- a/src/grib_accessor_class_pack_bufr_values.cc +++ b/src/grib_accessor_class_pack_bufr_values.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_pack_bufr_values = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_pack_bufr_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_pad.cc b/src/grib_accessor_class_pad.cc index 460055c19..7f19c1c73 100644 --- a/src/grib_accessor_class_pad.cc +++ b/src/grib_accessor_class_pad.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_pad = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_pad = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_padding.cc b/src/grib_accessor_class_padding.cc index cfb47097e..5f8900c6a 100644 --- a/src/grib_accessor_class_padding.cc +++ b/src/grib_accessor_class_padding.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_padding = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_padding = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_padto.cc b/src/grib_accessor_class_padto.cc index cc69fd1a2..233a751d2 100644 --- a/src/grib_accessor_class_padto.cc +++ b/src/grib_accessor_class_padto.cc @@ -74,7 +74,9 @@ static grib_accessor_class _grib_accessor_class_padto = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -90,7 +92,9 @@ static grib_accessor_class _grib_accessor_class_padto = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_padtoeven.cc b/src/grib_accessor_class_padtoeven.cc index b0e88a8d5..3f37d7c78 100644 --- a/src/grib_accessor_class_padtoeven.cc +++ b/src/grib_accessor_class_padtoeven.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_padtoeven = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_padtoeven = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,7 +121,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_padtomultiple.cc b/src/grib_accessor_class_padtomultiple.cc index d8afbeba3..e57d33788 100644 --- a/src/grib_accessor_class_padtomultiple.cc +++ b/src/grib_accessor_class_padtomultiple.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_padtomultiple = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_padtomultiple = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,7 +121,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_position.cc b/src/grib_accessor_class_position.cc index b0769ca0b..eed88cd38 100644 --- a/src/grib_accessor_class_position.cc +++ b/src/grib_accessor_class_position.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_position = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_position = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -114,7 +118,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_proj_string.cc b/src/grib_accessor_class_proj_string.cc index 37317eebc..92d99c2a1 100644 --- a/src/grib_accessor_class_proj_string.cc +++ b/src/grib_accessor_class_proj_string.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_proj_string = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_proj_string = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,7 +115,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -151,17 +159,17 @@ static int get_native_type(grib_accessor* a) return GRIB_TYPE_STRING; } -/* Function pointer than takes a handle and returns the proj string */ +// Function pointer than takes a handle and returns the proj string typedef int (*proj_func)(grib_handle*, char*); struct proj_mapping { - const char* gridType; /* key gridType */ - proj_func func; /* function to compute proj string */ + const char* gridType; // key gridType + proj_func func; // function to compute proj string }; typedef struct proj_mapping proj_mapping; -/* This should only be called for GRID POINT data (not spherical harmonics etc) */ +// This should only be called for GRID POINT data (not spherical harmonics etc) static int get_major_minor_axes(grib_handle* h, double* pMajor, double* pMinor) { int err = 0; @@ -177,7 +185,7 @@ static int get_major_minor_axes(grib_handle* h, double* pMajor, double* pMinor) return err; } -/* Caller must have allocated enough space in the 'result' argument */ +// Caller must have allocated enough space in the 'result' argument static int get_earth_shape(grib_handle* h, char* result) { int err = 0; @@ -185,22 +193,11 @@ static int get_earth_shape(grib_handle* h, char* result) if ((err = get_major_minor_axes(h, &major, &minor)) != GRIB_SUCCESS) return err; if (major == minor) - snprintf(result, 128, "+R=%lf", major); /* spherical */ + snprintf(result, 128, "+R=%lf", major); // spherical else - snprintf(result, 128, "+a=%lf +b=%lf", major, minor); /*oblate*/ + snprintf(result, 128, "+a=%lf +b=%lf", major, minor); // oblate return err; } -#if 0 -static int proj_regular_latlon(grib_handle* h, char* result) -{ - int err = 0; - char shape[64] = {0,}; - if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) - return err; - snprintf(result, 128, "+proj=latlong %s", shape); - return err; -} -#endif static int proj_space_view(grib_handle* h, char* result) { @@ -297,6 +294,20 @@ static int proj_polar_stereographic(grib_handle* h, char* result) return err; } +#if 0 +// ECC-1552: This is for regular_ll, regular_gg, reduced_ll, reduced_gg +static int proj_unprojected(grib_handle* h, char* result) +{ + int err = 0; + char shape[64] = {0,}; + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + + snprintf(result, 1024, "+proj=longlat %s", shape); + return err; +} +#endif + static int proj_mercator(grib_handle* h, char* result) { int err = 0; @@ -314,7 +325,10 @@ static int proj_mercator(grib_handle* h, char* result) #define NUMBER(a) (sizeof(a) / sizeof(a[0])) static proj_mapping proj_mappings[] = { - /*{ "regular_ll", &proj_regular_latlon },*/ + // { "regular_ll", &proj_unprojected }, + // { "regular_gg", &proj_unprojected }, + // { "reduced_ll", &proj_unprojected }, + // { "reduced_gg", &proj_unprojected }, { "mercator", &proj_mercator }, { "lambert", &proj_lambert_conformal }, @@ -350,7 +364,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) snprintf(v, 64, "EPSG:4326"); } else { - /* Invoke the appropriate function to get the target proj string */ + // Invoke the appropriate function to get the target proj string if ((err = pm.func(h, v)) != GRIB_SUCCESS) return err; } } diff --git a/src/grib_accessor_class_raw.cc b/src/grib_accessor_class_raw.cc index ae685ed3b..ec2a89dc4 100644 --- a/src/grib_accessor_class_raw.cc +++ b/src/grib_accessor_class_raw.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_raw = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_raw = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_rdbtime_guess_date.cc b/src/grib_accessor_class_rdbtime_guess_date.cc index 7c46c7c6b..33b380520 100644 --- a/src/grib_accessor_class_rdbtime_guess_date.cc +++ b/src/grib_accessor_class_rdbtime_guess_date.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_rdbtime_guess_date = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_rdbtime_guess_date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_reference_value_error.cc b/src/grib_accessor_class_reference_value_error.cc index 1f8812b2a..8b94991b4 100644 --- a/src/grib_accessor_class_reference_value_error.cc +++ b/src/grib_accessor_class_reference_value_error.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_reference_value_error = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_reference_value_error = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,6 +121,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_round.cc b/src/grib_accessor_class_round.cc index bfc59442a..d15a5b83a 100644 --- a/src/grib_accessor_class_round.cc +++ b/src/grib_accessor_class_round.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_round = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_round = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,6 +114,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_scale.cc b/src/grib_accessor_class_scale.cc index fc474c0d8..9ebab9e2b 100644 --- a/src/grib_accessor_class_scale.cc +++ b/src/grib_accessor_class_scale.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_scale = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_scale = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -122,6 +126,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -137,7 +143,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_scale_values.cc b/src/grib_accessor_class_scale_values.cc index c0e7f0ff5..1f62cd902 100644 --- a/src/grib_accessor_class_scale_values.cc +++ b/src/grib_accessor_class_scale_values.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_scale_values = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_scale_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,6 +119,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_second_order_bits_per_value.cc b/src/grib_accessor_class_second_order_bits_per_value.cc index eb0a5811d..5cd3b970c 100644 --- a/src/grib_accessor_class_second_order_bits_per_value.cc +++ b/src/grib_accessor_class_second_order_bits_per_value.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_second_order_bits_per_value = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_second_order_bits_per_value = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,7 +123,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -135,7 +141,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -236,7 +244,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) values = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); if (!values) { - grib_context_log(a->context, GRIB_LOG_FATAL, "%s: Memory allocation error: %zu bytes", a->name, size); + grib_context_log(a->context, GRIB_LOG_ERROR, "%s: Memory allocation error: %zu bytes", a->name, size); return GRIB_OUT_OF_MEMORY; } if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->values, values, &size)) != GRIB_SUCCESS) diff --git a/src/grib_accessor_class_section.cc b/src/grib_accessor_class_section.cc index 9964c682b..12abc49e8 100644 --- a/src/grib_accessor_class_section.cc +++ b/src/grib_accessor_class_section.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_section = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_section = { &next, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_section_length.cc b/src/grib_accessor_class_section_length.cc index 95f3dc550..4d51be289 100644 --- a/src/grib_accessor_class_section_length.cc +++ b/src/grib_accessor_class_section_length.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_section_length = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_section_length = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,7 +114,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_section_padding.cc b/src/grib_accessor_class_section_padding.cc index 5de803d00..3d4cab230 100644 --- a/src/grib_accessor_class_section_padding.cc +++ b/src/grib_accessor_class_section_padding.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_section_padding = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_section_padding = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -110,7 +114,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_section_pointer.cc b/src/grib_accessor_class_section_pointer.cc index 7a6369263..687f35d73 100644 --- a/src/grib_accessor_class_section_pointer.cc +++ b/src/grib_accessor_class_section_pointer.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_section_pointer = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_section_pointer = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_select_step_template.cc b/src/grib_accessor_class_select_step_template.cc index fed9fee4a..a3ddb88fe 100644 --- a/src/grib_accessor_class_select_step_template.cc +++ b/src/grib_accessor_class_select_step_template.cc @@ -8,12 +8,8 @@ * 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 @@ -81,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_select_step_template = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_select_step_template = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -119,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -135,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -146,10 +150,11 @@ static void init_class(grib_accessor_class* c) static void init(grib_accessor* a, const long l, grib_arguments* c) { grib_accessor_select_step_template* self = (grib_accessor_select_step_template*)a; - int n = 0; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; - self->productDefinitionTemplateNumber = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->instant = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++); + self->instant = grib_arguments_get_long(hand, c, n++); } static int unpack_long(grib_accessor* a, long* val, size_t* len) @@ -161,13 +166,16 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) static int pack_long(grib_accessor* a, const long* val, size_t* len) { grib_accessor_select_step_template* self = (grib_accessor_select_step_template*)a; + grib_handle* hand = grib_handle_of_accessor(a); long productDefinitionTemplateNumber = 0; long productDefinitionTemplateNumberNew = 0; - grib_get_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); + grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); + // DET = deterministic i.e., not ensemble + // ENS = ensemble system if (self->instant) { - /* Going from continuous or non-continuous interval to a point-in-time (instantaneous) */ + // Going from continuous or non-continuous interval to a point-in-time (instantaneous) switch (productDefinitionTemplateNumber) { case 8: productDefinitionTemplateNumberNew = 0; @@ -190,28 +198,28 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) case 14: productDefinitionTemplateNumberNew = 4; break; - case 42: /* non-EPS chemical */ + case 42: // DET chemical productDefinitionTemplateNumberNew = 40; break; - case 43: /* EPS chemical */ + case 43: // ENS chemical productDefinitionTemplateNumberNew = 41; break; - case 46: /* non-EPS aerosol */ - productDefinitionTemplateNumberNew = 48; /*44 is deprecated*/ + case 46: // DET aerosol + productDefinitionTemplateNumberNew = 48; // 44 is deprecated break; - case 47: /* EPS aerosol */ + case 47: // ENS aerosol productDefinitionTemplateNumberNew = 45; break; - case 67: /* non-EPS chemical distrib func */ + case 67: // DET chemical distrib func productDefinitionTemplateNumberNew = 57; break; - case 68: /* EPS chemical distrib func */ + case 68: // ENS chemical distrib func productDefinitionTemplateNumberNew = 58; break; - case 72: /* non-EPS post-processing */ + case 72: // DET post-processing productDefinitionTemplateNumberNew = 70; break; - case 73: /* EPS post-processing */ + case 73: // ENS post-processing */ productDefinitionTemplateNumberNew = 71; break; case 0: @@ -231,7 +239,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } else { - /* Going from point-in-time (instantaneous) to continuous or non-continuous interval */ + // Going from point-in-time (instantaneous) to continuous or non-continuous interval switch (productDefinitionTemplateNumber) { case 0: productDefinitionTemplateNumberNew = 8; @@ -254,29 +262,25 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) case 6: productDefinitionTemplateNumberNew = 10; break; - case 40: /* non-EPS chemical */ + case 40: // DET chemical productDefinitionTemplateNumberNew = 42; break; - case 41: /* EPS chemical */ + case 41: // ENS chemical productDefinitionTemplateNumberNew = 43; break; - case 48: /* non-EPS aerosol. Note template 44 is deprecated */ - productDefinitionTemplateNumberNew = 46; + case 45: // ENS aerosol + productDefinitionTemplateNumberNew = 85; // 47 is deprecated break; - case 45: /* EPS aerosol */ - /*productDefinitionTemplateNumberNew = 47; PDT deprecated */ - productDefinitionTemplateNumberNew = 85; - break; - case 57: /* non-EPS chemical distrib func */ + case 57: // DET chemical distrib func productDefinitionTemplateNumberNew = 67; break; - case 58: /* EPS chemical distrib func */ + case 58: // ENS chemical distrib func productDefinitionTemplateNumberNew = 68; break; - case 70: /* non-EPS post-processing */ + case 70: // DET post-processing productDefinitionTemplateNumberNew = 72; break; - case 71: /* EPS post-processing */ + case 71: // ENS post-processing productDefinitionTemplateNumberNew = 73; break; case 7: @@ -295,10 +299,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } } - if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) - grib_set_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, productDefinitionTemplateNumberNew); + if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) { + grib_set_long(hand, self->productDefinitionTemplateNumber, productDefinitionTemplateNumberNew); + } - return 0; + return GRIB_SUCCESS; } static int value_count(grib_accessor* a, long* c) diff --git a/src/grib_accessor_class_sexagesimal2decimal.cc b/src/grib_accessor_class_sexagesimal2decimal.cc index 5279bdefd..31683d2ed 100644 --- a/src/grib_accessor_class_sexagesimal2decimal.cc +++ b/src/grib_accessor_class_sexagesimal2decimal.cc @@ -77,7 +77,9 @@ static grib_accessor_class _grib_accessor_class_sexagesimal2decimal = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -93,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_sexagesimal2decimal = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_signed.cc b/src/grib_accessor_class_signed.cc index 08d899a4d..6c5606be0 100644 --- a/src/grib_accessor_class_signed.cc +++ b/src/grib_accessor_class_signed.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_signed = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_signed = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_signed_bits.cc b/src/grib_accessor_class_signed_bits.cc index e9510bade..de9aab6fe 100644 --- a/src/grib_accessor_class_signed_bits.cc +++ b/src/grib_accessor_class_signed_bits.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_signed_bits = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_signed_bits = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_simple_packing_error.cc b/src/grib_accessor_class_simple_packing_error.cc index f0d8a0435..54ee2d426 100644 --- a/src/grib_accessor_class_simple_packing_error.cc +++ b/src/grib_accessor_class_simple_packing_error.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_simple_packing_error = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_simple_packing_error = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -123,6 +127,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_size.cc b/src/grib_accessor_class_size.cc index 67308d594..e6b305414 100644 --- a/src/grib_accessor_class_size.cc +++ b/src/grib_accessor_class_size.cc @@ -68,7 +68,9 @@ static grib_accessor_class _grib_accessor_class_size = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -84,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_size = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -108,7 +112,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -124,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_smart_table.cc b/src/grib_accessor_class_smart_table.cc index d2d21e04e..6291f6eb0 100644 --- a/src/grib_accessor_class_smart_table.cc +++ b/src/grib_accessor_class_smart_table.cc @@ -103,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_smart_table = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -119,7 +121,9 @@ static grib_accessor_class _grib_accessor_class_smart_table = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -140,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -155,7 +161,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_smart_table_column.cc b/src/grib_accessor_class_smart_table_column.cc index 249038448..2c307240b 100644 --- a/src/grib_accessor_class_smart_table_column.cc +++ b/src/grib_accessor_class_smart_table_column.cc @@ -76,7 +76,9 @@ static grib_accessor_class _grib_accessor_class_smart_table_column = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -92,7 +94,9 @@ static grib_accessor_class _grib_accessor_class_smart_table_column = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -113,7 +117,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_spd.cc b/src/grib_accessor_class_spd.cc index cebc15c77..06b8d0e66 100644 --- a/src/grib_accessor_class_spd.cc +++ b/src/grib_accessor_class_spd.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_spd = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_spd = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_spectral_truncation.cc b/src/grib_accessor_class_spectral_truncation.cc index 5e901a4ba..98c4f30ae 100644 --- a/src/grib_accessor_class_spectral_truncation.cc +++ b/src/grib_accessor_class_spectral_truncation.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_spectral_truncation = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_spectral_truncation = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_sprintf.cc b/src/grib_accessor_class_sprintf.cc index d2794d7c3..4b39122e0 100644 --- a/src/grib_accessor_class_sprintf.cc +++ b/src/grib_accessor_class_sprintf.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_sprintf = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_sprintf = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,7 +115,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_statistics.cc b/src/grib_accessor_class_statistics.cc index 6a509c9f4..0669ed7b2 100644 --- a/src/grib_accessor_class_statistics.cc +++ b/src/grib_accessor_class_statistics.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_statistics = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_statistics = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -125,6 +129,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_statistics_spectral.cc b/src/grib_accessor_class_statistics_spectral.cc index 270f14504..0d4b47d94 100644 --- a/src/grib_accessor_class_statistics_spectral.cc +++ b/src/grib_accessor_class_statistics_spectral.cc @@ -89,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_statistics_spectral = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -105,7 +107,9 @@ static grib_accessor_class _grib_accessor_class_statistics_spectral = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -129,6 +133,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -143,7 +149,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_step_human_readable.cc b/src/grib_accessor_class_step_human_readable.cc index d536941de..eefa3f902 100644 --- a/src/grib_accessor_class_step_human_readable.cc +++ b/src/grib_accessor_class_step_human_readable.cc @@ -71,7 +71,9 @@ static grib_accessor_class _grib_accessor_class_step_human_readable = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -87,7 +89,9 @@ static grib_accessor_class _grib_accessor_class_step_human_readable = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -111,7 +115,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -126,7 +132,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_step_in_units.cc b/src/grib_accessor_class_step_in_units.cc index e8fac61ed..ce1cbcdba 100644 --- a/src/grib_accessor_class_step_in_units.cc +++ b/src/grib_accessor_class_step_in_units.cc @@ -80,7 +80,9 @@ static grib_accessor_class _grib_accessor_class_step_in_units = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -96,7 +98,9 @@ static grib_accessor_class _grib_accessor_class_step_in_units = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -134,7 +140,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_sum.cc b/src/grib_accessor_class_sum.cc index fa793b611..db7d3843a 100644 --- a/src/grib_accessor_class_sum.cc +++ b/src/grib_accessor_class_sum.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_sum = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_sum = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,6 +121,8 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_suppressed.cc b/src/grib_accessor_class_suppressed.cc index 61f4cde32..64d9657bb 100644 --- a/src/grib_accessor_class_suppressed.cc +++ b/src/grib_accessor_class_suppressed.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_suppressed = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_suppressed = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,6 +119,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -128,7 +134,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_time.cc b/src/grib_accessor_class_time.cc index f52d23083..1bdfdec7b 100644 --- a/src/grib_accessor_class_time.cc +++ b/src/grib_accessor_class_time.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_time = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_time = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; @@ -131,7 +137,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_times.cc b/src/grib_accessor_class_times.cc index 4d431f3b0..b0b27baf6 100644 --- a/src/grib_accessor_class_times.cc +++ b/src/grib_accessor_class_times.cc @@ -78,7 +78,9 @@ static grib_accessor_class _grib_accessor_class_times = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -94,7 +96,9 @@ static grib_accessor_class _grib_accessor_class_times = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,7 +120,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_to_double.cc b/src/grib_accessor_class_to_double.cc index 5f2df9b00..0110b5cc1 100644 --- a/src/grib_accessor_class_to_double.cc +++ b/src/grib_accessor_class_to_double.cc @@ -95,7 +95,9 @@ static grib_accessor_class _grib_accessor_class_to_double = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -111,7 +113,9 @@ static grib_accessor_class _grib_accessor_class_to_double = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -128,6 +132,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -140,7 +146,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_to_integer.cc b/src/grib_accessor_class_to_integer.cc index 0c847a9e8..7d74b40f8 100644 --- a/src/grib_accessor_class_to_integer.cc +++ b/src/grib_accessor_class_to_integer.cc @@ -93,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_to_integer = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -109,7 +111,9 @@ static grib_accessor_class _grib_accessor_class_to_integer = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,6 +130,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_to_string.cc b/src/grib_accessor_class_to_string.cc index a6a5032d9..b7f9f05ca 100644 --- a/src/grib_accessor_class_to_string.cc +++ b/src/grib_accessor_class_to_string.cc @@ -93,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_to_string = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -109,7 +111,9 @@ static grib_accessor_class _grib_accessor_class_to_string = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,6 +130,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_transient.cc b/src/grib_accessor_class_transient.cc index 3c4199842..158351e31 100644 --- a/src/grib_accessor_class_transient.cc +++ b/src/grib_accessor_class_transient.cc @@ -68,7 +68,9 @@ static grib_accessor_class _grib_accessor_class_transient = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -84,7 +86,9 @@ static grib_accessor_class _grib_accessor_class_transient = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -109,7 +113,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -125,7 +131,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_transient_darray.cc b/src/grib_accessor_class_transient_darray.cc index 9750db127..19fec9f56 100644 --- a/src/grib_accessor_class_transient_darray.cc +++ b/src/grib_accessor_class_transient_darray.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_transient_darray = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_transient_darray = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -130,7 +136,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_trim.cc b/src/grib_accessor_class_trim.cc index a974d1077..86b18376f 100644 --- a/src/grib_accessor_class_trim.cc +++ b/src/grib_accessor_class_trim.cc @@ -75,7 +75,9 @@ static grib_accessor_class _grib_accessor_class_trim = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -91,7 +93,9 @@ static grib_accessor_class _grib_accessor_class_trim = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -115,7 +119,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint16.cc b/src/grib_accessor_class_uint16.cc index d66401a05..cbf1eba05 100644 --- a/src/grib_accessor_class_uint16.cc +++ b/src/grib_accessor_class_uint16.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_uint16 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_uint16 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint16_little_endian.cc b/src/grib_accessor_class_uint16_little_endian.cc index 16407bed8..42cc1ed6c 100644 --- a/src/grib_accessor_class_uint16_little_endian.cc +++ b/src/grib_accessor_class_uint16_little_endian.cc @@ -67,7 +67,9 @@ static grib_accessor_class _grib_accessor_class_uint16_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -83,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_uint16_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -106,7 +110,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -122,7 +128,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint32.cc b/src/grib_accessor_class_uint32.cc index 7f384d57f..c29a9c7f2 100644 --- a/src/grib_accessor_class_uint32.cc +++ b/src/grib_accessor_class_uint32.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_uint32 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_uint32 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint32_little_endian.cc b/src/grib_accessor_class_uint32_little_endian.cc index 575c90978..6938f7284 100644 --- a/src/grib_accessor_class_uint32_little_endian.cc +++ b/src/grib_accessor_class_uint32_little_endian.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_uint32_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_uint32_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint64.cc b/src/grib_accessor_class_uint64.cc index 18717068b..c2f240b29 100644 --- a/src/grib_accessor_class_uint64.cc +++ b/src/grib_accessor_class_uint64.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_uint64 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_uint64 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint64_little_endian.cc b/src/grib_accessor_class_uint64_little_endian.cc index bd4e87be8..d7aaa3aba 100644 --- a/src/grib_accessor_class_uint64_little_endian.cc +++ b/src/grib_accessor_class_uint64_little_endian.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_uint64_little_endian = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_uint64_little_endian = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_uint8.cc b/src/grib_accessor_class_uint8.cc index 52daeb545..b9d4fc665 100644 --- a/src/grib_accessor_class_uint8.cc +++ b/src/grib_accessor_class_uint8.cc @@ -69,7 +69,9 @@ static grib_accessor_class _grib_accessor_class_uint8 = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -85,7 +87,9 @@ static grib_accessor_class _grib_accessor_class_uint8 = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -107,7 +111,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -123,7 +129,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_unexpanded_descriptors.cc b/src/grib_accessor_class_unexpanded_descriptors.cc index fd7f43ab1..e0c31460b 100644 --- a/src/grib_accessor_class_unexpanded_descriptors.cc +++ b/src/grib_accessor_class_unexpanded_descriptors.cc @@ -82,7 +82,9 @@ static grib_accessor_class _grib_accessor_class_unexpanded_descriptors = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -98,7 +100,9 @@ static grib_accessor_class _grib_accessor_class_unexpanded_descriptors = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -117,7 +121,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -132,7 +138,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_unpack_bufr_values.cc b/src/grib_accessor_class_unpack_bufr_values.cc index eb6afff57..0f02df1d6 100644 --- a/src/grib_accessor_class_unpack_bufr_values.cc +++ b/src/grib_accessor_class_unpack_bufr_values.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_unpack_bufr_values = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_unpack_bufr_values = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -116,6 +120,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->pack_string_array = (*(c->super))->pack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -129,7 +135,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_unsigned.cc b/src/grib_accessor_class_unsigned.cc index 5fe6195b6..1ffe1c385 100644 --- a/src/grib_accessor_class_unsigned.cc +++ b/src/grib_accessor_class_unsigned.cc @@ -85,7 +85,9 @@ static grib_accessor_class _grib_accessor_class_unsigned = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -101,7 +103,9 @@ static grib_accessor_class _grib_accessor_class_unsigned = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_unsigned_bits.cc b/src/grib_accessor_class_unsigned_bits.cc index 23a16cc09..d675bab7c 100644 --- a/src/grib_accessor_class_unsigned_bits.cc +++ b/src/grib_accessor_class_unsigned_bits.cc @@ -84,7 +84,9 @@ static grib_accessor_class _grib_accessor_class_unsigned_bits = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -100,7 +102,9 @@ static grib_accessor_class _grib_accessor_class_unsigned_bits = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -118,7 +122,9 @@ static void init_class(grib_accessor_class* c) c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -133,7 +139,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_validity_date.cc b/src/grib_accessor_class_validity_date.cc index 428093375..9d8c5cab1 100644 --- a/src/grib_accessor_class_validity_date.cc +++ b/src/grib_accessor_class_validity_date.cc @@ -83,7 +83,9 @@ static grib_accessor_class _grib_accessor_class_validity_date = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -99,7 +101,9 @@ static grib_accessor_class _grib_accessor_class_validity_date = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -122,7 +126,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -138,7 +144,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_validity_time.cc b/src/grib_accessor_class_validity_time.cc index 81fe79a6e..64ae1a197 100644 --- a/src/grib_accessor_class_validity_time.cc +++ b/src/grib_accessor_class_validity_time.cc @@ -81,7 +81,9 @@ static grib_accessor_class _grib_accessor_class_validity_time = { 0, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -97,7 +99,9 @@ static grib_accessor_class _grib_accessor_class_validity_time = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,7 +124,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->pack_long = (*(c->super))->pack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_values.cc b/src/grib_accessor_class_values.cc index 733ea0f34..3d5ec2818 100644 --- a/src/grib_accessor_class_values.cc +++ b/src/grib_accessor_class_values.cc @@ -91,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_values = { &pack_long, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -107,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_values = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -126,7 +130,9 @@ static void init_class(grib_accessor_class* c) c->is_missing = (*(c->super))->is_missing; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -140,7 +146,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_variable.cc b/src/grib_accessor_class_variable.cc index 1183c5f4c..306578968 100644 --- a/src/grib_accessor_class_variable.cc +++ b/src/grib_accessor_class_variable.cc @@ -91,7 +91,9 @@ static grib_accessor_class _grib_accessor_class_variable = { &pack_long, /* grib_pack procedures long */ &unpack_long, /* grib_unpack procedures long */ &pack_double, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ &pack_string, /* grib_pack procedures string */ &unpack_string, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -107,7 +109,9 @@ static grib_accessor_class _grib_accessor_class_variable = { 0, /* next accessor */ &compare, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ &make_clone, /* clone accessor */ @@ -124,6 +128,8 @@ static void init_class(grib_accessor_class* c) c->sub_section = (*(c->super))->sub_section; c->pack_missing = (*(c->super))->pack_missing; c->is_missing = (*(c->super))->is_missing; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string_array = (*(c->super))->pack_string_array; c->unpack_string_array = (*(c->super))->unpack_string_array; c->pack_bytes = (*(c->super))->pack_bytes; @@ -136,7 +142,9 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; } diff --git a/src/grib_accessor_class_vector.cc b/src/grib_accessor_class_vector.cc index 627ab6a83..26b870001 100644 --- a/src/grib_accessor_class_vector.cc +++ b/src/grib_accessor_class_vector.cc @@ -79,7 +79,9 @@ static grib_accessor_class _grib_accessor_class_vector = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ &unpack_double, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -95,7 +97,9 @@ static grib_accessor_class _grib_accessor_class_vector = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -120,6 +124,8 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -135,7 +141,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_accessor_class_when.cc b/src/grib_accessor_class_when.cc index 8adaae235..1f2c1f57b 100644 --- a/src/grib_accessor_class_when.cc +++ b/src/grib_accessor_class_when.cc @@ -72,7 +72,9 @@ static grib_accessor_class _grib_accessor_class_when = { 0, /* grib_pack procedures long */ 0, /* grib_unpack procedures long */ 0, /* grib_pack procedures double */ + 0, /* grib_pack procedures float */ 0, /* grib_unpack procedures double */ + 0, /* grib_unpack procedures float */ 0, /* grib_pack procedures string */ 0, /* grib_unpack procedures string */ 0, /* grib_pack array procedures string */ @@ -88,7 +90,9 @@ static grib_accessor_class _grib_accessor_class_when = { 0, /* next accessor */ 0, /* compare vs. another accessor */ 0, /* unpack only ith value */ + 0, /* unpack only ith value */ 0, /* unpack a given set of elements */ + 0, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -112,7 +116,9 @@ static void init_class(grib_accessor_class* c) c->pack_long = (*(c->super))->pack_long; c->unpack_long = (*(c->super))->unpack_long; c->pack_double = (*(c->super))->pack_double; + c->pack_float = (*(c->super))->pack_float; c->unpack_double = (*(c->super))->unpack_double; + c->unpack_float = (*(c->super))->unpack_float; c->pack_string = (*(c->super))->pack_string; c->unpack_string = (*(c->super))->unpack_string; c->pack_string_array = (*(c->super))->pack_string_array; @@ -127,7 +133,9 @@ static void init_class(grib_accessor_class* c) c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; c->unpack_double_element = (*(c->super))->unpack_double_element; + c->unpack_float_element = (*(c->super))->unpack_float_element; c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; + c->unpack_float_element_set = (*(c->super))->unpack_float_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; diff --git a/src/grib_api.h b/src/grib_api.h index 471754ee1..b06e854fc 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -10,7 +10,6 @@ /*! \file grib_api.h \brief grib_api C header file - */ #ifndef grib_api_H @@ -24,14 +23,14 @@ #include "eccodes_windef.h" #ifndef ECCODES_ON_WINDOWS -#include + #include #endif #include #if defined(__GNUC__) || defined(__clang__) -#define ECCODES_DEPRECATED __attribute__((deprecated)) + #define ECCODES_DEPRECATED __attribute__((deprecated)) #else -#define ECCODES_DEPRECATED + #define ECCODES_DEPRECATED #endif typedef enum ProductKind @@ -52,15 +51,13 @@ extern "C" { /* sections */ #define GRIB_SECTION_PRODUCT (1 << 0) -#define GRIB_SECTION_GRID (1 << 1) -#define GRIB_SECTION_LOCAL (1 << 2) -#define GRIB_SECTION_DATA (1 << 3) -#define GRIB_SECTION_BITMAP (1 << 4) +#define GRIB_SECTION_GRID (1 << 1) +#define GRIB_SECTION_LOCAL (1 << 2) +#define GRIB_SECTION_DATA (1 << 3) +#define GRIB_SECTION_BITMAP (1 << 4) -/* LOG MODES -Log mode for information for processing information -*/ +/* Log modes for processing information */ /* Log mode for info */ #define GRIB_LOG_INFO 0 /* Log mode for warnings */ @@ -93,10 +90,10 @@ Log mode for information for processing information /* Missing values */ /* #define GRIB_MISSING_LONG 0x80000001 */ /* #define GRIB_MISSING_LONG 0xffffffff */ -#define GRIB_MISSING_LONG 2147483647 +#define GRIB_MISSING_LONG 2147483647 #define GRIB_MISSING_DOUBLE -1e+100 -/* Dump option flags*/ +/* Dump option flags */ #define GRIB_DUMP_FLAG_READ_ONLY (1 << 0) #define GRIB_DUMP_FLAG_DUMP_OK (1 << 1) #define GRIB_DUMP_FLAG_VALUES (1 << 2) @@ -114,6 +111,9 @@ Log mode for information for processing information #define GRIB_NEAREST_SAME_DATA (1 << 1) #define GRIB_NEAREST_SAME_POINT (1 << 2) +/* Geoiterator flags */ +#define GRIB_GEOITERATOR_NO_VALUES (1 << 0) + /*! Iteration is carried out on all the keys available in the message \ingroup keys_iterator \see grib_keys_iterator_new @@ -179,17 +179,17 @@ struct grib_values }; -/*! Grib handle, structure giving access to parsed message values by keys +/*! Grib handle, structure giving access to parsed message values by keys \ingroup grib_handle */ typedef struct grib_handle grib_handle; -/*! Grib multi field handle, structure used to build multi-field GRIB messages. +/*! Grib multi field handle, structure used to build multi-field GRIB messages. \ingroup grib_handle */ typedef struct grib_multi_handle grib_multi_handle; -/*! Grib context, structure containing the memory methods, the parsers and the formats. +/*! Grib context, structure containing the memory methods, the parsers and the formats. \ingroup grib_context */ typedef struct grib_context grib_context; @@ -246,7 +246,7 @@ The grib_index is the structure giving indexed access to messages in a file. /*! @{*/ /*! index structure to access messages in a file. -*/ + */ typedef struct grib_index grib_index; /** @@ -402,47 +402,47 @@ The grib_handle is the structure giving access to parsed grib values by keys. */ /*! @{*/ /** -* Counts the messages contained in a file resource. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param n : the number of messages in the file -* @return 0 if OK, integer value on error -*/ + * Counts the messages contained in a file resource. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param n : the number of messages in the file + * @return 0 if OK, integer value on error + */ int grib_count_in_file(grib_context* c, FILE* f, int* n); /** -* Counts the messages contained in a file. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param filename : the path to the file -* @param n : the number of messages in the file -* @return 0 if OK, integer value on error -*/ + * Counts the messages contained in a file. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param filename : the path to the file + * @param n : the number of messages in the file + * @return 0 if OK, integer value on error + */ int grib_count_in_filename(grib_context* c, const char* filename, int* n); /** -* Create a handle from a file resource. -* The file is read until a message is found. The message is then copied. -* Remember always to delete the handle when it is not needed anymore to avoid -* memory leaks. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param f : the file resource -* @param error : error code set if the returned handle is NULL and the end of file is not reached -* @return the new handle, NULL if the resource is invalid or a problem is encountered -*/ + * Create a handle from a file resource. + * The file is read until a message is found. The message is then copied. + * Remember always to delete the handle when it is not needed anymore to avoid + * memory leaks. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param f : the file resource + * @param error : error code set if the returned handle is NULL and the end of file is not reached + * @return the new handle, NULL if the resource is invalid or a problem is encountered + */ grib_handle* grib_handle_new_from_file(grib_context* c, FILE* f, int* error); /** -* Write a coded message in a file. -* -* @param h : grib_handle to be written -* @param file : name of the file -* @param mode : mode -* @return 0 if OK, integer value on error -*/ + * Write a coded message in a file. + * + * @param h : grib_handle to be written + * @param file : name of the file + * @param mode : mode + * @return 0 if OK, integer value on error + */ int grib_write_message(const grib_handle* h, const char* file, const char* mode); typedef struct grib_string_list grib_string_list; @@ -458,39 +458,39 @@ grib_string_list* grib_util_get_param_id(const char* mars_param); grib_string_list* grib_util_get_mars_param(const char* param_id); /** -* Create a handle from a user message in memory. The message will not be freed at the end. -* The message will be copied as soon as a modification is needed. -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message in memory. The message will not be freed at the end. + * The message will be copied as soon as a modification is needed. + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ grib_handle* grib_handle_new_from_message(grib_context* c, const void* data, size_t data_len); /** -* Create a handle from a user message in memory. The message will not be freed at the end. -* The message will be copied as soon as a modification is needed. -* This function works also with multi-field messages. -* Note: The data pointer argument may be modified -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @param error : error code -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message in memory. The message will not be freed at the end. + * The message will be copied as soon as a modification is needed. + * This function works also with multi-field messages. + * Note: The data pointer argument may be modified + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @param error : error code + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ grib_handle* grib_handle_new_from_multi_message(grib_context* c, void** data, size_t* data_len, int* error); /** -* Create a handle from a user message. The message is copied and will be freed with the handle -* -* @param c : the context from which the handle will be created (NULL for default context) -* @param data : the actual message -* @param data_len : the length of the message in number of bytes -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Create a handle from a user message. The message is copied and will be freed with the handle + * + * @param c : the context from which the handle will be created (NULL for default context) + * @param data : the actual message + * @param data_len : the length of the message in number of bytes + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ grib_handle* grib_handle_new_from_message_copy(grib_context* c, const void* data, size_t data_len); @@ -506,20 +506,20 @@ grib_handle* grib_handle_new_from_samples(grib_context* c, const char* sample_na /** -* Clone an existing handle using the context of the original handle, -* The message is copied and reparsed -* -* @param h : The handle to be cloned -* @return the new handle, NULL if the message is invalid or a problem is encountered -*/ + * Clone an existing handle using the context of the original handle, + * The message is copied and reparsed + * + * @param h : The handle to be cloned + * @return the new handle, NULL if the message is invalid or a problem is encountered + */ grib_handle* grib_handle_clone(const grib_handle* h); /** -* Frees a handle, also frees the message if it is not a user message -* @see grib_handle_new_from_message -* @param h : The handle to be deleted -* @return 0 if OK, integer value on error -*/ + * Frees a handle, also frees the message if it is not a user message + * @see grib_handle_new_from_message + * @param h : The handle to be deleted + * @return 0 if OK, integer value on error + */ int grib_handle_delete(grib_handle* h); /** @@ -568,25 +568,25 @@ int grib_multi_handle_write(grib_multi_handle* mh, FILE* f); /*! \defgroup handling_coded_messages Handling coded messages */ /*! @{ */ /** -* getting the message attached to a handle -* -* @param h : the handle to which the buffer should be gathered -* @param message : the pointer to be set to the handle's data -* @param message_length : On exit, the message size in number of bytes -* @return 0 if OK, integer value on error -*/ + * getting the message attached to a handle + * + * @param h : the handle to which the buffer should be gathered + * @param message : the pointer to be set to the handle's data + * @param message_length : On exit, the message size in number of bytes + * @return 0 if OK, integer value on error + */ int grib_get_message(const grib_handle* h, const void** message, size_t* message_length); /** -* getting a copy of the message attached to a handle -* -* @param h : the handle to which the buffer should be returned -* @param message : the pointer to the data buffer to be filled -* @param message_length : On entry, the size in number of bytes of the allocated empty message. -* On exit, the actual message length in number of bytes -* @return 0 if OK, integer value on error -*/ + * getting a copy of the message attached to a handle + * + * @param h : the handle to which the buffer should be returned + * @param message : the pointer to the data buffer to be filled + * @param message_length : On entry, the size in number of bytes of the allocated empty message. + * On exit, the actual message length in number of bytes + * @return 0 if OK, integer value on error + */ int grib_get_message_copy(const grib_handle* h, void* message, size_t* message_length); /*! @} */ @@ -594,140 +594,140 @@ int grib_get_message_copy(const grib_handle* h, void* message, size_t* message_l /*! @{ */ /*! -* \brief Create a new geoiterator from a handle, using current geometry and values. -* -* \param h : the handle from which the geoiterator will be created -* \param flags : flags for future use. -* \param error : error code -* \return the new geoiterator, NULL if no geoiterator can be created -*/ + * \brief Create a new geoiterator from a handle, using current geometry and values. + * + * \param h : the handle from which the geoiterator will be created + * \param flags : flags for future use. + * \param error : error code + * \return the new geoiterator, NULL if no geoiterator can be created + */ grib_iterator* grib_iterator_new(const grib_handle* h, unsigned long flags, int* error); /** -* Get latitude/longitude and data values. -* The Latitudes, longitudes and values arrays must be properly allocated by the caller. -* Their required dimension can be obtained by getting the value of the integer key "numberOfPoints". -* -* @param h : handle from which geography and data values are taken -* @param lats : returned array of latitudes -* @param lons : returned array of longitudes -* @param values : returned array of data values -* @return 0 if OK, integer value on error -*/ + * Get latitude/longitude and data values. + * The Latitudes, longitudes and values arrays must be properly allocated by the caller. + * Their required dimension can be obtained by getting the value of the integer key "numberOfPoints". + * + * @param h : handle from which geography and data values are taken + * @param lats : returned array of latitudes + * @param lons : returned array of longitudes + * @param values : returned array of data values + * @return 0 if OK, integer value on error + */ int grib_get_data(const grib_handle* h, double* lats, double* lons, double* values); /** -* Get the next value from a geoiterator. -* -* @param i : the geoiterator -* @param lat : on output latitude in degree -* @param lon : on output longitude in degree -* @param value : on output value of the point -* @return positive value if successful, 0 if no more data are available -*/ + * Get the next value from a geoiterator. + * + * @param i : the geoiterator + * @param lat : on output latitude in degree + * @param lon : on output longitude in degree + * @param value : on output value of the point + * @return positive value if successful, 0 if no more data are available + */ int grib_iterator_next(grib_iterator* i, double* lat, double* lon, double* value); /** -* Get the previous value from a geoiterator. -* -* @param i : the geoiterator -* @param lat : on output latitude in degree -* @param lon : on output longitude in degree -* @param value : on output value of the point* -* @return positive value if successful, 0 if no more data are available -*/ + * Get the previous value from a geoiterator. + * + * @param i : the geoiterator + * @param lat : on output latitude in degree + * @param lon : on output longitude in degree + * @param value : on output value of the point* + * @return positive value if successful, 0 if no more data are available + */ int grib_iterator_previous(grib_iterator* i, double* lat, double* lon, double* value); /** -* Test procedure for values in a geoiterator. -* -* @param i : the geoiterator -* @return boolean, 1 if the geoiterator still nave next values, 0 otherwise -*/ + * Test procedure for values in a geoiterator. + * + * @param i : the geoiterator + * @return boolean, 1 if the geoiterator still nave next values, 0 otherwise + */ int grib_iterator_has_next(grib_iterator* i); /** -* Test procedure for values in a geoiterator. -* -* @param i : the geoiterator -* @return 0 if OK, integer value on error -*/ + * Test procedure for values in a geoiterator. + * + * @param i : the geoiterator + * @return 0 if OK, integer value on error + */ int grib_iterator_reset(grib_iterator* i); /** -* Frees a geoiterator from memory -* -* @param i : the geoiterator -* @return 0 if OK, integer value on error -*/ + * Frees a geoiterator from memory + * + * @param i : the geoiterator + * @return 0 if OK, integer value on error + */ int grib_iterator_delete(grib_iterator* i); /*! -* \brief Create a new nearest neighbour object from a handle, using current geometry. -* -* \param h : the handle from which the nearest object will be created -* \param error : error code -* \return the new nearest, NULL if no nearest can be created -*/ + * \brief Create a new nearest neighbour object from a handle, using current geometry. + * + * \param h : the handle from which the nearest object will be created + * \param error : error code + * \return the new nearest, NULL if no nearest can be created + */ grib_nearest* grib_nearest_new(const grib_handle* h, int* error); /** -* Find the 4 nearest points of a latitude longitude point. -* The flags are provided to speed up the process of searching. If you are -* sure that the point you are asking for is not changing from a call -* to another you can use GRIB_NEAREST_SAME_POINT. The same is valid for -* the grid. Flags can be used together doing a bitwise OR. -* The distances are given in kilometres. -* -* @param nearest : nearest structure -* @param h : handle from which geography and data values are taken -* @param inlat : latitude of the point to search for -* @param inlon : longitude of the point to search for -* @param flags : GRIB_NEAREST_SAME_POINT, GRIB_NEAREST_SAME_GRID -* @param outlats : returned array of latitudes of the nearest points -* @param outlons : returned array of longitudes of the nearest points -* @param values : returned array of data values of the nearest points -* @param distances : returned array of distances from the nearest points -* @param indexes : returned array of indexes of the nearest points -* @param len : size of the arrays -* @return 0 if OK, integer value on error -*/ + * Find the 4 nearest points of a latitude longitude point. + * The flags are provided to speed up the process of searching. If you are + * sure that the point you are asking for is not changing from a call + * to another you can use GRIB_NEAREST_SAME_POINT. The same is valid for + * the grid. Flags can be used together doing a bitwise OR. + * The distances are given in kilometres. + * + * @param nearest : nearest structure + * @param h : handle from which geography and data values are taken + * @param inlat : latitude of the point to search for + * @param inlon : longitude of the point to search for + * @param flags : GRIB_NEAREST_SAME_POINT, GRIB_NEAREST_SAME_GRID + * @param outlats : returned array of latitudes of the nearest points + * @param outlons : returned array of longitudes of the nearest points + * @param values : returned array of data values of the nearest points + * @param distances : returned array of distances from the nearest points + * @param indexes : returned array of indexes of the nearest points + * @param len : size of the arrays + * @return 0 if OK, integer value on error + */ int grib_nearest_find(grib_nearest* nearest, const grib_handle* h, double inlat, double inlon, unsigned long flags, double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); /** -* Frees a nearest neighbour object from memory -* -* @param nearest : the nearest -* @return 0 if OK, integer value on error -*/ + * Frees a nearest neighbour object from memory + * + * @param nearest : the nearest + * @return 0 if OK, integer value on error + */ int grib_nearest_delete(grib_nearest* nearest); /** -* Find the nearest point of a set of points whose latitudes and longitudes -* are given in the inlats, inlons arrays respectively. -* If the flag is_lsm is 1 the nearest land point is returned and the -* GRIB passed as handle (h) is considered a land sea mask. -* The land nearest point is the nearest point with land sea mask value>=0.5. -* If no nearest land points are found the nearest value is returned. -* If the flag is_lsm is 0 the nearest point is returned. -* values, distances, indexes (in the "values" array) for the nearest points (ilons,ilats) -* are returned. -* The distances are given in kilometres. -* -* @param h : handle from which geography and data values are taken -* @param is_lsm : lsm flag (1-> nearest land, 0-> nearest) -* @param inlats : latitudes of the points to search for -* @param inlons : longitudes of the points to search for -* @param npoints : number of points (size of the inlats,inlons,outlats,outlons,values,distances,indexes arrays) -* @param outlats : returned array of latitudes of the nearest points -* @param outlons : returned array of longitudes of the nearest points -* @param values : returned array of data values of the nearest points -* @param distances : returned array of distances from the nearest points -* @param indexes : returned array of indexes of the nearest points -* @return 0 if OK, integer value on error -*/ + * Find the nearest point of a set of points whose latitudes and longitudes + * are given in the inlats, inlons arrays respectively. + * If the flag is_lsm is 1 the nearest land point is returned and the + * GRIB passed as handle (h) is considered a land sea mask. + * The land nearest point is the nearest point with land sea mask value>=0.5. + * If no nearest land points are found the nearest value is returned. + * If the flag is_lsm is 0 the nearest point is returned. + * values, distances, indexes (in the "values" array) for the nearest points (ilons,ilats) + * are returned. + * The distances are given in kilometres. + * + * @param h : handle from which geography and data values are taken + * @param is_lsm : lsm flag (1-> nearest land, 0-> nearest) + * @param inlats : latitudes of the points to search for + * @param inlons : longitudes of the points to search for + * @param npoints : number of points (size of the inlats,inlons,outlats,outlons,values,distances,indexes arrays) + * @param outlats : returned array of latitudes of the nearest points + * @param outlons : returned array of longitudes of the nearest points + * @param values : returned array of data values of the nearest points + * @param distances : returned array of distances from the nearest points + * @param indexes : returned array of indexes of the nearest points + * @return 0 if OK, integer value on error + */ int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, @@ -738,261 +738,266 @@ int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, /*! \defgroup get_set Accessing header and data values */ /*! @{ */ /** -* Get the number offset of a key, in a message if several keys of the same name -* are present, the offset of the last one is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param offset : the address of a size_t where the offset will be set -* @return 0 if OK, integer value on error -*/ + * Get the number offset of a key, in a message if several keys of the same name + * are present, the offset of the last one is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param offset : the address of a size_t where the offset will be set + * @return 0 if OK, integer value on error + */ int grib_get_offset(const grib_handle* h, const char* key, size_t* offset); /** -* Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param size : the address of a size_t where the size will be set -* @return 0 if OK, integer value on error -*/ + * Get the number of coded value from a key, if several keys of the same name are present, the total sum is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param size : the address of a size_t where the size will be set + * @return 0 if OK, integer value on error + */ int grib_get_size(const grib_handle* h, const char* key, size_t* size); /** -* Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned -* -* @param h : the handle to get the offset from -* @param key : the key to be searched -* @param length : the address of a size_t where the length will be set -* @return 0 if OK, integer value on error -*/ + * Get the length of the string representation of the key, if several keys of the same name are present, the maximum length is returned + * + * @param h : the handle to get the offset from + * @param key : the key to be searched + * @param length : the address of a size_t where the length will be set + * @return 0 if OK, integer value on error + */ int grib_get_length(const grib_handle* h, const char* key, size_t* length); /** -* Get a long value from a key, if several keys of the same name are present, the last one is returned -* @see grib_set_long -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param value : the address of a long where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get a long value from a key, if several keys of the same name are present, the last one is returned + * @see grib_set_long + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param value : the address of a long where the data will be retrieved + * @return 0 if OK, integer value on error + */ int grib_get_long(const grib_handle* h, const char* key, long* value); /** -* Get a double value from a key, if several keys of the same name are present, the last one is returned -* @see grib_set_double -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param value : the address of a double where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get a double value from a key, if several keys of the same name are present, the last one is returned + * @see grib_set_double + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param value : the address of a double where the data will be retrieved + * @return 0 if OK, integer value on error + */ int grib_get_double(const grib_handle* h, const char* key, double* value); /** -* Get as double the i-th element of the "key" array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param i : zero-based index -* @param value : the address of a double where the data will be retrieved -* @return 0 if OK, integer value on error -*/ + * Get as double the i-th element of the "key" array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param i : zero-based index + * @param value : the address of a double where the data will be retrieved + * @return 0 if OK, integer value on error + */ int grib_get_double_element(const grib_handle* h, const char* key, int i, double* value); +int grib_get_float_element(const grib_handle* h, const char* key, int i, float* value); /** -* Get as double array the elements of the "key" array whose indexes are listed in the input array "index_array" -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param index_array : zero-based array of indexes -* @param size : size of the index_array and value arrays -* @param value : the double array for the data values -* @return 0 if OK, integer value on error -*/ + * Get as double array the elements of the "key" array whose indexes are listed in the input array "index_array" + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param index_array : zero-based array of indexes + * @param size : size of the index_array and value arrays + * @param value : the double array for the data values + * @return 0 if OK, integer value on error + */ int grib_get_double_elements(const grib_handle* h, const char* key, const int* index_array, long size, double* value); +int grib_get_float_elements(const grib_handle* h, const char* key, const int* index_array, long size, float* value); /** -* Get a string value from a key, if several keys of the same name are present, the last one is returned -* @see grib_set_string -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param mesg : the address of a string where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output -* @return 0 if OK, integer value on error -*/ + * Get a string value from a key, if several keys of the same name are present, the last one is returned + * @see grib_set_string + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param mesg : the address of a string where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output + * @return 0 if OK, integer value on error + */ int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t* length); /** -* Get string array values from a key. If several keys of the same name are present, the last one is returned -* @see grib_set_string_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a string array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output -* @return 0 if OK, integer value on error -*/ + * Get string array values from a key. If several keys of the same name are present, the last one is returned + * @see grib_set_string_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a string array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output + * @return 0 if OK, integer value on error + */ int grib_get_string_array(const grib_handle* h, const char* key, char** vals, size_t* length); /** -* Get raw bytes values from a key. If several keys of the same name are present, the last one is returned -* @see grib_set_bytes -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param bytes : the address of a byte array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output -* @return 0 if OK, integer value on error -*/ + * Get raw bytes values from a key. If several keys of the same name are present, the last one is returned + * @see grib_set_bytes + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param bytes : the address of a byte array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output + * @return 0 if OK, integer value on error + */ int grib_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, size_t* length); /** -* Get double array values from a key. If several keys of the same name are present, the last one is returned -* @see grib_set_double_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a double array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output -* @return 0 if OK, integer value on error -*/ + * Get double array values from a key. If several keys of the same name are present, the last one is returned + * @see grib_set_double_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a double array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output + * @return 0 if OK, integer value on error + */ int grib_get_double_array(const grib_handle* h, const char* key, double* vals, size_t* length); +int grib_get_float_array(const grib_handle* h, const char* key, float* vals, size_t* length); /** -* Get long array values from a key. If several keys of the same name are present, the last one is returned -* @see grib_set_long_array -* -* @param h : the handle to get the data from -* @param key : the key to be searched -* @param vals : the address of a long array where the data will be retrieved -* @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output -* @return 0 if OK, integer value on error -*/ + * Get long array values from a key. If several keys of the same name are present, the last one is returned + * @see grib_set_long_array + * + * @param h : the handle to get the data from + * @param key : the key to be searched + * @param vals : the address of a long array where the data will be retrieved + * @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output + * @return 0 if OK, integer value on error + */ int grib_get_long_array(const grib_handle* h, const char* key, long* vals, size_t* length); /* setting data */ /** -* Copy the keys belonging to a given namespace from a source handle to a destination handle -* -* -* @param dest : destination handle -* @param name : namespace -* @param src : source handle -* @return 0 if OK, integer value on error -*/ + * Copy the keys belonging to a given namespace from a source handle to a destination handle + * + * + * @param dest : destination handle + * @param name : namespace + * @param src : source handle + * @return 0 if OK, integer value on error + */ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src); /** -* Set a long value from a key. If several keys of the same name are present, the last one is set -* @see grib_get_long -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param val : a long where the data will be read -* @return 0 if OK, integer value on error -*/ + * Set a long value from a key. If several keys of the same name are present, the last one is set + * @see grib_get_long + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param val : a long where the data will be read + * @return 0 if OK, integer value on error + */ int grib_set_long(grib_handle* h, const char* key, long val); /** -* Set a double value from a key. If several keys of the same name are present, the last one is set -* @see grib_get_double -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param val : a double where the data will be read -* @return 0 if OK, integer value on error -*/ + * Set a double value from a key. If several keys of the same name are present, the last one is set + * @see grib_get_double + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param val : a double where the data will be read + * @return 0 if OK, integer value on error + */ int grib_set_double(grib_handle* h, const char* key, double val); /** -* Set a string value from a key. If several keys of the same name are present, the last one is set -* @see grib_get_string -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param mesg : the address of a string where the data will be read -* @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output -* @return 0 if OK, integer value on error -*/ + * Set a string value from a key. If several keys of the same name are present, the last one is set + * @see grib_get_string + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param mesg : the address of a string where the data will be read + * @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output + * @return 0 if OK, integer value on error + */ int grib_set_string(grib_handle* h, const char* key, const char* mesg, size_t* length); /** -* Set a bytes array from a key. If several keys of the same name are present, the last one is set -* @see grib_get_bytes -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param bytes : the address of a byte array where the data will be read -* @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output -* @return 0 if OK, integer value on error -*/ + * Set a bytes array from a key. If several keys of the same name are present, the last one is set + * @see grib_get_bytes + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param bytes : the address of a byte array where the data will be read + * @param length : the address of a size_t that contains the length of the byte array on input, and that contains the actual packed length of the byte array on output + * @return 0 if OK, integer value on error + */ int grib_set_bytes(grib_handle* h, const char* key, const unsigned char* bytes, size_t* length); /** -* Set a double array from a key. If several keys of the same name are present, the last one is set -* @see grib_get_double_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a double array where the data will be read -* @param length : a size_t that contains the length of the byte array on input -* @return 0 if OK, integer value on error -*/ + * Set a double array from a key. If several keys of the same name are present, the last one is set + * @see grib_get_double_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a double array where the data will be read + * @param length : a size_t that contains the length of the byte array on input + * @return 0 if OK, integer value on error + */ int grib_set_double_array(grib_handle* h, const char* key, const double* vals, size_t length); +int grib_set_float_array(grib_handle* h, const char* key, const float* vals, size_t length); /** -* Same as grib_set_double_array but allows setting of READ-ONLY keys like codedValues. -* Use with great caution!! -*/ + * Same as grib_set_double_array but allows setting of READ-ONLY keys like codedValues. + * Use with great caution!! + */ int grib_set_force_double_array(grib_handle* h, const char* key, const double* vals, size_t length); +int grib_set_force_float_array(grib_handle* h, const char* key, const float* vals, size_t length); /** -* Set a long array from a key. If several keys of the same name are present, the last one is set -* @see grib_get_long_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a long array where the data will be read -* @param length : a size_t that contains the length of the long array on input -* @return 0 if OK, integer value on error -*/ + * Set a long array from a key. If several keys of the same name are present, the last one is set + * @see grib_get_long_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a long array where the data will be read + * @param length : a size_t that contains the length of the long array on input + * @return 0 if OK, integer value on error + */ int grib_set_long_array(grib_handle* h, const char* key, const long* vals, size_t length); /** -* Set a string array from a key. If several keys of the same name are present, the last one is set -* @see grib_get_string_array -* -* @param h : the handle to set the data to -* @param key : the key to be searched -* @param vals : the address of a string array where the data will be read -* @param length : a size_t that contains the length of the array on input -* @return 0 if OK, integer value on error -*/ + * Set a string array from a key. If several keys of the same name are present, the last one is set + * @see grib_get_string_array + * + * @param h : the handle to set the data to + * @param key : the key to be searched + * @param vals : the address of a string array where the data will be read + * @param length : a size_t that contains the length of the array on input + * @return 0 if OK, integer value on error + */ int grib_set_string_array(grib_handle* h, const char* key, const char** vals, size_t length); /*! @} */ /** -* Print all keys, with the context print procedure and dump mode to a resource -* -* @param h : the handle to be printed -* @param out : output file handle -* @param mode : Examples of available dump modes: debug wmo -* @param option_flags : all the GRIB_DUMP_FLAG_x flags can be used -* @param arg : used to provide a format to output data (experimental) -*/ + * Print all keys, with the context print procedure and dump mode to a resource + * + * @param h : the handle to be printed + * @param out : output file handle + * @param mode : Examples of available dump modes: debug wmo + * @param option_flags : all the GRIB_DUMP_FLAG_x flags can be used + * @param arg : used to provide a format to output data (experimental) + */ void grib_dump_content(const grib_handle* h, FILE* out, const char* mode, unsigned long option_flags, void* arg); /** -* Print all keys from the parsed definition files available in a context -* -* @param f : the File used to print the keys on -* @param c : the context that contains the cached definition files to be printed -*/ + * Print all keys from the parsed definition files available in a context + * + * @param f : the File used to print the keys on + * @param c : the context that contains the cached definition files to be printed + */ void grib_dump_action_tree(grib_context* c, FILE* f); /*! \defgroup context The context object @@ -1002,80 +1007,80 @@ void grib_dump_action_tree(grib_context* c, FILE* f); */ /*! @{ */ /** -* free procedure, format of a procedure referenced in the context that is used to free memory -* -* @param c : the context where the memory freeing will apply -* @param data : pointer to the data to be freed -* must match @see grib_malloc_proc -*/ + * free procedure, format of a procedure referenced in the context that is used to free memory + * + * @param c : the context where the memory freeing will apply + * @param data : pointer to the data to be freed + * must match @see grib_malloc_proc + */ typedef void (*grib_free_proc)(const grib_context* c, void* data); /** -* malloc procedure, format of a procedure referenced in the context that is used to allocate memory -* @param c : the context where the memory allocation will apply -* @param length : length to be allocated in number of bytes -* @return a pointer to the allocated memory, NULL if no memory can be allocated -* must match @see grib_free_proc -*/ + * malloc procedure, format of a procedure referenced in the context that is used to allocate memory + * @param c : the context where the memory allocation will apply + * @param length : length to be allocated in number of bytes + * @return a pointer to the allocated memory, NULL if no memory can be allocated + * must match @see grib_free_proc + */ typedef void* (*grib_malloc_proc)(const grib_context* c, size_t length); /** -* realloc procedure, format of a procedure referenced in the context that is used to reallocate memory -* @param c : the context where the memory allocation will apply -* @param data : pointer to the data to be reallocated -* @param length : length to be allocated in number of bytes -* @return a pointer to the allocated memory -*/ + * realloc procedure, format of a procedure referenced in the context that is used to reallocate memory + * @param c : the context where the memory allocation will apply + * @param data : pointer to the data to be reallocated + * @param length : length to be allocated in number of bytes + * @return a pointer to the allocated memory + */ typedef void* (*grib_realloc_proc)(const grib_context* c, void* data, size_t length); /** -* log procedure, format of a procedure referenced in the context that is used to log internal messages -* -* @param c : the context where the logging will apply -* @param level : the log level, as defined in log modes -* @param mesg : the message to be logged -*/ + * log procedure, format of a procedure referenced in the context that is used to log internal messages + * + * @param c : the context where the logging will apply + * @param level : the log level, as defined in log modes + * @param mesg : the message to be logged + */ typedef void (*grib_log_proc)(const grib_context* c, int level, const char* mesg); /** -* print procedure, format of a procedure referenced in the context that is used to print external messages -* -* @param c : the context where the logging will apply -* @param descriptor : the structure to be printed on, must match the implementation -* @param mesg : the message to be printed -*/ + * print procedure, format of a procedure referenced in the context that is used to print external messages + * + * @param c : the context where the logging will apply + * @param descriptor : the structure to be printed on, must match the implementation + * @param mesg : the message to be printed + */ typedef void (*grib_print_proc)(const grib_context* c, void* descriptor, const char* mesg); /** -* data read procedure, format of a procedure referenced in the context that is used to read from a stream in a resource -* -* @param c : the context where the read will apply -* @param ptr : the resource -* @param size : size to read -* @param stream : the stream -* @return size read -*/ + * data read procedure, format of a procedure referenced in the context that is used to read from a stream in a resource + * + * @param c : the context where the read will apply + * @param ptr : the resource + * @param size : size to read + * @param stream : the stream + * @return size read + */ typedef size_t (*grib_data_read_proc)(const grib_context* c, void* ptr, size_t size, void* stream); /** -* data write procedure, format of a procedure referenced in the context that is used to write to a stream from a resource -* -* @param c : the context where the write will apply -* @param ptr : the resource -* @param size : size to read -* @param stream : the stream -* @return size written -*/ + * data write procedure, format of a procedure referenced in the context that is used to write to a stream from a resource + * + * @param c : the context where the write will apply + * @param ptr : the resource + * @param size : size to read + * @param stream : the stream + * @return size written + */ typedef size_t (*grib_data_write_proc)(const grib_context* c, const void* ptr, size_t size, void* stream); /** -* data tell procedure, format of a procedure referenced in the context that is used to tell the current position in a stream -* -* @param c : the context where the tell will apply -* @param stream : the stream -* @return the position in the stream -*/ + * data tell procedure, format of a procedure referenced in the context that is used to tell the current position in a stream + * + * @param c : the context where the tell will apply + * @param stream : the stream + * @return the position in the stream + */ typedef off_t (*grib_data_tell_proc)(const grib_context* c, void* stream); /** @@ -1091,65 +1096,65 @@ typedef off_t (*grib_data_tell_proc)(const grib_context* c, void* stream); typedef off_t (*grib_data_seek_proc)(const grib_context* c, off_t offset, int whence, void* stream); /** -* data eof procedure, format of a procedure referenced in the context that is used to test end of file -* -* @param c : the context where the tell will apply -* @param stream : the stream -* @return the position in the stream -*/ + * data eof procedure, format of a procedure referenced in the context that is used to test end of file + * + * @param c : the context where the tell will apply + * @param stream : the stream + * @return the position in the stream + */ typedef int (*grib_data_eof_proc)(const grib_context* c, void* stream); /** -* Get the static default context -* -* @return the default context, NULL it the context is not available -*/ + * Get the static default context + * + * @return the default context, NULL it the context is not available + */ grib_context* grib_context_get_default(void); /** -* Frees the cached definition files of the context -* -* @param c : the context to be deleted -*/ + * Frees the cached definition files of the context + * + * @param c : the context to be deleted + */ void grib_context_delete(grib_context* c); /** -* Set the GTS header mode on. -* The GTS headers will be preserved. -* -* @param c : the context -*/ + * Set the GTS header mode on. + * The GTS headers will be preserved. + * + * @param c : the context + */ void grib_gts_header_on(grib_context* c); /** -* Set the GTS header mode off. -* The GTS headers will be deleted. -* -* @param c : the context -*/ + * Set the GTS header mode off. + * The GTS headers will be deleted. + * + * @param c : the context + */ void grib_gts_header_off(grib_context* c); /** -* Set the GRIBEX mode on. -* Grib files will be compatible with GRIBEX. -* -* @param c : the context -*/ + * Set the GRIBEX mode on. + * Grib files will be compatible with GRIBEX. + * + * @param c : the context + */ void grib_gribex_mode_on(grib_context* c); /** -* Get the GRIBEX mode. -* -* @param c : the context -*/ + * Get the GRIBEX mode. + * + * @param c : the context + */ int grib_get_gribex_mode(grib_context* c); /** -* Set the GRIBEX mode off. -* GRIB files won't be always compatible with GRIBEX. -* -* @param c : the context -*/ + * Set the GRIBEX mode off. + * GRIB files won't be always compatible with GRIBEX. + * + * @param c : the context + */ void grib_gribex_mode_off(grib_context* c); /** @@ -1169,73 +1174,73 @@ void grib_context_set_definitions_path(grib_context* c, const char* path); void grib_context_set_samples_path(grib_context* c, const char* path); /** -* Sets memory procedures of the context -* -* @param c : the context to be modified -* @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc -* @param gribfree : the memory freeing procedure to be set @see grib_free_proc -*/ + * Sets memory procedures of the context + * + * @param c : the context to be modified + * @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc + * @param gribfree : the memory freeing procedure to be set @see grib_free_proc + */ void grib_context_set_memory_proc(grib_context* c, grib_malloc_proc griballoc, grib_free_proc gribfree, grib_realloc_proc gribrealloc); /** -* Sets memory procedures of the context for persistent data -* -* @param c : the context to be modified -* @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc -* @param gribfree : the memory freeing procedure to be set @see grib_free_proc -*/ + * Sets memory procedures of the context for persistent data + * + * @param c : the context to be modified + * @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc + * @param gribfree : the memory freeing procedure to be set @see grib_free_proc + */ void grib_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc griballoc, grib_free_proc gribfree); /** -* Sets memory procedures of the context for large buffers -* -* @param c : the context to be modified -* @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc -* @param gribfree : the memory freeing procedure to be set @see grib_free_proc -*/ + * Sets memory procedures of the context for large buffers + * + * @param c : the context to be modified + * @param griballoc : the memory allocation procedure to be set @see grib_malloc_proc + * @param gribfree : the memory freeing procedure to be set @see grib_free_proc + */ void grib_context_set_buffer_memory_proc(grib_context* c, grib_malloc_proc griballoc, grib_free_proc gribfree, grib_realloc_proc gribrealloc); /** -* Sets the context printing procedure used for user interaction -* -* @param c : the context to be modified -* @param printp : the printing procedure to be set @see grib_print_proc -*/ + * Sets the context printing procedure used for user interaction + * + * @param c : the context to be modified + * @param printp : the printing procedure to be set @see grib_print_proc + */ void grib_context_set_print_proc(grib_context* c, grib_print_proc printp); /** -* Sets the context logging procedure used for system (warning, errors, infos ...) messages -* -* @param c : the context to be modified -* @param logp : the logging procedure to be set @see grib_log_proc -*/ + * Sets the context logging procedure used for system (warning, errors, infos ...) messages + * + * @param c : the context to be modified + * @param logp : the logging procedure to be set @see grib_log_proc + */ void grib_context_set_logging_proc(grib_context* c, grib_log_proc logp); /** -* Turn on support for multi-fields in single GRIB messages -* -* @param c : the context to be modified -*/ + * Turn on support for multi-fields in single GRIB messages + * + * @param c : the context to be modified + */ void grib_multi_support_on(grib_context* c); /** -* Turn off support for multi-fields in single GRIB messages -* -* @param c : the context to be modified -*/ + * Turn off support for multi-fields in single GRIB messages + * + * @param c : the context to be modified + */ void grib_multi_support_off(grib_context* c); /** -* Reset file handle in multi-field support mode -* -* @param c : the context to be modified -* @param f : the file pointer -*/ + * Reset file handle in multi-field support mode + * + * @param c : the context to be modified + * @param f : the file pointer + */ void grib_multi_support_reset_file(grib_context* c, FILE* f); char* grib_samples_path(const grib_context* c); @@ -1243,29 +1248,29 @@ char* grib_definition_path(const grib_context* c); /*! @} */ /** -* Get the API version -* -* @return API version -*/ + * Get the API version + * + * @return API version + */ long grib_get_api_version(void); /** -* Get the Git version control SHA1 identifier -* -* @return character string with SHA1 identifier -*/ + * Get the Git version control SHA1 identifier + * + * @return character string with SHA1 identifier + */ const char* grib_get_git_sha1(void); /** -* Get the package name -* -* @return character string with package name -*/ + * Get the package name + * + * @return character string with package name + */ const char* grib_get_package_name(void); /** -* Prints the API version -*/ + * Prints the API version + */ void grib_print_api_version(FILE* out); /*! \defgroup keys_iterator Iterating on keys names @@ -1275,42 +1280,42 @@ attributes or by the namespace they belong to. */ /*! @{ */ /*! Create a new iterator from a valid and initialised handle. -* @param h : the handle whose keys you want to iterate -* @param filter_flags : flags to filter out some of the keys through their attributes -* @param name_space : if not null the iteration is carried out only on -* keys belonging to the namespace passed. (NULL for all the keys) -* @return keys iterator ready to iterate through keys according to filter_flags -* and namespace -*/ + * @param h : the handle whose keys you want to iterate + * @param filter_flags : flags to filter out some of the keys through their attributes + * @param name_space : if not null the iteration is carried out only on + * keys belonging to the namespace passed. (NULL for all the keys) + * @return keys iterator ready to iterate through keys according to filter_flags + * and namespace + */ grib_keys_iterator* grib_keys_iterator_new(grib_handle* h, unsigned long filter_flags, const char* name_space); bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h, unsigned long filter_flags); bufr_keys_iterator* codes_bufr_data_section_keys_iterator_new(grib_handle* h); /*! Step to the next iterator. -* @param kiter : valid grib_keys_iterator -* @return 1 if next iterator exists, 0 if no more elements to iterate on -*/ + * @param kiter : valid grib_keys_iterator + * @return 1 if next iterator exists, 0 if no more elements to iterate on + */ int grib_keys_iterator_next(grib_keys_iterator* kiter); int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter); /*! get the key name from the iterator -* @param kiter : valid grib_keys_iterator -* @return key name -*/ + * @param kiter : valid grib_keys_iterator + * @return key name + */ const char* grib_keys_iterator_get_name(const grib_keys_iterator* kiter); char* codes_bufr_keys_iterator_get_name(const bufr_keys_iterator* kiter); /*! Delete the iterator. -* @param kiter : valid grib_keys_iterator -* @return 0 if OK, integer value on error -*/ + * @param kiter : valid grib_keys_iterator + * @return 0 if OK, integer value on error + */ int grib_keys_iterator_delete(grib_keys_iterator* kiter); int codes_bufr_keys_iterator_delete(bufr_keys_iterator* kiter); /*! Rewind the iterator. -* @param kiter : valid grib_keys_iterator -* @return 0 if OK, integer value on error -*/ + * @param kiter : valid grib_keys_iterator + * @return 0 if OK, integer value on error + */ int grib_keys_iterator_rewind(grib_keys_iterator* kiter); int codes_bufr_keys_iterator_rewind(bufr_keys_iterator* kiter); @@ -1318,6 +1323,7 @@ int grib_keys_iterator_set_flags(grib_keys_iterator* kiter, unsigned long flags) int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len); int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); int codes_copy_key(grib_handle* h1, grib_handle* h2, const char* key, int type); @@ -1328,17 +1334,17 @@ void grib_update_sections_lengths(grib_handle* h); /** -* Convert an error code into a string -* @param code : the error code -* @return the error message -*/ + * Convert an error code into a string + * @param code : the error code + * @return the error message + */ const char* grib_get_error_message(int code); const char* grib_get_type_name(int type); int grib_get_native_type(const grib_handle* h, const char* name, int* type); void grib_check(const char* call, const char* file, int line, int e, const char* msg); -#define GRIB_CHECK(a, msg) grib_check(#a, __FILE__, __LINE__, a, msg) +#define GRIB_CHECK(a, msg) grib_check(#a, __FILE__, __LINE__, a, msg) #define GRIB_CHECK_NOLINE(a, msg) grib_check(#a, 0, 0, a, msg) @@ -1404,13 +1410,13 @@ struct grib_points #define GRIB_UTIL_GRID_SPEC_ROTATED_GG 4 #define GRIB_UTIL_GRID_SPEC_REDUCED_GG 5 -#define GRIB_UTIL_GRID_SPEC_SH 6 -#define GRIB_UTIL_GRID_SPEC_REDUCED_LL 7 -#define GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC 8 -#define GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG 9 +#define GRIB_UTIL_GRID_SPEC_SH 6 +#define GRIB_UTIL_GRID_SPEC_REDUCED_LL 7 +#define GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC 8 +#define GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG 9 #define GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA 10 -#define GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL 11 -#define GRIB_UTIL_GRID_SPEC_UNSTRUCTURED 12 +#define GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL 11 +#define GRIB_UTIL_GRID_SPEC_UNSTRUCTURED 12 typedef struct grib_util_grid_spec @@ -1462,7 +1468,7 @@ typedef struct grib_util_grid_spec typedef struct grib_util_grid_spec2 { - int grid_type; /* e.g. GRIB_UTIL_GRID_SPEC_REGULAR_LL etc */ + int grid_type; /* e.g. GRIB_UTIL_GRID_SPEC_REGULAR_LL etc */ const char* grid_name; /* e.g. N320 */ /* Grid */ @@ -1493,7 +1499,7 @@ typedef struct grib_util_grid_spec2 /* Bitmap */ long bitmapPresent; - double missingValue; /* 0 means use the default */ + double missingValue; /* 0 means use the default */ /* 'pl' array for reduced Gaussian grids */ const long* pl; @@ -1509,24 +1515,24 @@ typedef struct grib_util_grid_spec2 } grib_util_grid_spec2; -#define GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT 0 -#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX 1 -#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE 2 -#define GRIB_UTIL_PACKING_TYPE_JPEG 3 -#define GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX 4 -#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE 5 +#define GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT 0 +#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX 1 +#define GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE 2 +#define GRIB_UTIL_PACKING_TYPE_JPEG 3 +#define GRIB_UTIL_PACKING_TYPE_GRID_COMPLEX 4 +#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE 5 #define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX 6 -#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7 -#define GRIB_UTIL_PACKING_TYPE_CCSDS 8 -#define GRIB_UTIL_PACKING_TYPE_IEEE 9 +#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7 +#define GRIB_UTIL_PACKING_TYPE_CCSDS 8 +#define GRIB_UTIL_PACKING_TYPE_IEEE 9 #define GRIB_UTIL_PACKING_SAME_AS_INPUT 0 -#define GRIB_UTIL_PACKING_USE_PROVIDED 1 +#define GRIB_UTIL_PACKING_USE_PROVIDED 1 -#define GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT 0 -#define GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES 1 +#define GRIB_UTIL_ACCURACY_SAME_BITS_PER_VALUES_AS_INPUT 0 +#define GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES 1 #define GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT 2 -#define GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR 3 +#define GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR 3 typedef struct grib_util_packing_spec { diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h index 20751f4f9..da2fa37ac 100644 --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -16,7 +16,6 @@ #ifndef grib_api_internal_H #define grib_api_internal_H - #ifdef __cplusplus extern "C" { #endif @@ -201,7 +200,7 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type); #endif /* Return true if two strings are equal */ -#define STR_EQ(a, b) (strcmp((a), (b)) == 0) +#define STR_EQUAL(a, b) (strcmp((a), (b)) == 0) #include "grib_api.h" @@ -253,6 +252,8 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type); #define GRIB_COMPARE_NAMES (1 << 0) #define GRIB_COMPARE_TYPES (1 << 1) +extern const int max_nbits; + typedef struct grib_expression grib_expression; typedef struct grib_arguments grib_arguments; @@ -308,14 +309,16 @@ typedef long (*iterator_has_next_proc)(grib_iterator* i); typedef int (*grib_pack_proc)(grib_handle* h, const double* in, size_t inlen, void* out, size_t* outlen); typedef int (*grib_unpack_proc)(grib_handle* h, const void* in, size_t inlen, double* out, size_t* outlen); - typedef void (*accessor_destroy_proc)(grib_context*, grib_accessor*); typedef int (*accessor_unpack_long_proc)(grib_accessor*, long*, size_t* len); typedef int (*accessor_unpack_double_proc)(grib_accessor*, double*, size_t* len); +typedef int (*accessor_unpack_float_proc)(grib_accessor*, float*, size_t* len); typedef int (*accessor_unpack_double_element_proc)(grib_accessor*, size_t, double*); +typedef int (*accessor_unpack_float_element_proc)(grib_accessor*, size_t, float*); typedef int (*accessor_unpack_double_element_set_proc)(grib_accessor*, const size_t*, size_t, double*); +typedef int (*accessor_unpack_float_element_set_proc)(grib_accessor*, const size_t*, size_t, float*); typedef int (*accessor_unpack_double_subarray_proc)(grib_accessor*, double*, size_t, size_t); typedef int (*accessor_unpack_string_proc)(grib_accessor*, char*, size_t* len); @@ -335,6 +338,7 @@ typedef int (*accessor_pack_missing_proc)(grib_accessor*); typedef int (*accessor_pack_is_missing_proc)(grib_accessor*); typedef int (*accessor_pack_long_proc)(grib_accessor*, const long*, size_t* len); typedef int (*accessor_pack_double_proc)(grib_accessor*, const double*, size_t* len); +typedef int (*accessor_pack_float_proc)(grib_accessor*, const float*, size_t* len); typedef int (*accessor_pack_string_proc)(grib_accessor*, const char*, size_t* len); typedef int (*accessor_pack_string_array_proc)(grib_accessor*, const char**, size_t* len); typedef int (*accessor_pack_bytes_proc)(grib_accessor*, const unsigned char*, size_t* len); @@ -957,7 +961,9 @@ struct grib_accessor_class accessor_unpack_long_proc unpack_long; accessor_pack_double_proc pack_double; + accessor_pack_float_proc pack_float; accessor_unpack_double_proc unpack_double; + accessor_unpack_float_proc unpack_float; accessor_pack_string_proc pack_string; accessor_unpack_string_proc unpack_string; @@ -980,7 +986,9 @@ struct grib_accessor_class accessor_next_proc next; accessor_compare_proc compare; accessor_unpack_double_element_proc unpack_double_element; + accessor_unpack_float_element_proc unpack_float_element; accessor_unpack_double_element_set_proc unpack_double_element_set; + accessor_unpack_float_element_set_proc unpack_float_element_set; accessor_unpack_double_subarray_proc unpack_double_subarray; accessor_clear_proc clear; accessor_clone_proc make_clone; @@ -1270,7 +1278,7 @@ struct grib_int_array int* el; }; -#ifndef NEWDB +#if 1 struct grib_fieldset { grib_context* context; @@ -1287,7 +1295,7 @@ struct grib_fieldset }; #endif -#ifdef NEWDB +#if 0 /* grib db */ struct grib_db { @@ -1599,11 +1607,14 @@ typedef struct j2k_encode_helper #include "eccodes_prototypes.h" - #ifdef __cplusplus } #endif + #endif + + + /* This part is automatically generated by ./errors.pl, do not edit */ #ifndef grib_errors_internal_H #define grib_errors_internal_H diff --git a/src/grib_api_internal_cpp.h b/src/grib_api_internal_cpp.h new file mode 100644 index 000000000..47ea00874 --- /dev/null +++ b/src/grib_api_internal_cpp.h @@ -0,0 +1,6 @@ +#pragma once + +#include "grib_accessor.h" +#include "grib_value.h" +#include "grib_bits_any_endian_simple.h" +#include "grib_ieeefloat.h" diff --git a/src/grib_bits.cc b/src/grib_bits.cc index 5be5d4251..92482612b 100644 --- a/src/grib_bits.cc +++ b/src/grib_bits.cc @@ -48,7 +48,7 @@ static const unsigned long dmasks[] = { 0x00, }; -static const int max_nbits = sizeof(unsigned long) * 8; +extern const int max_nbits = sizeof(unsigned long) * 8; static const int max_nbits_size_t = sizeof(size_t) * 8; unsigned long grib_decode_unsigned_byte_long(const unsigned char* p, long o, int l) diff --git a/src/grib_bits_any_endian.cc b/src/grib_bits_any_endian.cc index f56260066..2c803f089 100644 --- a/src/grib_bits_any_endian.cc +++ b/src/grib_bits_any_endian.cc @@ -91,7 +91,7 @@ int grib_is_all_bits_one(int64_t val, long nbits) int grib_encode_string(unsigned char* bitStream, long* bitOffset, size_t numberOfCharacters, const char* string) { - size_t i; + size_t i = 0, slen = 0; int err = 0; long byteOffset = *bitOffset / 8; int remainder = *bitOffset % 8; @@ -104,9 +104,20 @@ int grib_encode_string(unsigned char* bitStream, long* bitOffset, size_t numberO Assert(numberOfCharacters < 512); - if (string) - memcpy(s, string, strlen(string)); - + /* There is a case where string == NULL: + * bufr_dump -Efortran data/bufr/btem_109.bufr + * This writes: + * call codes_set(ibufr,'shipOrMobileLandStationIdentifier','') + * For some odd reason this gets passed in as a NULL string here! + * To be further investigated + */ + if (string) { + slen = strlen(string); + if (slen > numberOfCharacters) { + return GRIB_ENCODING_ERROR; + } + memcpy(s, string, slen); + } /* if (remainder) byteOffset++; */ if (numberOfCharacters == 0) diff --git a/src/grib_bits_any_endian_simple.cc b/src/grib_bits_any_endian_simple.cc index 7c00aa4c7..e7291c283 100644 --- a/src/grib_bits_any_endian_simple.cc +++ b/src/grib_bits_any_endian_simple.cc @@ -13,10 +13,7 @@ * * ***************************************************************************/ -/* A mask with x least-significant bits set, possibly 0 or >=32 */ -/* -1UL is 1111111... in every bit in binary representation */ -#define BIT_MASK1(x) \ - (((x) >= max_nbits) ? (unsigned long)-1UL : (1UL << (x)) - 1) +#include "grib_bits_any_endian_simple.h" /** * decode an array of n_vals values from a octet-stream @@ -79,90 +76,90 @@ int grib_decode_long_array(const unsigned char* p, long* bitp, long bitsPerValue * @param n_vals number of values to decode * @param val output, values encoded as 32/64bit numbers */ -int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerValue, - double reference_value, double s, double d, - size_t n_vals, double* val) -{ - long i = 0; - unsigned long lvalue = 0; - double x; +//int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerValue, +// double reference_value, double s, double d, +// size_t n_vals, double* val) +//{ +// long i = 0; +// unsigned long lvalue = 0; +// double x; -#if 0 - /* slow reference code */ - int j=0; - for(i=0;i < n_vals;i++) { - lvalue=0; - for(j=0; j< bitsPerValue;j++){ - lvalue <<= 1; - if(grib_get_bit( p, *bitp)) lvalue += 1; - *bitp += 1; - } - x=((lvalue*s)+reference_value)*d; - val[i] = (double)x; - } -#endif - if (bitsPerValue % 8 == 0) { - /* See ECC-386 */ - int bc; - int l = bitsPerValue / 8; - size_t o = 0; +//#if 0 +// [> slow reference code <] +// int j=0; +// for(i=0;i < n_vals;i++) { +// lvalue=0; +// for(j=0; j< bitsPerValue;j++){ +// lvalue <<= 1; +// if(grib_get_bit( p, *bitp)) lvalue += 1; +// *bitp += 1; +// } +// x=((lvalue*s)+reference_value)*d; +// val[i] = (double)x; +// } +//#endif +// if (bitsPerValue % 8 == 0) { +// [> See ECC-386 <] +// int bc; +// int l = bitsPerValue / 8; +// size_t o = 0; - for (i = 0; i < n_vals; i++) { - lvalue = 0; - lvalue <<= 8; - lvalue |= p[o++]; +// for (i = 0; i < n_vals; i++) { +// lvalue = 0; +// lvalue <<= 8; +// lvalue |= p[o++]; - for (bc = 1; bc < l; bc++) { - lvalue <<= 8; - lvalue |= p[o++]; - } - x = ((lvalue * s) + reference_value) * d; - val[i] = (double)x; - /* *bitp += bitsPerValue * n_vals; */ - } - } - else { - unsigned long mask = BIT_MASK1(bitsPerValue); +// for (bc = 1; bc < l; bc++) { +// lvalue <<= 8; +// lvalue |= p[o++]; +// } +// x = ((lvalue * s) + reference_value) * d; +// val[i] = (double)x; +// [> *bitp += bitsPerValue * n_vals; <] +// } +// } +// else { +// unsigned long mask = BIT_MASK1(bitsPerValue); - /* pi: position of bitp in p[]. >>3 == /8 */ - long pi = *bitp / 8; - /* some bits might of the current byte at pi might be used */ - /* by the previous number usefulBitsInByte gives remaining unused bits */ - /* number of useful bits in current byte */ - int usefulBitsInByte = 8 - (*bitp & 7); - for (i = 0; i < n_vals; i++) { - /* value read as long */ - long bitsToRead = 0; - lvalue = 0; - bitsToRead = bitsPerValue; - /* read one byte after the other to lvalue until >= bitsPerValue are read */ - while (bitsToRead > 0) { - lvalue <<= 8; - lvalue += p[pi]; - pi++; - bitsToRead -= usefulBitsInByte; - usefulBitsInByte = 8; - } - *bitp += bitsPerValue; - /* bitsToRead is now <= 0, remove the last bits */ - lvalue >>= -1 * bitsToRead; - /* set leading bits to 0 - removing bits used for previous number */ - lvalue &= mask; +// [> pi: position of bitp in p[]. >>3 == /8 <] +// long pi = *bitp / 8; +// [> some bits might of the current byte at pi might be used <] +// [> by the previous number usefulBitsInByte gives remaining unused bits <] +// [> number of useful bits in current byte <] +// int usefulBitsInByte = 8 - (*bitp & 7); +// for (i = 0; i < n_vals; i++) { +// [> value read as long <] +// long bitsToRead = 0; +// lvalue = 0; +// bitsToRead = bitsPerValue; +// [> read one byte after the other to lvalue until >= bitsPerValue are read <] +// while (bitsToRead > 0) { +// lvalue <<= 8; +// lvalue += p[pi]; +// pi++; +// bitsToRead -= usefulBitsInByte; +// usefulBitsInByte = 8; +// } +// *bitp += bitsPerValue; +// [> bitsToRead is now <= 0, remove the last bits <] +// lvalue >>= -1 * bitsToRead; +// [> set leading bits to 0 - removing bits used for previous number <] +// lvalue &= mask; - usefulBitsInByte = -1 * bitsToRead; /* prepare for next round */ - if (usefulBitsInByte > 0) { - pi--; /* reread the current byte */ - } - else { - usefulBitsInByte = 8; /* start with next full byte */ - } - /* scaling and move value to output */ - x = ((lvalue * s) + reference_value) * d; - val[i] = (double)x; - } - } - return 0; -} +// usefulBitsInByte = -1 * bitsToRead; [> prepare for next round <] +// if (usefulBitsInByte > 0) { +// pi--; [> reread the current byte <] +// } +// else { +// usefulBitsInByte = 8; [> start with next full byte <] +// } +// [> scaling and move value to output <] +// x = ((lvalue * s) + reference_value) * d; +// val[i] = (double)x; +// } +// } +// return 0; +//} int grib_decode_double_array_complex(const unsigned char* p, long* bitp, long nbits, double reference_value, double s, double* d, size_t size, double* val) { diff --git a/src/grib_bits_any_endian_simple.h b/src/grib_bits_any_endian_simple.h new file mode 100644 index 000000000..369b87067 --- /dev/null +++ b/src/grib_bits_any_endian_simple.h @@ -0,0 +1,97 @@ +// ECC-1467 + +#pragma once + +#include "grib_api_internal.h" + +/* A mask with x least-significant bits set, possibly 0 or >=32 */ +/* -1UL is 1111111... in every bit in binary representation */ +#define BIT_MASK1(x) \ + (((x) >= max_nbits) ? (unsigned long)-1UL : (1UL << (x)) - 1) + + +template +int grib_decode_array(const unsigned char* p, long* bitp, long bitsPerValue, + double reference_value, double s, double d, + size_t n_vals, T* val) +{ + size_t i = 0; + unsigned long lvalue = 0; + T x; + +#if 0 + /* slow reference code */ + int j=0; + for(i=0; i < n_vals; i++) { + lvalue=0; + for(j=0; j< bitsPerValue;j++){ + lvalue <<= 1; + if(grib_get_bit( p, *bitp)) lvalue += 1; + *bitp += 1; + } + x=((lvalue*s)+reference_value)*d; + val[i] = x; + } +#endif + if (bitsPerValue % 8 == 0) { + /* See ECC-386 */ + int bc; + int l = bitsPerValue / 8; + size_t o = 0; + + for (i = 0; i < n_vals; i++) { + lvalue = 0; + lvalue <<= 8; + lvalue |= p[o++]; + + for (bc = 1; bc < l; bc++) { + lvalue <<= 8; + lvalue |= p[o++]; + } + x = ((lvalue * s) + reference_value) * d; + val[i] = x; + /* *bitp += bitsPerValue * n_vals; */ + } + } + else { + unsigned long mask = BIT_MASK1(bitsPerValue); + + /* pi: position of bitp in p[]. >>3 == /8 */ + long pi = *bitp / 8; + /* some bits might of the current byte at pi might be used */ + /* by the previous number usefulBitsInByte gives remaining unused bits */ + /* number of useful bits in current byte */ + int usefulBitsInByte = 8 - (*bitp & 7); + for (i = 0; i < n_vals; i++) { + /* value read as long */ + long bitsToRead = 0; + lvalue = 0; + bitsToRead = bitsPerValue; + /* read one byte after the other to lvalue until >= bitsPerValue are read */ + while (bitsToRead > 0) { + lvalue <<= 8; + lvalue += p[pi]; + pi++; + bitsToRead -= usefulBitsInByte; + usefulBitsInByte = 8; + } + *bitp += bitsPerValue; + /* bitsToRead is now <= 0, remove the last bits */ + lvalue >>= -1 * bitsToRead; + /* set leading bits to 0 - removing bits used for previous number */ + lvalue &= mask; + + usefulBitsInByte = -1 * bitsToRead; /* prepare for next round */ + if (usefulBitsInByte > 0) { + pi--; /* reread the current byte */ + } + else { + usefulBitsInByte = 8; /* start with next full byte */ + } + /* scaling and move value to output */ + x = ((lvalue * s) + reference_value) * d; + val[i] = x; + } + } + return 0; +} diff --git a/src/grib_context.cc b/src/grib_context.cc index c2c49aa92..3bfc44982 100644 --- a/src/grib_context.cc +++ b/src/grib_context.cc @@ -19,7 +19,6 @@ #endif #ifdef ENABLE_FLOATING_POINT_EXCEPTIONS - #define _GNU_SOURCE #include int feenableexcept(int excepts); #endif @@ -643,6 +642,7 @@ static int init_definition_files_dir(grib_context* c) /* Note: strtok_r modifies its first argument so we copy */ strncpy(path, c->grib_definition_files_path, ECC_PATH_MAXLEN-1); + path[ ECC_PATH_MAXLEN - 1 ] = '\0'; GRIB_MUTEX_INIT_ONCE(&once, &init); GRIB_MUTEX_LOCK(&mutex_c); diff --git a/src/grib_dumper_class_bufr_decode_C.cc b/src/grib_dumper_class_bufr_decode_C.cc index f02070d8e..e658a29ba 100644 --- a/src/grib_dumper_class_bufr_decode_C.cc +++ b/src/grib_dumper_class_bufr_decode_C.cc @@ -489,7 +489,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm self->empty = 0; values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } diff --git a/src/grib_dumper_class_bufr_encode_C.cc b/src/grib_dumper_class_bufr_encode_C.cc index 5c915049f..385474470 100644 --- a/src/grib_dumper_class_bufr_encode_C.cc +++ b/src/grib_dumper_class_bufr_encode_C.cc @@ -621,7 +621,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm self->empty = 0; values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } @@ -682,7 +682,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(c, size); if (!value) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } diff --git a/src/grib_dumper_class_bufr_encode_filter.cc b/src/grib_dumper_class_bufr_encode_filter.cc index de3db03ca..308d5f7b4 100644 --- a/src/grib_dumper_class_bufr_encode_filter.cc +++ b/src/grib_dumper_class_bufr_encode_filter.cc @@ -557,7 +557,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } @@ -615,7 +615,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(c, size); if (!value) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } diff --git a/src/grib_dumper_class_bufr_encode_fortran.cc b/src/grib_dumper_class_bufr_encode_fortran.cc index 2c722a50c..5596718c6 100644 --- a/src/grib_dumper_class_bufr_encode_fortran.cc +++ b/src/grib_dumper_class_bufr_encode_fortran.cc @@ -672,7 +672,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } @@ -731,7 +731,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(c, size); if (!value) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } diff --git a/src/grib_dumper_class_bufr_encode_python.cc b/src/grib_dumper_class_bufr_encode_python.cc index f7344acdb..53c9a9352 100644 --- a/src/grib_dumper_class_bufr_encode_python.cc +++ b/src/grib_dumper_class_bufr_encode_python.cc @@ -614,7 +614,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } @@ -672,7 +672,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(c, size); if (!value) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } diff --git a/src/grib_dumper_class_bufr_simple.cc b/src/grib_dumper_class_bufr_simple.cc index 2759c20f5..19094f7c7 100644 --- a/src/grib_dumper_class_bufr_simple.cc +++ b/src/grib_dumper_class_bufr_simple.cc @@ -572,7 +572,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } diff --git a/src/grib_dumper_class_default.cc b/src/grib_dumper_class_default.cc index 53652da8c..0b64ce88a 100644 --- a/src/grib_dumper_class_default.cc +++ b/src/grib_dumper_class_default.cc @@ -350,7 +350,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } @@ -416,7 +416,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(c, size); if (!value) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } diff --git a/src/grib_dumper_class_json.cc b/src/grib_dumper_class_json.cc index b0f43bd10..7ccf07f7f 100644 --- a/src/grib_dumper_class_json.cc +++ b/src/grib_dumper_class_json.cc @@ -397,7 +397,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "Memory allocation error: %zu bytes", size); + grib_context_log(c, GRIB_LOG_ERROR, "Memory allocation error: %zu bytes", size); return; } @@ -458,7 +458,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) * if (size==0) return; * value=(char*)grib_context_malloc_clear(a->context,size); * if (!value) { - * grib_context_log(a->context,GRIB_LOG_FATAL,"unable to allocate %d bytes",(int)size); + * grib_context_log(a->context,GRIB_LOG_ERROR,"unable to allocate %d bytes",(int)size); * return; * } */ diff --git a/src/grib_dumper_class_wmo.cc b/src/grib_dumper_class_wmo.cc index f896d04aa..86270e0b2 100644 --- a/src/grib_dumper_class_wmo.cc +++ b/src/grib_dumper_class_wmo.cc @@ -308,7 +308,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) ecc__grib_get_string_length(a, &size); value = (char*)grib_context_malloc_clear(a->context, size); if (!value) { - grib_context_log(a->context, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(a->context, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } err = grib_unpack_string(a, value, &size); @@ -630,7 +630,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm values = (char**)grib_context_malloc_clear(c, size * sizeof(char*)); if (!values) { - grib_context_log(c, GRIB_LOG_FATAL, "unable to allocate %d bytes", (int)size); + grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } diff --git a/src/grib_expression_class_functor.cc b/src/grib_expression_class_functor.cc index 8a36b68c9..5c9d9c3ca 100644 --- a/src/grib_expression_class_functor.cc +++ b/src/grib_expression_class_functor.cc @@ -88,9 +88,6 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) { grib_expression_functor* e = (grib_expression_functor*)g; - /* - TODO: needs OO code here - */ if (strcmp(e->name, "lookup") == 0) { return GRIB_SUCCESS; } @@ -113,16 +110,15 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) } err = grib_get_long_internal(h, p, &val); if (err) return err; - /* Note: This does not cope with keys like typeOfSecondFixedSurface - * which are codetable entries with values like 255: this value is - * not classed as 'missing'! - * (See ECC-594) - */ + // Note: This does not cope with keys like typeOfSecondFixedSurface + // which are codetable entries with values like 255: this value is + // not classed as 'missing'! + // (See ECC-594) *lres = (val == GRIB_MISSING_LONG); return GRIB_SUCCESS; } else { - /* No arguments means return the actual integer missing value */ + // No arguments means return the actual integer missing value *lres = GRIB_MISSING_LONG; } return GRIB_SUCCESS; @@ -140,6 +136,26 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) return GRIB_SUCCESS; } + if (strcmp(e->name, "environment_variable") == 0) { + // ECC-1520: This implementation has some limitations: + // 1. Cannot distinguish between environment variable NOT SET + // and SET but equal to 0 + // 2. Cannot deal with string values + const char* p = grib_arguments_get_name(h, e->args, 0); + if (p) { + char* env = getenv(p); + if (env) { + long lval = 0; + if (string_to_long(env, &lval) == GRIB_SUCCESS) { + *lres = lval; + return GRIB_SUCCESS; + } + } + } + *lres = 0; + return GRIB_SUCCESS; + } + if (strcmp(e->name, "changed") == 0) { *lres = 1; return GRIB_SUCCESS; @@ -157,7 +173,7 @@ static void print(grib_context* c, grib_expression* g, grib_handle* f) { grib_expression_functor* e = (grib_expression_functor*)g; printf("%s(", e->name); - /*grib_expression_print(c,e->args,f);*/ + // grib_expression_print(c,e->args,f); printf(")"); } diff --git a/src/grib_fieldset.cc b/src/grib_fieldset.cc index 5c104405e..0c7ba5652 100644 --- a/src/grib_fieldset.cc +++ b/src/grib_fieldset.cc @@ -373,6 +373,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, const char else { type = default_type; } + //if (type==0) type = default_type; *err = grib_fieldset_new_column(set, i, key, type); grib_context_free(c, key); } @@ -925,6 +926,10 @@ static int grib_fieldset_set_order_by(grib_fieldset* set, grib_order_by* ob) if (*p == ':') *p = 0; for (i = 0; i < set->columns_size; i++) { + if (!set->columns[i].name) { //ECC-1562 + grib_context_log(set->context, GRIB_LOG_ERROR, "grib_fieldset_set_order_by: Invalid type for key=%s", next->key); + return GRIB_INVALID_TYPE; + } if (!grib_inline_strcmp(next->key, set->columns[i].name)) { next->idkey = i; break; @@ -933,7 +938,7 @@ static int grib_fieldset_set_order_by(grib_fieldset* set, grib_order_by* ob) if (next->idkey == -1) { grib_context_log(set->context, GRIB_LOG_ERROR, "grib_fieldset_set_order_by: " - "Unable to apply the order by. Key missing from the fieldset.\n"); + "Unable to apply the order by. Key missing from the fieldset."); return GRIB_MISSING_KEY; } next = next->next; diff --git a/src/grib_handle.cc b/src/grib_handle.cc index 2b152d846..931bdd6ea 100644 --- a/src/grib_handle.cc +++ b/src/grib_handle.cc @@ -9,9 +9,8 @@ */ /*************************************************************************** - * Jean Baptiste Filippi - 01.11.2005 - * Enrico Fucile - * * + * Jean Baptiste Filippi - 01.11.2005 * + * Enrico Fucile * ***************************************************************************/ #include "grib_api_internal.h" @@ -1375,25 +1374,25 @@ int codes_check_message_footer(const void* bytes, size_t length, ProductKind pro int grib_get_message_size(const grib_handle* ch, size_t* size) { long totalLength = 0; - int ret = 0; + int err = 0; grib_handle* h = (grib_handle*)ch; *size = h->buffer->ulength; - ret = grib_get_long(h, "totalLength", &totalLength); - if (!ret) + err = grib_get_long(h, "totalLength", &totalLength); + if (!err) *size = totalLength; - return ret; + return err; } int grib_get_message(const grib_handle* ch, const void** msg, size_t* size) { long totalLength = 0; - int ret = 0; + int err = 0; grib_handle* h = (grib_handle*)ch; *msg = h->buffer->data; *size = h->buffer->ulength; - ret = grib_get_long(h, "totalLength", &totalLength); - if (!ret) + err = grib_get_long(h, "totalLength", &totalLength); + if (!err) *size = totalLength; if (h->context->gts_header_on && h->gts_header) { @@ -1406,20 +1405,20 @@ int grib_get_message(const grib_handle* ch, const void** msg, size_t* size) int grib_get_message_headers(grib_handle* h, const void** msg, size_t* size) { - int ret = 0; + int err = 0; size_t endOfHeadersMarker; *msg = h->buffer->data; *size = h->buffer->ulength; - if ((ret = grib_get_offset(h, "endOfHeadersMarker", &endOfHeadersMarker)) != GRIB_SUCCESS) { - grib_context_log(h->context, GRIB_LOG_FATAL, - "grib_get_message_headers unable to get offset of endOfHeadersMarker"); - return ret; + if ((err = grib_get_offset(h, "endOfHeadersMarker", &endOfHeadersMarker)) != GRIB_SUCCESS) { + grib_context_log(h->context, GRIB_LOG_ERROR, + "grib_get_message_headers: unable to get offset of endOfHeadersMarker"); + return err; } *size = endOfHeadersMarker; - return ret; + return err; } grib_handle* grib_handle_new(grib_context* c) diff --git a/src/grib_header_compute.cc b/src/grib_header_compute.cc index d8f9fb29f..da68f004e 100644 --- a/src/grib_header_compute.cc +++ b/src/grib_header_compute.cc @@ -415,19 +415,19 @@ static grib_math* reador(grib_context* c, char** form, int* err) return p; } -grib_math* grib_math_clone(grib_context* c, grib_math* m) -{ - grib_math* n = NULL; - if (m) { - n = (grib_math*)grib_context_malloc(c, sizeof(grib_math)); - n->arity = m->arity; - n->name = strdup(m->name); - Assert(n->name); - n->left = grib_math_clone(c, m->left); - n->right = grib_math_clone(c, m->right); - } - return n; -} +// static grib_math* grib_math_clone(grib_context* c, grib_math* m) +// { +// grib_math* n = NULL; +// if (m) { +// n = (grib_math*)grib_context_malloc(c, sizeof(grib_math)); +// n->arity = m->arity; +// n->name = strdup(m->name); +// Assert(n->name); +// n->left = grib_math_clone(c, m->left); +// n->right = grib_math_clone(c, m->right); +// } +// return n; +// } void grib_math_delete(grib_context* c, grib_math* m) { diff --git a/src/grib_ieeefloat.cc b/src/grib_ieeefloat.cc index 2c88d7630..5ed74163a 100644 --- a/src/grib_ieeefloat.cc +++ b/src/grib_ieeefloat.cc @@ -12,7 +12,7 @@ * Enrico Fucile - 06.01.2009 * * * ***************************************************************************/ -#include "grib_api_internal.h" +#include "grib_ieeefloat.h" #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -246,6 +246,7 @@ double grib_long_to_ieee(unsigned long x) return val; } + unsigned long grib_ieee_nearest_smaller_to_long(double x) { unsigned long l; @@ -343,7 +344,8 @@ double grib_long_to_ieee64(unsigned long x) return dval; } -int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val) +template <> +int grib_ieee_decode_array (grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val) { int err = 0, i = 0, j = 0; unsigned char s[8] = {0,}; @@ -386,6 +388,34 @@ int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, in return err; } +template <> +int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, float* val) +{ + int err = 0, i = 0, j = 0; + unsigned char s[4] = {0,}; + + switch (bytes) { + case 4: + for (i = 0; i < nvals; i++) { +#if IEEE_LE + for (j = 3; j >= 0; j--) + s[j] = *(buf++); + memcpy(&val[i], s, 4); +#elif IEEE_BE + memcpy(&val[i], buf, 4); + buf += 4; +#endif + } + break; + default: + grib_context_log(c, GRIB_LOG_ERROR, + "grib_ieee_decode_array_float: %d bits not implemented", bytes * 8); + return GRIB_NOT_IMPLEMENTED; + } + + return err; +} + #else int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val) @@ -399,6 +429,17 @@ int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, in return err; } +int grib_ieee_decode_array_float(grib_context* c, unsigned char* buf, size_t nvals, int bytes, float* val) +{ + int err = 0, i = 0; + long bitr = 0; + + for (i = 0; i < nvals; i++) + val[i] = (float) grib_long_to_ieee(grib_decode_unsigned_long(buf, &bitr, bytes * 8)); + + return err; +} + #endif #ifdef IEEE diff --git a/src/grib_ieeefloat.h b/src/grib_ieeefloat.h new file mode 100644 index 000000000..4967a6129 --- /dev/null +++ b/src/grib_ieeefloat.h @@ -0,0 +1,5 @@ +#pragma once + +#include "grib_api_internal.h" + +template int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, T* val); diff --git a/src/grib_io.cc b/src/grib_io.cc index 3e7ac6264..da16be6d4 100644 --- a/src/grib_io.cc +++ b/src/grib_io.cc @@ -341,10 +341,8 @@ static int read_GRIB(reader* r) } /* fprintf(stderr,"%s sec1len=%d i=%d\n",type,sec1len,i); */ - GROW_BUF_IF_REQUIRED(sec1len + sec2len + sec3len + 4 + 3); - for (j = 0; j < 3; j++) { if (r->read(r->read_data, &tmp[i], 1, &err) != 1 || err) return err; diff --git a/src/grib_iterator.cc b/src/grib_iterator.cc index 7018f6b1c..0844a1fed 100644 --- a/src/grib_iterator.cc +++ b/src/grib_iterator.cc @@ -9,8 +9,8 @@ */ /*************************************************************************** - * Enrico Fucile - * Jean Baptiste Filippi - 01.11.2005 * + * Enrico Fucile * + * Jean Baptiste Filippi - 01.11.2005 * * * ***************************************************************************/ #include "grib_api_internal.h" diff --git a/src/grib_iterator_class.cc b/src/grib_iterator_class.cc index c3902893b..0197a09a4 100644 --- a/src/grib_iterator_class.cc +++ b/src/grib_iterator_class.cc @@ -33,7 +33,7 @@ static const struct table_entry table[] = { grib_iterator* grib_iterator_factory(grib_handle* h, grib_arguments* args, unsigned long flags, int* ret) { - int i; + size_t i = 0; const char* type = (char*)grib_arguments_get_name(h, args, 0); for (i = 0; i < NUMBER(table); i++) diff --git a/src/grib_iterator_class_gaussian.cc b/src/grib_iterator_class_gaussian.cc index 11b9d6641..366505b71 100644 --- a/src/grib_iterator_class_gaussian.cc +++ b/src/grib_iterator_class_gaussian.cc @@ -36,8 +36,10 @@ or edit "iterator.class" and rerun ./make_class.pl */ -static void init_class (grib_iterator_class*); -static int init (grib_iterator* i,grib_handle*,grib_arguments*); +static void init_class (grib_iterator_class*); + +static int init (grib_iterator* i,grib_handle*,grib_arguments*); + typedef struct grib_iterator_gaussian{ grib_iterator it; @@ -80,10 +82,10 @@ grib_iterator_class* grib_iterator_class_gaussian = &_grib_iterator_class_gaussi static void init_class(grib_iterator_class* c) { - c->next = (*(c->super))->next; - c->previous = (*(c->super))->previous; - c->reset = (*(c->super))->reset; - c->has_next = (*(c->super))->has_next; + c->next = (*(c->super))->next; + c->previous = (*(c->super))->previous; + c->reset = (*(c->super))->reset; + c->has_next = (*(c->super))->has_next; } /* END_CLASS_IMP */ diff --git a/src/grib_iterator_class_gaussian_reduced.cc b/src/grib_iterator_class_gaussian_reduced.cc index fd934d686..95608dd91 100644 --- a/src/grib_iterator_class_gaussian_reduced.cc +++ b/src/grib_iterator_class_gaussian_reduced.cc @@ -87,18 +87,19 @@ static void init_class(grib_iterator_class* c) } /* END_CLASS_IMP */ -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_gaussian_reduced* self = (grib_iterator_gaussian_reduced*)i; + grib_iterator_gaussian_reduced* self = (grib_iterator_gaussian_reduced*)iter; - if (i->e >= (long)(i->nv - 1)) + if (iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->las[i->e]; - *lon = self->los[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->las[iter->e]; + *lon = self->los[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } @@ -412,12 +413,12 @@ finalise: return ret; } -static int destroy(grib_iterator* i) +static int destroy(grib_iterator* iter) { - grib_iterator_gaussian_reduced* self = (grib_iterator_gaussian_reduced*)i; - const grib_context* c = i->h->context; + grib_iterator_gaussian_reduced* self = (grib_iterator_gaussian_reduced*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->las); grib_context_free(c, self->los); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_gen.cc b/src/grib_iterator_class_gen.cc index cea90181b..02fe38c28 100644 --- a/src/grib_iterator_class_gen.cc +++ b/src/grib_iterator_class_gen.cc @@ -114,6 +114,7 @@ int transform_iterator_data(grib_context* context, double* data, /* Already +i and +j. No need to change */ return GRIB_SUCCESS; } + if (!data) return GRIB_SUCCESS; if (!context) context = grib_context_get_default(); @@ -183,6 +184,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) self->missingValue = grib_arguments_get_name(h, args, self->carg++); s_rawData = grib_arguments_get_name(h, args, self->carg++); + iter->data = NULL; iter->h = h; /* We may not need to keep them */ iter->args = args; if ((err = grib_get_size(h, s_rawData, &dli)) != GRIB_SUCCESS) @@ -201,11 +203,17 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) grib_context_log(h->context, GRIB_LOG_ERROR, "Geoiterator: size(%s) is %ld", s_rawData, dli); return GRIB_WRONG_GRID; } - iter->data = (double*)grib_context_malloc(h->context, (iter->nv) * sizeof(double)); - if ((err = grib_get_double_array_internal(h, s_rawData, iter->data, &(iter->nv)))) - return err; + if ((iter->flags & GRIB_GEOITERATOR_NO_VALUES) == 0) { + // ECC-1525 + // When the NO_VALUES flag is unset, decode the values and store them in the iterator. + // By default (and legacy) flags==0, so we decode + iter->data = (double*)grib_context_malloc(h->context, (iter->nv) * sizeof(double)); + if ((err = grib_get_double_array_internal(h, s_rawData, iter->data, &(iter->nv)))) { + return err; + } + } iter->e = -1; return err; @@ -221,12 +229,12 @@ static int destroy(grib_iterator* iter) { const grib_context* c = iter->h->context; grib_context_free(c, iter->data); - return 1; + return GRIB_SUCCESS; } static long has_next(grib_iterator* iter) { - if (iter->data == NULL) + if (iter->flags == 0 && iter->data == NULL) return 0; if (iter->e >= (long)(iter->nv - 1)) return 0; diff --git a/src/grib_iterator_class_lambert_azimuthal_equal_area.cc b/src/grib_iterator_class_lambert_azimuthal_equal_area.cc index 5d54aee88..f77b23afc 100644 --- a/src/grib_iterator_class_lambert_azimuthal_equal_area.cc +++ b/src/grib_iterator_class_lambert_azimuthal_equal_area.cc @@ -81,18 +81,19 @@ static void init_class(grib_iterator_class* c) } /* END_CLASS_IMP */ -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_lambert_azimuthal_equal_area* self = (grib_iterator_lambert_azimuthal_equal_area*)i; + grib_iterator_lambert_azimuthal_equal_area* self = (grib_iterator_lambert_azimuthal_equal_area*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->lats[i->e]; - *lon = self->lons[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->lats[iter->e]; + *lon = self->lons[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } @@ -486,12 +487,12 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) return GRIB_SUCCESS; } -static int destroy(grib_iterator* i) +static int destroy(grib_iterator* iter) { - grib_iterator_lambert_azimuthal_equal_area* self = (grib_iterator_lambert_azimuthal_equal_area*)i; - const grib_context* c = i->h->context; + grib_iterator_lambert_azimuthal_equal_area* self = (grib_iterator_lambert_azimuthal_equal_area*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->lats); grib_context_free(c, self->lons); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_lambert_conformal.cc b/src/grib_iterator_class_lambert_conformal.cc index a39b314ab..8c5fed223 100644 --- a/src/grib_iterator_class_lambert_conformal.cc +++ b/src/grib_iterator_class_lambert_conformal.cc @@ -485,18 +485,19 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) return err; } -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_lambert_conformal* self = (grib_iterator_lambert_conformal*)i; + grib_iterator_lambert_conformal* self = (grib_iterator_lambert_conformal*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->lats[i->e]; - *lon = self->lons[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->lats[iter->e]; + *lon = self->lons[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } @@ -507,5 +508,5 @@ static int destroy(grib_iterator* i) grib_context_free(c, self->lats); grib_context_free(c, self->lons); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_latlon.cc b/src/grib_iterator_class_latlon.cc index 444aa594c..d0e4d2d54 100644 --- a/src/grib_iterator_class_latlon.cc +++ b/src/grib_iterator_class_latlon.cc @@ -32,9 +32,11 @@ or edit "iterator.class" and rerun ./make_class.pl */ -static void init_class (grib_iterator_class*); -static int init (grib_iterator* i,grib_handle*,grib_arguments*); -static int next (grib_iterator* i, double *lat, double *lon, double *val); +static void init_class (grib_iterator_class*); + +static int init (grib_iterator* i,grib_handle*,grib_arguments*); +static int next (grib_iterator* i, double *lat, double *lon, double *val); + typedef struct grib_iterator_latlon{ grib_iterator it; @@ -77,16 +79,16 @@ grib_iterator_class* grib_iterator_class_latlon = &_grib_iterator_class_latlon; static void init_class(grib_iterator_class* c) { - c->previous = (*(c->super))->previous; - c->reset = (*(c->super))->reset; - c->has_next = (*(c->super))->has_next; + c->previous = (*(c->super))->previous; + c->reset = (*(c->super))->reset; + c->has_next = (*(c->super))->has_next; } /* END_CLASS_IMP */ static int next(grib_iterator* iter, double* lat, double* lon, double* val) { /* GRIB-238: Support rotated lat/lon grids */ - double ret_lat, ret_lon, ret_val; + double ret_lat, ret_lon, ret_val=0; grib_iterator_latlon* self = (grib_iterator_latlon*)iter; if ((long)iter->e >= (long)(iter->nv - 1)) @@ -101,13 +103,15 @@ static int next(grib_iterator* iter, double* lat, double* lon, double* val) /* Adjacent points in i (x) direction are consecutive */ ret_lat = self->las[(long)floor(iter->e / self->Ni)]; ret_lon = self->los[(long)iter->e % self->Ni]; - ret_val = iter->data[iter->e]; + if (iter->data) + ret_val = iter->data[iter->e]; } else { /* Adjacent points in j (y) direction is consecutive */ ret_lon = self->los[(long)iter->e / self->Nj]; ret_lat = self->las[(long)floor(iter->e % self->Nj)]; - ret_val = iter->data[iter->e]; + if (iter->data) + ret_val = iter->data[iter->e]; } /* See ECC-808: Some users want to disable the unrotate */ @@ -122,7 +126,9 @@ static int next(grib_iterator* iter, double* lat, double* lon, double* val) *lat = ret_lat; *lon = ret_lon; - *val = ret_val; + if (val && iter->data) { + *val = ret_val; + } return 1; } diff --git a/src/grib_iterator_class_latlon_reduced.cc b/src/grib_iterator_class_latlon_reduced.cc index 03f0d5e04..90154ff22 100644 --- a/src/grib_iterator_class_latlon_reduced.cc +++ b/src/grib_iterator_class_latlon_reduced.cc @@ -85,24 +85,25 @@ static void init_class(grib_iterator_class* c) } /* END_CLASS_IMP */ -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)i; + grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->las[i->e]; - *lon = self->los[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->las[iter->e]; + *lon = self->los[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } -static int init(grib_iterator* i, grib_handle* h, grib_arguments* args) +static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) { - grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)i; + grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)iter; int ret = GRIB_SUCCESS; double laf; @@ -148,8 +149,8 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args) pl = (long*)grib_context_malloc(h->context, plsize * sizeof(long)); grib_get_long_array_internal(h, plac, pl, &plsize); - self->las = (double*)grib_context_malloc(h->context, i->nv * sizeof(double)); - self->los = (double*)grib_context_malloc(h->context, i->nv * sizeof(double)); + self->las = (double*)grib_context_malloc(h->context, iter->nv * sizeof(double)); + self->los = (double*)grib_context_malloc(h->context, iter->nv * sizeof(double)); plmax = pl[0]; for (j = 0; j < nlats; j++) @@ -192,18 +193,18 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args) laf += jdirinc; } - i->e = -1; + iter->e = -1; grib_context_free(h->context, pl); return ret; } -static int destroy(grib_iterator* i) +static int destroy(grib_iterator* iter) { - grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)i; - const grib_context* c = i->h->context; + grib_iterator_latlon_reduced* self = (grib_iterator_latlon_reduced*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->las); grib_context_free(c, self->los); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_mercator.cc b/src/grib_iterator_class_mercator.cc index 1690792d6..fd67bd833 100644 --- a/src/grib_iterator_class_mercator.cc +++ b/src/grib_iterator_class_mercator.cc @@ -323,27 +323,28 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) return err; } -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_mercator* self = (grib_iterator_mercator*)i; + grib_iterator_mercator* self = (grib_iterator_mercator*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->lats[i->e]; - *lon = self->lons[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->lats[iter->e]; + *lon = self->lons[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } -static int destroy(grib_iterator* i) +static int destroy(grib_iterator* iter) { - grib_iterator_mercator* self = (grib_iterator_mercator*)i; - const grib_context* c = i->h->context; + grib_iterator_mercator* self = (grib_iterator_mercator*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->lats); grib_context_free(c, self->lons); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_polar_stereographic.cc b/src/grib_iterator_class_polar_stereographic.cc index 0e3988030..1f8b0d17b 100644 --- a/src/grib_iterator_class_polar_stereographic.cc +++ b/src/grib_iterator_class_polar_stereographic.cc @@ -83,18 +83,19 @@ static void init_class(grib_iterator_class* c) #define ITER "Polar stereographic Geoiterator" -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_polar_stereographic* self = (grib_iterator_polar_stereographic*)i; + grib_iterator_polar_stereographic* self = (grib_iterator_polar_stereographic*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->lats[i->e]; - *lon = self->lons[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->lats[iter->e]; + *lon = self->lons[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } @@ -370,5 +371,5 @@ static int destroy(grib_iterator* i) grib_context_free(c, self->lats); grib_context_free(c, self->lons); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_regular.cc b/src/grib_iterator_class_regular.cc index 1078243c0..ce45da00a 100644 --- a/src/grib_iterator_class_regular.cc +++ b/src/grib_iterator_class_regular.cc @@ -99,48 +99,51 @@ static void init_class(grib_iterator_class* c) /* END_CLASS_IMP */ -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_regular* self = (grib_iterator_regular*)i; + grib_iterator_regular* self = (grib_iterator_regular*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; + iter->e++; - *lat = self->las[(long)floor(i->e / self->Ni)]; - *lon = self->los[(long)i->e % self->Ni]; - *val = i->data[i->e]; + *lat = self->las[(long)floor(iter->e / self->Ni)]; + *lon = self->los[(long)iter->e % self->Ni]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } + return 1; +} + +static int previous(grib_iterator* iter, double* lat, double* lon, double* val) +{ + grib_iterator_regular* self = (grib_iterator_regular*)iter; + + if (iter->e < 0) + return 0; + *lat = self->las[(long)floor(iter->e / self->Ni)]; + *lon = self->los[iter->e % self->Ni]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } + iter->e--; return 1; } -static int previous(grib_iterator* i, double* lat, double* lon, double* val) +static int destroy(grib_iterator* iter) { - grib_iterator_regular* self = (grib_iterator_regular*)i; - - if (i->e < 0) - return 0; - *lat = self->las[(long)floor(i->e / self->Ni)]; - *lon = self->los[i->e % self->Ni]; - *val = i->data[i->e]; - i->e--; - - return 1; -} - -static int destroy(grib_iterator* i) -{ - grib_iterator_regular* self = (grib_iterator_regular*)i; - const grib_context* c = i->h->context; + grib_iterator_regular* self = (grib_iterator_regular*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->las); grib_context_free(c, self->los); return GRIB_SUCCESS; } -static int init(grib_iterator* i, grib_handle* h, grib_arguments* args) +static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) { - grib_iterator_regular* self = (grib_iterator_regular*)i; + grib_iterator_regular* self = (grib_iterator_regular*)iter; int ret = GRIB_SUCCESS; long Ni; /* Number of points along a parallel = Nx */ diff --git a/src/grib_iterator_class_space_view.cc b/src/grib_iterator_class_space_view.cc index 355acfa13..70299278b 100644 --- a/src/grib_iterator_class_space_view.cc +++ b/src/grib_iterator_class_space_view.cc @@ -81,18 +81,19 @@ static void init_class(grib_iterator_class* c) } /* END_CLASS_IMP */ -static int next(grib_iterator* i, double* lat, double* lon, double* val) +static int next(grib_iterator* iter, double* lat, double* lon, double* val) { - grib_iterator_space_view* self = (grib_iterator_space_view*)i; + grib_iterator_space_view* self = (grib_iterator_space_view*)iter; - if ((long)i->e >= (long)(i->nv - 1)) + if ((long)iter->e >= (long)(iter->nv - 1)) return 0; - i->e++; - - *lat = self->lats[i->e]; - *lon = self->lons[i->e]; - *val = i->data[i->e]; + iter->e++; + *lat = self->lats[iter->e]; + *lon = self->lons[iter->e]; + if (val && iter->data) { + *val = iter->data[iter->e]; + } return 1; } @@ -377,12 +378,12 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) return ret; } -static int destroy(grib_iterator* i) +static int destroy(grib_iterator* iter) { - grib_iterator_space_view* self = (grib_iterator_space_view*)i; - const grib_context* c = i->h->context; + grib_iterator_space_view* self = (grib_iterator_space_view*)iter; + const grib_context* c = iter->h->context; grib_context_free(c, self->lats); grib_context_free(c, self->lons); - return 1; + return GRIB_SUCCESS; } diff --git a/src/grib_jasper_encoding.cc b/src/grib_jasper_encoding.cc index 609991a0a..815fe376b 100644 --- a/src/grib_jasper_encoding.cc +++ b/src/grib_jasper_encoding.cc @@ -26,6 +26,11 @@ static int ecc_jasper_initialise() int jaserr = 0; jas_conf_clear(); jas_conf_set_max_mem_usage(jas_get_total_mem_size()); + + #if defined GRIB_PTHREADS || defined GRIB_OMP_THREADS + jas_conf_set_multithread(1); + #endif + jaserr = jas_init_library(); if (jaserr) return jaserr; jaserr = jas_init_thread(); diff --git a/src/grib_keys_iterator.cc b/src/grib_keys_iterator.cc index aebff8095..854b4a2c5 100644 --- a/src/grib_keys_iterator.cc +++ b/src/grib_keys_iterator.cc @@ -207,6 +207,10 @@ int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, si { return grib_unpack_double(kiter->current, v, len); } +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len) +{ + return grib_unpack_float(kiter->current, v, len); +} int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len) { diff --git a/src/grib_lex.cc b/src/grib_lex.cc index c94d46e05..f4057b7a0 100644 --- a/src/grib_lex.cc +++ b/src/grib_lex.cc @@ -1,6 +1,6 @@ -#line 1 "gribl.c" +#line 1 "gribl.cc" -#line 3 "gribl.c" +#line 3 "gribl.cc" #define YY_INT_ALIGNED short int @@ -47,6 +47,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -155,7 +156,7 @@ typedef struct grib_yy_buffer_state *YY_BUFFER_STATE; typedef size_t grib_yy_size_t; #endif -extern int grib_yyleng; +extern grib_yy_size_t grib_yyleng; extern FILE *grib_yyin, *grib_yyout; @@ -198,7 +199,7 @@ struct grib_yy_buffer_state /* Number of characters read into grib_yy_ch_buf, not including EOB * characters. */ - int grib_yy_n_chars; + grib_yy_size_t grib_yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -267,8 +268,8 @@ static YY_BUFFER_STATE * grib_yy_buffer_stack = NULL; /**< Stack as an array. */ /* grib_yy_hold_char holds the character lost when grib_yytext is formed. */ static char grib_yy_hold_char; -static int grib_yy_n_chars; /* number of characters read into grib_yy_ch_buf */ -int grib_yyleng; +static grib_yy_size_t grib_yy_n_chars; /* number of characters read into grib_yy_ch_buf */ +grib_yy_size_t grib_yyleng; /* Points to current character in buffer. */ static char *grib_yy_c_buf_p = NULL; @@ -295,7 +296,7 @@ static void grib_yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); YY_BUFFER_STATE grib_yy_scan_buffer ( char *base, grib_yy_size_t size ); YY_BUFFER_STATE grib_yy_scan_string ( const char *grib_yy_str ); -YY_BUFFER_STATE grib_yy_scan_bytes ( const char *bytes, int len ); +YY_BUFFER_STATE grib_yy_scan_bytes ( const char *bytes, grib_yy_size_t len ); void *grib_yyalloc ( grib_yy_size_t ); void *grib_yyrealloc ( void *, grib_yy_size_t ); @@ -348,7 +349,7 @@ static void grib_yynoreturn grib_yy_fatal_error ( const char* msg ); */ #define YY_DO_BEFORE_ACTION \ (grib_yytext_ptr) = grib_yy_bp; \ - grib_yyleng = (int) (grib_yy_cp - grib_yy_bp); \ + grib_yyleng = (grib_yy_size_t) (grib_yy_cp - grib_yy_bp); \ (grib_yy_hold_char) = *grib_yy_cp; \ *grib_yy_cp = '\0'; \ (grib_yy_c_buf_p) = grib_yy_cp; @@ -1198,8 +1199,8 @@ void _grib_ignore_grib_yyunput_unused_error() { grib_yyunput(0,0); } #define GET_INPUT input #endif -#line 1201 "gribl.c" -#line 1202 "gribl.c" +#line 1202 "gribl.cc" +#line 1203 "gribl.cc" #define INITIAL 0 @@ -1238,7 +1239,7 @@ FILE *grib_yyget_out ( void ); void grib_yyset_out ( FILE * _out_str ); - int grib_yyget_leng ( void ); + grib_yy_size_t grib_yyget_leng ( void ); char *grib_yyget_text ( void ); @@ -1307,7 +1308,7 @@ static int input ( void ); if ( YY_CURRENT_BUFFER_LVALUE->grib_yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + grib_yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( grib_yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1420,7 +1421,7 @@ YY_DECL -#line 1423 "gribl.c" +#line 1424 "gribl.cc" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -2216,7 +2217,7 @@ YY_RULE_SETUP #line 284 "gribl.l" ECHO; YY_BREAK -#line 2219 "gribl.c" +#line 2220 "gribl.cc" case YY_STATE_EOF(INITIAL): grib_yyterminate(); @@ -2403,7 +2404,7 @@ static int grib_yy_get_next_buffer (void) else { - int num_to_read = + grib_yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2417,7 +2418,7 @@ static int grib_yy_get_next_buffer (void) if ( b->grib_yy_is_our_buffer ) { - int new_size = b->grib_yy_buf_size * 2; + grib_yy_size_t new_size = b->grib_yy_buf_size * 2; if ( new_size <= 0 ) b->grib_yy_buf_size += b->grib_yy_buf_size / 8; @@ -2475,7 +2476,7 @@ static int grib_yy_get_next_buffer (void) if (((grib_yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - int new_size = (grib_yy_n_chars) + number_to_move + ((grib_yy_n_chars) >> 1); + grib_yy_size_t new_size = (grib_yy_n_chars) + number_to_move + ((grib_yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf = (char *) grib_yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf, (grib_yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf ) @@ -2564,7 +2565,7 @@ static int grib_yy_get_next_buffer (void) if ( grib_yy_cp < YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - int number_to_move = (grib_yy_n_chars) + 2; + grib_yy_size_t number_to_move = (grib_yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->grib_yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->grib_yy_buf_size + 2]; char *source = @@ -2615,7 +2616,7 @@ static int grib_yy_get_next_buffer (void) else { /* need more input */ - int offset = (int) ((grib_yy_c_buf_p) - (grib_yytext_ptr)); + grib_yy_size_t offset = (grib_yy_c_buf_p) - (grib_yytext_ptr); ++(grib_yy_c_buf_p); switch ( grib_yy_get_next_buffer( ) ) @@ -2984,12 +2985,12 @@ YY_BUFFER_STATE grib_yy_scan_string (const char * grib_yystr ) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE grib_yy_scan_bytes (const char * grib_yybytes, int _grib_yybytes_len ) +YY_BUFFER_STATE grib_yy_scan_bytes (const char * grib_yybytes, grib_yy_size_t _grib_yybytes_len ) { YY_BUFFER_STATE b; char *buf; grib_yy_size_t n; - int i; + grib_yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (grib_yy_size_t) (_grib_yybytes_len + 2); @@ -3031,7 +3032,7 @@ static void grib_yynoreturn grib_yy_fatal_error (const char* msg ) do \ { \ /* Undo effects of setting up grib_yytext. */ \ - int grib_yyless_macro_arg = (n); \ + grib_yy_size_t grib_yyless_macro_arg = (n); \ YY_LESS_LINENO(grib_yyless_macro_arg);\ grib_yytext[grib_yyleng] = (grib_yy_hold_char); \ (grib_yy_c_buf_p) = grib_yytext + grib_yyless_macro_arg; \ @@ -3071,7 +3072,7 @@ FILE *grib_yyget_out (void) /** Get the length of the current token. * */ -int grib_yyget_leng (void) +grib_yy_size_t grib_yyget_leng (void) { return grib_yyleng; } diff --git a/src/grib_nearest.cc b/src/grib_nearest.cc index ae07d598d..1bacbe767 100644 --- a/src/grib_nearest.cc +++ b/src/grib_nearest.cc @@ -437,7 +437,9 @@ int grib_nearest_find_generic( outlats[i] = neighbours[i].m_lat; outlons[i] = neighbours[i].m_lon; indexes[i] = neighbours[i].m_index; - values[i] = neighbours[i].m_value; + if (values) { + values[i] = neighbours[i].m_value; + } /*printf("(%f,%f) i=%d d=%f v=%f\n",outlats[i],outlons[i],indexes[i],distances[i],values[i]);*/ } diff --git a/src/grib_nearest_class_latlon_reduced.cc b/src/grib_nearest_class_latlon_reduced.cc index fc682ed05..9262723c6 100644 --- a/src/grib_nearest_class_latlon_reduced.cc +++ b/src/grib_nearest_class_latlon_reduced.cc @@ -182,7 +182,6 @@ static int find_global(grib_nearest* nearest, grib_handle* h, * This is for performance: if the grid has not changed, we only do this once * and reuse for other messages */ if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID) == 0) { - double dummy = 0; double olat = 1.e10; long n = 0; @@ -211,12 +210,12 @@ static int find_global(grib_nearest* nearest, grib_handle* h, if (!self->lons) return GRIB_OUT_OF_MEMORY; - iter = grib_iterator_new(h, 0, &ret); + iter = grib_iterator_new(h, GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret) { grib_context_log(h->context, GRIB_LOG_ERROR, "unable to create iterator"); return ret; } - while (grib_iterator_next(iter, &lat, &lon, &dummy)) { + while (grib_iterator_next(iter, &lat, &lon, NULL)) { if (olat != lat) { self->lats[ilat++] = lat; olat = lat; diff --git a/src/grib_nearest_class_reduced.cc b/src/grib_nearest_class_reduced.cc index 4e034e9b8..9556149c9 100644 --- a/src/grib_nearest_class_reduced.cc +++ b/src/grib_nearest_class_reduced.cc @@ -108,20 +108,20 @@ static int init(grib_nearest* nearest, grib_handle* h, grib_arguments* args) return GRIB_OUT_OF_MEMORY; grib_get_long(h, "global", &self->global); if (!self->global) { - int ret; + int err; /*TODO longitudeOfFirstGridPointInDegrees from the def file*/ - if ((ret = grib_get_double(h, "longitudeOfFirstGridPointInDegrees", &self->lon_first)) != GRIB_SUCCESS) { + if ((err = grib_get_double(h, "longitudeOfFirstGridPointInDegrees", &self->lon_first)) != GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_reduced: Unable to get longitudeOfFirstGridPointInDegrees %s\n", - grib_get_error_message(ret)); - return ret; + grib_get_error_message(err)); + return err; } /*TODO longitudeOfLastGridPointInDegrees from the def file*/ - if ((ret = grib_get_double(h, "longitudeOfLastGridPointInDegrees", &self->lon_last)) != GRIB_SUCCESS) { + if ((err = grib_get_double(h, "longitudeOfLastGridPointInDegrees", &self->lon_last)) != GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_reduced: Unable to get longitudeOfLastGridPointInDegrees %s\n", - grib_get_error_message(ret)); - return ret; + grib_get_error_message(err)); + return err; } } @@ -135,13 +135,16 @@ static int find_global(grib_nearest* nearest, grib_handle* h, double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len); -static int is_legacy(grib_handle* h) +static int is_legacy(grib_handle* h, int* legacy) { - long is_legacy = 0; - return (grib_get_long(h, "legacyGaussSubarea", &is_legacy) == GRIB_SUCCESS && is_legacy == 1); + int err = 0; + long lLegacy = 0; + err = grib_get_long(h, "legacyGaussSubarea", &lLegacy); + if (err) return err; + *legacy = (int)lLegacy; + return GRIB_SUCCESS; } - static int find(grib_nearest* nearest, grib_handle* h, double inlat, double inlon, unsigned long flags, double* outlats, double* outlons, double* values, @@ -186,7 +189,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h, double* distances, int* indexes, size_t* len) { grib_nearest_reduced* self = (grib_nearest_reduced*)nearest; - int ret = 0, kk = 0, ii = 0; + int err = 0, kk = 0, ii = 0; size_t jj = 0; long* pla = NULL; long* pl = NULL; @@ -198,36 +201,36 @@ static int find_global(grib_nearest* nearest, grib_handle* h, get_reduced_row_proc get_reduced_row_func = &grib_get_reduced_row; if (self->legacy == -1 || (flags & GRIB_NEAREST_SAME_GRID) == 0) { - self->legacy = is_legacy(h); + err = is_legacy(h, &(self->legacy)); + if (err) return err; } if (self->legacy == 1) { get_reduced_row_func = &grib_get_reduced_row_legacy; } - if ((ret = grib_get_size(h, self->values_key, &nvalues)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_size(h, self->values_key, &nvalues)) != GRIB_SUCCESS) + return err; nearest->values_count = nvalues; - if ((ret = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS) - return ret; + if ((err = grib_nearest_get_radius(h, &radiusInKm)) != GRIB_SUCCESS) + return err; /* Compute lat/lon info, create iterator etc if it's the 1st time or different grid. * This is for performance: if the grid has not changed, we only do this once * and reuse for other messages */ if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID) == 0) { - double dummy = 0; double olat = 1.e10; long n = 0; ilat = 0; ilon = 0; - if (grib_is_missing(h, self->Nj, &ret)) { + if (grib_is_missing(h, self->Nj, &err)) { grib_context_log(h->context, GRIB_LOG_DEBUG, "Key '%s' is missing", self->Nj); - return ret ? ret : GRIB_GEOCALCULUS_PROBLEM; + return err ? err : GRIB_GEOCALCULUS_PROBLEM; } - if ((ret = grib_get_long(h, self->Nj, &n)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long(h, self->Nj, &n)) != GRIB_SUCCESS) + return err; self->lats_count = n; if (self->lats) @@ -244,12 +247,12 @@ static int find_global(grib_nearest* nearest, grib_handle* h, if (!self->lons) return GRIB_OUT_OF_MEMORY; - iter = grib_iterator_new(h, 0, &ret); - if (ret != GRIB_SUCCESS) { + iter = grib_iterator_new(h, GRIB_GEOITERATOR_NO_VALUES, &err); + if (err != GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_reduced: Unable to create lat/lon iterator"); - return ret; + return err; } - while (grib_iterator_next(iter, &lat, &lon, &dummy)) { + while (grib_iterator_next(iter, &lat, &lon, NULL)) { if (olat != lat) { self->lats[ilat++] = lat; olat = lat; @@ -308,13 +311,13 @@ static int find_global(grib_nearest* nearest, grib_handle* h, &(self->j[0]), &(self->j[1])); plsize = self->lats_count; - if ((ret = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_size(h, self->pl, &plsize)) != GRIB_SUCCESS) + return err; pla = (long*)grib_context_malloc(h->context, plsize * sizeof(long)); if (!pla) return GRIB_OUT_OF_MEMORY; - if ((ret = grib_get_long_array(h, self->pl, pla, &plsize)) != GRIB_SUCCESS) - return ret; + if ((err = grib_get_long_array(h, self->pl, pla, &plsize)) != GRIB_SUCCESS) + return err; pl = pla; while ((*pl) == 0) { @@ -472,8 +475,8 @@ static int find_global(grib_nearest* nearest, grib_handle* h, if (values) { /* See ECC-1403 and ECC-499 */ /* Performance: Decode the field once and get all 4 values */ - ret = grib_get_double_element_set(h, self->values_key, self->k, NUM_NEIGHBOURS, values); - if (ret != GRIB_SUCCESS) return ret; + err = grib_get_double_element_set(h, self->values_key, self->k, NUM_NEIGHBOURS, values); + if (err != GRIB_SUCCESS) return err; } for (jj = 0; jj < 2; jj++) { for (ii = 0; ii < 2; ii++) { diff --git a/src/grib_nearest_class_regular.cc b/src/grib_nearest_class_regular.cc index 132da2f5f..ab2793181 100644 --- a/src/grib_nearest_class_regular.cc +++ b/src/grib_nearest_class_regular.cc @@ -213,13 +213,13 @@ static int find(grib_nearest* nearest, grib_handle* h, return GRIB_SUCCESS; } #else -static int is_rotated_grid(grib_handle* h) +static bool is_rotated_grid(grib_handle* h) { long is_rotated = 0; int err = grib_get_long(h, "isRotatedGrid", &is_rotated); if (!err && is_rotated) - return 1; - return 0; + return true; + return false; } static int find(grib_nearest* nearest, grib_handle* h, @@ -234,7 +234,7 @@ static int find(grib_nearest* nearest, grib_handle* h, grib_iterator* iter = NULL; double lat = 0, lon = 0; - const int is_rotated = is_rotated_grid(h); + const bool is_rotated = is_rotated_grid(h); double angleOfRotation = 0, southPoleLat = 0, southPoleLon = 0; while (inlon < 0) @@ -253,7 +253,6 @@ static int find(grib_nearest* nearest, grib_handle* h, * This is for performance: if the grid has not changed, we only do this once * and reuse for other messages */ if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID) == 0) { - double dummy = 0; double olat = 1.e10, olon = 1.e10; int ilat = 0, ilon = 0; long n = 0; @@ -316,12 +315,12 @@ static int find(grib_nearest* nearest, grib_handle* h, if (!self->lons) return GRIB_OUT_OF_MEMORY; - iter = grib_iterator_new(h, 0, &ret); + iter = grib_iterator_new(h, GRIB_GEOITERATOR_NO_VALUES, &ret); if (ret != GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_regular: Unable to create lat/lon iterator"); return ret; } - while (grib_iterator_next(iter, &lat, &lon, &dummy)) { + while (grib_iterator_next(iter, &lat, &lon, NULL)) { if (ilat < self->lats_count && olat != lat) { /* Assert(ilat < self->lats_count); */ self->lats[ilat++] = lat; diff --git a/src/grib_parse_utils.cc b/src/grib_parse_utils.cc index 11c5aabf8..93d4ce50d 100644 --- a/src/grib_parse_utils.cc +++ b/src/grib_parse_utils.cc @@ -108,7 +108,8 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una snprintf(val, sizeof(val), "undef"); } else { - grib_context_log(h->context, GRIB_LOG_WARNING, "grib_recompose_name: Problem to recompose filename with : %s ( %s no accessor found)", uname, loc); + grib_context_log(h->context, GRIB_LOG_WARNING, + "Recompose name: Problem recomposing filename with : %s ( %s no accessor found)", uname, loc); return GRIB_NOT_FOUND; } } @@ -129,14 +130,15 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una snprintf(val, sizeof(val), "%d", (int)lval); break; default: - grib_context_log(h->context, GRIB_LOG_WARNING, "grib_recompose_name: Problem to recompose filename with : %s, invalid type %d", loc, type); + grib_context_log(h->context, GRIB_LOG_WARNING, + "Recompose name: Problem recomposing filename with %s, invalid type %d", loc, type); break; } grib_dependency_add(observer, a); if ((ret != GRIB_SUCCESS)) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_recompose_name: Could not recompose filename : %s", uname); + grib_context_log(h->context, GRIB_LOG_ERROR, "Recompose name: Could not recompose filename: %s", uname); return ret; } } @@ -420,7 +422,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha break; default: grib_context_log(h->context, GRIB_LOG_WARNING, - "grib_accessor_print: Problem printing \"%s\", invalid type %d", a->name, grib_get_type_name(type)); + "Accessor print: Problem printing \"%s\", invalid type %d", a->name, grib_get_type_name(type)); } return ret; } @@ -496,7 +498,8 @@ int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* un ret = GRIB_NOT_FOUND; } else { - grib_context_log(h->context, GRIB_LOG_WARNING, "grib_recompose_print: Problem to recompose print with : %s, no accessor found", loc); + grib_context_log(h->context, GRIB_LOG_WARNING, + "Recompose print: Problem recomposing print with : %s, no accessor found", loc); return GRIB_NOT_FOUND; } } @@ -623,7 +626,7 @@ char* file_being_parsed() int grib_yyerror(const char* msg) { grib_context_log(grib_parser_context, GRIB_LOG_ERROR, - "grib_parser: %s at line %d of %s", msg, grib_yylineno + 1, parse_file); + "Parser: %s at line %d of %s", msg, grib_yylineno + 1, parse_file); grib_context_log(grib_parser_context, GRIB_LOG_ERROR, "ecCodes Version: %s", ECCODES_VERSION_STR); error = 1; @@ -658,7 +661,7 @@ void grib_parser_include(const char* included_fname) grib_parser_context->grib_definition_files_path); grib_context_log(grib_parser_context, GRIB_LOG_FATAL, - "grib_parser_include: Could not resolve '%s' (included in %s)", included_fname, parse_file); + "Parser include: Could not resolve '%s' (included in %s)", included_fname, parse_file); return; } @@ -678,7 +681,7 @@ void grib_parser_include(const char* included_fname) if (f == NULL) { char buffer[1024]; - grib_context_log(grib_parser_context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), "grib_parser_include: cannot open: '%s'", parse_file); + grib_context_log(grib_parser_context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR), "Parser include: cannot open: '%s'", parse_file); snprintf(buffer, sizeof(buffer), "Cannot include file: '%s'", parse_file); grib_yyerror(buffer); } diff --git a/src/grib_scaling.cc b/src/grib_scaling.cc index d5dc80719..d7654889f 100644 --- a/src/grib_scaling.cc +++ b/src/grib_scaling.cc @@ -40,16 +40,17 @@ long grib_get_binary_scale_fact(double max, double min, long bpval, int* ret) long scale = 0; const long last = 127; /* Depends on edition, should be parameter */ unsigned long maxint = 0; + const size_t ulong_size = sizeof(maxint) * 8; /* See ECC-246 unsigned long maxint = grib_power(bpval,2) - 1; double dmaxint=(double)maxint; */ - const double dmaxint = grib_power(bpval, 2) - 1; - if (dmaxint >= ULONG_MAX) { + if (bpval >= ulong_size) { *ret = GRIB_OUT_OF_RANGE; /*overflow*/ return 0; } + const double dmaxint = grib_power(bpval, 2) - 1; maxint = (unsigned long)dmaxint; /* Now it's safe to cast */ *ret = 0; diff --git a/src/grib_util.cc b/src/grib_util.cc index 4b8770ae5..dc3bc8cb7 100644 --- a/src/grib_util.cc +++ b/src/grib_util.cc @@ -11,8 +11,6 @@ #include "grib_api_internal.h" #include -#define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) - typedef enum { eROUND_ANGLE_UP, @@ -810,7 +808,7 @@ static const char* get_grid_type_name(const int spec_grid_type) static int is_constant_field(const double missingValue, const double* data_values, size_t data_values_count) { - int ii = 0; + size_t ii = 0; int constant = 1; double value = missingValue; @@ -1291,7 +1289,7 @@ grib_handle* grib_util_set_spec2(grib_handle* h, * Reason 1: It is not available in GRIB1 and so we have to wait until we change edition * Reason 2: It has to be done AFTER we set the data values */ - if (strcmp(input_packing_type, "grid_jpeg") && !strcmp(input_packing_type, "grid_simple")) + if (strcmp(input_packing_type, "grid_jpeg")) setJpegPacking = 1; break; case GRIB_UTIL_PACKING_TYPE_CCSDS: @@ -1634,7 +1632,7 @@ cleanup: grib_handle_delete(h_out); return NULL; } - +#if 0 int grib_moments(grib_handle* h, double east, double north, double west, double south, int order, double* moments, long* count) { grib_iterator* iter = NULL; @@ -1721,8 +1719,9 @@ int grib_moments(grib_handle* h, double east, double north, double west, double return ret; } +#endif -/* Helper function for 'parse_keyval_string' */ +// Helper function for 'parse_keyval_string' static void set_value(grib_values* value, char* str, int equal) { char *p = 0, *q = 0, *s = 0; @@ -1808,14 +1807,14 @@ static void set_value(grib_values* value, char* str, int equal) } } -/* - 'grib_tool' Optional tool name which is printed on error. Can be NULL - 'arg' The string to be parsed e.g. key1=value1,key2!=value2 etc (cannot be const) - 'values_required' If true then each key must have a value after it - 'default_type' The default type e.g. GRIB_TYPE_UNDEFINED or GRIB_TYPE_DOUBLE - 'values' The array we populate and return (output) - 'count' Number of elements (output). Must be initialised to the size of the values array - */ +// +// 'grib_tool' Optional tool name which is printed on error. Can be NULL +// 'arg' The string to be parsed e.g. key1=value1,key2!=value2 etc (cannot be const) +// 'values_required' If true then each key must have a value after it +// 'default_type' The default type e.g. GRIB_TYPE_UNDEFINED or GRIB_TYPE_DOUBLE +// 'values' The array we populate and return (output) +// 'count' Number of elements (output). Must be initialised to the size of the values array +// int parse_keyval_string(const char* grib_tool, char* arg, int values_required, int default_type, grib_values values[], int* count) @@ -1896,18 +1895,22 @@ int parse_keyval_string(const char* grib_tool, return GRIB_SUCCESS; } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is related to EPS */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for EPS (ensemble) products int grib2_is_PDTN_EPS(long pdtn) { - return ( - pdtn == 1 || pdtn == 11 || - pdtn == 33 || pdtn == 34 || /*simulated (synthetic) satellite data*/ - pdtn == 41 || pdtn == 43 || /*atmospheric chemical constituents*/ - pdtn == 45 || pdtn == 47 || pdtn == 85 /*aerosols*/ - ); +#define NUMBER(x) (sizeof(x) / sizeof(x[0])) + + static int eps_pdtns[] = { 1, 11, 33, 34, 41, 43, 45, 47, + 49, 54, 56, 58, 59, 60, 61, 63, 68, 71, 73, 77, 79, + 81, 83, 84, 85, 92, 94, 96, 98 }; + size_t i; + for (i = 0; i < NUMBER(eps_pdtns); ++i) { + if (eps_pdtns[i] == pdtn) return 1; + } + return 0; } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is for atmospheric chemical constituents */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for atmospheric chemical constituents int grib2_is_PDTN_Chemical(long pdtn) { return ( @@ -1917,8 +1920,8 @@ int grib2_is_PDTN_Chemical(long pdtn) pdtn == 43); } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is for - * atmospheric chemical constituents with source or sink */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for +// atmospheric chemical constituents with source or sink int grib2_is_PDTN_ChemicalSourceSink(long pdtn) { return ( @@ -1928,8 +1931,8 @@ int grib2_is_PDTN_ChemicalSourceSink(long pdtn) pdtn == 79); } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is for - * atmospheric chemical constituents based on a distribution function */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for +// atmospheric chemical constituents based on a distribution function int grib2_is_PDTN_ChemicalDistFunc(long pdtn) { return ( @@ -1939,11 +1942,11 @@ int grib2_is_PDTN_ChemicalDistFunc(long pdtn) pdtn == 68); } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is for aerosols */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for aerosols int grib2_is_PDTN_Aerosol(long pdtn) { - /* Notes: PDT 44 is deprecated and replaced by 48 */ - /* PDT 47 is deprecated and replaced by 85 */ + // Notes: PDT 44 is deprecated and replaced by 48 + // PDT 47 is deprecated and replaced by 85 return ( pdtn == 44 || pdtn == 48 || @@ -1954,23 +1957,21 @@ int grib2_is_PDTN_Aerosol(long pdtn) pdtn == 85); } -/* Return 1 if the productDefinitionTemplateNumber (GRIB2) is for optical properties of aerosol */ +// Return 1 if the productDefinitionTemplateNumber (GRIB2) is for optical properties of aerosol int grib2_is_PDTN_AerosolOptical(long pdtn) { - /* Note: PDT 48 can be used for both plain aerosols as well as optical properties of aerosol. - * For the former user must set the optical wavelength range to missing. - */ + // Note: PDT 48 can be used for both plain aerosols as well as optical properties of aerosol. + // For the former user must set the optical wavelength range to missing return ( pdtn == 48 || pdtn == 49); } -/* Given some information about the type of grib2 parameter, return the productDefinitionTemplateNumber to use. - * All arguments are booleans (0 or 1) - * is_eps: ensemble or deterministic - * is_instant: instantaneous or interval-based - * etc - */ +// Given some information about the type of grib2 parameter, return the productDefinitionTemplateNumber to use. +// All arguments are booleans (0 or 1) +// is_eps: ensemble or deterministic +// is_instant: instantaneous or interval-based +// etc... int grib2_select_PDTN(int is_eps, int is_instant, int is_chemical, int is_chemical_srcsink, @@ -1978,8 +1979,8 @@ int grib2_select_PDTN(int is_eps, int is_instant, int is_aerosol, int is_aerosol_optical) { - /* At most one has to be set. All could be 0 */ - /* Unfortunately if PDTN=48 then both aerosol and aerosol_optical can be 1! */ + // At most one has to be set. All could be 0 + // Unfortunately if PDTN=48 then both aerosol and aerosol_optical can be 1! const int sum = is_chemical + is_chemical_srcsink + is_chemical_distfn + is_aerosol + is_aerosol_optical; Assert(sum == 0 || sum == 1 || sum == 2); @@ -2032,12 +2033,12 @@ int grib2_select_PDTN(int is_eps, int is_instant, if (is_eps) { if (is_instant) return 49; - /* WMO does not have a non-instantaneous case here! */ + // WMO does not have a non-instantaneous case here! } else { if (is_instant) return 48; - /* WMO does not have a non-instantaneous case here! */ + // WMO does not have a non-instantaneous case here! } } @@ -2046,17 +2047,17 @@ int grib2_select_PDTN(int is_eps, int is_instant, if (is_instant) return 45; else - return 85; /* PDT 47 is deprecated*/ + return 85; // PDT 47 is deprecated } else { if (is_instant) - return 48; /*44 is deprecated*/ + return 48; // 44 is deprecated else return 46; } } - /* Fallthru case: default */ + // Fallthru case: default if (is_eps) { if (is_instant) return 1; @@ -2104,7 +2105,7 @@ int grib_check_data_values_range(grib_handle* h, const double min_val, const dou return GRIB_ENCODING_ERROR; } - /* Data Quality checks */ + // Data Quality checks if (ctx->grib_data_quality_checks) { result = grib_util_grib_data_quality_check(h, min_val, max_val); } @@ -2112,10 +2113,10 @@ int grib_check_data_values_range(grib_handle* h, const double min_val, const dou return result; } -/* Return true(1) if large constant fields are to be created, otherwise false(0) */ +// Return true(1) if large constant fields are to be created, otherwise false(0) int grib_producing_large_constant_fields(grib_handle* h, int edition) { - /* First check if the transient key is set */ + // First check if the transient key is set grib_context* c = h->context; long produceLargeConstantFields = 0; if (grib_get_long(h, "produceLargeConstantFields", &produceLargeConstantFields) == GRIB_SUCCESS && @@ -2127,7 +2128,7 @@ int grib_producing_large_constant_fields(grib_handle* h, int edition) return 1; } - /* Finally check the environment variable via the context */ + // Finally check the environment variable via the context return c->large_constant_fields; } @@ -2138,18 +2139,26 @@ int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max double min_field_value_allowed = 0, max_field_value_allowed = 0; long paramId = 0; grib_context* ctx = h->context; - int is_error = 1; + bool is_error = true; char description[1024] = {0,}; - char step[32] = "unknown"; - size_t len = 32; - /* - * If grib_data_quality_checks == 1, limits failure results in an error - * If grib_data_quality_checks == 2, limits failure results in a warning - */ + char step[32] = "unknown"; + char shortName[32] = {0,}; + size_t len = 32; + + // If grib_data_quality_checks == 1, limits failure results in an error + // If grib_data_quality_checks == 2, limits failure results in a warning + Assert(ctx->grib_data_quality_checks == 1 || ctx->grib_data_quality_checks == 2); is_error = (ctx->grib_data_quality_checks == 1); - /* The limit keys must exist if we are here */ + err = grib_get_string(h, "shortName", shortName, &len); + if (err || STR_EQUAL(shortName, "unknown")) { + fprintf(stderr, "ECCODES %s : Invalid metadata: shortName=unknown\n", + (is_error ? "ERROR" : "WARNING")); + if (is_error) return GRIB_INVALID_MESSAGE; + } + + // The limit keys must exist if we are here err = grib_get_double(h, "param_value_min", &min_field_value_allowed); if (err) { grib_context_log(ctx, GRIB_LOG_ERROR, "grib_data_quality_check: Could not get param_value_min"); @@ -2183,7 +2192,7 @@ int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max } } if (is_error) { - return GRIB_OUT_OF_RANGE; /* Failure */ + return GRIB_OUT_OF_RANGE; // Failure } } if (max_val > max_field_value_allowed) { @@ -2199,7 +2208,7 @@ int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max } } if (is_error) { - return GRIB_OUT_OF_RANGE; /* Failure */ + return GRIB_OUT_OF_RANGE; // Failure } } diff --git a/src/grib_value.cc b/src/grib_value.cc index 2512f21fe..b2c67c9a9 100644 --- a/src/grib_value.cc +++ b/src/grib_value.cc @@ -11,9 +11,11 @@ * Jean Baptiste Filippi - 01.11.2005 * Enrico Fucile * ***************************************************************************/ -#include "grib_api_internal.h" +#include "grib_api_internal_cpp.h" #include + + /* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* 0 means input strings are equal and 1 means not equal */ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) @@ -780,6 +782,11 @@ int grib_set_double_array_internal(grib_handle* h, const char* name, const doubl return ret; } +int grib_set_float_array_internal(grib_handle* h, const char* name, const float* val, size_t length) +{ + return GRIB_NOT_IMPLEMENTED; +} + static int __grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length, int check) { double v = 0; @@ -852,11 +859,23 @@ int grib_set_force_double_array(grib_handle* h, const char* name, const double* /* Use with great caution!! */ return __grib_set_double_array(h, name, val, length, /*check=*/0); } +int grib_set_force_float_array(grib_handle* h, const char* name, const float* val, size_t length) +{ + /* GRIB-285: Same as grib_set_float_array but allows setting of READ-ONLY keys like codedValues */ + /* Use with great caution!! */ + //return __grib_set_float_array(h, name, val, length, /*check=*/0); + return GRIB_NOT_IMPLEMENTED; +} int grib_set_double_array(grib_handle* h, const char* name, const double* val, size_t length) { return __grib_set_double_array(h, name, val, length, /*check=*/1); } +int grib_set_float_array(grib_handle* h, const char* name, const float* val, size_t length) +{ + //return __grib_set_float_array(h, name, val, length, /*check=*/1); + return GRIB_NOT_IMPLEMENTED; +} static int _grib_set_long_array_internal(grib_handle* h, grib_accessor* a, const long* val, size_t buffer_len, size_t* encoded_length, int check) { @@ -1054,6 +1073,15 @@ int grib_get_double_element(const grib_handle* h, const char* name, int i, doubl } return GRIB_NOT_FOUND; } +int grib_get_float_element(const grib_handle* h, const char* name, int i, float* val) +{ + grib_accessor* act = grib_find_accessor(h, name); + + if (act) { + return grib_unpack_float_element(act, i, val); + } + return GRIB_NOT_FOUND; +} int grib_get_double_element_set_internal(grib_handle* h, const char* name, const size_t* index_array, size_t len, double* val_array) { @@ -1066,6 +1094,17 @@ int grib_get_double_element_set_internal(grib_handle* h, const char* name, const return ret; } +int grib_get_float_element_set_internal(grib_handle* h, const char* name, const size_t* index_array, size_t len, float* val_array) +{ + int ret = grib_get_float_element_set(h, name, index_array, len, val_array); + + if (ret != GRIB_SUCCESS) + grib_context_log(h->context, GRIB_LOG_ERROR, + "unable to get %s as float element set (%s)", + name, grib_get_error_message(ret)); + + return ret; +} int grib_get_double_element_set(const grib_handle* h, const char* name, const size_t* index_array, size_t len, double* val_array) { @@ -1076,6 +1115,15 @@ int grib_get_double_element_set(const grib_handle* h, const char* name, const si } return GRIB_NOT_FOUND; } +int grib_get_float_element_set(const grib_handle* h, const char* name, const size_t* index_array, size_t len, float* val_array) +{ + grib_accessor* acc = grib_find_accessor(h, name); + + if (acc) { + return grib_unpack_float_element_set(acc, index_array, len, val_array); + } + return GRIB_NOT_FOUND; +} int grib_points_get_values(grib_handle* h, grib_points* points, double* val) { @@ -1141,6 +1189,10 @@ int grib_get_double_elements(const grib_handle* h, const char* name, const int* return err; } +int grib_get_float_elements(const grib_handle* h, const char* name, const int* index_array, long len, float* val_array) +{ + return GRIB_NOT_IMPLEMENTED; +} int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t* length) { @@ -1230,14 +1282,16 @@ const char* grib_get_accessor_class_name(grib_handle* h, const char* name) return act ? act->cclass->name : NULL; } -static int _grib_get_double_array_internal(const grib_handle* h, grib_accessor* a, double* val, size_t buffer_len, size_t* decoded_length) +template +static int _grib_get_array_internal(const grib_handle* h, grib_accessor* a, T* val, size_t buffer_len, size_t* decoded_length) { + static_assert(std::is_floating_point::value, "Requires floating point numbers"); if (a) { - int err = _grib_get_double_array_internal(h, a->same, val, buffer_len, decoded_length); + int err = _grib_get_array_internal(h, a->same, val, buffer_len, decoded_length); if (err == GRIB_SUCCESS) { size_t len = buffer_len - *decoded_length; - err = grib_unpack_double(a, val + *decoded_length, &len); + err = grib_unpack(a, val + *decoded_length, &len); *decoded_length += len; } @@ -1250,14 +1304,12 @@ static int _grib_get_double_array_internal(const grib_handle* h, grib_accessor* int grib_get_double_array_internal(const grib_handle* h, const char* name, double* val, size_t* length) { - int ret = grib_get_double_array(h, name, val, length); + return grib_get_array_internal(h, name, val, length); +} - if (ret != GRIB_SUCCESS) - grib_context_log(h->context, GRIB_LOG_ERROR, - "unable to get %s as double array (%s)", - name, grib_get_error_message(ret)); - - return ret; +int grib_get_float_array_internal(const grib_handle* h, const char* name, float* val, size_t* length) +{ + return grib_get_array_internal(h, name, val, length); } int grib_get_double_array(const grib_handle* h, const char* name, double* val, size_t* length) @@ -1280,15 +1332,44 @@ int grib_get_double_array(const grib_handle* h, const char* name, double* val, s if (!a) return GRIB_NOT_FOUND; if (name[0] == '#') { - return grib_unpack_double(a, val, length); + return grib_unpack(a, val, length); } else { *length = 0; - return _grib_get_double_array_internal(h, a, val, len, length); + return _grib_get_array_internal(h, a, val, len, length); } } } +int grib_get_float_array(const grib_handle* h, const char* name, float* val, size_t *length) +{ + size_t len = *length; + grib_accessor* a = grib_find_accessor(h, name); + if (!a) return GRIB_NOT_FOUND; + + //[> TODO: For now only GRIB supported... no BUFR keys <] + if (h->product_kind != PRODUCT_GRIB) { + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_get_float_array only supported for GRIB"); + return GRIB_NOT_IMPLEMENTED; + } + Assert(name[0]!='/'); + Assert(name[0]!='#'); + *length = 0; + return _grib_get_array_internal(h,a,val,len,length); +} + +template <> +int grib_get_array(const grib_handle* h, const char* name, float* val, size_t *length) +{ + return grib_get_float_array(h, name, val, length); +} + +template <> +int grib_get_array(const grib_handle* h, const char* name, double* val, size_t* length) +{ + return grib_get_double_array(h, name, val, length); +} + int ecc__grib_get_string_length(grib_accessor* a, size_t* size) { size_t s = 0; diff --git a/src/grib_value.h b/src/grib_value.h new file mode 100644 index 000000000..b0485de40 --- /dev/null +++ b/src/grib_value.h @@ -0,0 +1,22 @@ +#pragma once + +#include "grib_api_internal.h" +#include +#include + +template +int grib_get_array(const grib_handle* h, const char* name, T* val, size_t* length); + +template +int grib_get_array_internal(const grib_handle* h, const char* name, T* val, size_t* length) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + int ret = grib_get_array(h, name, val, length); + + if (ret != GRIB_SUCCESS) + grib_context_log(h->context, GRIB_LOG_ERROR, + "unable to get %s as %s array (%s)", + name, typeid(T).name(), grib_get_error_message(ret)); + + return ret; +} diff --git a/src/grib_yacc.cc b/src/grib_yacc.cc index 09bbbb45f..b8d94ab2c 100644 --- a/src/grib_yacc.cc +++ b/src/grib_yacc.cc @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.5.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -34,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or grib_yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with grib_yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -41,14 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.5.4" +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -93,7 +94,7 @@ static grib_hash_array_value *_reverse_hash_array(grib_hash_array_value *r,grib_ -#line 97 "y.tab.c" +#line 98 "y.tab.c" # ifndef YY_CAST # ifdef __cplusplus @@ -116,14 +117,6 @@ static grib_hash_array_value *_reverse_hash_array(grib_hash_array_value *r,grib_ # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_YY_Y_TAB_H_INCLUDED @@ -136,138 +129,147 @@ static grib_hash_array_value *_reverse_hash_array(grib_hash_array_value *r,grib_ extern int grib_yydebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum grib_yytokentype { - LOWERCASE = 258, - IF = 259, - IF_TRANSIENT = 260, - ELSE = 261, - END = 262, - CLOSE = 263, - UNSIGNED = 264, - TEMPLATE = 265, - TEMPLATE_NOFAIL = 266, - TRIGGER = 267, - ASCII = 268, - GROUP = 269, - NON_ALPHA = 270, - KSEC1EXPVER = 271, - LABEL = 272, - LIST = 273, - IS_IN_LIST = 274, - IS_IN_DICT = 275, - IS_INTEGER = 276, - TO_INTEGER = 277, - TO_STRING = 278, - SEX2DEC = 279, - WHILE = 280, - IBMFLOAT = 281, - SIGNED = 282, - UINT8 = 283, - INT8 = 284, - UINT16 = 285, - INT16 = 286, - UINT16_LITTLE_ENDIAN = 287, - INT16_LITTLE_ENDIAN = 288, - UINT32 = 289, - INT32 = 290, - UINT32_LITTLE_ENDIAN = 291, - INT32_LITTLE_ENDIAN = 292, - UINT64 = 293, - INT64 = 294, - UINT64_LITTLE_ENDIAN = 295, - INT64_LITTLE_ENDIAN = 296, - BLOB = 297, - BYTE = 298, - CODETABLE = 299, - SMART_TABLE = 300, - DICTIONARY = 301, - COMPLEX_CODETABLE = 302, - LOOKUP = 303, - ALIAS = 304, - UNALIAS = 305, - META = 306, - POS = 307, - INTCONST = 308, - TRANS = 309, - FLAGBIT = 310, - CONCEPT = 311, - GETENV = 312, - HASH_ARRAY = 313, - CONCEPT_NOFAIL = 314, - NIL = 315, - DUMMY = 316, - MODIFY = 317, - READ_ONLY = 318, - STRING_TYPE = 319, - LONG_TYPE = 320, - DOUBLE_TYPE = 321, - NO_COPY = 322, - DUMP = 323, - JSON = 324, - XML = 325, - NO_FAIL = 326, - EDITION_SPECIFIC = 327, - OVERRIDE = 328, - HIDDEN = 329, - CAN_BE_MISSING = 330, - MISSING = 331, - CONSTRAINT = 332, - COPY_OK = 333, - WHEN = 334, - SET = 335, - SET_NOFAIL = 336, - WRITE = 337, - APPEND = 338, - PRINT = 339, - EXPORT = 340, - REMOVE = 341, - RENAME = 342, - SKIP = 343, - PAD = 344, - SECTION_PADDING = 345, - MESSAGE = 346, - MESSAGE_COPY = 347, - PADTO = 348, - PADTOEVEN = 349, - PADTOMULTIPLE = 350, - G1_HALF_BYTE = 351, - G1_MESSAGE_LENGTH = 352, - G1_SECTION4_LENGTH = 353, - SECTION_LENGTH = 354, - LENGTH = 355, - FLAG = 356, - ITERATOR = 357, - NEAREST = 358, - BOX = 359, - KSEC = 360, - ASSERT = 361, - SUBSTR = 362, - CASE = 363, - SWITCH = 364, - DEFAULT = 365, - EQ = 366, - NE = 367, - GE = 368, - LE = 369, - LT = 370, - GT = 371, - BIT = 372, - BITOFF = 373, - AND = 374, - OR = 375, - NOT = 376, - IS = 377, - IDENT = 378, - STRING = 379, - INTEGER = 380, - FLOAT = 381 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + LOWERCASE = 258, /* LOWERCASE */ + IF = 259, /* IF */ + IF_TRANSIENT = 260, /* IF_TRANSIENT */ + ELSE = 261, /* ELSE */ + END = 262, /* END */ + CLOSE = 263, /* CLOSE */ + UNSIGNED = 264, /* UNSIGNED */ + TEMPLATE = 265, /* TEMPLATE */ + TEMPLATE_NOFAIL = 266, /* TEMPLATE_NOFAIL */ + TRIGGER = 267, /* TRIGGER */ + ASCII = 268, /* ASCII */ + GROUP = 269, /* GROUP */ + NON_ALPHA = 270, /* NON_ALPHA */ + KSEC1EXPVER = 271, /* KSEC1EXPVER */ + LABEL = 272, /* LABEL */ + LIST = 273, /* LIST */ + IS_IN_LIST = 274, /* IS_IN_LIST */ + IS_IN_DICT = 275, /* IS_IN_DICT */ + IS_INTEGER = 276, /* IS_INTEGER */ + TO_INTEGER = 277, /* TO_INTEGER */ + TO_STRING = 278, /* TO_STRING */ + SEX2DEC = 279, /* SEX2DEC */ + WHILE = 280, /* WHILE */ + IBMFLOAT = 281, /* IBMFLOAT */ + SIGNED = 282, /* SIGNED */ + UINT8 = 283, /* UINT8 */ + INT8 = 284, /* INT8 */ + UINT16 = 285, /* UINT16 */ + INT16 = 286, /* INT16 */ + UINT16_LITTLE_ENDIAN = 287, /* UINT16_LITTLE_ENDIAN */ + INT16_LITTLE_ENDIAN = 288, /* INT16_LITTLE_ENDIAN */ + UINT32 = 289, /* UINT32 */ + INT32 = 290, /* INT32 */ + UINT32_LITTLE_ENDIAN = 291, /* UINT32_LITTLE_ENDIAN */ + INT32_LITTLE_ENDIAN = 292, /* INT32_LITTLE_ENDIAN */ + UINT64 = 293, /* UINT64 */ + INT64 = 294, /* INT64 */ + UINT64_LITTLE_ENDIAN = 295, /* UINT64_LITTLE_ENDIAN */ + INT64_LITTLE_ENDIAN = 296, /* INT64_LITTLE_ENDIAN */ + BLOB = 297, /* BLOB */ + BYTE = 298, /* BYTE */ + CODETABLE = 299, /* CODETABLE */ + SMART_TABLE = 300, /* SMART_TABLE */ + DICTIONARY = 301, /* DICTIONARY */ + COMPLEX_CODETABLE = 302, /* COMPLEX_CODETABLE */ + LOOKUP = 303, /* LOOKUP */ + ALIAS = 304, /* ALIAS */ + UNALIAS = 305, /* UNALIAS */ + META = 306, /* META */ + POS = 307, /* POS */ + INTCONST = 308, /* INTCONST */ + TRANS = 309, /* TRANS */ + FLAGBIT = 310, /* FLAGBIT */ + CONCEPT = 311, /* CONCEPT */ + GETENV = 312, /* GETENV */ + HASH_ARRAY = 313, /* HASH_ARRAY */ + CONCEPT_NOFAIL = 314, /* CONCEPT_NOFAIL */ + NIL = 315, /* NIL */ + DUMMY = 316, /* DUMMY */ + MODIFY = 317, /* MODIFY */ + READ_ONLY = 318, /* READ_ONLY */ + STRING_TYPE = 319, /* STRING_TYPE */ + LONG_TYPE = 320, /* LONG_TYPE */ + DOUBLE_TYPE = 321, /* DOUBLE_TYPE */ + NO_COPY = 322, /* NO_COPY */ + DUMP = 323, /* DUMP */ + JSON = 324, /* JSON */ + XML = 325, /* XML */ + NO_FAIL = 326, /* NO_FAIL */ + EDITION_SPECIFIC = 327, /* EDITION_SPECIFIC */ + OVERRIDE = 328, /* OVERRIDE */ + HIDDEN = 329, /* HIDDEN */ + CAN_BE_MISSING = 330, /* CAN_BE_MISSING */ + MISSING = 331, /* MISSING */ + CONSTRAINT = 332, /* CONSTRAINT */ + COPY_OK = 333, /* COPY_OK */ + WHEN = 334, /* WHEN */ + SET = 335, /* SET */ + SET_NOFAIL = 336, /* SET_NOFAIL */ + WRITE = 337, /* WRITE */ + APPEND = 338, /* APPEND */ + PRINT = 339, /* PRINT */ + EXPORT = 340, /* EXPORT */ + REMOVE = 341, /* REMOVE */ + RENAME = 342, /* RENAME */ + SKIP = 343, /* SKIP */ + PAD = 344, /* PAD */ + SECTION_PADDING = 345, /* SECTION_PADDING */ + MESSAGE = 346, /* MESSAGE */ + MESSAGE_COPY = 347, /* MESSAGE_COPY */ + PADTO = 348, /* PADTO */ + PADTOEVEN = 349, /* PADTOEVEN */ + PADTOMULTIPLE = 350, /* PADTOMULTIPLE */ + G1_HALF_BYTE = 351, /* G1_HALF_BYTE */ + G1_MESSAGE_LENGTH = 352, /* G1_MESSAGE_LENGTH */ + G1_SECTION4_LENGTH = 353, /* G1_SECTION4_LENGTH */ + SECTION_LENGTH = 354, /* SECTION_LENGTH */ + LENGTH = 355, /* LENGTH */ + FLAG = 356, /* FLAG */ + ITERATOR = 357, /* ITERATOR */ + NEAREST = 358, /* NEAREST */ + BOX = 359, /* BOX */ + KSEC = 360, /* KSEC */ + ASSERT = 361, /* ASSERT */ + SUBSTR = 362, /* SUBSTR */ + CASE = 363, /* CASE */ + SWITCH = 364, /* SWITCH */ + DEFAULT = 365, /* DEFAULT */ + EQ = 366, /* EQ */ + NE = 367, /* NE */ + GE = 368, /* GE */ + LE = 369, /* LE */ + LT = 370, /* LT */ + GT = 371, /* GT */ + BIT = 372, /* BIT */ + BITOFF = 373, /* BITOFF */ + AND = 374, /* AND */ + OR = 375, /* OR */ + NOT = 376, /* NOT */ + IS = 377, /* IS */ + IDENT = 378, /* IDENT */ + STRING = 379, /* STRING */ + INTEGER = 380, /* INTEGER */ + FLOAT = 381 /* FLOAT */ }; + typedef enum grib_yytokentype grib_yytoken_kind_t; #endif -/* Tokens. */ +/* Token kinds. */ +#define YYEMPTY -2 +#define YYEOF 0 +#define YYerror 256 +#define YYUNDEF 257 #define LOWERCASE 258 #define IF 259 #define IF_TRANSIENT 260 @@ -411,11 +413,11 @@ union YYSTYPE grib_concept_condition *concept_condition; grib_concept_value *concept_value; grib_hash_array_value *hash_array_value; - grib_case *case_value; + grib_case *case_value; grib_rule *rules; grib_rule_entry *rule_entry; -#line 419 "y.tab.c" +#line 421 "y.tab.c" }; typedef union YYSTYPE YYSTYPE; @@ -426,9 +428,212 @@ typedef union YYSTYPE YYSTYPE; extern YYSTYPE grib_yylval; + int grib_yyparse (void); + #endif /* !YY_YY_Y_TAB_H_INCLUDED */ +/* Symbol kind. */ +enum grib_yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_LOWERCASE = 3, /* LOWERCASE */ + YYSYMBOL_IF = 4, /* IF */ + YYSYMBOL_IF_TRANSIENT = 5, /* IF_TRANSIENT */ + YYSYMBOL_ELSE = 6, /* ELSE */ + YYSYMBOL_END = 7, /* END */ + YYSYMBOL_CLOSE = 8, /* CLOSE */ + YYSYMBOL_UNSIGNED = 9, /* UNSIGNED */ + YYSYMBOL_TEMPLATE = 10, /* TEMPLATE */ + YYSYMBOL_TEMPLATE_NOFAIL = 11, /* TEMPLATE_NOFAIL */ + YYSYMBOL_TRIGGER = 12, /* TRIGGER */ + YYSYMBOL_ASCII = 13, /* ASCII */ + YYSYMBOL_GROUP = 14, /* GROUP */ + YYSYMBOL_NON_ALPHA = 15, /* NON_ALPHA */ + YYSYMBOL_KSEC1EXPVER = 16, /* KSEC1EXPVER */ + YYSYMBOL_LABEL = 17, /* LABEL */ + YYSYMBOL_LIST = 18, /* LIST */ + YYSYMBOL_IS_IN_LIST = 19, /* IS_IN_LIST */ + YYSYMBOL_IS_IN_DICT = 20, /* IS_IN_DICT */ + YYSYMBOL_IS_INTEGER = 21, /* IS_INTEGER */ + YYSYMBOL_TO_INTEGER = 22, /* TO_INTEGER */ + YYSYMBOL_TO_STRING = 23, /* TO_STRING */ + YYSYMBOL_SEX2DEC = 24, /* SEX2DEC */ + YYSYMBOL_WHILE = 25, /* WHILE */ + YYSYMBOL_IBMFLOAT = 26, /* IBMFLOAT */ + YYSYMBOL_SIGNED = 27, /* SIGNED */ + YYSYMBOL_UINT8 = 28, /* UINT8 */ + YYSYMBOL_INT8 = 29, /* INT8 */ + YYSYMBOL_UINT16 = 30, /* UINT16 */ + YYSYMBOL_INT16 = 31, /* INT16 */ + YYSYMBOL_UINT16_LITTLE_ENDIAN = 32, /* UINT16_LITTLE_ENDIAN */ + YYSYMBOL_INT16_LITTLE_ENDIAN = 33, /* INT16_LITTLE_ENDIAN */ + YYSYMBOL_UINT32 = 34, /* UINT32 */ + YYSYMBOL_INT32 = 35, /* INT32 */ + YYSYMBOL_UINT32_LITTLE_ENDIAN = 36, /* UINT32_LITTLE_ENDIAN */ + YYSYMBOL_INT32_LITTLE_ENDIAN = 37, /* INT32_LITTLE_ENDIAN */ + YYSYMBOL_UINT64 = 38, /* UINT64 */ + YYSYMBOL_INT64 = 39, /* INT64 */ + YYSYMBOL_UINT64_LITTLE_ENDIAN = 40, /* UINT64_LITTLE_ENDIAN */ + YYSYMBOL_INT64_LITTLE_ENDIAN = 41, /* INT64_LITTLE_ENDIAN */ + YYSYMBOL_BLOB = 42, /* BLOB */ + YYSYMBOL_BYTE = 43, /* BYTE */ + YYSYMBOL_CODETABLE = 44, /* CODETABLE */ + YYSYMBOL_SMART_TABLE = 45, /* SMART_TABLE */ + YYSYMBOL_DICTIONARY = 46, /* DICTIONARY */ + YYSYMBOL_COMPLEX_CODETABLE = 47, /* COMPLEX_CODETABLE */ + YYSYMBOL_LOOKUP = 48, /* LOOKUP */ + YYSYMBOL_ALIAS = 49, /* ALIAS */ + YYSYMBOL_UNALIAS = 50, /* UNALIAS */ + YYSYMBOL_META = 51, /* META */ + YYSYMBOL_POS = 52, /* POS */ + YYSYMBOL_INTCONST = 53, /* INTCONST */ + YYSYMBOL_TRANS = 54, /* TRANS */ + YYSYMBOL_FLAGBIT = 55, /* FLAGBIT */ + YYSYMBOL_CONCEPT = 56, /* CONCEPT */ + YYSYMBOL_GETENV = 57, /* GETENV */ + YYSYMBOL_HASH_ARRAY = 58, /* HASH_ARRAY */ + YYSYMBOL_CONCEPT_NOFAIL = 59, /* CONCEPT_NOFAIL */ + YYSYMBOL_NIL = 60, /* NIL */ + YYSYMBOL_DUMMY = 61, /* DUMMY */ + YYSYMBOL_MODIFY = 62, /* MODIFY */ + YYSYMBOL_READ_ONLY = 63, /* READ_ONLY */ + YYSYMBOL_STRING_TYPE = 64, /* STRING_TYPE */ + YYSYMBOL_LONG_TYPE = 65, /* LONG_TYPE */ + YYSYMBOL_DOUBLE_TYPE = 66, /* DOUBLE_TYPE */ + YYSYMBOL_NO_COPY = 67, /* NO_COPY */ + YYSYMBOL_DUMP = 68, /* DUMP */ + YYSYMBOL_JSON = 69, /* JSON */ + YYSYMBOL_XML = 70, /* XML */ + YYSYMBOL_NO_FAIL = 71, /* NO_FAIL */ + YYSYMBOL_EDITION_SPECIFIC = 72, /* EDITION_SPECIFIC */ + YYSYMBOL_OVERRIDE = 73, /* OVERRIDE */ + YYSYMBOL_HIDDEN = 74, /* HIDDEN */ + YYSYMBOL_CAN_BE_MISSING = 75, /* CAN_BE_MISSING */ + YYSYMBOL_MISSING = 76, /* MISSING */ + YYSYMBOL_CONSTRAINT = 77, /* CONSTRAINT */ + YYSYMBOL_COPY_OK = 78, /* COPY_OK */ + YYSYMBOL_WHEN = 79, /* WHEN */ + YYSYMBOL_SET = 80, /* SET */ + YYSYMBOL_SET_NOFAIL = 81, /* SET_NOFAIL */ + YYSYMBOL_WRITE = 82, /* WRITE */ + YYSYMBOL_APPEND = 83, /* APPEND */ + YYSYMBOL_PRINT = 84, /* PRINT */ + YYSYMBOL_EXPORT = 85, /* EXPORT */ + YYSYMBOL_REMOVE = 86, /* REMOVE */ + YYSYMBOL_RENAME = 87, /* RENAME */ + YYSYMBOL_SKIP = 88, /* SKIP */ + YYSYMBOL_PAD = 89, /* PAD */ + YYSYMBOL_SECTION_PADDING = 90, /* SECTION_PADDING */ + YYSYMBOL_MESSAGE = 91, /* MESSAGE */ + YYSYMBOL_MESSAGE_COPY = 92, /* MESSAGE_COPY */ + YYSYMBOL_PADTO = 93, /* PADTO */ + YYSYMBOL_PADTOEVEN = 94, /* PADTOEVEN */ + YYSYMBOL_PADTOMULTIPLE = 95, /* PADTOMULTIPLE */ + YYSYMBOL_G1_HALF_BYTE = 96, /* G1_HALF_BYTE */ + YYSYMBOL_G1_MESSAGE_LENGTH = 97, /* G1_MESSAGE_LENGTH */ + YYSYMBOL_G1_SECTION4_LENGTH = 98, /* G1_SECTION4_LENGTH */ + YYSYMBOL_SECTION_LENGTH = 99, /* SECTION_LENGTH */ + YYSYMBOL_LENGTH = 100, /* LENGTH */ + YYSYMBOL_FLAG = 101, /* FLAG */ + YYSYMBOL_ITERATOR = 102, /* ITERATOR */ + YYSYMBOL_NEAREST = 103, /* NEAREST */ + YYSYMBOL_BOX = 104, /* BOX */ + YYSYMBOL_KSEC = 105, /* KSEC */ + YYSYMBOL_ASSERT = 106, /* ASSERT */ + YYSYMBOL_SUBSTR = 107, /* SUBSTR */ + YYSYMBOL_CASE = 108, /* CASE */ + YYSYMBOL_SWITCH = 109, /* SWITCH */ + YYSYMBOL_DEFAULT = 110, /* DEFAULT */ + YYSYMBOL_EQ = 111, /* EQ */ + YYSYMBOL_NE = 112, /* NE */ + YYSYMBOL_GE = 113, /* GE */ + YYSYMBOL_LE = 114, /* LE */ + YYSYMBOL_LT = 115, /* LT */ + YYSYMBOL_GT = 116, /* GT */ + YYSYMBOL_BIT = 117, /* BIT */ + YYSYMBOL_BITOFF = 118, /* BITOFF */ + YYSYMBOL_AND = 119, /* AND */ + YYSYMBOL_OR = 120, /* OR */ + YYSYMBOL_NOT = 121, /* NOT */ + YYSYMBOL_IS = 122, /* IS */ + YYSYMBOL_IDENT = 123, /* IDENT */ + YYSYMBOL_STRING = 124, /* STRING */ + YYSYMBOL_INTEGER = 125, /* INTEGER */ + YYSYMBOL_FLOAT = 126, /* FLOAT */ + YYSYMBOL_127_ = 127, /* ',' */ + YYSYMBOL_128_ = 128, /* ';' */ + YYSYMBOL_129_ = 129, /* '[' */ + YYSYMBOL_130_ = 130, /* ']' */ + YYSYMBOL_131_ = 131, /* '(' */ + YYSYMBOL_132_ = 132, /* ')' */ + YYSYMBOL_133_ = 133, /* '=' */ + YYSYMBOL_134_ = 134, /* '.' */ + YYSYMBOL_135_ = 135, /* '{' */ + YYSYMBOL_136_ = 136, /* '}' */ + YYSYMBOL_137_ = 137, /* ':' */ + YYSYMBOL_138_ = 138, /* '-' */ + YYSYMBOL_139_ = 139, /* '^' */ + YYSYMBOL_140_ = 140, /* '*' */ + YYSYMBOL_141_ = 141, /* '/' */ + YYSYMBOL_142_ = 142, /* '%' */ + YYSYMBOL_143_ = 143, /* '+' */ + YYSYMBOL_YYACCEPT = 144, /* $accept */ + YYSYMBOL_all = 145, /* all */ + YYSYMBOL_empty = 146, /* empty */ + YYSYMBOL_dvalues = 147, /* dvalues */ + YYSYMBOL_svalues = 148, /* svalues */ + YYSYMBOL_integer_array = 149, /* integer_array */ + YYSYMBOL_instructions = 150, /* instructions */ + YYSYMBOL_instruction = 151, /* instruction */ + YYSYMBOL_semi = 152, /* semi */ + YYSYMBOL_argument_list = 153, /* argument_list */ + YYSYMBOL_arguments = 154, /* arguments */ + YYSYMBOL_argument = 155, /* argument */ + YYSYMBOL_simple = 156, /* simple */ + YYSYMBOL_if_block = 157, /* if_block */ + YYSYMBOL_when_block = 158, /* when_block */ + YYSYMBOL_set = 159, /* set */ + YYSYMBOL_set_list = 160, /* set_list */ + YYSYMBOL_default = 161, /* default */ + YYSYMBOL_flags = 162, /* flags */ + YYSYMBOL_flag_list = 163, /* flag_list */ + YYSYMBOL_flag = 164, /* flag */ + YYSYMBOL_list_block = 165, /* list_block */ + YYSYMBOL_while_block = 166, /* while_block */ + YYSYMBOL_trigger_block = 167, /* trigger_block */ + YYSYMBOL_concept_block = 168, /* concept_block */ + YYSYMBOL_concept_list = 169, /* concept_list */ + YYSYMBOL_hash_array_list = 170, /* hash_array_list */ + YYSYMBOL_hash_array_block = 171, /* hash_array_block */ + YYSYMBOL_case_list = 172, /* case_list */ + YYSYMBOL_case_value = 173, /* case_value */ + YYSYMBOL_switch_block = 174, /* switch_block */ + YYSYMBOL_concept_value = 175, /* concept_value */ + YYSYMBOL_concept_conditions = 176, /* concept_conditions */ + YYSYMBOL_concept_condition = 177, /* concept_condition */ + YYSYMBOL_hash_array_value = 178, /* hash_array_value */ + YYSYMBOL_string_or_ident = 179, /* string_or_ident */ + YYSYMBOL_atom = 180, /* atom */ + YYSYMBOL_power = 181, /* power */ + YYSYMBOL_factor = 182, /* factor */ + YYSYMBOL_term = 183, /* term */ + YYSYMBOL_condition = 184, /* condition */ + YYSYMBOL_conjunction = 185, /* conjunction */ + YYSYMBOL_disjunction = 186, /* disjunction */ + YYSYMBOL_expression = 187, /* expression */ + YYSYMBOL_rule = 188, /* rule */ + YYSYMBOL_rule_entry = 189, /* rule_entry */ + YYSYMBOL_rule_entries = 190, /* rule_entries */ + YYSYMBOL_fact = 191, /* fact */ + YYSYMBOL_conditional_rule = 192, /* conditional_rule */ + YYSYMBOL_rules = 193 /* rules */ +}; +typedef enum grib_yysymbol_kind_t grib_yysymbol_kind_t; + @@ -469,6 +674,18 @@ typedef int_least16_t grib_yytype_int16; typedef short grib_yytype_int16; #endif +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ grib_yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ @@ -528,6 +745,7 @@ typedef int grib_yytype_uint16; #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + /* Stored state numbers (used for stacks). */ typedef grib_yytype_int16 grib_yy_state_t; @@ -546,6 +764,7 @@ typedef int grib_yy_state_fast_t; # endif #endif + #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -564,17 +783,23 @@ typedef int grib_yy_state_fast_t; /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about grib_yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -603,7 +828,7 @@ typedef int grib_yy_state_fast_t; #define YY_ASSERT(E) ((void) (0 && (E))) -#if ! defined grib_yyoverflow || YYERROR_VERBOSE +#if !defined grib_yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -668,8 +893,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined grib_yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined grib_yyoverflow */ #if (! defined grib_yyoverflow \ && (! defined __cplusplus \ @@ -745,14 +969,16 @@ union grib_yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 903 -#define YYUNDEFTOK 2 +/* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 381 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by grib_yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? grib_yytranslate[YYX] : YYUNDEFTOK) +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (grib_yysymbol_kind_t, grib_yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by grib_yylex. */ @@ -800,7 +1026,7 @@ static const grib_yytype_uint8 grib_yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const grib_yytype_int16 grib_yyrline[] = { 0, 262, 262, 264, 265, 266, 267, 269, 273, 276, @@ -833,27 +1059,34 @@ static const grib_yytype_int16 grib_yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (grib_yysymbol_kind_t, grib_yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *grib_yysymbol_name (grib_yysymbol_kind_t grib_yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const grib_yytname[] = { - "$end", "error", "$undefined", "LOWERCASE", "IF", "IF_TRANSIENT", - "ELSE", "END", "CLOSE", "UNSIGNED", "TEMPLATE", "TEMPLATE_NOFAIL", - "TRIGGER", "ASCII", "GROUP", "NON_ALPHA", "KSEC1EXPVER", "LABEL", "LIST", - "IS_IN_LIST", "IS_IN_DICT", "IS_INTEGER", "TO_INTEGER", "TO_STRING", - "SEX2DEC", "WHILE", "IBMFLOAT", "SIGNED", "UINT8", "INT8", "UINT16", - "INT16", "UINT16_LITTLE_ENDIAN", "INT16_LITTLE_ENDIAN", "UINT32", - "INT32", "UINT32_LITTLE_ENDIAN", "INT32_LITTLE_ENDIAN", "UINT64", - "INT64", "UINT64_LITTLE_ENDIAN", "INT64_LITTLE_ENDIAN", "BLOB", "BYTE", - "CODETABLE", "SMART_TABLE", "DICTIONARY", "COMPLEX_CODETABLE", "LOOKUP", - "ALIAS", "UNALIAS", "META", "POS", "INTCONST", "TRANS", "FLAGBIT", - "CONCEPT", "GETENV", "HASH_ARRAY", "CONCEPT_NOFAIL", "NIL", "DUMMY", - "MODIFY", "READ_ONLY", "STRING_TYPE", "LONG_TYPE", "DOUBLE_TYPE", - "NO_COPY", "DUMP", "JSON", "XML", "NO_FAIL", "EDITION_SPECIFIC", - "OVERRIDE", "HIDDEN", "CAN_BE_MISSING", "MISSING", "CONSTRAINT", - "COPY_OK", "WHEN", "SET", "SET_NOFAIL", "WRITE", "APPEND", "PRINT", - "EXPORT", "REMOVE", "RENAME", "SKIP", "PAD", "SECTION_PADDING", + "\"end of file\"", "error", "\"invalid token\"", "LOWERCASE", "IF", + "IF_TRANSIENT", "ELSE", "END", "CLOSE", "UNSIGNED", "TEMPLATE", + "TEMPLATE_NOFAIL", "TRIGGER", "ASCII", "GROUP", "NON_ALPHA", + "KSEC1EXPVER", "LABEL", "LIST", "IS_IN_LIST", "IS_IN_DICT", "IS_INTEGER", + "TO_INTEGER", "TO_STRING", "SEX2DEC", "WHILE", "IBMFLOAT", "SIGNED", + "UINT8", "INT8", "UINT16", "INT16", "UINT16_LITTLE_ENDIAN", + "INT16_LITTLE_ENDIAN", "UINT32", "INT32", "UINT32_LITTLE_ENDIAN", + "INT32_LITTLE_ENDIAN", "UINT64", "INT64", "UINT64_LITTLE_ENDIAN", + "INT64_LITTLE_ENDIAN", "BLOB", "BYTE", "CODETABLE", "SMART_TABLE", + "DICTIONARY", "COMPLEX_CODETABLE", "LOOKUP", "ALIAS", "UNALIAS", "META", + "POS", "INTCONST", "TRANS", "FLAGBIT", "CONCEPT", "GETENV", "HASH_ARRAY", + "CONCEPT_NOFAIL", "NIL", "DUMMY", "MODIFY", "READ_ONLY", "STRING_TYPE", + "LONG_TYPE", "DOUBLE_TYPE", "NO_COPY", "DUMP", "JSON", "XML", "NO_FAIL", + "EDITION_SPECIFIC", "OVERRIDE", "HIDDEN", "CAN_BE_MISSING", "MISSING", + "CONSTRAINT", "COPY_OK", "WHEN", "SET", "SET_NOFAIL", "WRITE", "APPEND", + "PRINT", "EXPORT", "REMOVE", "RENAME", "SKIP", "PAD", "SECTION_PADDING", "MESSAGE", "MESSAGE_COPY", "PADTO", "PADTOEVEN", "PADTOMULTIPLE", "G1_HALF_BYTE", "G1_MESSAGE_LENGTH", "G1_SECTION4_LENGTH", "SECTION_LENGTH", "LENGTH", "FLAG", "ITERATOR", "NEAREST", "BOX", "KSEC", @@ -872,30 +1105,13 @@ static const char *const grib_yytname[] = "condition", "conjunction", "disjunction", "expression", "rule", "rule_entry", "rule_entries", "fact", "conditional_rule", "rules", YY_NULLPTR }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const grib_yytype_int16 grib_yytoknum[] = +static const char * +grib_yysymbol_name (grib_yysymbol_kind_t grib_yysymbol) { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 44, 59, 91, - 93, 40, 41, 61, 46, 123, 125, 58, 45, 94, - 42, 47, 37, 43 -}; -# endif + return grib_yytname[grib_yysymbol]; +} +#endif #define YYPACT_NINF (-654) @@ -907,8 +1123,8 @@ static const grib_yytype_int16 grib_yytoknum[] = #define grib_yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const grib_yytype_int16 grib_yypact[] = { 1435, -654, -24, -10, 8, 65, -67, 115, 162, 147, @@ -1004,9 +1220,9 @@ static const grib_yytype_int16 grib_yypact[] = -654, -654, -654 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const grib_yytype_int16 grib_yydefact[] = { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1102,7 +1318,7 @@ static const grib_yytype_int16 grib_yydefact[] = 178, 180, 188 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const grib_yytype_int16 grib_yypgoto[] = { -654, -654, 5, 564, -654, -351, 0, -654, -653, 242, @@ -1112,19 +1328,19 @@ static const grib_yytype_int16 grib_yypgoto[] = -160, 691, -654, -96, -654, 14, 392, -654, -654, 913 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const grib_yytype_int16 grib_yydefgoto[] = { - -1, 80, 290, 545, 567, 503, 615, 83, 669, 176, + 0, 80, 290, 545, 567, 503, 615, 83, 669, 176, 177, 178, 84, 85, 86, 666, 667, 243, 291, 441, 442, 87, 88, 89, 90, 91, 92, 93, 685, 686, 94, 95, 505, 506, 96, 179, 180, 181, 182, 183, 184, 185, 186, 187, 97, 616, 617, 99, 100, 101 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const grib_yytype_int16 grib_yytable[] = { 82, 564, 224, 462, 508, 81, 231, 232, 305, 308, @@ -1513,8 +1729,8 @@ static const grib_yytype_int16 grib_yycheck[] = -1, -1, 126 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ static const grib_yytype_uint8 grib_yystos[] = { 0, 1, 4, 5, 8, 9, 10, 11, 12, 13, @@ -1610,7 +1826,7 @@ static const grib_yytype_uint8 grib_yystos[] = 162, 162, 162 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const grib_yytype_uint8 grib_yyr1[] = { 0, 144, 145, 145, 145, 145, 145, 145, 146, 147, @@ -1642,7 +1858,7 @@ static const grib_yytype_uint8 grib_yyr1[] = 189, 189, 190, 190, 191, 192, 193, 193 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const grib_yytype_int8 grib_yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 0, 1, @@ -1675,14 +1891,15 @@ static const grib_yytype_int8 grib_yyr2[] = }; +enum { YYENOMEM = -2 }; + #define grib_yyerrok (grib_yyerrstatus = 0) #define grib_yyclearin (grib_yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto grib_yyacceptlab #define YYABORT goto grib_yyabortlab #define YYERROR goto grib_yyerrorlab +#define YYNOMEM goto grib_yyexhaustedlab #define YYRECOVERING() (!!grib_yyerrstatus) @@ -1704,10 +1921,9 @@ static const grib_yytype_int8 grib_yyr2[] = } \ while (0) -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -1724,19 +1940,16 @@ do { \ YYFPRINTF Args; \ } while (0) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (grib_yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ grib_yy_symbol_print (stderr, \ - Type, Value); \ + Kind, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -1747,18 +1960,15 @@ do { \ `-----------------------------------*/ static void -grib_yy_symbol_value_print (FILE *grib_yyo, int grib_yytype, YYSTYPE const * const grib_yyvaluep) +grib_yy_symbol_value_print (FILE *grib_yyo, + grib_yysymbol_kind_t grib_yykind, YYSTYPE const * const grib_yyvaluep) { FILE *grib_yyoutput = grib_yyo; - YYUSE (grib_yyoutput); + YY_USE (grib_yyoutput); if (!grib_yyvaluep) return; -# ifdef YYPRINT - if (grib_yytype < YYNTOKENS) - YYPRINT (grib_yyo, grib_yytoknum[grib_yytype], *grib_yyvaluep); -# endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (grib_yytype); + YY_USE (grib_yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1768,12 +1978,13 @@ grib_yy_symbol_value_print (FILE *grib_yyo, int grib_yytype, YYSTYPE const * con `---------------------------*/ static void -grib_yy_symbol_print (FILE *grib_yyo, int grib_yytype, YYSTYPE const * const grib_yyvaluep) +grib_yy_symbol_print (FILE *grib_yyo, + grib_yysymbol_kind_t grib_yykind, YYSTYPE const * const grib_yyvaluep) { YYFPRINTF (grib_yyo, "%s %s (", - grib_yytype < YYNTOKENS ? "token" : "nterm", grib_yytname[grib_yytype]); + grib_yykind < YYNTOKENS ? "token" : "nterm", grib_yysymbol_name (grib_yykind)); - grib_yy_symbol_value_print (grib_yyo, grib_yytype, grib_yyvaluep); + grib_yy_symbol_value_print (grib_yyo, grib_yykind, grib_yyvaluep); YYFPRINTF (grib_yyo, ")"); } @@ -1806,7 +2017,8 @@ do { \ `------------------------------------------------*/ static void -grib_yy_reduce_print (grib_yy_state_t *grib_yyssp, YYSTYPE *grib_yyvsp, int grib_yyrule) +grib_yy_reduce_print (grib_yy_state_t *grib_yyssp, YYSTYPE *grib_yyvsp, + int grib_yyrule) { int grib_yylno = grib_yyrline[grib_yyrule]; int grib_yynrhs = grib_yyr2[grib_yyrule]; @@ -1818,9 +2030,8 @@ grib_yy_reduce_print (grib_yy_state_t *grib_yyssp, YYSTYPE *grib_yyvsp, int grib { YYFPRINTF (stderr, " $%d = ", grib_yyi + 1); grib_yy_symbol_print (stderr, - grib_yystos[+grib_yyssp[grib_yyi + 1 - grib_yynrhs]], - &grib_yyvsp[(grib_yyi + 1) - (grib_yynrhs)] - ); + YY_ACCESSING_SYMBOL (+grib_yyssp[grib_yyi + 1 - grib_yynrhs]), + &grib_yyvsp[(grib_yyi + 1) - (grib_yynrhs)]); YYFPRINTF (stderr, "\n"); } } @@ -1835,8 +2046,8 @@ do { \ multiple parsers can coexist. */ int grib_yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1859,259 +2070,30 @@ int grib_yydebug; #endif -#if YYERROR_VERBOSE -# ifndef grib_yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define grib_yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else -/* Return the length of YYSTR. */ -static YYPTRDIFF_T -grib_yystrlen (const char *grib_yystr) -{ - YYPTRDIFF_T grib_yylen; - for (grib_yylen = 0; grib_yystr[grib_yylen]; grib_yylen++) - continue; - return grib_yylen; -} -# endif -# endif -# ifndef grib_yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define grib_yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -grib_yystpcpy (char *grib_yydest, const char *grib_yysrc) -{ - char *grib_yyd = grib_yydest; - const char *grib_yys = grib_yysrc; - while ((*grib_yyd++ = *grib_yys++) != '\0') - continue; - - return grib_yyd - 1; -} -# endif -# endif - -# ifndef grib_yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for grib_yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from grib_yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYPTRDIFF_T -grib_yytnamerr (char *grib_yyres, const char *grib_yystr) -{ - if (*grib_yystr == '"') - { - YYPTRDIFF_T grib_yyn = 0; - char const *grib_yyp = grib_yystr; - - for (;;) - switch (*++grib_yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++grib_yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (grib_yyres) - grib_yyres[grib_yyn] = *grib_yyp; - grib_yyn++; - break; - - case '"': - if (grib_yyres) - grib_yyres[grib_yyn] = '\0'; - return grib_yyn; - } - do_not_strip_quotes: ; - } - - if (grib_yyres) - return grib_yystpcpy (grib_yyres, grib_yystr) - grib_yyres; - else - return grib_yystrlen (grib_yystr); -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -grib_yysyntax_error (YYPTRDIFF_T *grib_yymsg_alloc, char **grib_yymsg, - grib_yy_state_t *grib_yyssp, int grib_yytoken) -{ - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *grib_yyformat = YY_NULLPTR; - /* Arguments of grib_yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - char const *grib_yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Actual size of YYARG. */ - int grib_yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T grib_yysize = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in grib_yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated grib_yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (grib_yytoken != YYEMPTY) - { - int grib_yyn = grib_yypact[+*grib_yyssp]; - YYPTRDIFF_T grib_yysize0 = grib_yytnamerr (YY_NULLPTR, grib_yytname[grib_yytoken]); - grib_yysize = grib_yysize0; - grib_yyarg[grib_yycount++] = grib_yytname[grib_yytoken]; - if (!grib_yypact_value_is_default (grib_yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int grib_yyxbegin = grib_yyn < 0 ? -grib_yyn : 0; - /* Stay within bounds of both grib_yycheck and grib_yytname. */ - int grib_yychecklim = YYLAST - grib_yyn + 1; - int grib_yyxend = grib_yychecklim < YYNTOKENS ? grib_yychecklim : YYNTOKENS; - int grib_yyx; - - for (grib_yyx = grib_yyxbegin; grib_yyx < grib_yyxend; ++grib_yyx) - if (grib_yycheck[grib_yyx + grib_yyn] == grib_yyx && grib_yyx != YYTERROR - && !grib_yytable_value_is_error (grib_yytable[grib_yyx + grib_yyn])) - { - if (grib_yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - grib_yycount = 1; - grib_yysize = grib_yysize0; - break; - } - grib_yyarg[grib_yycount++] = grib_yytname[grib_yyx]; - { - YYPTRDIFF_T grib_yysize1 - = grib_yysize + grib_yytnamerr (YY_NULLPTR, grib_yytname[grib_yyx]); - if (grib_yysize <= grib_yysize1 && grib_yysize1 <= YYSTACK_ALLOC_MAXIMUM) - grib_yysize = grib_yysize1; - else - return 2; - } - } - } - } - - switch (grib_yycount) - { -# define YYCASE_(N, S) \ - case N: \ - grib_yyformat = S; \ - break - default: /* Avoid compiler warnings. */ - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T grib_yysize1 = grib_yysize + (grib_yystrlen (grib_yyformat) - 2 * grib_yycount) + 1; - if (grib_yysize <= grib_yysize1 && grib_yysize1 <= YYSTACK_ALLOC_MAXIMUM) - grib_yysize = grib_yysize1; - else - return 2; - } - - if (*grib_yymsg_alloc < grib_yysize) - { - *grib_yymsg_alloc = 2 * grib_yysize; - if (! (grib_yysize <= *grib_yymsg_alloc - && *grib_yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *grib_yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid snprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *grib_yyp = *grib_yymsg; - int grib_yyi = 0; - while ((*grib_yyp = *grib_yyformat) != '\0') - if (*grib_yyp == '%' && grib_yyformat[1] == 's' && grib_yyi < grib_yycount) - { - grib_yyp += grib_yytnamerr (grib_yyp, grib_yyarg[grib_yyi++]); - grib_yyformat += 2; - } - else - { - ++grib_yyp; - ++grib_yyformat; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -grib_yydestruct (const char *grib_yymsg, int grib_yytype, YYSTYPE *grib_yyvaluep) +grib_yydestruct (const char *grib_yymsg, + grib_yysymbol_kind_t grib_yykind, YYSTYPE *grib_yyvaluep) { - YYUSE (grib_yyvaluep); + YY_USE (grib_yyvaluep); if (!grib_yymsg) grib_yymsg = "Deleting"; - YY_SYMBOL_PRINT (grib_yymsg, grib_yytype, grib_yyvaluep, grib_yylocationp); + YY_SYMBOL_PRINT (grib_yymsg, grib_yykind, grib_yyvaluep, grib_yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (grib_yytype); + YY_USE (grib_yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } - - -/* The lookahead symbol. */ +/* Lookahead token kind. */ int grib_yychar; /* The semantic value of the lookahead symbol. */ @@ -2120,6 +2102,8 @@ YYSTYPE grib_yylval; int grib_yynerrs; + + /*----------. | grib_yyparse. | `----------*/ @@ -2127,43 +2111,36 @@ int grib_yynerrs; int grib_yyparse (void) { - grib_yy_state_fast_t grib_yystate; + grib_yy_state_fast_t grib_yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int grib_yyerrstatus; + int grib_yyerrstatus = 0; - /* The stacks and their tools: - 'grib_yyss': related to states. - 'grib_yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow grib_yyoverflow + /* Refer to the stacks through separate pointers, to allow grib_yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ + /* Their size. */ + YYPTRDIFF_T grib_yystacksize = YYINITDEPTH; + + /* The state stack: array, bottom, top. */ grib_yy_state_t grib_yyssa[YYINITDEPTH]; - grib_yy_state_t *grib_yyss; - grib_yy_state_t *grib_yyssp; + grib_yy_state_t *grib_yyss = grib_yyssa; + grib_yy_state_t *grib_yyssp = grib_yyss; - /* The semantic value stack. */ + /* The semantic value stack: array, bottom, top. */ YYSTYPE grib_yyvsa[YYINITDEPTH]; - YYSTYPE *grib_yyvs; - YYSTYPE *grib_yyvsp; - - YYPTRDIFF_T grib_yystacksize; + YYSTYPE *grib_yyvs = grib_yyvsa; + YYSTYPE *grib_yyvsp = grib_yyvs; int grib_yyn; + /* The return value of grib_yyparse. */ int grib_yyresult; - /* Lookahead token as an internal (translated) token number. */ - int grib_yytoken = 0; + /* Lookahead symbol kind. */ + grib_yysymbol_kind_t grib_yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE grib_yyval; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char grib_yymsgbuf[128]; - char *grib_yymsg = grib_yymsgbuf; - YYPTRDIFF_T grib_yymsg_alloc = sizeof grib_yymsgbuf; -#endif + #define YYPOPSTACK(N) (grib_yyvsp -= (N), grib_yyssp -= (N)) @@ -2171,16 +2148,10 @@ grib_yyparse (void) Keep to zero when no symbol should be popped. */ int grib_yylen = 0; - grib_yyssp = grib_yyss = grib_yyssa; - grib_yyvsp = grib_yyvs = grib_yyvsa; - grib_yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); - grib_yystate = 0; - grib_yyerrstatus = 0; - grib_yynerrs = 0; grib_yychar = YYEMPTY; /* Cause a token to be read. */ + goto grib_yysetstate; @@ -2202,10 +2173,11 @@ grib_yysetstate: YY_IGNORE_USELESS_CAST_BEGIN *grib_yyssp = YY_CAST (grib_yy_state_t, grib_yystate); YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (grib_yyss, grib_yyssp); if (grib_yyss + grib_yystacksize - 1 <= grib_yyssp) #if !defined grib_yyoverflow && !defined YYSTACK_RELOCATE - goto grib_yyexhaustedlab; + YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ @@ -2233,7 +2205,7 @@ grib_yysetstate: # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= grib_yystacksize) - goto grib_yyexhaustedlab; + YYNOMEM; grib_yystacksize *= 2; if (YYMAXDEPTH < grib_yystacksize) grib_yystacksize = YYMAXDEPTH; @@ -2244,10 +2216,10 @@ grib_yysetstate: YY_CAST (union grib_yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (grib_yystacksize)))); if (! grib_yyptr) - goto grib_yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (grib_yyss_alloc, grib_yyss); YYSTACK_RELOCATE (grib_yyvs_alloc, grib_yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (grib_yyss1 != grib_yyssa) YYSTACK_FREE (grib_yyss1); } @@ -2266,6 +2238,7 @@ grib_yysetstate: } #endif /* !defined grib_yyoverflow && !defined YYSTACK_RELOCATE */ + if (grib_yystate == YYFINAL) YYACCEPT; @@ -2286,18 +2259,29 @@ grib_yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (grib_yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); grib_yychar = grib_yylex (); } if (grib_yychar <= YYEOF) { - grib_yychar = grib_yytoken = YYEOF; + grib_yychar = YYEOF; + grib_yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (grib_yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + grib_yychar = YYUNDEF; + grib_yytoken = YYSYMBOL_YYerror; + goto grib_yyerrlab1; + } else { grib_yytoken = YYTRANSLATE (grib_yychar); @@ -2366,249 +2350,249 @@ grib_yyreduce: YY_REDUCE_PRINT (grib_yyn); switch (grib_yyn) { - case 2: + case 2: /* all: empty */ #line 262 "griby.y" { grib_parser_all_actions = 0;grib_parser_concept=0; grib_parser_hash_array=0;grib_parser_rules=0; } -#line 2374 "y.tab.c" +#line 2358 "y.tab.c" break; - case 3: + case 3: /* all: concept_list */ #line 264 "griby.y" { grib_parser_concept = reverse_concept((grib_yyvsp[0].concept_value)); } -#line 2380 "y.tab.c" +#line 2364 "y.tab.c" break; - case 4: + case 4: /* all: hash_array_list */ #line 265 "griby.y" { grib_parser_hash_array = reverse_hash_array((grib_yyvsp[0].hash_array_value)); } -#line 2386 "y.tab.c" +#line 2370 "y.tab.c" break; - case 5: + case 5: /* all: instructions */ #line 266 "griby.y" { grib_parser_all_actions = (grib_yyvsp[0].act); } -#line 2392 "y.tab.c" +#line 2376 "y.tab.c" break; - case 6: + case 6: /* all: rules */ #line 267 "griby.y" { grib_parser_rules = (grib_yyvsp[0].rules); } -#line 2398 "y.tab.c" +#line 2382 "y.tab.c" break; - case 7: + case 7: /* all: error */ #line 269 "griby.y" { grib_parser_all_actions = 0; grib_parser_concept=0; grib_parser_hash_array=0; grib_parser_rules=0; } -#line 2405 "y.tab.c" +#line 2389 "y.tab.c" break; - case 9: + case 9: /* dvalues: FLOAT */ #line 276 "griby.y" { (grib_yyval.dvalue)=grib_darray_push(grib_parser_context,0,(grib_yyvsp[0].dval));} -#line 2411 "y.tab.c" +#line 2395 "y.tab.c" break; - case 10: + case 10: /* dvalues: dvalues ',' FLOAT */ #line 277 "griby.y" { (grib_yyval.dvalue)=grib_darray_push(grib_parser_context,(grib_yyvsp[-2].dvalue),(grib_yyvsp[0].dval));} -#line 2417 "y.tab.c" +#line 2401 "y.tab.c" break; - case 11: + case 11: /* dvalues: INTEGER */ #line 278 "griby.y" { (grib_yyval.dvalue)=grib_darray_push(grib_parser_context,0,(grib_yyvsp[0].lval));} -#line 2423 "y.tab.c" +#line 2407 "y.tab.c" break; - case 12: + case 12: /* dvalues: dvalues ',' INTEGER */ #line 279 "griby.y" { (grib_yyval.dvalue)=grib_darray_push(grib_parser_context,(grib_yyvsp[-2].dvalue),(grib_yyvsp[0].lval));} -#line 2429 "y.tab.c" +#line 2413 "y.tab.c" break; - case 13: + case 13: /* svalues: STRING */ #line 282 "griby.y" { (grib_yyval.svalue)=grib_sarray_push(grib_parser_context,0,(grib_yyvsp[0].str));} -#line 2435 "y.tab.c" +#line 2419 "y.tab.c" break; - case 14: + case 14: /* svalues: svalues ',' STRING */ #line 283 "griby.y" { (grib_yyval.svalue)=grib_sarray_push(grib_parser_context,(grib_yyvsp[-2].svalue),(grib_yyvsp[0].str));} -#line 2441 "y.tab.c" +#line 2425 "y.tab.c" break; - case 15: + case 15: /* integer_array: INTEGER */ #line 287 "griby.y" { (grib_yyval.ivalue)=grib_iarray_push(0,(grib_yyvsp[0].lval));} -#line 2447 "y.tab.c" +#line 2431 "y.tab.c" break; - case 16: + case 16: /* integer_array: integer_array ',' INTEGER */ #line 288 "griby.y" { (grib_yyval.ivalue)=grib_iarray_push((grib_yyvsp[-2].ivalue),(grib_yyvsp[0].lval));} -#line 2453 "y.tab.c" +#line 2437 "y.tab.c" break; - case 18: + case 18: /* instructions: instruction instructions */ #line 292 "griby.y" { (grib_yyvsp[-1].act)->next = (grib_yyvsp[0].act); (grib_yyval.act) = (grib_yyvsp[-1].act); } -#line 2459 "y.tab.c" +#line 2443 "y.tab.c" break; - case 19: + case 19: /* instructions: instruction ';' instructions */ #line 293 "griby.y" { (grib_yyvsp[-2].act)->next = (grib_yyvsp[0].act); (grib_yyval.act) = (grib_yyvsp[-2].act); } -#line 2465 "y.tab.c" +#line 2449 "y.tab.c" break; - case 20: + case 20: /* instructions: instruction ';' */ #line 294 "griby.y" { (grib_yyval.act) = (grib_yyvsp[-1].act);} -#line 2471 "y.tab.c" +#line 2455 "y.tab.c" break; - case 32: + case 32: /* argument_list: empty */ #line 313 "griby.y" { (grib_yyval.explist) = 0; } -#line 2477 "y.tab.c" +#line 2461 "y.tab.c" break; - case 35: + case 35: /* arguments: argument ',' arguments */ #line 318 "griby.y" { (grib_yyvsp[-2].explist)->next = (grib_yyvsp[0].explist); (grib_yyval.explist) = (grib_yyvsp[-2].explist); } -#line 2483 "y.tab.c" +#line 2467 "y.tab.c" break; - case 36: + case 36: /* argument: expression */ #line 321 "griby.y" { (grib_yyval.explist) = grib_arguments_new(grib_parser_context,(grib_yyvsp[0].exp),NULL); } -#line 2489 "y.tab.c" +#line 2473 "y.tab.c" break; - case 37: + case 37: /* simple: UNSIGNED '[' INTEGER ']' IDENT default flags */ #line 326 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"unsigned",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2495 "y.tab.c" +#line 2479 "y.tab.c" break; - case 38: + case 38: /* simple: UNSIGNED '[' INTEGER ']' IDENT '[' argument_list ']' default flags */ #line 329 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"unsigned",(grib_yyvsp[-7].lval),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2501 "y.tab.c" +#line 2485 "y.tab.c" break; - case 39: + case 39: /* simple: UNSIGNED '(' INTEGER ')' IDENT default flags */ #line 332 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"unsigned_bits",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2507 "y.tab.c" +#line 2491 "y.tab.c" break; - case 40: + case 40: /* simple: UNSIGNED '(' INTEGER ')' IDENT '[' argument_list ']' default flags */ #line 335 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"unsigned_bits",(grib_yyvsp[-7].lval),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2513 "y.tab.c" +#line 2497 "y.tab.c" break; - case 41: + case 41: /* simple: ASCII '[' INTEGER ']' IDENT default flags */ #line 338 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ascii",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2519 "y.tab.c" +#line 2503 "y.tab.c" break; - case 42: + case 42: /* simple: GROUP IDENT default flags */ #line 341 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"group",0,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2525 "y.tab.c" +#line 2509 "y.tab.c" break; - case 43: + case 43: /* simple: GROUP IDENT '(' argument_list ')' default flags */ #line 344 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"group",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2531 "y.tab.c" +#line 2515 "y.tab.c" break; - case 44: + case 44: /* simple: IDENT '=' TO_INTEGER '(' argument_list ')' flags */ #line 347 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-6].str),"to_integer",0,(grib_yyvsp[-2].explist),0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-6].str)); } -#line 2537 "y.tab.c" +#line 2521 "y.tab.c" break; - case 45: + case 45: /* simple: IDENT '=' SEX2DEC '(' argument_list ')' flags */ #line 350 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-6].str),"sexagesimal2decimal",0,(grib_yyvsp[-2].explist),0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-6].str)); } -#line 2543 "y.tab.c" +#line 2527 "y.tab.c" break; - case 46: + case 46: /* simple: IDENT '=' TO_STRING '(' argument_list ')' flags */ #line 353 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-6].str),"to_string",0,(grib_yyvsp[-2].explist),0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-6].str)); } -#line 2549 "y.tab.c" +#line 2533 "y.tab.c" break; - case 47: + case 47: /* simple: NON_ALPHA IDENT default flags */ #line 356 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"non_alpha",0,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2555 "y.tab.c" +#line 2539 "y.tab.c" break; - case 48: + case 48: /* simple: ASCII '[' INTEGER ']' STRING default flags */ #line 360 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ascii",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2561 "y.tab.c" +#line 2545 "y.tab.c" break; - case 49: + case 49: /* simple: BYTE '[' INTEGER ']' IDENT default flags */ #line 363 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"bytes",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2567 "y.tab.c" +#line 2551 "y.tab.c" break; - case 50: + case 50: /* simple: BYTE '[' INTEGER ']' IDENT '[' argument_list ']' default flags */ #line 366 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"bytes",(grib_yyvsp[-7].lval),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2573 "y.tab.c" +#line 2557 "y.tab.c" break; - case 51: + case 51: /* simple: KSEC1EXPVER '[' INTEGER ']' IDENT default flags */ #line 369 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ksec1expver",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2579 "y.tab.c" +#line 2563 "y.tab.c" break; - case 52: + case 52: /* simple: SIGNED '[' INTEGER ']' IDENT default flags */ #line 372 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"signed",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2585 "y.tab.c" +#line 2569 "y.tab.c" break; - case 53: + case 53: /* simple: SIGNED '[' INTEGER ']' IDENT '[' argument_list ']' default flags */ #line 375 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"signed",(grib_yyvsp[-7].lval),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2591 "y.tab.c" +#line 2575 "y.tab.c" break; - case 54: + case 54: /* simple: SIGNED '(' INTEGER ')' IDENT default flags */ #line 378 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"signed_bits",(grib_yyvsp[-4].lval),NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2597 "y.tab.c" +#line 2581 "y.tab.c" break; - case 55: + case 55: /* simple: SIGNED '(' INTEGER ')' IDENT '[' argument_list ']' default flags */ #line 381 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"signed_bits",(grib_yyvsp[-7].lval),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2603 "y.tab.c" +#line 2587 "y.tab.c" break; - case 56: + case 56: /* simple: CODETABLE '[' INTEGER ']' IDENT argument default flags */ #line 384 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"codetable",(grib_yyvsp[-5].lval), (grib_yyvsp[-2].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2609 "y.tab.c" +#line 2593 "y.tab.c" break; - case 57: + case 57: /* simple: CODETABLE '[' IDENT ']' IDENT argument default flags */ #line 387 "griby.y" { /* ECC-485: Set length to 0 and prepend the new argument */ @@ -2619,357 +2603,357 @@ grib_yyreduce: (grib_yyvsp[-1].explist), (grib_yyvsp[0].lval), NULL, NULL); free((grib_yyvsp[-3].str)); } -#line 2623 "y.tab.c" +#line 2607 "y.tab.c" break; - case 58: + case 58: /* simple: CODETABLE '[' INTEGER ']' IDENT argument default SET '(' IDENT ')' flags */ #line 398 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-7].str),"codetable",(grib_yyvsp[-9].lval), (grib_yyvsp[-6].explist),(grib_yyvsp[-5].explist),(grib_yyvsp[0].lval),NULL,(grib_yyvsp[-2].str)); free((grib_yyvsp[-7].str));free((grib_yyvsp[-2].str)); } -#line 2630 "y.tab.c" +#line 2614 "y.tab.c" break; - case 59: + case 59: /* simple: CODETABLE '[' INTEGER ']' IDENT '(' argument_list ')' default flags */ #line 402 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"codetable",(grib_yyvsp[-7].lval), (grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2636 "y.tab.c" +#line 2620 "y.tab.c" break; - case 60: + case 60: /* simple: SMART_TABLE IDENT '(' argument_list ')' default flags */ #line 405 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"smart_table",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2642 "y.tab.c" +#line 2626 "y.tab.c" break; - case 61: + case 61: /* simple: IDENT '=' DICTIONARY '(' argument_list ')' default flags */ #line 408 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-7].str),"dictionary",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-7].str)); } -#line 2648 "y.tab.c" +#line 2632 "y.tab.c" break; - case 62: + case 62: /* simple: IDENT '=' GETENV '(' argument_list ')' default flags */ #line 411 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-7].str),"getenv",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-7].str)); } -#line 2654 "y.tab.c" +#line 2638 "y.tab.c" break; - case 63: + case 63: /* simple: COMPLEX_CODETABLE '[' INTEGER ']' IDENT argument default flags */ #line 414 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"complex_codetable",(grib_yyvsp[-5].lval), (grib_yyvsp[-2].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2660 "y.tab.c" +#line 2644 "y.tab.c" break; - case 64: + case 64: /* simple: COMPLEX_CODETABLE '[' INTEGER ']' IDENT '(' argument_list ')' default flags */ #line 417 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"complex_codetable",(grib_yyvsp[-7].lval), (grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2666 "y.tab.c" +#line 2650 "y.tab.c" break; - case 65: + case 65: /* simple: FLAG '[' INTEGER ']' IDENT argument default flags */ #line 420 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"codeflag",(grib_yyvsp[-5].lval), (grib_yyvsp[-2].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2672 "y.tab.c" +#line 2656 "y.tab.c" break; - case 66: + case 66: /* simple: LOOKUP '[' INTEGER ']' IDENT '(' argument_list ')' flags */ #line 423 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-4].str),"lookup",(grib_yyvsp[-6].lval),(grib_yyvsp[-2].explist),NULL,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-4].str)); } -#line 2678 "y.tab.c" +#line 2662 "y.tab.c" break; - case 67: + case 67: /* simple: FLAGBIT IDENT '(' argument_list ')' default flags */ #line 426 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"bit",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2684 "y.tab.c" +#line 2668 "y.tab.c" break; - case 68: + case 68: /* simple: LABEL IDENT */ #line 429 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[0].str),"label",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[0].str)); } -#line 2690 "y.tab.c" +#line 2674 "y.tab.c" break; - case 69: + case 69: /* simple: LABEL STRING */ #line 432 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[0].str),"label",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[0].str)); } -#line 2696 "y.tab.c" +#line 2680 "y.tab.c" break; - case 70: + case 70: /* simple: IBMFLOAT IDENT default flags */ #line 435 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ibmfloat",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2702 "y.tab.c" +#line 2686 "y.tab.c" break; - case 71: + case 71: /* simple: INT8 IDENT default flags */ #line 439 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int8",1,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2708 "y.tab.c" +#line 2692 "y.tab.c" break; - case 72: + case 72: /* simple: UINT8 IDENT default flags */ #line 442 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint8",1,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2714 "y.tab.c" +#line 2698 "y.tab.c" break; - case 73: + case 73: /* simple: INT16 IDENT default flags */ #line 445 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int16",2,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2720 "y.tab.c" +#line 2704 "y.tab.c" break; - case 74: + case 74: /* simple: UINT16 IDENT default flags */ #line 448 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint16",2,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2726 "y.tab.c" +#line 2710 "y.tab.c" break; - case 75: + case 75: /* simple: INT16_LITTLE_ENDIAN IDENT default flags */ #line 451 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int16_little_endian",2,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2732 "y.tab.c" +#line 2716 "y.tab.c" break; - case 76: + case 76: /* simple: UINT16_LITTLE_ENDIAN IDENT default flags */ #line 454 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint16_little_endian",2,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2738 "y.tab.c" +#line 2722 "y.tab.c" break; - case 77: + case 77: /* simple: INT32 IDENT default flags */ #line 457 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int32",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2744 "y.tab.c" +#line 2728 "y.tab.c" break; - case 78: + case 78: /* simple: UINT32 IDENT default flags */ #line 460 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint32",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2750 "y.tab.c" +#line 2734 "y.tab.c" break; - case 79: + case 79: /* simple: INT32_LITTLE_ENDIAN IDENT default flags */ #line 463 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int32_little_endian",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2756 "y.tab.c" +#line 2740 "y.tab.c" break; - case 80: + case 80: /* simple: UINT32_LITTLE_ENDIAN IDENT default flags */ #line 466 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint32_little_endian",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2762 "y.tab.c" +#line 2746 "y.tab.c" break; - case 81: + case 81: /* simple: INT64 IDENT default flags */ #line 469 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int64",8,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2768 "y.tab.c" +#line 2752 "y.tab.c" break; - case 82: + case 82: /* simple: UINT64 IDENT default flags */ #line 472 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint64",8,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2774 "y.tab.c" +#line 2758 "y.tab.c" break; - case 83: + case 83: /* simple: INT64_LITTLE_ENDIAN IDENT default flags */ #line 475 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"int64_little_endian",8,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2780 "y.tab.c" +#line 2764 "y.tab.c" break; - case 84: + case 84: /* simple: UINT64_LITTLE_ENDIAN IDENT default flags */ #line 478 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"uint64_little_endian",8,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-2].str)); } -#line 2786 "y.tab.c" +#line 2770 "y.tab.c" break; - case 85: + case 85: /* simple: BLOB IDENT '[' argument_list ']' default flags */ #line 481 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"blob",0,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-5].str)); } -#line 2792 "y.tab.c" +#line 2776 "y.tab.c" break; - case 86: + case 86: /* simple: IBMFLOAT IDENT '.' IDENT default flags */ #line 485 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ibmfloat",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),(grib_yyvsp[-4].str),NULL);free((grib_yyvsp[-2].str)); free((grib_yyvsp[-4].str)); } -#line 2798 "y.tab.c" +#line 2782 "y.tab.c" break; - case 87: + case 87: /* simple: IBMFLOAT IDENT '[' argument ']' default flags */ #line 488 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"ibmfloat",4,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-5].str)); } -#line 2804 "y.tab.c" +#line 2788 "y.tab.c" break; - case 88: + case 88: /* simple: POS IDENT */ #line 491 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[0].str),"position",0,NULL,NULL,0,NULL,NULL); free((grib_yyvsp[0].str)); } -#line 2810 "y.tab.c" +#line 2794 "y.tab.c" break; - case 89: + case 89: /* simple: INTCONST IDENT '=' argument flags */ #line 494 "griby.y" { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[-3].str),"constant",0,(grib_yyvsp[-1].explist),NULL,(grib_yyvsp[0].lval),NULL);free((grib_yyvsp[-3].str)); } -#line 2816 "y.tab.c" +#line 2800 "y.tab.c" break; - case 90: + case 90: /* simple: TRANS IDENT '=' argument flags */ #line 497 "griby.y" { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[-3].str),"transient",0,(grib_yyvsp[-1].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL); free((grib_yyvsp[-3].str)); } -#line 2822 "y.tab.c" +#line 2806 "y.tab.c" break; - case 91: + case 91: /* simple: TRANS IDENT '=' '{' dvalues '}' flags */ #line 499 "griby.y" { (grib_yyval.act) = grib_action_create_transient_darray(grib_parser_context,(grib_yyvsp[-5].str),(grib_yyvsp[-2].dvalue),(grib_yyvsp[0].lval)); free((grib_yyvsp[-5].str)); } -#line 2828 "y.tab.c" +#line 2812 "y.tab.c" break; - case 92: + case 92: /* simple: FLOAT IDENT default flags */ #line 502 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ieeefloat",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-2].str)); } -#line 2834 "y.tab.c" +#line 2818 "y.tab.c" break; - case 93: + case 93: /* simple: FLOAT IDENT '.' IDENT default flags */ #line 505 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-2].str),"ieeefloat",4,NULL,(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),(grib_yyvsp[-4].str),NULL); free((grib_yyvsp[-2].str));free((grib_yyvsp[-4].str));} -#line 2840 "y.tab.c" +#line 2824 "y.tab.c" break; - case 94: + case 94: /* simple: FLOAT IDENT '[' argument ']' default flags */ #line 508 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-5].str),"ieeefloat",4,(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL,NULL);free((grib_yyvsp[-5].str)); } -#line 2846 "y.tab.c" +#line 2830 "y.tab.c" break; - case 95: + case 95: /* simple: G1_HALF_BYTE IDENT */ #line 511 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[0].str),"g1_half_byte_codeflag",0,NULL,NULL,0,NULL,NULL);free((grib_yyvsp[0].str)); } -#line 2852 "y.tab.c" +#line 2836 "y.tab.c" break; - case 96: + case 96: /* simple: SECTION_LENGTH '[' INTEGER ']' IDENT default */ #line 514 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-1].str),"section_length",(grib_yyvsp[-3].lval),NULL,(grib_yyvsp[0].explist),0,NULL,NULL);free((grib_yyvsp[-1].str)); } -#line 2858 "y.tab.c" +#line 2842 "y.tab.c" break; - case 97: + case 97: /* simple: G1_MESSAGE_LENGTH '[' INTEGER ']' IDENT '(' argument_list ')' */ #line 517 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"g1_message_length",(grib_yyvsp[-5].lval),(grib_yyvsp[-1].explist),NULL,0,NULL,NULL);free((grib_yyvsp[-3].str)); } -#line 2864 "y.tab.c" +#line 2848 "y.tab.c" break; - case 98: + case 98: /* simple: G1_SECTION4_LENGTH '[' INTEGER ']' IDENT '(' argument_list ')' */ #line 520 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"g1_section4_length",(grib_yyvsp[-5].lval),(grib_yyvsp[-1].explist),NULL,0,NULL,NULL);free((grib_yyvsp[-3].str)); } -#line 2870 "y.tab.c" +#line 2854 "y.tab.c" break; - case 99: + case 99: /* simple: KSEC IDENT argument */ #line 523 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-1].str),"ksec",0,(grib_yyvsp[0].explist),NULL,0,NULL,NULL);free((grib_yyvsp[-1].str)); } -#line 2876 "y.tab.c" +#line 2860 "y.tab.c" break; - case 100: + case 100: /* simple: PAD IDENT '(' argument_list ')' */ #line 526 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"pad",0,(grib_yyvsp[-1].explist),0,0,NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2882 "y.tab.c" +#line 2866 "y.tab.c" break; - case 101: + case 101: /* simple: PADTO IDENT '(' argument_list ')' */ #line 529 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"padto",0,(grib_yyvsp[-1].explist),0,0,NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2888 "y.tab.c" +#line 2872 "y.tab.c" break; - case 102: + case 102: /* simple: PADTOEVEN IDENT '(' argument_list ')' */ #line 532 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"padtoeven",0,(grib_yyvsp[-1].explist),0,0,NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2894 "y.tab.c" +#line 2878 "y.tab.c" break; - case 103: + case 103: /* simple: PADTOMULTIPLE IDENT '(' argument_list ')' */ #line 535 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-3].str),"padtomultiple",0,(grib_yyvsp[-1].explist),0,0,NULL,NULL); free((grib_yyvsp[-3].str)); } -#line 2900 "y.tab.c" +#line 2884 "y.tab.c" break; - case 104: + case 104: /* simple: MESSAGE '[' INTEGER ']' IDENT flags */ #line 538 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-1].str),"message",(grib_yyvsp[-3].lval),0,0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-1].str)); } -#line 2906 "y.tab.c" +#line 2890 "y.tab.c" break; - case 105: + case 105: /* simple: MESSAGE_COPY IDENT flags */ #line 541 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-1].str),"message_copy",0,0,0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-1].str)); } -#line 2912 "y.tab.c" +#line 2896 "y.tab.c" break; - case 106: + case 106: /* simple: SECTION_PADDING IDENT flags */ #line 544 "griby.y" { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[-1].str),"section_padding",0,0,0,(grib_yyvsp[0].lval),NULL,NULL); free((grib_yyvsp[-1].str)); } -#line 2918 "y.tab.c" +#line 2902 "y.tab.c" break; - case 107: + case 107: /* simple: TEMPLATE IDENT STRING */ #line 546 "griby.y" { (grib_yyval.act) = grib_action_create_template(grib_parser_context,0,(grib_yyvsp[-1].str),(grib_yyvsp[0].str)); free((grib_yyvsp[-1].str)); free((grib_yyvsp[0].str));} -#line 2924 "y.tab.c" +#line 2908 "y.tab.c" break; - case 108: + case 108: /* simple: TEMPLATE_NOFAIL IDENT STRING */ #line 548 "griby.y" { (grib_yyval.act) = grib_action_create_template(grib_parser_context,1,(grib_yyvsp[-1].str),(grib_yyvsp[0].str)); free((grib_yyvsp[-1].str)); free((grib_yyvsp[0].str));} -#line 2930 "y.tab.c" +#line 2914 "y.tab.c" break; - case 109: + case 109: /* simple: ALIAS IDENT '=' IDENT flags */ #line 551 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].str),NULL,(grib_yyvsp[0].lval)); free((grib_yyvsp[-3].str)); free((grib_yyvsp[-1].str)); } -#line 2936 "y.tab.c" +#line 2920 "y.tab.c" break; - case 110: + case 110: /* simple: UNALIAS IDENT */ #line 554 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[0].str),NULL,NULL,0); free((grib_yyvsp[0].str)); } -#line 2942 "y.tab.c" +#line 2926 "y.tab.c" break; - case 111: + case 111: /* simple: ALIAS IDENT '.' IDENT '=' IDENT flags */ #line 557 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].str),(grib_yyvsp[-5].str),(grib_yyvsp[0].lval)); free((grib_yyvsp[-5].str)); free((grib_yyvsp[-3].str)); free((grib_yyvsp[-1].str)); } -#line 2950 "y.tab.c" +#line 2934 "y.tab.c" break; - case 112: + case 112: /* simple: UNALIAS IDENT '.' IDENT */ #line 561 "griby.y" { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[0].str),NULL,(grib_yyvsp[-2].str),0); free((grib_yyvsp[-2].str)); free((grib_yyvsp[0].str)); } -#line 2958 "y.tab.c" +#line 2942 "y.tab.c" break; - case 113: + case 113: /* simple: META IDENT IDENT '(' argument_list ')' default flags */ #line 565 "griby.y" { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[-6].str),(grib_yyvsp[-5].str),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),NULL); free((grib_yyvsp[-6].str));free((grib_yyvsp[-5].str));} -#line 2964 "y.tab.c" +#line 2948 "y.tab.c" break; - case 114: + case 114: /* simple: META IDENT '.' IDENT IDENT '(' argument_list ')' default flags */ #line 568 "griby.y" { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[-6].str),(grib_yyvsp[-5].str),(grib_yyvsp[-3].explist),(grib_yyvsp[-1].explist),(grib_yyvsp[0].lval),(grib_yyvsp[-8].str)); free((grib_yyvsp[-6].str));free((grib_yyvsp[-5].str));free((grib_yyvsp[-8].str));} -#line 2970 "y.tab.c" +#line 2954 "y.tab.c" break; - case 115: + case 115: /* simple: ITERATOR IDENT '(' argument_list ')' */ #line 571 "griby.y" { grib_arguments* a = grib_arguments_new( @@ -2982,10 +2966,10 @@ grib_yyreduce: "ITERATOR","iterator",a,NULL, GRIB_ACCESSOR_FLAG_HIDDEN|GRIB_ACCESSOR_FLAG_READ_ONLY,NULL); free((grib_yyvsp[-3].str)); } -#line 2986 "y.tab.c" +#line 2970 "y.tab.c" break; - case 116: + case 116: /* simple: NEAREST IDENT '(' argument_list ')' */ #line 583 "griby.y" { grib_arguments* a = grib_arguments_new( @@ -2998,10 +2982,10 @@ grib_yyreduce: "NEAREST","nearest",a,NULL, GRIB_ACCESSOR_FLAG_HIDDEN|GRIB_ACCESSOR_FLAG_READ_ONLY,NULL); free((grib_yyvsp[-3].str)); } -#line 3002 "y.tab.c" +#line 2986 "y.tab.c" break; - case 117: + case 117: /* simple: BOX IDENT '(' argument_list ')' */ #line 595 "griby.y" { grib_arguments* a = grib_arguments_new( @@ -3014,809 +2998,809 @@ grib_yyreduce: "BOX","box",a,NULL, GRIB_ACCESSOR_FLAG_HIDDEN|GRIB_ACCESSOR_FLAG_READ_ONLY,NULL); free((grib_yyvsp[-3].str)); } -#line 3018 "y.tab.c" +#line 3002 "y.tab.c" break; - case 118: + case 118: /* simple: EXPORT IDENT '(' argument_list ')' */ #line 607 "griby.y" { (grib_yyval.act) = grib_action_create_put(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].explist));free((grib_yyvsp[-3].str));} -#line 3024 "y.tab.c" +#line 3008 "y.tab.c" break; - case 119: + case 119: /* simple: REMOVE argument_list */ #line 610 "griby.y" { (grib_yyval.act) = grib_action_create_remove(grib_parser_context,(grib_yyvsp[0].explist));} -#line 3030 "y.tab.c" +#line 3014 "y.tab.c" break; - case 120: + case 120: /* simple: RENAME '(' IDENT ',' IDENT ')' */ #line 612 "griby.y" { (grib_yyval.act) = grib_action_create_rename(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].str));free((grib_yyvsp[-3].str));free((grib_yyvsp[-1].str));} -#line 3036 "y.tab.c" +#line 3020 "y.tab.c" break; - case 121: + case 121: /* simple: ASSERT '(' expression ')' */ #line 615 "griby.y" { (grib_yyval.act) = grib_action_create_assert(grib_parser_context,(grib_yyvsp[-1].exp));} -#line 3042 "y.tab.c" +#line 3026 "y.tab.c" break; - case 122: + case 122: /* simple: MODIFY IDENT flags */ #line 618 "griby.y" { (grib_yyval.act) = grib_action_create_modify(grib_parser_context,(grib_yyvsp[-1].str),(grib_yyvsp[0].lval)); free((grib_yyvsp[-1].str));} -#line 3048 "y.tab.c" +#line 3032 "y.tab.c" break; - case 123: + case 123: /* simple: SET IDENT '=' MISSING */ #line 620 "griby.y" { (grib_yyval.act) = grib_action_create_set_missing(grib_parser_context,(grib_yyvsp[-2].str)); free((grib_yyvsp[-2].str)); } -#line 3054 "y.tab.c" +#line 3038 "y.tab.c" break; - case 124: + case 124: /* simple: SET IDENT '=' expression */ #line 621 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[-2].str),(grib_yyvsp[0].exp),0); free((grib_yyvsp[-2].str)); } -#line 3060 "y.tab.c" +#line 3044 "y.tab.c" break; - case 125: + case 125: /* simple: SET IDENT '=' '{' dvalues '}' */ #line 622 "griby.y" { (grib_yyval.act) = grib_action_create_set_darray(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].dvalue)); free((grib_yyvsp[-4].str)); } -#line 3066 "y.tab.c" +#line 3050 "y.tab.c" break; - case 126: + case 126: /* simple: SET IDENT '=' '{' svalues '}' */ #line 623 "griby.y" { (grib_yyval.act) = grib_action_create_set_sarray(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].svalue)); free((grib_yyvsp[-4].str)); } -#line 3072 "y.tab.c" +#line 3056 "y.tab.c" break; - case 127: + case 127: /* simple: SET_NOFAIL IDENT '=' expression */ #line 625 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[-2].str),(grib_yyvsp[0].exp),1); free((grib_yyvsp[-2].str)); } -#line 3078 "y.tab.c" +#line 3062 "y.tab.c" break; - case 128: + case 128: /* simple: WRITE STRING */ #line 628 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[0].str),0,0); free((grib_yyvsp[0].str));} -#line 3084 "y.tab.c" +#line 3068 "y.tab.c" break; - case 129: + case 129: /* simple: WRITE */ #line 629 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,0); } -#line 3090 "y.tab.c" +#line 3074 "y.tab.c" break; - case 130: + case 130: /* simple: WRITE '(' INTEGER ')' STRING */ #line 630 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[0].str),0,(grib_yyvsp[-2].lval)); free((grib_yyvsp[0].str));} -#line 3096 "y.tab.c" +#line 3080 "y.tab.c" break; - case 131: + case 131: /* simple: WRITE '(' INTEGER ')' */ #line 631 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,(grib_yyvsp[-1].lval)); } -#line 3102 "y.tab.c" +#line 3086 "y.tab.c" break; - case 132: + case 132: /* simple: APPEND STRING */ #line 632 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[0].str),1,0); free((grib_yyvsp[0].str));} -#line 3108 "y.tab.c" +#line 3092 "y.tab.c" break; - case 133: + case 133: /* simple: APPEND */ #line 633 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,0); } -#line 3114 "y.tab.c" +#line 3098 "y.tab.c" break; - case 134: + case 134: /* simple: APPEND '(' INTEGER ')' STRING */ #line 634 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[0].str),1,(grib_yyvsp[-2].lval)); free((grib_yyvsp[0].str));} -#line 3120 "y.tab.c" +#line 3104 "y.tab.c" break; - case 135: + case 135: /* simple: APPEND '(' INTEGER ')' */ #line 635 "griby.y" { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,(grib_yyvsp[-1].lval)); } -#line 3126 "y.tab.c" +#line 3110 "y.tab.c" break; - case 136: + case 136: /* simple: CLOSE '(' IDENT ')' */ #line 637 "griby.y" { (grib_yyval.act) = grib_action_create_close(grib_parser_context,(grib_yyvsp[-1].str)); free((grib_yyvsp[-1].str));} -#line 3132 "y.tab.c" +#line 3116 "y.tab.c" break; - case 137: + case 137: /* simple: PRINT STRING */ #line 638 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[0].str),0); free((grib_yyvsp[0].str)); } -#line 3138 "y.tab.c" +#line 3122 "y.tab.c" break; - case 138: + case 138: /* simple: PRINT '(' STRING ')' STRING */ #line 639 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[0].str),(grib_yyvsp[-2].str)); free((grib_yyvsp[0].str)); free((grib_yyvsp[-2].str));} -#line 3144 "y.tab.c" +#line 3128 "y.tab.c" break; - case 139: + case 139: /* simple: PRINT '(' IDENT ')' STRING */ #line 640 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[0].str),(grib_yyvsp[-2].str)); free((grib_yyvsp[0].str)); free((grib_yyvsp[-2].str));} -#line 3150 "y.tab.c" +#line 3134 "y.tab.c" break; - case 140: + case 140: /* simple: PRINT */ #line 641 "griby.y" { (grib_yyval.act) = grib_action_create_print(grib_parser_context,"",0); } -#line 3156 "y.tab.c" +#line 3140 "y.tab.c" break; - case 141: + case 141: /* if_block: IF '(' expression ')' '{' instructions '}' */ #line 645 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[-4].exp),(grib_yyvsp[-1].act),0,0,grib_yylineno,file_being_parsed()); } -#line 3162 "y.tab.c" +#line 3146 "y.tab.c" break; - case 142: + case 142: /* if_block: IF '(' expression ')' '{' instructions '}' ELSE '{' instructions '}' */ #line 646 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[-8].exp),(grib_yyvsp[-5].act),(grib_yyvsp[-1].act),0,grib_yylineno,file_being_parsed()); } -#line 3168 "y.tab.c" +#line 3152 "y.tab.c" break; - case 143: + case 143: /* if_block: IF_TRANSIENT '(' expression ')' '{' instructions '}' */ #line 647 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[-4].exp),(grib_yyvsp[-1].act),0,1,grib_yylineno,file_being_parsed()); } -#line 3174 "y.tab.c" +#line 3158 "y.tab.c" break; - case 144: + case 144: /* if_block: IF_TRANSIENT '(' expression ')' '{' instructions '}' ELSE '{' instructions '}' */ #line 648 "griby.y" { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[-8].exp),(grib_yyvsp[-5].act),(grib_yyvsp[-1].act),1,grib_yylineno,file_being_parsed()); } -#line 3180 "y.tab.c" +#line 3164 "y.tab.c" break; - case 145: + case 145: /* when_block: WHEN '(' expression ')' set semi */ #line 652 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[-3].exp),(grib_yyvsp[-1].act),NULL); } -#line 3186 "y.tab.c" +#line 3170 "y.tab.c" break; - case 146: + case 146: /* when_block: WHEN '(' expression ')' '{' set_list '}' */ #line 653 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[-4].exp),(grib_yyvsp[-1].act),NULL); } -#line 3192 "y.tab.c" +#line 3176 "y.tab.c" break; - case 147: + case 147: /* when_block: WHEN '(' expression ')' '{' set_list '}' ELSE '{' set_list '}' */ #line 654 "griby.y" { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[-8].exp),(grib_yyvsp[-5].act),(grib_yyvsp[-1].act)); } -#line 3198 "y.tab.c" +#line 3182 "y.tab.c" break; - case 148: + case 148: /* set: SET IDENT '=' expression */ #line 657 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[-2].str),(grib_yyvsp[0].exp),0); free((grib_yyvsp[-2].str)); } -#line 3204 "y.tab.c" +#line 3188 "y.tab.c" break; - case 149: + case 149: /* set: SET_NOFAIL IDENT '=' expression */ #line 658 "griby.y" { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[-2].str),(grib_yyvsp[0].exp),1); free((grib_yyvsp[-2].str)); } -#line 3210 "y.tab.c" +#line 3194 "y.tab.c" break; - case 151: + case 151: /* set_list: set_list set semi */ #line 662 "griby.y" { (grib_yyvsp[-2].act)->next = (grib_yyvsp[-1].act); (grib_yyval.act) = (grib_yyvsp[-2].act); } -#line 3216 "y.tab.c" +#line 3200 "y.tab.c" break; - case 152: + case 152: /* default: empty */ #line 666 "griby.y" { (grib_yyval.explist) = NULL ;} -#line 3222 "y.tab.c" +#line 3206 "y.tab.c" break; - case 153: + case 153: /* default: '=' argument_list */ #line 667 "griby.y" { (grib_yyval.explist) = (grib_yyvsp[0].explist) ;} -#line 3228 "y.tab.c" +#line 3212 "y.tab.c" break; - case 154: + case 154: /* flags: empty */ #line 670 "griby.y" { (grib_yyval.lval) = 0 ; } -#line 3234 "y.tab.c" +#line 3218 "y.tab.c" break; - case 155: + case 155: /* flags: ':' flag_list */ #line 671 "griby.y" { (grib_yyval.lval) = (grib_yyvsp[0].lval); } -#line 3240 "y.tab.c" +#line 3224 "y.tab.c" break; - case 157: + case 157: /* flag_list: flag_list ',' flag */ #line 675 "griby.y" { (grib_yyval.lval) = (grib_yyvsp[-2].lval) | (grib_yyvsp[0].lval); } -#line 3246 "y.tab.c" +#line 3230 "y.tab.c" break; - case 158: + case 158: /* flag: READ_ONLY */ #line 678 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_READ_ONLY; } -#line 3252 "y.tab.c" +#line 3236 "y.tab.c" break; - case 159: + case 159: /* flag: LOWERCASE */ #line 679 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LOWERCASE; } -#line 3258 "y.tab.c" +#line 3242 "y.tab.c" break; - case 160: + case 160: /* flag: DUMP */ #line 680 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_DUMP; } -#line 3264 "y.tab.c" +#line 3248 "y.tab.c" break; - case 161: + case 161: /* flag: NO_COPY */ #line 681 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_COPY; } -#line 3270 "y.tab.c" +#line 3254 "y.tab.c" break; - case 162: + case 162: /* flag: NO_FAIL */ #line 682 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_FAIL; } -#line 3276 "y.tab.c" +#line 3260 "y.tab.c" break; - case 163: + case 163: /* flag: HIDDEN */ #line 683 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_HIDDEN; } -#line 3282 "y.tab.c" +#line 3266 "y.tab.c" break; - case 164: + case 164: /* flag: EDITION_SPECIFIC */ #line 684 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; } -#line 3288 "y.tab.c" +#line 3272 "y.tab.c" break; - case 165: + case 165: /* flag: CAN_BE_MISSING */ #line 685 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CAN_BE_MISSING; } -#line 3294 "y.tab.c" +#line 3278 "y.tab.c" break; - case 166: + case 166: /* flag: CONSTRAINT */ #line 686 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CONSTRAINT; } -#line 3300 "y.tab.c" +#line 3284 "y.tab.c" break; - case 167: + case 167: /* flag: COPY_OK */ #line 687 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_COPY_OK; } -#line 3306 "y.tab.c" +#line 3290 "y.tab.c" break; - case 168: + case 168: /* flag: TRANS */ #line 688 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_TRANSIENT; } -#line 3312 "y.tab.c" +#line 3296 "y.tab.c" break; - case 169: + case 169: /* flag: STRING_TYPE */ #line 689 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_STRING_TYPE; } -#line 3318 "y.tab.c" +#line 3302 "y.tab.c" break; - case 170: + case 170: /* flag: LONG_TYPE */ #line 690 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LONG_TYPE; } -#line 3324 "y.tab.c" +#line 3308 "y.tab.c" break; - case 171: + case 171: /* flag: DOUBLE_TYPE */ #line 691 "griby.y" { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_DOUBLE_TYPE; } -#line 3330 "y.tab.c" +#line 3314 "y.tab.c" break; - case 172: + case 172: /* list_block: IDENT LIST '(' expression ')' '{' instructions '}' */ #line 694 "griby.y" { (grib_yyval.act) = grib_action_create_list(grib_parser_context,(grib_yyvsp[-7].str),(grib_yyvsp[-4].exp),(grib_yyvsp[-1].act)); free((grib_yyvsp[-7].str)); } -#line 3336 "y.tab.c" +#line 3320 "y.tab.c" break; - case 173: + case 173: /* while_block: WHILE '(' expression ')' '{' instructions '}' */ #line 697 "griby.y" { (grib_yyval.act) = grib_action_create_while(grib_parser_context,(grib_yyvsp[-4].exp),(grib_yyvsp[-1].act)); } -#line 3342 "y.tab.c" +#line 3326 "y.tab.c" break; - case 174: + case 174: /* trigger_block: TRIGGER '(' argument_list ')' '{' instructions '}' */ #line 700 "griby.y" { (grib_yyval.act) = grib_action_create_trigger(grib_parser_context,(grib_yyvsp[-4].explist),(grib_yyvsp[-1].act)); } -#line 3348 "y.tab.c" +#line 3332 "y.tab.c" break; - case 175: + case 175: /* concept_block: CONCEPT IDENT '{' concept_list '}' flags */ #line 703 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-2].concept_value),0,0,0,0,0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-4].str)); } -#line 3354 "y.tab.c" +#line 3338 "y.tab.c" break; - case 176: + case 176: /* concept_block: CONCEPT IDENT '(' IDENT ')' '{' concept_list '}' flags */ #line 704 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-7].str),(grib_yyvsp[-2].concept_value),0,0,(grib_yyvsp[-5].str),0,0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-7].str));free((grib_yyvsp[-5].str)); } -#line 3360 "y.tab.c" +#line 3344 "y.tab.c" break; - case 177: + case 177: /* concept_block: CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags */ #line 705 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-10].str),0,(grib_yyvsp[-6].str),0,(grib_yyvsp[-8].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-2].str)); } -#line 3366 "y.tab.c" +#line 3350 "y.tab.c" break; - case 178: + case 178: /* concept_block: CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ',' IDENT ')' flags */ #line 706 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-12].str),0,(grib_yyvsp[-8].str),0,(grib_yyvsp[-10].str),(grib_yyvsp[-6].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),(grib_yyvsp[0].lval),0); free((grib_yyvsp[-12].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-2].str)); } -#line 3372 "y.tab.c" +#line 3356 "y.tab.c" break; - case 179: + case 179: /* concept_block: CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ')' flags */ #line 707 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-8].str),0,(grib_yyvsp[-4].str),0,(grib_yyvsp[-6].str),(grib_yyvsp[-2].str),0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-2].str)); } -#line 3378 "y.tab.c" +#line 3362 "y.tab.c" break; - case 180: + case 180: /* concept_block: CONCEPT IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags */ #line 708 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-10].str),0,(grib_yyvsp[-6].str),(grib_yyvsp[-12].str),(grib_yyvsp[-8].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str)); free((grib_yyvsp[-2].str)); free((grib_yyvsp[-12].str));} -#line 3384 "y.tab.c" +#line 3368 "y.tab.c" break; - case 181: + case 181: /* concept_block: CONCEPT IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ')' flags */ #line 709 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-8].str),0,(grib_yyvsp[-4].str),(grib_yyvsp[-10].str),(grib_yyvsp[-6].str),(grib_yyvsp[-2].str),0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-2].str)); free((grib_yyvsp[-10].str));} -#line 3390 "y.tab.c" +#line 3374 "y.tab.c" break; - case 182: + case 182: /* concept_block: CONCEPT IDENT '.' IDENT '{' concept_list '}' flags */ #line 710 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-2].concept_value),0,(grib_yyvsp[-6].str),0,0,0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-6].str));free((grib_yyvsp[-4].str)); } -#line 3396 "y.tab.c" +#line 3380 "y.tab.c" break; - case 183: + case 183: /* concept_block: CONCEPT IDENT '.' IDENT '(' IDENT ')' '{' concept_list '}' flags */ #line 711 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-7].str),(grib_yyvsp[-2].concept_value),0,(grib_yyvsp[-9].str),(grib_yyvsp[-5].str),0,0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-9].str));free((grib_yyvsp[-7].str));free((grib_yyvsp[-5].str)); } -#line 3402 "y.tab.c" +#line 3386 "y.tab.c" break; - case 184: + case 184: /* concept_block: CONCEPT_NOFAIL IDENT '{' concept_list '}' flags */ #line 712 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-2].concept_value),0,0,0,0,0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-4].str)); } -#line 3408 "y.tab.c" +#line 3392 "y.tab.c" break; - case 185: + case 185: /* concept_block: CONCEPT_NOFAIL IDENT '(' IDENT ')' '{' concept_list '}' flags */ #line 713 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-7].str),(grib_yyvsp[-2].concept_value),0,0,(grib_yyvsp[-5].str),0,0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-7].str));free((grib_yyvsp[-5].str)); } -#line 3414 "y.tab.c" +#line 3398 "y.tab.c" break; - case 186: + case 186: /* concept_block: CONCEPT_NOFAIL IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags */ #line 714 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-10].str),0,(grib_yyvsp[-6].str),0,(grib_yyvsp[-8].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-2].str)); } -#line 3420 "y.tab.c" +#line 3404 "y.tab.c" break; - case 187: + case 187: /* concept_block: CONCEPT_NOFAIL IDENT '(' IDENT ',' STRING ',' IDENT ')' flags */ #line 715 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-8].str),0,(grib_yyvsp[-4].str),0,(grib_yyvsp[-6].str),(grib_yyvsp[-2].str),0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-2].str)); } -#line 3426 "y.tab.c" +#line 3410 "y.tab.c" break; - case 188: + case 188: /* concept_block: CONCEPT_NOFAIL IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags */ #line 716 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-10].str),0,(grib_yyvsp[-6].str),(grib_yyvsp[-12].str),(grib_yyvsp[-8].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-2].str)); free((grib_yyvsp[-12].str));} -#line 3432 "y.tab.c" +#line 3416 "y.tab.c" break; - case 189: + case 189: /* concept_block: CONCEPT_NOFAIL IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ')' flags */ #line 717 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-8].str),0,(grib_yyvsp[-4].str),(grib_yyvsp[-10].str),(grib_yyvsp[-6].str),(grib_yyvsp[-2].str),0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-2].str)); free((grib_yyvsp[-10].str));} -#line 3438 "y.tab.c" +#line 3422 "y.tab.c" break; - case 190: + case 190: /* concept_block: CONCEPT_NOFAIL IDENT '.' IDENT '{' concept_list '}' flags */ #line 718 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-2].concept_value),0,(grib_yyvsp[-6].str),0,0,0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-6].str));free((grib_yyvsp[-4].str)); } -#line 3444 "y.tab.c" +#line 3428 "y.tab.c" break; - case 191: + case 191: /* concept_block: CONCEPT_NOFAIL IDENT '.' IDENT '(' IDENT ')' '{' concept_list '}' flags */ #line 719 "griby.y" { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[-7].str),(grib_yyvsp[-2].concept_value),0,(grib_yyvsp[-9].str),(grib_yyvsp[-5].str),0,0,0,(grib_yyvsp[0].lval),1); free((grib_yyvsp[-9].str));free((grib_yyvsp[-7].str));free((grib_yyvsp[-5].str)); } -#line 3450 "y.tab.c" +#line 3434 "y.tab.c" break; - case 193: + case 193: /* concept_list: concept_list concept_value */ #line 724 "griby.y" { (grib_yyval.concept_value) = (grib_yyvsp[0].concept_value); (grib_yyvsp[0].concept_value)->next = (grib_yyvsp[-1].concept_value); } -#line 3456 "y.tab.c" +#line 3440 "y.tab.c" break; - case 195: + case 195: /* hash_array_list: hash_array_list hash_array_value */ #line 728 "griby.y" { (grib_yyval.hash_array_value) = (grib_yyvsp[0].hash_array_value); (grib_yyvsp[0].hash_array_value)->next = (grib_yyvsp[-1].hash_array_value); } -#line 3462 "y.tab.c" +#line 3446 "y.tab.c" break; - case 196: + case 196: /* hash_array_block: HASH_ARRAY IDENT '{' hash_array_list '}' flags */ #line 731 "griby.y" { (grib_yyval.act) = grib_action_create_hash_array(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-2].hash_array_value),0,0,0,0,0,0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-4].str)); } -#line 3468 "y.tab.c" +#line 3452 "y.tab.c" break; - case 197: + case 197: /* hash_array_block: HASH_ARRAY IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags */ #line 732 "griby.y" { (grib_yyval.act) = grib_action_create_hash_array(grib_parser_context,(grib_yyvsp[-10].str),0,(grib_yyvsp[-6].str),0,(grib_yyvsp[-8].str),(grib_yyvsp[-4].str),(grib_yyvsp[-2].str),0,(grib_yyvsp[0].lval),0); free((grib_yyvsp[-10].str));free((grib_yyvsp[-6].str));free((grib_yyvsp[-8].str));free((grib_yyvsp[-4].str));free((grib_yyvsp[-2].str)); } -#line 3474 "y.tab.c" +#line 3458 "y.tab.c" break; - case 199: + case 199: /* case_list: case_list case_value */ #line 736 "griby.y" { (grib_yyval.case_value) = (grib_yyvsp[0].case_value); (grib_yyvsp[0].case_value)->next = (grib_yyvsp[-1].case_value); } -#line 3480 "y.tab.c" +#line 3464 "y.tab.c" break; - case 200: + case 200: /* case_value: CASE arguments ':' instructions */ #line 739 "griby.y" { (grib_yyval.case_value) = grib_case_new(grib_parser_context,(grib_yyvsp[-2].explist),(grib_yyvsp[0].act)); } -#line 3486 "y.tab.c" +#line 3470 "y.tab.c" break; - case 201: + case 201: /* switch_block: SWITCH '(' argument_list ')' '{' case_list DEFAULT ':' instructions '}' */ #line 743 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[-7].explist),(grib_yyvsp[-4].case_value),(grib_yyvsp[-1].act)); } -#line 3492 "y.tab.c" +#line 3476 "y.tab.c" break; - case 202: + case 202: /* switch_block: SWITCH '(' argument_list ')' '{' case_list DEFAULT ':' '}' */ #line 744 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[-6].explist),(grib_yyvsp[-3].case_value),grib_action_create_noop(grib_parser_context,"continue")); } -#line 3498 "y.tab.c" +#line 3482 "y.tab.c" break; - case 203: + case 203: /* switch_block: SWITCH '(' argument_list ')' '{' case_list '}' */ #line 745 "griby.y" { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[-4].explist),(grib_yyvsp[-1].case_value),0); } -#line 3504 "y.tab.c" +#line 3488 "y.tab.c" break; - case 204: + case 204: /* concept_value: STRING '=' '{' concept_conditions '}' */ #line 748 "griby.y" { (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].concept_condition)); free((grib_yyvsp[-4].str));} -#line 3511 "y.tab.c" +#line 3495 "y.tab.c" break; - case 205: + case 205: /* concept_value: IDENT '=' '{' concept_conditions '}' */ #line 750 "griby.y" { (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].concept_condition)); free((grib_yyvsp[-4].str));} -#line 3518 "y.tab.c" +#line 3502 "y.tab.c" break; - case 206: + case 206: /* concept_value: INTEGER '=' '{' concept_conditions '}' */ #line 752 "griby.y" { - char buf[80]; snprintf(buf,sizeof(buf),"%ld",(long)(grib_yyvsp[-4].lval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[-1].concept_condition));} -#line 3525 "y.tab.c" + char buf[80]; snprintf(buf, sizeof(buf), "%ld",(long)(grib_yyvsp[-4].lval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[-1].concept_condition));} +#line 3509 "y.tab.c" break; - case 207: + case 207: /* concept_value: FLOAT '=' '{' concept_conditions '}' */ #line 754 "griby.y" { - char buf[80]; snprintf(buf,sizeof(buf),"%g",(double)(grib_yyvsp[-4].dval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[-1].concept_condition));} -#line 3532 "y.tab.c" + char buf[80]; snprintf(buf, sizeof(buf), "%g", (double)(grib_yyvsp[-4].dval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[-1].concept_condition));} +#line 3516 "y.tab.c" break; - case 209: + case 209: /* concept_conditions: concept_condition concept_conditions */ #line 759 "griby.y" { (grib_yyvsp[-1].concept_condition)->next = (grib_yyvsp[0].concept_condition); (grib_yyval.concept_condition) = (grib_yyvsp[-1].concept_condition); } -#line 3538 "y.tab.c" +#line 3522 "y.tab.c" break; - case 210: + case 210: /* concept_condition: IDENT '=' expression ';' */ #line 762 "griby.y" { (grib_yyval.concept_condition) = grib_concept_condition_new(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].exp),0); free((grib_yyvsp[-3].str)); } -#line 3544 "y.tab.c" +#line 3528 "y.tab.c" break; - case 211: + case 211: /* concept_condition: IDENT '=' '[' integer_array ']' ';' */ #line 763 "griby.y" { (grib_yyval.concept_condition) = grib_concept_condition_new(grib_parser_context,(grib_yyvsp[-5].str),0,(grib_yyvsp[-2].ivalue)); free((grib_yyvsp[-5].str)); } -#line 3550 "y.tab.c" +#line 3534 "y.tab.c" break; - case 212: + case 212: /* hash_array_value: STRING '=' '[' integer_array ']' */ #line 767 "griby.y" { (grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));} -#line 3557 "y.tab.c" +#line 3541 "y.tab.c" break; - case 213: + case 213: /* hash_array_value: IDENT '=' '[' integer_array ']' */ #line 769 "griby.y" { (grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[-4].str),(grib_yyvsp[-1].ivalue)); free((grib_yyvsp[-4].str));} -#line 3564 "y.tab.c" +#line 3548 "y.tab.c" break; - case 214: + case 214: /* string_or_ident: SUBSTR '(' IDENT ',' INTEGER ',' INTEGER ')' */ #line 773 "griby.y" { (grib_yyval.exp) = new_accessor_expression(grib_parser_context,(grib_yyvsp[-5].str),(grib_yyvsp[-3].lval),(grib_yyvsp[-1].lval)); free((grib_yyvsp[-5].str)); } -#line 3570 "y.tab.c" +#line 3554 "y.tab.c" break; - case 215: + case 215: /* string_or_ident: IDENT */ #line 774 "griby.y" { (grib_yyval.exp) = new_accessor_expression(grib_parser_context,(grib_yyvsp[0].str),0,0); free((grib_yyvsp[0].str)); } -#line 3576 "y.tab.c" +#line 3560 "y.tab.c" break; - case 216: + case 216: /* string_or_ident: SUBSTR '(' STRING ',' INTEGER ',' INTEGER ')' */ #line 775 "griby.y" { (grib_yyval.exp) = new_sub_string_expression(grib_parser_context,(grib_yyvsp[-5].str),(grib_yyvsp[-3].lval),(grib_yyvsp[-1].lval)); free((grib_yyvsp[-5].str)); } -#line 3582 "y.tab.c" +#line 3566 "y.tab.c" break; - case 217: + case 217: /* string_or_ident: STRING */ #line 776 "griby.y" { (grib_yyval.exp) = new_string_expression(grib_parser_context,(grib_yyvsp[0].str)); free((grib_yyvsp[0].str)); } -#line 3588 "y.tab.c" +#line 3572 "y.tab.c" break; - case 219: + case 219: /* atom: INTEGER */ #line 780 "griby.y" { (grib_yyval.exp) = new_long_expression(grib_parser_context,(grib_yyvsp[0].lval)); } -#line 3594 "y.tab.c" +#line 3578 "y.tab.c" break; - case 220: + case 220: /* atom: FLOAT */ #line 781 "griby.y" { (grib_yyval.exp) = new_double_expression(grib_parser_context,(grib_yyvsp[0].dval)); /* TODO: change to new_float_expression*/} -#line 3600 "y.tab.c" +#line 3584 "y.tab.c" break; - case 221: + case 221: /* atom: NIL */ #line 783 "griby.y" { (grib_yyval.exp) = NULL; } -#line 3606 "y.tab.c" +#line 3590 "y.tab.c" break; - case 222: + case 222: /* atom: DUMMY */ #line 784 "griby.y" { (grib_yyval.exp) = new_true_expression(grib_parser_context); } -#line 3612 "y.tab.c" +#line 3596 "y.tab.c" break; - case 223: + case 223: /* atom: '(' expression ')' */ #line 785 "griby.y" { (grib_yyval.exp) = (grib_yyvsp[-1].exp); } -#line 3618 "y.tab.c" +#line 3602 "y.tab.c" break; - case 224: + case 224: /* atom: '-' atom */ #line 786 "griby.y" { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_neg,&grib_op_neg_d,(grib_yyvsp[0].exp)); } -#line 3624 "y.tab.c" +#line 3608 "y.tab.c" break; - case 225: + case 225: /* atom: IDENT '(' ')' */ #line 787 "griby.y" { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[-2].str),NULL); free((grib_yyvsp[-2].str));} -#line 3630 "y.tab.c" +#line 3614 "y.tab.c" break; - case 226: + case 226: /* atom: IDENT '(' argument_list ')' */ #line 788 "griby.y" { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].explist)); free((grib_yyvsp[-3].str));} -#line 3636 "y.tab.c" +#line 3620 "y.tab.c" break; - case 227: + case 227: /* power: atom '^' power */ #line 792 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_pow,NULL,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3642 "y.tab.c" +#line 3626 "y.tab.c" break; - case 229: + case 229: /* factor: factor '*' power */ #line 796 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_mul,&grib_op_mul_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3648 "y.tab.c" +#line 3632 "y.tab.c" break; - case 230: + case 230: /* factor: factor '/' power */ #line 797 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_div,&grib_op_div_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3654 "y.tab.c" +#line 3638 "y.tab.c" break; - case 231: + case 231: /* factor: factor '%' power */ #line 798 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_modulo,NULL,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3660 "y.tab.c" +#line 3644 "y.tab.c" break; - case 232: + case 232: /* factor: factor BIT power */ #line 799 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bit,NULL,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3666 "y.tab.c" +#line 3650 "y.tab.c" break; - case 233: + case 233: /* factor: factor BITOFF power */ #line 800 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bitoff,NULL,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3672 "y.tab.c" +#line 3656 "y.tab.c" break; - case 235: + case 235: /* factor: LENGTH '(' IDENT ')' */ #line 802 "griby.y" { (grib_yyval.exp) = new_length_expression(grib_parser_context,(grib_yyvsp[-1].str)); free((grib_yyvsp[-1].str));} -#line 3678 "y.tab.c" +#line 3662 "y.tab.c" break; - case 236: + case 236: /* factor: IS_IN_LIST '(' IDENT ',' STRING ')' */ #line 803 "griby.y" { (grib_yyval.exp) = new_is_in_list_expression(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].str)); free((grib_yyvsp[-3].str));free((grib_yyvsp[-1].str));} -#line 3684 "y.tab.c" +#line 3668 "y.tab.c" break; - case 237: + case 237: /* factor: IS_IN_DICT '(' IDENT ',' STRING ')' */ #line 804 "griby.y" { (grib_yyval.exp) = new_is_in_dict_expression(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].str)); free((grib_yyvsp[-3].str));free((grib_yyvsp[-1].str));} -#line 3690 "y.tab.c" +#line 3674 "y.tab.c" break; - case 238: + case 238: /* factor: IS_INTEGER '(' IDENT ',' INTEGER ')' */ #line 805 "griby.y" { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].lval),0); free((grib_yyvsp[-3].str));} -#line 3696 "y.tab.c" +#line 3680 "y.tab.c" break; - case 239: + case 239: /* factor: IS_INTEGER '(' IDENT ',' INTEGER ',' INTEGER ')' */ #line 806 "griby.y" { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[-5].str),(grib_yyvsp[-3].lval),(grib_yyvsp[-1].lval)); free((grib_yyvsp[-5].str));} -#line 3702 "y.tab.c" +#line 3686 "y.tab.c" break; - case 240: + case 240: /* factor: IS_INTEGER '(' IDENT ')' */ #line 807 "griby.y" { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[-1].str),0,0); free((grib_yyvsp[-1].str));} -#line 3708 "y.tab.c" +#line 3692 "y.tab.c" break; - case 241: + case 241: /* term: term '+' factor */ #line 810 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_add,&grib_op_add_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3714 "y.tab.c" +#line 3698 "y.tab.c" break; - case 242: + case 242: /* term: term '-' factor */ #line 811 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_sub,&grib_op_sub_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3720 "y.tab.c" +#line 3704 "y.tab.c" break; - case 244: + case 244: /* condition: condition GT term */ #line 815 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_gt,&grib_op_gt_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3726 "y.tab.c" +#line 3710 "y.tab.c" break; - case 245: + case 245: /* condition: condition EQ term */ #line 817 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_eq,&grib_op_eq_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3732 "y.tab.c" +#line 3716 "y.tab.c" break; - case 246: + case 246: /* condition: condition LT term */ #line 818 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_lt,&grib_op_lt_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3738 "y.tab.c" +#line 3722 "y.tab.c" break; - case 247: + case 247: /* condition: condition GE term */ #line 819 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ge,&grib_op_ge_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3744 "y.tab.c" +#line 3728 "y.tab.c" break; - case 248: + case 248: /* condition: condition LE term */ #line 820 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_le,&grib_op_le_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3750 "y.tab.c" +#line 3734 "y.tab.c" break; - case 249: + case 249: /* condition: condition NE term */ #line 821 "griby.y" { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ne,&grib_op_ne_d,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3756 "y.tab.c" +#line 3740 "y.tab.c" break; - case 250: + case 250: /* condition: string_or_ident IS string_or_ident */ #line 822 "griby.y" { (grib_yyval.exp) = new_string_compare_expression(grib_parser_context,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3762 "y.tab.c" +#line 3746 "y.tab.c" break; - case 251: + case 251: /* condition: NOT condition */ #line 827 "griby.y" { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_not,NULL,(grib_yyvsp[0].exp)); } -#line 3768 "y.tab.c" +#line 3752 "y.tab.c" break; - case 253: + case 253: /* conjunction: conjunction AND condition */ #line 831 "griby.y" { (grib_yyval.exp) = new_logical_and_expression(grib_parser_context,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp)); } -#line 3774 "y.tab.c" +#line 3758 "y.tab.c" break; - case 255: + case 255: /* disjunction: disjunction OR conjunction */ #line 835 "griby.y" { (grib_yyval.exp) = new_logical_or_expression(grib_parser_context,(grib_yyvsp[-2].exp),(grib_yyvsp[0].exp));} -#line 3780 "y.tab.c" +#line 3764 "y.tab.c" break; - case 260: + case 260: /* rule_entry: IDENT '=' expression ';' */ #line 849 "griby.y" { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,(grib_yyvsp[-3].str),(grib_yyvsp[-1].exp)); free((grib_yyvsp[-3].str)); } -#line 3786 "y.tab.c" +#line 3770 "y.tab.c" break; - case 261: + case 261: /* rule_entry: SKIP ';' */ #line 850 "griby.y" { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,"skip",0);} -#line 3792 "y.tab.c" +#line 3776 "y.tab.c" break; - case 263: + case 263: /* rule_entries: rule_entry rule_entries */ #line 854 "griby.y" { (grib_yyvsp[-1].rule_entry)->next = (grib_yyvsp[0].rule_entry); (grib_yyval.rule_entry) = (grib_yyvsp[-1].rule_entry); } -#line 3798 "y.tab.c" +#line 3782 "y.tab.c" break; - case 264: + case 264: /* fact: rule_entry */ #line 857 "griby.y" { (grib_yyval.rules) = grib_new_rule(grib_parser_context,NULL,(grib_yyvsp[0].rule_entry)); } -#line 3804 "y.tab.c" +#line 3788 "y.tab.c" break; - case 265: + case 265: /* conditional_rule: IF '(' expression ')' '{' rule_entries '}' */ #line 861 "griby.y" { (grib_yyval.rules) = grib_new_rule(grib_parser_context,(grib_yyvsp[-4].exp),(grib_yyvsp[-1].rule_entry)); } -#line 3810 "y.tab.c" +#line 3794 "y.tab.c" break; - case 267: + case 267: /* rules: rule rules */ #line 865 "griby.y" { (grib_yyvsp[-1].rules)->next = (grib_yyvsp[0].rules); (grib_yyval.rules) = (grib_yyvsp[-1].rules); } -#line 3816 "y.tab.c" +#line 3800 "y.tab.c" break; -#line 3820 "y.tab.c" +#line 3804 "y.tab.c" default: break; } @@ -3831,11 +3815,10 @@ grib_yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", grib_yyr1[grib_yyn], &grib_yyval, &grib_yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (grib_yysymbol_kind_t, grib_yyr1[grib_yyn]), &grib_yyval, &grib_yyloc); YYPOPSTACK (grib_yylen); grib_yylen = 0; - YY_STACK_PRINT (grib_yyss, grib_yyssp); *++grib_yyvsp = grib_yyval; @@ -3859,50 +3842,14 @@ grib_yyreduce: grib_yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - grib_yytoken = grib_yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (grib_yychar); - + grib_yytoken = grib_yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (grib_yychar); /* If not already recovering from an error, report this error. */ if (!grib_yyerrstatus) { ++grib_yynerrs; -#if ! YYERROR_VERBOSE grib_yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR grib_yysyntax_error (&grib_yymsg_alloc, &grib_yymsg, \ - grib_yyssp, grib_yytoken) - { - char const *grib_yymsgp = YY_("syntax error"); - int grib_yysyntax_error_status; - grib_yysyntax_error_status = YYSYNTAX_ERROR; - if (grib_yysyntax_error_status == 0) - grib_yymsgp = grib_yymsg; - else if (grib_yysyntax_error_status == 1) - { - if (grib_yymsg != grib_yymsgbuf) - YYSTACK_FREE (grib_yymsg); - grib_yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, grib_yymsg_alloc))); - if (!grib_yymsg) - { - grib_yymsg = grib_yymsgbuf; - grib_yymsg_alloc = sizeof grib_yymsgbuf; - grib_yysyntax_error_status = 2; - } - else - { - grib_yysyntax_error_status = YYSYNTAX_ERROR; - grib_yymsgp = grib_yymsg; - } - } - grib_yyerror (grib_yymsgp); - if (grib_yysyntax_error_status == 2) - goto grib_yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif } - - if (grib_yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -3935,6 +3882,7 @@ grib_yyerrorlab: label grib_yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++grib_yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -3951,13 +3899,14 @@ grib_yyerrorlab: grib_yyerrlab1: grib_yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { grib_yyn = grib_yypact[grib_yystate]; if (!grib_yypact_value_is_default (grib_yyn)) { - grib_yyn += YYTERROR; - if (0 <= grib_yyn && grib_yyn <= YYLAST && grib_yycheck[grib_yyn] == YYTERROR) + grib_yyn += YYSYMBOL_YYerror; + if (0 <= grib_yyn && grib_yyn <= YYLAST && grib_yycheck[grib_yyn] == YYSYMBOL_YYerror) { grib_yyn = grib_yytable[grib_yyn]; if (0 < grib_yyn) @@ -3971,7 +3920,7 @@ grib_yyerrlab1: grib_yydestruct ("Error: popping", - grib_yystos[grib_yystate], grib_yyvsp); + YY_ACCESSING_SYMBOL (grib_yystate), grib_yyvsp); YYPOPSTACK (1); grib_yystate = *grib_yyssp; YY_STACK_PRINT (grib_yyss, grib_yyssp); @@ -3983,7 +3932,7 @@ grib_yyerrlab1: /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", grib_yystos[grib_yyn], grib_yyvsp, grib_yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (grib_yyn), grib_yyvsp, grib_yylsp); grib_yystate = grib_yyn; goto grib_yynewstate; @@ -3994,7 +3943,7 @@ grib_yyerrlab1: `-------------------------------------*/ grib_yyacceptlab: grib_yyresult = 0; - goto grib_yyreturn; + goto grib_yyreturnlab; /*-----------------------------------. @@ -4002,24 +3951,22 @@ grib_yyacceptlab: `-----------------------------------*/ grib_yyabortlab: grib_yyresult = 1; - goto grib_yyreturn; + goto grib_yyreturnlab; -#if !defined grib_yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| grib_yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| grib_yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ grib_yyexhaustedlab: grib_yyerror (YY_("memory exhausted")); grib_yyresult = 2; - /* Fall through. */ -#endif + goto grib_yyreturnlab; -/*-----------------------------------------------------. -| grib_yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ -grib_yyreturn: +/*----------------------------------------------------------. +| grib_yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +grib_yyreturnlab: if (grib_yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -4035,19 +3982,17 @@ grib_yyreturn: while (grib_yyssp != grib_yyss) { grib_yydestruct ("Cleanup: popping", - grib_yystos[+*grib_yyssp], grib_yyvsp); + YY_ACCESSING_SYMBOL (+*grib_yyssp), grib_yyvsp); YYPOPSTACK (1); } #ifndef grib_yyoverflow if (grib_yyss != grib_yyssa) YYSTACK_FREE (grib_yyss); #endif -#if YYERROR_VERBOSE - if (grib_yymsg != grib_yymsgbuf) - YYSTACK_FREE (grib_yymsg); -#endif + return grib_yyresult; } + #line 869 "griby.y" diff --git a/src/grib_yacc.h b/src/grib_yacc.h index 5fe8ca334..e99fb7050 100644 --- a/src/grib_yacc.h +++ b/src/grib_yacc.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.5.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -31,8 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or grib_yy_. They are + private implementation details that can be changed or removed. */ #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED @@ -44,138 +45,147 @@ extern int grib_yydebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum grib_yytokentype { - LOWERCASE = 258, - IF = 259, - IF_TRANSIENT = 260, - ELSE = 261, - END = 262, - CLOSE = 263, - UNSIGNED = 264, - TEMPLATE = 265, - TEMPLATE_NOFAIL = 266, - TRIGGER = 267, - ASCII = 268, - GROUP = 269, - NON_ALPHA = 270, - KSEC1EXPVER = 271, - LABEL = 272, - LIST = 273, - IS_IN_LIST = 274, - IS_IN_DICT = 275, - IS_INTEGER = 276, - TO_INTEGER = 277, - TO_STRING = 278, - SEX2DEC = 279, - WHILE = 280, - IBMFLOAT = 281, - SIGNED = 282, - UINT8 = 283, - INT8 = 284, - UINT16 = 285, - INT16 = 286, - UINT16_LITTLE_ENDIAN = 287, - INT16_LITTLE_ENDIAN = 288, - UINT32 = 289, - INT32 = 290, - UINT32_LITTLE_ENDIAN = 291, - INT32_LITTLE_ENDIAN = 292, - UINT64 = 293, - INT64 = 294, - UINT64_LITTLE_ENDIAN = 295, - INT64_LITTLE_ENDIAN = 296, - BLOB = 297, - BYTE = 298, - CODETABLE = 299, - SMART_TABLE = 300, - DICTIONARY = 301, - COMPLEX_CODETABLE = 302, - LOOKUP = 303, - ALIAS = 304, - UNALIAS = 305, - META = 306, - POS = 307, - INTCONST = 308, - TRANS = 309, - FLAGBIT = 310, - CONCEPT = 311, - GETENV = 312, - HASH_ARRAY = 313, - CONCEPT_NOFAIL = 314, - NIL = 315, - DUMMY = 316, - MODIFY = 317, - READ_ONLY = 318, - STRING_TYPE = 319, - LONG_TYPE = 320, - DOUBLE_TYPE = 321, - NO_COPY = 322, - DUMP = 323, - JSON = 324, - XML = 325, - NO_FAIL = 326, - EDITION_SPECIFIC = 327, - OVERRIDE = 328, - HIDDEN = 329, - CAN_BE_MISSING = 330, - MISSING = 331, - CONSTRAINT = 332, - COPY_OK = 333, - WHEN = 334, - SET = 335, - SET_NOFAIL = 336, - WRITE = 337, - APPEND = 338, - PRINT = 339, - EXPORT = 340, - REMOVE = 341, - RENAME = 342, - SKIP = 343, - PAD = 344, - SECTION_PADDING = 345, - MESSAGE = 346, - MESSAGE_COPY = 347, - PADTO = 348, - PADTOEVEN = 349, - PADTOMULTIPLE = 350, - G1_HALF_BYTE = 351, - G1_MESSAGE_LENGTH = 352, - G1_SECTION4_LENGTH = 353, - SECTION_LENGTH = 354, - LENGTH = 355, - FLAG = 356, - ITERATOR = 357, - NEAREST = 358, - BOX = 359, - KSEC = 360, - ASSERT = 361, - SUBSTR = 362, - CASE = 363, - SWITCH = 364, - DEFAULT = 365, - EQ = 366, - NE = 367, - GE = 368, - LE = 369, - LT = 370, - GT = 371, - BIT = 372, - BITOFF = 373, - AND = 374, - OR = 375, - NOT = 376, - IS = 377, - IDENT = 378, - STRING = 379, - INTEGER = 380, - FLOAT = 381 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + LOWERCASE = 258, /* LOWERCASE */ + IF = 259, /* IF */ + IF_TRANSIENT = 260, /* IF_TRANSIENT */ + ELSE = 261, /* ELSE */ + END = 262, /* END */ + CLOSE = 263, /* CLOSE */ + UNSIGNED = 264, /* UNSIGNED */ + TEMPLATE = 265, /* TEMPLATE */ + TEMPLATE_NOFAIL = 266, /* TEMPLATE_NOFAIL */ + TRIGGER = 267, /* TRIGGER */ + ASCII = 268, /* ASCII */ + GROUP = 269, /* GROUP */ + NON_ALPHA = 270, /* NON_ALPHA */ + KSEC1EXPVER = 271, /* KSEC1EXPVER */ + LABEL = 272, /* LABEL */ + LIST = 273, /* LIST */ + IS_IN_LIST = 274, /* IS_IN_LIST */ + IS_IN_DICT = 275, /* IS_IN_DICT */ + IS_INTEGER = 276, /* IS_INTEGER */ + TO_INTEGER = 277, /* TO_INTEGER */ + TO_STRING = 278, /* TO_STRING */ + SEX2DEC = 279, /* SEX2DEC */ + WHILE = 280, /* WHILE */ + IBMFLOAT = 281, /* IBMFLOAT */ + SIGNED = 282, /* SIGNED */ + UINT8 = 283, /* UINT8 */ + INT8 = 284, /* INT8 */ + UINT16 = 285, /* UINT16 */ + INT16 = 286, /* INT16 */ + UINT16_LITTLE_ENDIAN = 287, /* UINT16_LITTLE_ENDIAN */ + INT16_LITTLE_ENDIAN = 288, /* INT16_LITTLE_ENDIAN */ + UINT32 = 289, /* UINT32 */ + INT32 = 290, /* INT32 */ + UINT32_LITTLE_ENDIAN = 291, /* UINT32_LITTLE_ENDIAN */ + INT32_LITTLE_ENDIAN = 292, /* INT32_LITTLE_ENDIAN */ + UINT64 = 293, /* UINT64 */ + INT64 = 294, /* INT64 */ + UINT64_LITTLE_ENDIAN = 295, /* UINT64_LITTLE_ENDIAN */ + INT64_LITTLE_ENDIAN = 296, /* INT64_LITTLE_ENDIAN */ + BLOB = 297, /* BLOB */ + BYTE = 298, /* BYTE */ + CODETABLE = 299, /* CODETABLE */ + SMART_TABLE = 300, /* SMART_TABLE */ + DICTIONARY = 301, /* DICTIONARY */ + COMPLEX_CODETABLE = 302, /* COMPLEX_CODETABLE */ + LOOKUP = 303, /* LOOKUP */ + ALIAS = 304, /* ALIAS */ + UNALIAS = 305, /* UNALIAS */ + META = 306, /* META */ + POS = 307, /* POS */ + INTCONST = 308, /* INTCONST */ + TRANS = 309, /* TRANS */ + FLAGBIT = 310, /* FLAGBIT */ + CONCEPT = 311, /* CONCEPT */ + GETENV = 312, /* GETENV */ + HASH_ARRAY = 313, /* HASH_ARRAY */ + CONCEPT_NOFAIL = 314, /* CONCEPT_NOFAIL */ + NIL = 315, /* NIL */ + DUMMY = 316, /* DUMMY */ + MODIFY = 317, /* MODIFY */ + READ_ONLY = 318, /* READ_ONLY */ + STRING_TYPE = 319, /* STRING_TYPE */ + LONG_TYPE = 320, /* LONG_TYPE */ + DOUBLE_TYPE = 321, /* DOUBLE_TYPE */ + NO_COPY = 322, /* NO_COPY */ + DUMP = 323, /* DUMP */ + JSON = 324, /* JSON */ + XML = 325, /* XML */ + NO_FAIL = 326, /* NO_FAIL */ + EDITION_SPECIFIC = 327, /* EDITION_SPECIFIC */ + OVERRIDE = 328, /* OVERRIDE */ + HIDDEN = 329, /* HIDDEN */ + CAN_BE_MISSING = 330, /* CAN_BE_MISSING */ + MISSING = 331, /* MISSING */ + CONSTRAINT = 332, /* CONSTRAINT */ + COPY_OK = 333, /* COPY_OK */ + WHEN = 334, /* WHEN */ + SET = 335, /* SET */ + SET_NOFAIL = 336, /* SET_NOFAIL */ + WRITE = 337, /* WRITE */ + APPEND = 338, /* APPEND */ + PRINT = 339, /* PRINT */ + EXPORT = 340, /* EXPORT */ + REMOVE = 341, /* REMOVE */ + RENAME = 342, /* RENAME */ + SKIP = 343, /* SKIP */ + PAD = 344, /* PAD */ + SECTION_PADDING = 345, /* SECTION_PADDING */ + MESSAGE = 346, /* MESSAGE */ + MESSAGE_COPY = 347, /* MESSAGE_COPY */ + PADTO = 348, /* PADTO */ + PADTOEVEN = 349, /* PADTOEVEN */ + PADTOMULTIPLE = 350, /* PADTOMULTIPLE */ + G1_HALF_BYTE = 351, /* G1_HALF_BYTE */ + G1_MESSAGE_LENGTH = 352, /* G1_MESSAGE_LENGTH */ + G1_SECTION4_LENGTH = 353, /* G1_SECTION4_LENGTH */ + SECTION_LENGTH = 354, /* SECTION_LENGTH */ + LENGTH = 355, /* LENGTH */ + FLAG = 356, /* FLAG */ + ITERATOR = 357, /* ITERATOR */ + NEAREST = 358, /* NEAREST */ + BOX = 359, /* BOX */ + KSEC = 360, /* KSEC */ + ASSERT = 361, /* ASSERT */ + SUBSTR = 362, /* SUBSTR */ + CASE = 363, /* CASE */ + SWITCH = 364, /* SWITCH */ + DEFAULT = 365, /* DEFAULT */ + EQ = 366, /* EQ */ + NE = 367, /* NE */ + GE = 368, /* GE */ + LE = 369, /* LE */ + LT = 370, /* LT */ + GT = 371, /* GT */ + BIT = 372, /* BIT */ + BITOFF = 373, /* BITOFF */ + AND = 374, /* AND */ + OR = 375, /* OR */ + NOT = 376, /* NOT */ + IS = 377, /* IS */ + IDENT = 378, /* IDENT */ + STRING = 379, /* STRING */ + INTEGER = 380, /* INTEGER */ + FLOAT = 381 /* FLOAT */ }; + typedef enum grib_yytokentype grib_yytoken_kind_t; #endif -/* Tokens. */ +/* Token kinds. */ +#define YYEMPTY -2 +#define YYEOF 0 +#define YYerror 256 +#define YYUNDEF 257 #define LOWERCASE 258 #define IF 259 #define IF_TRANSIENT 260 @@ -319,11 +329,11 @@ union YYSTYPE grib_concept_condition *concept_condition; grib_concept_value *concept_value; grib_hash_array_value *hash_array_value; - grib_case *case_value; + grib_case *case_value; grib_rule *rules; grib_rule_entry *rule_entry; -#line 327 "y.tab.h" +#line 337 "y.tab.h" }; typedef union YYSTYPE YYSTYPE; @@ -334,6 +344,8 @@ typedef union YYSTYPE YYSTYPE; extern YYSTYPE grib_yylval; + int grib_yyparse (void); + #endif /* !YY_YY_Y_TAB_H_INCLUDED */ diff --git a/src/iterator_class_hierarchy.txt b/src/iterator_class_hierarchy.txt index 730373f0d..e692fa5c7 100644 --- a/src/iterator_class_hierarchy.txt +++ b/src/iterator_class_hierarchy.txt @@ -1,5 +1,5 @@ - Iterator Class Hierarchy + |-grib_iterator_class_gen |---grib_iterator_class_gaussian_reduced |---grib_iterator_class_lambert_azimuthal_equal_area diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 867b18a9a..cc7a94f9b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -32,6 +32,7 @@ list(APPEND test_c_bins grib_optimize_scaling_sh grib_set_force grib_ecc-386 + grib_ecc-1467 grib_ecc-1431 bufr_ecc-517 bufr_ecc-1288 @@ -44,6 +45,7 @@ list(APPEND test_c_bins grib_sh_ieee64 grib_ieee grib_set_bytes + grib_copy_message grib_packing_order grib_sh_imag grib_sh_spectral_complex @@ -82,6 +84,7 @@ if( HAVE_BUILD_TOOLS ) grib_uerra grib_s2s grib_fire + # grib_true_imagery grib_element grib_suppressed grib_2nd_order_numValues @@ -199,6 +202,7 @@ if( HAVE_BUILD_TOOLS ) grib_ecc-1030 grib_ecc-1397 grib_ecc-1425 + grib_ecc-1467 grib_set_bytes grib_set_force bufr_ecc-556 @@ -239,6 +243,7 @@ if( HAVE_BUILD_TOOLS ) grib_grid_mercator grib_global grib_concept + grib_copy_message grib_decimalPrecision grib_bitsPerValue grib_get_fail @@ -311,7 +316,8 @@ if( HAVE_BUILD_TOOLS ) COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh RESOURCES asca_139.t1.ref TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs - eccodes_download_bufrs eccodes_download_metars eccodes_download_gts ) + eccodes_download_bufrs eccodes_download_bufr_refs + eccodes_download_metars eccodes_download_gts ) endforeach() if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS ) @@ -348,7 +354,7 @@ if( HAVE_BUILD_TOOLS ) TYPE SCRIPT CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-1288.sh - TEST_DEPENDS eccodes_download_bufrs ) + TEST_DEPENDS eccodes_download_bufrs eccodes_download_bufr_refs ) if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS ) diff --git a/tests/bufr_count.sh b/tests/bufr_count.sh index a00c3fee9..14c1e4f0f 100755 --- a/tests/bufr_count.sh +++ b/tests/bufr_count.sh @@ -10,6 +10,9 @@ . ./include.ctest.sh +label="bufr_count_test" +temp=temp.$label.truncated.bufr + # Enter data dir cd ${data_dir}/bufr input=syno_multi.bufr @@ -23,7 +26,6 @@ count=`${tools_dir}/codes_count $input` # Files with invalid (unreadable) messages # ----------------------------------------- -temp=$input.truncated # BUFR file size = 660 bytes. Write out only the first 640 bytes # thereby creating an unreadable final message head -c 640 $input > $temp @@ -39,5 +41,5 @@ set -e vcount=`${tools_dir}/bufr_count -f $temp` [ "$vcount" = "2" ] - +# Clean up rm -f $temp diff --git a/tests/bufr_filter_extract_subsets.sh b/tests/bufr_filter_extract_subsets.sh index cd64e0f9e..4987ddf18 100755 --- a/tests/bufr_filter_extract_subsets.sh +++ b/tests/bufr_filter_extract_subsets.sh @@ -26,6 +26,17 @@ fBufrTmp2=temp2.${label}.bufr # Define filter rules file fRules=${label}.filter +#----------------------------------------------------------- +# Test: extract without unpacking +#----------------------------------------------------------- +set +e +echo 'set extractSubset=1; set doExtractSubsets=1;' | ${tools_dir}/codes_bufr_filter - aaen_55.bufr > $fLog 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Could not extract subset" $fLog +rm -f $fLog + #----------------------------------------------------------- # Test: extract subsets uncompressed data #----------------------------------------------------------- diff --git a/tests/bufr_filter_misc.sh b/tests/bufr_filter_misc.sh index 80c68e9b5..6e2171a4f 100755 --- a/tests/bufr_filter_misc.sh +++ b/tests/bufr_filter_misc.sh @@ -564,6 +564,27 @@ set -e ${tools_dir}/codes_bufr_filter -f $fRules $f 2>>$fLog 1>>$fLog +#----------------------------------------------------------- +# Test: with invalid string key +#----------------------------------------------------------- +cat > $fRules <> $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 #---------------------------------------------------- diff --git a/tests/create_test.sh b/tests/create_test.sh index 6dd1b143b..47e04c547 100755 --- a/tests/create_test.sh +++ b/tests/create_test.sh @@ -34,10 +34,14 @@ cat <&2 diff --git a/tests/tests.ecmwf/chemical.c b/tests/deprecated/chemical.c similarity index 100% rename from tests/tests.ecmwf/chemical.c rename to tests/deprecated/chemical.c diff --git a/tests/tests.ecmwf/compare.c b/tests/deprecated/compare.c similarity index 100% rename from tests/tests.ecmwf/compare.c rename to tests/deprecated/compare.c diff --git a/tests/tests.ecmwf/compatibility.c b/tests/deprecated/compatibility.c similarity index 100% rename from tests/tests.ecmwf/compatibility.c rename to tests/deprecated/compatibility.c diff --git a/tests/tests.ecmwf/compatibility.test b/tests/deprecated/compatibility.test similarity index 100% rename from tests/tests.ecmwf/compatibility.test rename to tests/deprecated/compatibility.test diff --git a/tests/tests.ecmwf/compatibility_ex.c b/tests/deprecated/compatibility_ex.c similarity index 100% rename from tests/tests.ecmwf/compatibility_ex.c rename to tests/deprecated/compatibility_ex.c diff --git a/tests/tests.ecmwf/concept b/tests/deprecated/concept similarity index 100% rename from tests/tests.ecmwf/concept rename to tests/deprecated/concept diff --git a/tests/tests.ecmwf/concept.test b/tests/deprecated/concept.test similarity index 100% rename from tests/tests.ecmwf/concept.test rename to tests/deprecated/concept.test diff --git a/tests/tests.ecmwf/deserialize.c b/tests/deprecated/deserialize.c similarity index 100% rename from tests/tests.ecmwf/deserialize.c rename to tests/deprecated/deserialize.c diff --git a/tests/tests.ecmwf/dump.test b/tests/deprecated/dump.test similarity index 100% rename from tests/tests.ecmwf/dump.test rename to tests/deprecated/dump.test diff --git a/tests/tests.ecmwf/filter b/tests/deprecated/filter similarity index 100% rename from tests/tests.ecmwf/filter rename to tests/deprecated/filter diff --git a/tests/tests.ecmwf/filter.test b/tests/deprecated/filter.test similarity index 100% rename from tests/tests.ecmwf/filter.test rename to tests/deprecated/filter.test diff --git a/tests/tests.ecmwf/grib1to2.c b/tests/deprecated/grib1to2.c similarity index 100% rename from tests/tests.ecmwf/grib1to2.c rename to tests/deprecated/grib1to2.c diff --git a/tests/tests.ecmwf/grib1to2.test b/tests/deprecated/grib1to2.test similarity index 100% rename from tests/tests.ecmwf/grib1to2.test rename to tests/deprecated/grib1to2.test diff --git a/tests/tests.ecmwf/grib_ls b/tests/deprecated/grib_ls similarity index 100% rename from tests/tests.ecmwf/grib_ls rename to tests/deprecated/grib_ls diff --git a/tests/tests.ecmwf/grib_ls.test b/tests/deprecated/grib_ls.test similarity index 100% rename from tests/tests.ecmwf/grib_ls.test rename to tests/deprecated/grib_ls.test diff --git a/tests/tests.ecmwf/gribex b/tests/deprecated/gribex similarity index 100% rename from tests/tests.ecmwf/gribex rename to tests/deprecated/gribex diff --git a/tests/tests.ecmwf/gribex.test b/tests/deprecated/gribex.test similarity index 100% rename from tests/tests.ecmwf/gribex.test rename to tests/deprecated/gribex.test diff --git a/tests/tests.ecmwf/memory.c b/tests/deprecated/memory.c similarity index 100% rename from tests/tests.ecmwf/memory.c rename to tests/deprecated/memory.c diff --git a/tests/tests.ecmwf/memory.test b/tests/deprecated/memory.test similarity index 100% rename from tests/tests.ecmwf/memory.test rename to tests/deprecated/memory.test diff --git a/tests/tests.ecmwf/packing.c b/tests/deprecated/packing.c similarity index 100% rename from tests/tests.ecmwf/packing.c rename to tests/deprecated/packing.c diff --git a/tests/tests.ecmwf/packing.test b/tests/deprecated/packing.test similarity index 100% rename from tests/tests.ecmwf/packing.test rename to tests/deprecated/packing.test diff --git a/tests/tests.ecmwf/request.c b/tests/deprecated/request.c similarity index 100% rename from tests/tests.ecmwf/request.c rename to tests/deprecated/request.c diff --git a/tests/tests.ecmwf/sample.c b/tests/deprecated/sample.c similarity index 100% rename from tests/tests.ecmwf/sample.c rename to tests/deprecated/sample.c diff --git a/tests/tests.ecmwf/sample1.c b/tests/deprecated/sample1.c similarity index 100% rename from tests/tests.ecmwf/sample1.c rename to tests/deprecated/sample1.c diff --git a/tests/tests.ecmwf/serialize.c b/tests/deprecated/serialize.c similarity index 100% rename from tests/tests.ecmwf/serialize.c rename to tests/deprecated/serialize.c diff --git a/tests/tests.ecmwf/set b/tests/deprecated/set similarity index 100% rename from tests/tests.ecmwf/set rename to tests/deprecated/set diff --git a/tests/tests.ecmwf/set.test b/tests/deprecated/set.test similarity index 100% rename from tests/tests.ecmwf/set.test rename to tests/deprecated/set.test diff --git a/tests/tests.ecmwf/set1to2 b/tests/deprecated/set1to2 similarity index 100% rename from tests/tests.ecmwf/set1to2 rename to tests/deprecated/set1to2 diff --git a/tests/tests.ecmwf/set1to2.test b/tests/deprecated/set1to2.test similarity index 100% rename from tests/tests.ecmwf/set1to2.test rename to tests/deprecated/set1to2.test diff --git a/tests/tests.ecmwf/skip.t b/tests/deprecated/skip.t similarity index 100% rename from tests/tests.ecmwf/skip.t rename to tests/deprecated/skip.t diff --git a/tests/tests.ecmwf/test.h b/tests/deprecated/test.h similarity index 100% rename from tests/tests.ecmwf/test.h rename to tests/deprecated/test.h diff --git a/tests/tests.ecmwf/test.ksh b/tests/deprecated/test.ksh similarity index 100% rename from tests/tests.ecmwf/test.ksh rename to tests/deprecated/test.ksh diff --git a/tests/tests.ecmwf/tests b/tests/deprecated/tests similarity index 100% rename from tests/tests.ecmwf/tests rename to tests/deprecated/tests diff --git a/tests/tests.ecmwf/values.c b/tests/deprecated/values.c similarity index 100% rename from tests/tests.ecmwf/values.c rename to tests/deprecated/values.c diff --git a/tests/tests.ecmwf/values.test b/tests/deprecated/values.test similarity index 100% rename from tests/tests.ecmwf/values.test rename to tests/deprecated/values.test diff --git a/tests/grib_ccsds.sh b/tests/grib_ccsds.sh index 36446471e..1c53ed5a2 100755 --- a/tests/grib_ccsds.sh +++ b/tests/grib_ccsds.sh @@ -21,6 +21,11 @@ outfile2=temp.$label.2 rm -f $outfile1 $outfile2 +# Convert a non-constant grib2 file (Note: not using -r) +grib2_sample=$ECCODES_SAMPLES_PATH/gg_sfc_grib2.tmpl +${tools_dir}/grib_set -s packingType=grid_ccsds $grib2_sample $outfile1 +${tools_dir}/grib_compare -c data:n $grib2_sample $outfile1 + # ECC-1263 # --------- diff --git a/tests/grib_check_gaussian_grids.sh b/tests/grib_check_gaussian_grids.sh index ec6adb8b7..3d5dc7169 100755 --- a/tests/grib_check_gaussian_grids.sh +++ b/tests/grib_check_gaussian_grids.sh @@ -10,7 +10,8 @@ . ./include.ctest.sh label="grib_check_gaussian_grids_test" -temp=temp.$label.grib +tempGrib=temp.$label.grib +tempText=temp.$label.txt # Check all sample GRIBs with a Gaussian grid @@ -20,14 +21,44 @@ for gg in ${samples_dir}/reduced_gg_* ${samples_dir}/regular_gg_*; do grib_check_key_equals $gg "global" 1 done +for gg in ${samples_dir}/reduced_gg_*tmpl; do + ${tools_dir}/grib_set -s global=1 $gg $tempGrib + ${tools_dir}/grib_check_gaussian_grid $tempGrib +done + + # Set wrong angle and re-test. Should fail input=$samples_dir/reduced_gg_pl_1280_grib2.tmpl -${tools_dir}/grib_set -s longitudeOfLastGridPoint=359929680 $input $temp +${tools_dir}/grib_set -s longitudeOfLastGridPoint=359929680 $input $tempGrib set +e -${tools_dir}/grib_check_gaussian_grid -v $temp +${tools_dir}/grib_check_gaussian_grid -v $tempGrib 2> $tempText status=$? set -e [ $status -eq 1 ] +grep -q "Error: longitudeOfLastGridPointInDegrees.*but should be" $tempText -rm -f $temp +# Set wrong numberOfDataPoints and re-test. Should fail +input=$samples_dir/reduced_gg_pl_96_grib2.tmpl +${tools_dir}/grib_set -s numberOfDataPoints=44 $input $tempGrib +set +e +${tools_dir}/grib_check_gaussian_grid -v $tempGrib 2> $tempText +status=$? +set -e +[ $status -eq 1 ] +grep -q "Error: Sum of pl array 50662 does not match numberOfDataPoints 44" $tempText + + +# Set wrong numberOfValues and re-test. Should fail +input=$samples_dir/reduced_gg_pl_96_grib2.tmpl +${tools_dir}/grib_set -s numberOfValues=44 $input $tempGrib +set +e +${tools_dir}/grib_check_gaussian_grid -v $tempGrib 2> $tempText +status=$? +set -e +[ $status -eq 1 ] +cat $tempText +grep -q "Error: Sum of pl array 50662 does not match numberOfValues 44" $tempText + + +rm -f $tempGrib $tempText diff --git a/tests/grib_copy_message.cc b/tests/grib_copy_message.cc new file mode 100644 index 000000000..0fd6bb021 --- /dev/null +++ b/tests/grib_copy_message.cc @@ -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. + */ +#include +#undef NDEBUG +#include +#include "eccodes.h" + +int main(int argc, char* argv[]) +{ + FILE* in = NULL; + codes_handle* source_handle = NULL; + int err = 0; + size_t totalLength = 0, size = 0; + unsigned char* buffer = NULL; + codes_handle* new_handle = NULL; + + assert (argc == 3); + + in = fopen(argv[1], "rb"); + assert(in); + + source_handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err); + assert(source_handle); + + // How big is the input GRIB message? + CODES_CHECK(codes_get_message_size(source_handle, &totalLength), 0); + + // Allocate a buffer large enough to hold the message + buffer = (unsigned char*)malloc(totalLength); + size = totalLength; + + // Take a copy of the message into buffer. Now we own it + CODES_CHECK(codes_get_message_copy(source_handle, buffer, &size), 0); + assert(size == totalLength); + codes_handle_delete(source_handle); + + // Now buffer contains a copy of the message + new_handle = codes_handle_new_from_message(0, buffer, totalLength); + assert(new_handle); + + // Change something and write it out + CODES_CHECK(codes_set_long(new_handle, "hour", 18), 0); + CODES_CHECK(codes_write_message(new_handle, argv[2], "w"), 0); + codes_handle_delete(new_handle); + free(buffer); + + fclose(in); + + return 0; +} diff --git a/tests/grib_copy_message.sh b/tests/grib_copy_message.sh new file mode 100755 index 000000000..4d0786340 --- /dev/null +++ b/tests/grib_copy_message.sh @@ -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_copy_message_test" +temp=temp.$label.grib + +infile=$data_dir/sample.grib2 +$EXEC ${test_dir}/grib_copy_message $infile $temp + +# The hour key was changed but nothing else +${tools_dir}/grib_compare -b hour $infile $temp + +# Clean up test outputs +rm -f $temp diff --git a/tests/grib_data_quality_checks.sh b/tests/grib_data_quality_checks.sh index 6a6177cfd..4123a2785 100755 --- a/tests/grib_data_quality_checks.sh +++ b/tests/grib_data_quality_checks.sh @@ -200,13 +200,26 @@ unset ECCODES_EXTRA_DEFINITION_PATH # Check CCSDS encoding too # ------------------------- +if [ $HAVE_AEC -eq 1 ]; then + export ECCODES_GRIB_DATA_QUALITY_CHECKS=1 + set +e + ${tools_dir}/grib_set -s scaleValuesBy=1000 $sample_ccsds $tempGrib2 2>$tempErr + status=$? + set -e + [ $status -ne 0 ] +fi + +# Invalid shortName export ECCODES_GRIB_DATA_QUALITY_CHECKS=1 +input2=${data_dir}/reduced_gaussian_surface.grib2 +${tools_dir}/grib_set -s discipline=254 $input2 $tempOut +grib_check_key_equals $tempOut 'shortName' 'unknown' set +e -${tools_dir}/grib_set -s scaleValuesBy=1000 $sample_ccsds $tempGrib2 2>$tempErr +${tools_dir}/grib_set -s scaleValuesBy=2 $tempOut $tempGrib2 2>$tempErr status=$? set -e [ $status -ne 0 ] - +grep -q "Invalid metadata: shortName=unknown" $tempErr # Clean up rm -rf $tempDir diff --git a/tests/grib_double_cmp.cc b/tests/grib_double_cmp.cc index 2f943f1a6..26a5e93d7 100644 --- a/tests/grib_double_cmp.cc +++ b/tests/grib_double_cmp.cc @@ -62,8 +62,8 @@ int main(int argc, char** argv) for (i = 0; i < 100; i++) { /* get a particular data value */ GRIB_CHECK(grib_get_double_element(h, "values", i, &element_value), 0); - if (element_value != values[i]) { + printf("ERROR: element_value=%g != values[%d]=%g\n", element_value, i, values[i]); exit(1); } } diff --git a/tests/grib_double_cmp.sh b/tests/grib_double_cmp.sh index edba98d95..ca01eb02b 100755 --- a/tests/grib_double_cmp.sh +++ b/tests/grib_double_cmp.sh @@ -14,12 +14,22 @@ . ./include.ctest.sh -infile=${data_dir}/grid_ieee.grib +infiles=" + grid_ieee.grib + regular_latlon_surface_constant.grib2 + gfs.complex.mvmu.grib2 + constant_field.grib2 + missing.grib2" -# if [ ! -f ${infile} ] -# then -# echo no data to test -# exit 1 -# fi +if [ $HAVE_JPEG -eq 1 ]; then + infiles="jpeg.grib2 "$infiles +fi -$EXEC ${test_dir}/grib_double_cmp ${infile} +if [ $HAVE_AEC -eq 1 ]; then + infiles="ccsds.grib2 "$infiles +fi + +for f in $infiles; do + infile=$data_dir/$f + $EXEC ${test_dir}/grib_double_cmp ${infile} +done diff --git a/tests/grib_ecc-1212.sh b/tests/grib_ecc-1212.sh index a26e69395..7ae426756 100755 --- a/tests/grib_ecc-1212.sh +++ b/tests/grib_ecc-1212.sh @@ -79,6 +79,11 @@ echo "2 ecmf 20200805 1200 an regular_ll surface 0 t cat $tempOut diff -w $tempRef $tempOut +# Check "time" namespace +${tools_dir}/grib_get -n time $tempGrib > $tempOut +echo "h 20200804 0000 36" > $tempRef +diff -w $tempRef $tempOut + # numberOfForecastsUsedInLocalTime > 1 # ------------------------------------ @@ -110,6 +115,13 @@ ${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample_grib2 grib_check_key_equals $tempGrib selectedFcIndex,step '1 4' grib_check_key_equals $tempGrib mars.date,mars.time '20220607 300' +for pdtn in 88 92 93 94 95 96 97 98; do + ${tools_dir}/grib_set -s \ + tablesVersion=30,productDefinitionTemplateNumber=$pdtn,numberOfForecastsUsedInLocalTime=1 \ + $sample_grib2 $tempGrib + + grib_check_key_equals $tempGrib time.stepUnits:s,time.dataDate,time.dataTime 'h 0 0' +done # Clean up rm -f $tempGrib $tempFilt $tempOut $tempRef diff --git a/tests/grib_ecc-1467.cc b/tests/grib_ecc-1467.cc new file mode 100644 index 000000000..69c5f73e9 --- /dev/null +++ b/tests/grib_ecc-1467.cc @@ -0,0 +1,86 @@ +/* + * (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 +#include "eccodes.h" +#include "grib_api_internal.h" + +int main(int argc, char** argv) +{ + int err = 0; + float* fvalues = NULL; // data values as floats + double* dvalues = NULL; // data values as doubles + size_t values_len = 0; // number of data points + size_t i = 0; + + double abs_error = 0; + const double max_abs_error = 1e-03; + const double tolerance = 1e-03; + double dmin; + double dmax; + float fval; + + FILE* in = NULL; + const char* filename = 0; + codes_handle* h = NULL; + + if (argc != 2) { + fprintf(stderr, "usage: %s file\n", argv[0]); + return 1; + } + filename = argv[1]; + + printf("Opening %s\n", filename); + in = fopen(filename, "rb"); + Assert(in); + + h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err); + Assert(h); + + CODES_CHECK(codes_get_size(h, "values", &values_len), 0); + + fvalues = (float*)malloc(values_len * sizeof(float)); + dvalues = (double*)malloc(values_len * sizeof(double)); + CODES_CHECK(codes_get_float_array(h, "values", fvalues, &values_len), 0); + CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0); + + for (i = 0; i < values_len; i++) { + abs_error = fabs(dvalues[i] - (double)fvalues[i]); + if (abs_error > max_abs_error) { + fprintf(stderr, "ERROR:\n\tfvalue %e\n\tdvalue %e\n\terror %e\n\tmax_abs_error %e\n", + fvalues[i], dvalues[i], abs_error, max_abs_error); + Assert(!"Absolute error test failed\n"); + } + + dmin = dvalues[i] >= 0 ? dvalues[i] / (1 + tolerance) : dvalues[i] * (1 + tolerance); + dmax = dvalues[i] >= 0 ? dvalues[i] * (1 + tolerance) : dvalues[i] / (1 + tolerance); + fval = fvalues[i]; + + if (!((dmin <= fval) && (fval <= dmax))) { + fprintf(stderr, "Error:\n"); + fprintf(stderr, "dvalue: %f, fvalue: %f\n", dvalues[i], fvalues[i]); + fprintf(stderr, "\tmin < fvalue < max = %.20e < %.20e < %.20e FAILED\n", + dmin, fvalues[i], dmax); + fprintf(stderr, "\tfvalue - min = %.20e (%s)\n", + fvalues[i] - dmin, fvalues[i] - dmin >= 0 ? "OK" : "FAILED (should be positive)"); + fprintf(stderr, "\tmax - fvalue = %.20e (%s)\n", + dmax - fvalues[i], dmax - fvalues[i] >= 0 ? "OK" : "FAILED (should be positive)"); + + Assert(!"Relative tolerance test failed\n"); + } + } + + free(fvalues); + free(dvalues); + + codes_handle_delete(h); + fclose(in); + return 0; +} diff --git a/tests/grib_ecc-1467.sh b/tests/grib_ecc-1467.sh new file mode 100755 index 000000000..e666f7a0d --- /dev/null +++ b/tests/grib_ecc-1467.sh @@ -0,0 +1,45 @@ +#!/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 + +# Constant fields +gfiles="constant_field.grib1" # grid_simple, edition=1 +gfiles="$gfiles constant_field.grib2" # grid_simple, edition=2 + +# Grid simple +gfiles="$gfiles sst_globus0083.grib" # grid_simple, edition=1 +gfiles="$gfiles reduced_latlon_surface.grib1" # grid_simple, edition=1 +gfiles="$gfiles reduced_latlon_surface.grib2" # grid_simple, edition=2 +gfiles="$gfiles regular_latlon_surface.grib1" # grid_simple, edition=1 +gfiles="$gfiles regular_latlon_surface.grib2" # grid_simple, edition=2 + +# Spectral complex +gfiles="$gfiles spherical_pressure_level.grib1" # spectral_complex, edition=1 +gfiles="$gfiles spherical_pressure_level.grib2" # spectral_complex, edition=2 + +# Grid complex +#gfiles="$gfiles " # grid_complex, edition=1 +gfiles="$gfiles gfs.complex.mvmu.grib2" # grid_complex, edition=2, g22order_packing + +# Second order +gfiles="$gfiles lfpw.grib1" # grid_second_order, edition=1 +#gfiles="$gfiles " # grid_second_order, edition=2 + +# CCSDS +if [ $HAVE_AEC -eq 1 ]; then + gfiles="$gfiles ccsds.grib2" +fi + +for f in $gfiles; do + input=${data_dir}/$f + # ${tools_dir}/grib_ls -w count=1 -p numberOfDataPoints,numberOfCodedValues,numberOfMissing,avg $input + $EXEC ${test_dir}/grib_ecc-1467 $input +done diff --git a/tests/grib_filter.sh b/tests/grib_filter.sh index e85d5727b..c6c0a48f7 100755 --- a/tests/grib_filter.sh +++ b/tests/grib_filter.sh @@ -242,6 +242,29 @@ EOF diff $tempRef $tempOut +echo "Test environment variables" +# ----------------------------------------- +input="${samp_dir}/GRIB2.tmpl" +cat >$tempFilt < $tempOut +grep -q "undefined" $tempOut +CDS=0 ${tools_dir}/grib_filter $tempFilt $input > $tempOut +grep -q "defined but equal to 0" $tempOut +# Set to a non-zero integer +CDS=1 ${tools_dir}/grib_filter $tempFilt $input > $tempOut +grep -q "defined and equal to 1" $tempOut +CDS=-42 ${tools_dir}/grib_filter $tempFilt $input > $tempOut +grep -q "defined and equal to -42" $tempOut + + echo "Test IEEE float overflow" # ----------------------------------------- input="${samp_dir}/GRIB2.tmpl" @@ -257,6 +280,26 @@ set -e grep -q "ECCODES ERROR.*Number is too large" $tempOut +echo "Padded count for filenames" +# ----------------------------------------- +input=${data_dir}/tigge_af_ecmwf.grib2 +tempDir=temp.${label}.dir +rm -fr $tempDir +mkdir -p $tempDir +cd $tempDir +cat >$tempFilt < $REDIRECT > $REDIRECT - +${tools_dir}/grib_get -p boomerang ${data_dir}/regular_latlon_surface.grib1 2> $REDIRECT > $REDIRECT if [ $? -eq 0 ] ; then - # Should not have succeeded - exit 1; + exit 1; # Should not have succeeded fi +set -e + +# ECC-1551: Print which key does not exist +set +e +${tools_dir}/grib_get -p Ni,Nh,Nj $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Nh (Key/value not found)" $tempText + +rm -f $tempText diff --git a/tests/grib_global.sh b/tests/grib_global.sh index c62b616e8..bc2705fb1 100755 --- a/tests/grib_global.sh +++ b/tests/grib_global.sh @@ -9,6 +9,8 @@ . ./include.ctest.sh +label="grib_global_test" + # Check Gaussian grids files_global=" reduced_gaussian_lsm.grib1 @@ -49,3 +51,39 @@ for gg in $files_subarea; do filepath=${data_dir}/$gg grib_check_key_equals $filepath "global" 0 done + + +# ECC-1542: Invalid pl array in a Gaussian grid +# ----------------------------------------------- +sample1=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib1.tmpl +sample2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl +tempGrib=temp.$label.grib +tempText=temp.$label.txt +tempFilt=temp.$label.filt + +# Insert a zero into the pl array +cat > $tempFilt < $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Invalid pl array: entry at index=3 is zero" $tempText + +${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample1 +set +e +${tools_dir}/grib_get -l 0,0 $tempGrib > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Invalid pl array: entry at index=3 is zero" $tempText + + +# Clean up +rm -f $tempGrib $tempText $tempFilt diff --git a/tests/grib_iterator.sh b/tests/grib_iterator.sh index b6c3b3bc2..c8e0ffe78 100755 --- a/tests/grib_iterator.sh +++ b/tests/grib_iterator.sh @@ -9,8 +9,9 @@ # . ./include.ctest.sh -set -u -temp=temp.grib_iterator.grib + +label="grib_iterator_test" +temp=temp.$label.txt files="reduced_latlon_surface.grib1 \ reduced_gaussian_pressure_level.grib1 \ @@ -37,7 +38,6 @@ ${tools_dir}/grib_get_data -L%12.6f%11.5f ${data_dir}/regular_latlon_surface.gri ${tools_dir}/grib_get_data -p shortName,level ${data_dir}/regular_latlon_surface.grib2 > $temp grep -q "Latitude Longitude Value shortName level" $temp - # Run on a spectral field - should just print out its values ${tools_dir}/grib_get_data "$samp_dir/sh_ml_grib2.tmpl" diff --git a/tests/grib_level.sh b/tests/grib_level.sh index 822882a8a..2847c64fd 100755 --- a/tests/grib_level.sh +++ b/tests/grib_level.sh @@ -82,6 +82,13 @@ ${tools_dir}/grib_set -s scaledValueOfFirstFixedSurface=15,scaleFactorOfFirstFix res=`${tools_dir}/grib_get -p level:d $temp` [ "$res" = "1.5" ] +# ECC-1081: 'level' is not edition-independent for potential vorticity levels +${tools_dir}/grib_set -s typeOfLevel=potentialVorticity,shortName=q,level=1500 $sample_g1 $temp +${tools_dir}/grib_set -s edition=2 $temp $temp2 +grib_check_key_equals $temp2 'mars.levelist,level,typeOfLevel' '1500 1500 potentialVorticity' +grib_check_key_equals $temp2 'scaleFactorOfFirstFixedSurface,scaledValueOfFirstFixedSurface' '6 1500' + + # GRIB-637 grib2 Potential vorticity surface input=${data_dir}/tigge_pf_ecmwf.grib2 res=`${tools_dir}/grib_get -wcount=7 -F%.20f -p level:d $input` diff --git a/tests/grib_list.sh b/tests/grib_list.sh index bf5d6d20b..c6cba10ad 100755 --- a/tests/grib_list.sh +++ b/tests/grib_list.sh @@ -10,34 +10,40 @@ . ./include.ctest.sh -cat > list.filter < $tempFilt <list.filter<$tempFilt<list.ref<$tempRef< $temp.1 grep -q "iteration.* 23" $temp.1 +# ECC-1540: Local Definition 36 +# -------------------------------- +${tools_dir}/grib_set -s \ + setLocalDefinition=1,localDefinitionNumber=36,paramId=210170,class=rd,type=4v,stream=elda \ + $sample_g2 $temp +grib_check_key_exists $temp mars.number,constituentType,sourceSinkChemicalPhysicalProcess +${tools_dir}/grib_set -s localDefinitionNumber=36 $temp $temp.1 +${tools_dir}/grib_compare $temp $temp.1 # Clean up rm -f $temp $temp.1 $temp.2 $temp.3 diff --git a/tests/grib_local_NCEP.sh b/tests/grib_local_NCEP.sh index 478b57a4b..1cb734fc8 100755 --- a/tests/grib_local_NCEP.sh +++ b/tests/grib_local_NCEP.sh @@ -10,7 +10,8 @@ . ./include.ctest.sh -temp=output.grib_local_NCEP.grib +label="grib_local_NCEP_test" +temp=temp.$label.grib sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl ${tools_dir}/grib_set -s centre=kwbc,discipline=3,parameterCategory=192,parameterNumber=35 $sample $temp diff --git a/tests/grib_ls.sh b/tests/grib_ls.sh index 88036b633..0c19230bc 100755 --- a/tests/grib_ls.sh +++ b/tests/grib_ls.sh @@ -10,8 +10,12 @@ . ./include.ctest.sh -tempLog=temp.ls.log -rm -f $tempLog +label="grib_ls_test" +tempLog=temp.$label.log +temp1=temp.$label.1.txt +temp2=temp.$label.2.txt +tempText=temp.$label.txt +rm -f $temp1 $temp2 $tempText $tempLog sample_g1="$ECCODES_SAMPLES_PATH/GRIB1.tmpl" sample_g2="$ECCODES_SAMPLES_PATH/GRIB2.tmpl" @@ -62,8 +66,7 @@ regular_latlon_surface.grib1 regular_latlon_surface.grib2 " -for file in $files -do +for file in $files; do [ -f "$file" ] echo $file >> $tempLog ${tools_dir}/grib_ls -l 40,28 $file | grep index | awk '{print $4;}' >> $tempLog @@ -72,7 +75,8 @@ done diff $tempLog ls.log rm -f $tempLog -# Test for bug GRIB-56 +echo "Test for bug GRIB-56..." +# ------------------------------ ${tools_dir}/grib_set -s typeOfLevel=depthBelowLandLayer,topLevel=missing regular_latlon_surface.grib1 tmp_rlls.grib1 ${tools_dir}/grib_ls -plevels tmp_rlls.grib1 | grep MISSING>/dev/null @@ -80,27 +84,31 @@ ${tools_dir}/grib_set -s typeOfLevel=depthBelowLandLayer,bottomLevel=missing reg ${tools_dir}/grib_ls -plevels tmp_rlls.grib1 | grep MISSING>/dev/null rm -f tmp_rlls.grib1 -# GRIB-305. GRIB edition 1 file with one large message +echo "GRIB-305. GRIB edition 1 file with one large message..." +# ---------------------------------------------------------- if [ -f "sst_globus0083.grib" ]; then - ${tools_dir}/grib_ls sst_globus0083.grib > /dev/null + ${tools_dir}/grib_ls sst_globus0083.grib > /dev/null fi -# GRIB-387 printing key of type byte +echo "GRIB-387 printing key of type byte..." +# ---------------------------------------------------------- ${tools_dir}/grib_ls -p uuidOfVGrid test_uuid.grib2 > /dev/null type=`${tools_dir}/grib_get -wcount=1 -p typeOfLevel test_uuid.grib2` [ "$type" = "generalVertical" ] -# GRIB-213 nearest with land-sea mask -temp_ls=temp.grib_ls.grib-213.txt -${tools_dir}/grib_ls -l 85,13,1,reduced_gaussian_lsm.grib1 reduced_gaussian_surface.grib1 >$temp_ls -grep -q 'Point chosen #3 index=21 .* distance=11\.' $temp_ls -${tools_dir}/grib_ls -l 53,2,1,reduced_gaussian_lsm.grib1 reduced_gaussian_surface.grib1 >$temp_ls -grep -q 'Point chosen #2 index=749 .* distance=204\.' $temp_ls +echo "GRIB-213 nearest with land-sea mask..." +# ---------------------------------------------------------- +${tools_dir}/grib_ls -l 85,13,1,reduced_gaussian_lsm.grib1 reduced_gaussian_surface.grib1 >$tempText +grep -q 'Point chosen #3 index=21 .* distance=11\.' $tempText + +${tools_dir}/grib_ls -l 53,2,1,reduced_gaussian_lsm.grib1 reduced_gaussian_surface.grib1 >$tempText +grep -q 'Point chosen #2 index=749 .* distance=204\.' $tempText -# ECC-278: grib_ls -n namespace +echo "ECC-278: grib_ls -n namespace..." +# ---------------------------------------------------------- ${tools_dir}/grib_ls -n geography $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib2.tmpl ${tools_dir}/grib_ls -n data $sample_g1 @@ -109,8 +117,6 @@ grib_check_key_equals $sample_g1 angleSubdivisions 1000 grib_check_key_equals $sample_g2 angleSubdivisions 1000000 # Print 'offset' key as string and integer -temp1=temp.grib_ls.1.txt -temp2=temp.grib_ls.2.txt ${tools_dir}/grib_ls -p offset:s tigge_cf_ecmwf.grib2 > $temp1 ${tools_dir}/grib_ls -p offset:i tigge_cf_ecmwf.grib2 > $temp2 diff $temp1 $temp2 @@ -119,5 +125,69 @@ diff $temp1 $temp2 grib_check_key_equals $sample_g2 'section0Pointer,section1Pointer,section3Pointer,section4Pointer' '0_16 16_21 37_72 109_34' -rm -f $temp1 $temp2 -rm -f $temp_ls +echo "Test constraints: -w option..." +# ---------------------------------------------------------- +file=tigge_pf_ecmwf.grib2 # Has 38 messages +${tools_dir}/grib_ls -w count!=1 $file > $tempText +grep -q "37 of 38 messages" $tempText + +${tools_dir}/grib_ls -w count=1/2/38 $file > $tempText +grep -q "3 of 38 messages" $tempText + +${tools_dir}/grib_ls -w shortName=u $file > $tempText +grep -q "3 of 38 messages" $tempText + +${tools_dir}/grib_ls -w shortName=u/v $file > $tempText +grep -q "5 of 38 messages" $tempText + +${tools_dir}/grib_ls -w shortName!=u/v $file > $tempText +grep -q "33 of 38 messages" $tempText + +${tools_dir}/grib_ls -w shortName=u/v,level=925 $file > $tempText +grep -q "2 of 38 messages" $tempText + +${tools_dir}/grib_ls -w shortName=u/v/10u/10v,level=925/10 $file > $tempText +grep -q "4 of 38 messages" $tempText + +${tools_dir}/grib_ls -w packingType!=grid_simple $file > $tempText +grep -q "0 of 38 messages" $tempText + +${tools_dir}/grib_ls -w units!=K $file > $tempText +grep -q "30 of 38 messages" $tempText + +file=mixed.grib # Has 14 messages +${tools_dir}/grib_ls -w packingType=grid_simple,gridType=regular_ll/regular_gg $file > $tempText +grep -q "12 of 14 messages" $tempText + +${tools_dir}/grib_ls -w packingType=grid_simple/grid_simple_matrix,gridType=regular_ll/regular_gg $file > $tempText +grep -q "12 of 14 messages" $tempText + +${tools_dir}/grib_ls -w typeOfLevel=surface,centre=7 $file > $tempText +grep -q "3 of 14 messages" $tempText + +${tools_dir}/grib_ls -w shortName=t/10u,gridType=regular_gg $file > $tempText +grep -q "5 of 14 messages" $tempText + + +# ECC-1528: Try some invalid values for the count constraint +for cval in -1 0 xx; do + set +e + rm -f $tempText + ${tools_dir}/grib_ls -w count=$cval $file > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Invalid value for key 'count'" $tempText +done + + +# ECC-1562: Segmentation fault: Invalid orderby directive +set +e +${tools_dir}/grib_ls -B'shortName: asc' tigge_af_ecmwf.grib2 > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Invalid type for key=shortName" $tempText + +# Clean up +rm -f $temp1 $temp2 $tempText $tempLog diff --git a/tests/grib_nearest_test.sh b/tests/grib_nearest_test.sh index 1ca9e379a..6e0716afd 100755 --- a/tests/grib_nearest_test.sh +++ b/tests/grib_nearest_test.sh @@ -50,6 +50,9 @@ Idx lat lon dist EOF diff $tempRef $temp +$EXEC ${test_dir}/grib_nearest_test -n $ECCODES_SAMPLES_PATH/polar_stereographic_pl_grib2.tmpl + + # ECC-1295: regular lat/lon on ellipsoid # ---------------------------------------- sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl diff --git a/tests/grib_neg_fctime.sh b/tests/grib_neg_fctime.sh index 1905df9dd..3d0e5f88d 100755 --- a/tests/grib_neg_fctime.sh +++ b/tests/grib_neg_fctime.sh @@ -11,13 +11,12 @@ . ./include.ctest.sh REDIRECT=/dev/null - -temp=neg_fctime.temp.grib +label="grib_neg_fctime_test" +temp=temp.$label.grib input=${data_dir}/sample.grib2 - -############################ # Check various grib2 PDTs +# -------------------------- sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl PDTs="0 1 2 3 8 9 10 11 12 13 14 45 46 47 48 53" for p in $PDTs; do @@ -25,9 +24,8 @@ for p in $PDTs; do done -############################ - # check input time and date +# -------------------------- grib_check_key_equals $input 'dataDate,dataTime' '20080206 1200' # Negative step in same day diff --git a/tests/grib_octahedral.sh b/tests/grib_octahedral.sh index 3207bcaa1..b4f3ebf07 100755 --- a/tests/grib_octahedral.sh +++ b/tests/grib_octahedral.sh @@ -12,8 +12,8 @@ REDIRECT=/dev/null -this_test="octa_grid.test" -temp=temp.$this_test +label="grib_octahedral_test" +temp=temp.$label.txt # All our current GRIB samples (with reduced gaussian grids) are NON-Octahedral for s in $ECCODES_SAMPLES_PATH/reduced_gg_pl*.tmpl; do diff --git a/tests/grib_proj_string.sh b/tests/grib_proj_string.sh index e41c02d4e..866cea794 100755 --- a/tests/grib_proj_string.sh +++ b/tests/grib_proj_string.sh @@ -10,6 +10,11 @@ . ./include.ctest.sh +label="grib_proj_string_test" +tempGrib=temp.$label.grib +tempText=temp.$label.txt +grib2_sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + files=" mercator.grib2 satellite.grib @@ -39,3 +44,40 @@ for f in `echo $files`; do $PROJ_TOOL $ps fi done + +# Various grid types +# ECC-1552: To be done later. Current behaviour is to return KeyNotFound +set +e +${tools_dir}/grib_get -p projString $grib2_sample > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Key/value not found" $tempText +rm -f $tempText + +# ${tools_dir}/grib_get -p projString $grib2_sample > $tempText +# grep -q "proj=longlat +R=6367470" $tempText +# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/regular_ll_pl_grib2.tmpl > $tempText +# grep -q "proj=longlat +R=6371229" $tempText +# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/regular_gg_ml_grib1.tmpl > $tempText +# grep -q "proj=longlat +R=6367470" $tempText +# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText +# grep -q "proj=longlat +R=6367470" $tempText +# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl > $tempText +# grep -q "proj=longlat +R=6371229" $tempText + + +${tools_dir}/grib_set -s gridType=lambert_azimuthal_equal_area $grib2_sample $tempGrib +${tools_dir}/grib_get -p projString $tempGrib > $tempText +grep -q "proj=laea" $tempText + +${tools_dir}/grib_set -s gridType=lambert $grib2_sample $tempGrib +${tools_dir}/grib_get -p projString $tempGrib > $tempText +grep -q "proj=lcc" $tempText + +${tools_dir}/grib_set -s gridType=polar_stereographic $grib2_sample $tempGrib +${tools_dir}/grib_get -p projString $tempGrib > $tempText +grep -q "proj=stere" $tempText + + +rm -f $tempGrib $tempText diff --git a/tests/grib_second_order.sh b/tests/grib_second_order.sh index c95d50b0b..dfe245e46 100755 --- a/tests/grib_second_order.sh +++ b/tests/grib_second_order.sh @@ -153,11 +153,7 @@ grib_check_key_equals $temp3 packingType,accuracy 'grid_second_order 24' # ECC-1219: packingType conversion from grid_ieee to grid_second_order # --------------------------------------------------------------------- -if [ $ECCODES_ON_LINUX_32BIT -eq 1 ] ; then - ALLOWED_ERROR=7e-06 -else - ALLOWED_ERROR=3e-06 -fi +ALLOWED_ERROR=3e-06 if [ $ECCODES_ON_WINDOWS -eq 0 ]; then infile=grid_ieee.grib ${tools_dir}/grib_set -r -s packingType=grid_second_order $infile $temp1 @@ -173,6 +169,14 @@ grib_check_key_equals $infile packingType grid_second_order ${tools_dir}/grib_set -d1 $infile $temp1 grib_check_key_equals $temp1 packingType grid_simple +infile=$ECCODES_SAMPLES_PATH/GRIB1.tmpl +${tools_dir}/grib_set -r -s packingType=grid_second_order $infile $temp1 +grib_check_key_equals $temp1 packingType grid_simple + +infile=$ECCODES_SAMPLES_PATH/GRIB2.tmpl +${tools_dir}/grib_set -r -s packingType=grid_second_order $infile $temp1 +grib_check_key_equals $temp1 packingType grid_simple + # Clean up rm -f $temp_stat1 $temp_stat2 diff --git a/tests/grib_sh_ieee64.sh b/tests/grib_sh_ieee64.sh index 9fcfbb4ee..cad07bad3 100755 --- a/tests/grib_sh_ieee64.sh +++ b/tests/grib_sh_ieee64.sh @@ -20,9 +20,5 @@ if [ $ECCODES_ON_WINDOWS -eq 1 ]; then echo "$0: This test is currently disabled on Windows" exit 0 fi -if [ $ECCODES_ON_LINUX_32BIT -eq 1 ]; then - echo "$0: This test is currently disabled on Linux 32 bit system" - exit 0 -fi $EXEC $test_dir/grib_sh_ieee64 diff --git a/tests/grib_statistics.sh b/tests/grib_statistics.sh index f7503533e..5be8ed60f 100755 --- a/tests/grib_statistics.sh +++ b/tests/grib_statistics.sh @@ -45,7 +45,7 @@ input=${data_dir}/lfpw.grib1 temp1=temp1.statistics.grib temp2=temp2.statistics.grib stats=`${tools_dir}/grib_get -w count=50 -F%.2f -n statistics $input` -[ "$stats" = "10098 0 1064.19 3066.07 2.57004 4.60965 0" ] +[ "$stats" = "10098.00 0.00 1064.19 3066.07 2.57 4.61 0.00" ] # Scaling values in presence of real 9999 values ${tools_dir}/grib_set -s scaleValuesBy=0.5 $input $temp1 diff --git a/tests/grib_true-imagery.sh b/tests/grib_true-imagery.sh new file mode 100755 index 000000000..929eddb8d --- /dev/null +++ b/tests/grib_true-imagery.sh @@ -0,0 +1,44 @@ +#!/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_true_imagery_test" +temp=temp.$label +tempd=temp_dump.$label +sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +latest=30 # TODO + +## PDTN 108 - Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical products +${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=108 $sample_grib2 $temp +${tools_dir}/grib_dump -O $temp > $tempd +grep -q 'Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical properties' $tempd +grib_check_key_equals $temp typeOfWavelengthInterval,scaledValueOfFirstWavelength,scaledValueOfSecondWavelength "0 0 MISSING" + +## PDTN 109 - Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for generic optical products +${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=109 $sample_grib2 $temp +${tools_dir}/grib_dump -O $temp > $tempd +grep -q 'Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for generic optical properties' $tempd +grib_check_key_equals $temp typeOfWavelengthInterval,scaledValueOfFirstWavelength,scaledValueOfSecondWavelength "0 0 MISSING" + +## PDTN 110 - Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical products +${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=110 $sample_grib2 $temp +${tools_dir}/grib_dump -O $temp > $tempd +grep -q 'Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical properties' $tempd +grib_check_key_equals $temp typeOfWavelengthInterval,scaledValueOfFirstWavelength,scaledValueOfSecondWavelength "0 0 MISSING" + +## PDTN 111 - Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical products +${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=111 $sample_grib2 $temp +${tools_dir}/grib_dump -O $temp > $tempd +grep -q 'Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical properties' $tempd +grib_check_key_equals $temp typeOfWavelengthInterval,scaledValueOfFirstWavelength,scaledValueOfSecondWavelength "0 0 MISSING" + +rm -f $temp $tempd diff --git a/tests/grib_util_set_spec.cc b/tests/grib_util_set_spec.cc index 6d65653a1..cf254aff4 100644 --- a/tests/grib_util_set_spec.cc +++ b/tests/grib_util_set_spec.cc @@ -11,8 +11,6 @@ #include "grib_api_internal.h" #include "eccodes.h" -#define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) - static int get_packing_type_code(const char* packingType) { int result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE; diff --git a/tests/include.ctest.sh.in b/tests/include.ctest.sh.in index 8da7bf747..8832e2d0b 100644 --- a/tests/include.ctest.sh.in +++ b/tests/include.ctest.sh.in @@ -67,7 +67,6 @@ HAVE_PNG=@HAVE_PNG@ HAVE_AEC=@HAVE_AEC@ HAVE_EXTRA_TESTS=@HAVE_EXTRA_TESTS@ HAVE_MEMFS=@HAVE_MEMFS@ -ECCODES_ON_LINUX_32BIT=@ECCODES_ON_LINUX_32BIT@ ECCODES_ON_WINDOWS=@ECCODES_ON_WINDOWS@ echo "Current directory: `pwd`" diff --git a/tests/unit_tests.cc b/tests/unit_tests.cc index 7f910cd71..25ab24e88 100644 --- a/tests/unit_tests.cc +++ b/tests/unit_tests.cc @@ -10,7 +10,6 @@ #include "grib_api_internal.h" -#define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) #define NUMBER(x) (sizeof(x) / sizeof(x[0])) int assertion_caught = 0; @@ -125,1252 +124,7 @@ static void test_gaussian_latitude_640() compare_doubles(lats[13], 88.067032, tolerance); compare_doubles(lats[14], 87.926471, tolerance); compare_doubles(lats[15], 87.785908, tolerance); - compare_doubles(lats[16], 87.645345, tolerance); - compare_doubles(lats[17], 87.504781, tolerance); - compare_doubles(lats[18], 87.364216, tolerance); - compare_doubles(lats[19], 87.223651, tolerance); - compare_doubles(lats[20], 87.083085, tolerance); - compare_doubles(lats[21], 86.942519, tolerance); - compare_doubles(lats[22], 86.801952, tolerance); - compare_doubles(lats[23], 86.661385, tolerance); - compare_doubles(lats[24], 86.520818, tolerance); - compare_doubles(lats[25], 86.380251, tolerance); - compare_doubles(lats[26], 86.239684, tolerance); - compare_doubles(lats[27], 86.099116, tolerance); - compare_doubles(lats[28], 85.958548, tolerance); - compare_doubles(lats[29], 85.817980, tolerance); - compare_doubles(lats[30], 85.677412, tolerance); - compare_doubles(lats[31], 85.536844, tolerance); - compare_doubles(lats[32], 85.396275, tolerance); - compare_doubles(lats[33], 85.255707, tolerance); - compare_doubles(lats[34], 85.115138, tolerance); - compare_doubles(lats[35], 84.974570, tolerance); - compare_doubles(lats[36], 84.834001, tolerance); - compare_doubles(lats[37], 84.693432, tolerance); - compare_doubles(lats[38], 84.552863, tolerance); - compare_doubles(lats[39], 84.412294, tolerance); - compare_doubles(lats[40], 84.271725, tolerance); - compare_doubles(lats[41], 84.131156, tolerance); - compare_doubles(lats[42], 83.990587, tolerance); - compare_doubles(lats[43], 83.850018, tolerance); - compare_doubles(lats[44], 83.709449, tolerance); - compare_doubles(lats[45], 83.568880, tolerance); - compare_doubles(lats[46], 83.428310, tolerance); - compare_doubles(lats[47], 83.287741, tolerance); - compare_doubles(lats[48], 83.147172, tolerance); - compare_doubles(lats[49], 83.006602, tolerance); - compare_doubles(lats[50], 82.866033, tolerance); - compare_doubles(lats[51], 82.725464, tolerance); - compare_doubles(lats[52], 82.584894, tolerance); - compare_doubles(lats[53], 82.444325, tolerance); - compare_doubles(lats[54], 82.303755, tolerance); - compare_doubles(lats[55], 82.163186, tolerance); - compare_doubles(lats[56], 82.022616, tolerance); - compare_doubles(lats[57], 81.882047, tolerance); - compare_doubles(lats[58], 81.741477, tolerance); - compare_doubles(lats[59], 81.600908, tolerance); - compare_doubles(lats[60], 81.460338, tolerance); - compare_doubles(lats[61], 81.319768, tolerance); - compare_doubles(lats[62], 81.179199, tolerance); - compare_doubles(lats[63], 81.038629, tolerance); - compare_doubles(lats[64], 80.898059, tolerance); - compare_doubles(lats[65], 80.757490, tolerance); - compare_doubles(lats[66], 80.616920, tolerance); - compare_doubles(lats[67], 80.476350, tolerance); - compare_doubles(lats[68], 80.335781, tolerance); - compare_doubles(lats[69], 80.195211, tolerance); - compare_doubles(lats[70], 80.054641, tolerance); - compare_doubles(lats[71], 79.914072, tolerance); - compare_doubles(lats[72], 79.773502, tolerance); - compare_doubles(lats[73], 79.632932, tolerance); - compare_doubles(lats[74], 79.492362, tolerance); - compare_doubles(lats[75], 79.351792, tolerance); - compare_doubles(lats[76], 79.211223, tolerance); - compare_doubles(lats[77], 79.070653, tolerance); - compare_doubles(lats[78], 78.930083, tolerance); - compare_doubles(lats[79], 78.789513, tolerance); - compare_doubles(lats[80], 78.648943, tolerance); - compare_doubles(lats[81], 78.508374, tolerance); - compare_doubles(lats[82], 78.367804, tolerance); - compare_doubles(lats[83], 78.227234, tolerance); - compare_doubles(lats[84], 78.086664, tolerance); - compare_doubles(lats[85], 77.946094, tolerance); - compare_doubles(lats[86], 77.805524, tolerance); - compare_doubles(lats[87], 77.664955, tolerance); - compare_doubles(lats[88], 77.524385, tolerance); - compare_doubles(lats[89], 77.383815, tolerance); - compare_doubles(lats[90], 77.243245, tolerance); - compare_doubles(lats[91], 77.102675, tolerance); - compare_doubles(lats[92], 76.962105, tolerance); - compare_doubles(lats[93], 76.821535, tolerance); - compare_doubles(lats[94], 76.680966, tolerance); - compare_doubles(lats[95], 76.540396, tolerance); - compare_doubles(lats[96], 76.399826, tolerance); - compare_doubles(lats[97], 76.259256, tolerance); - compare_doubles(lats[98], 76.118686, tolerance); - compare_doubles(lats[99], 75.978116, tolerance); - compare_doubles(lats[100], 75.837546, tolerance); - compare_doubles(lats[101], 75.696976, tolerance); - compare_doubles(lats[102], 75.556406, tolerance); - compare_doubles(lats[103], 75.415836, tolerance); - compare_doubles(lats[104], 75.275266, tolerance); - compare_doubles(lats[105], 75.134697, tolerance); - compare_doubles(lats[106], 74.994127, tolerance); - compare_doubles(lats[107], 74.853557, tolerance); - compare_doubles(lats[108], 74.712987, tolerance); - compare_doubles(lats[109], 74.572417, tolerance); - compare_doubles(lats[110], 74.431847, tolerance); - compare_doubles(lats[111], 74.291277, tolerance); - compare_doubles(lats[112], 74.150707, tolerance); - compare_doubles(lats[113], 74.010137, tolerance); - compare_doubles(lats[114], 73.869567, tolerance); - compare_doubles(lats[115], 73.728997, tolerance); - compare_doubles(lats[116], 73.588427, tolerance); - compare_doubles(lats[117], 73.447857, tolerance); - compare_doubles(lats[118], 73.307287, tolerance); - compare_doubles(lats[119], 73.166717, tolerance); - compare_doubles(lats[120], 73.026147, tolerance); - compare_doubles(lats[121], 72.885577, tolerance); - compare_doubles(lats[122], 72.745007, tolerance); - compare_doubles(lats[123], 72.604437, tolerance); - compare_doubles(lats[124], 72.463867, tolerance); - compare_doubles(lats[125], 72.323298, tolerance); - compare_doubles(lats[126], 72.182728, tolerance); - compare_doubles(lats[127], 72.042158, tolerance); - compare_doubles(lats[128], 71.901588, tolerance); - compare_doubles(lats[129], 71.761018, tolerance); - compare_doubles(lats[130], 71.620448, tolerance); - compare_doubles(lats[131], 71.479878, tolerance); - compare_doubles(lats[132], 71.339308, tolerance); - compare_doubles(lats[133], 71.198738, tolerance); - compare_doubles(lats[134], 71.058168, tolerance); - compare_doubles(lats[135], 70.917598, tolerance); - compare_doubles(lats[136], 70.777028, tolerance); - compare_doubles(lats[137], 70.636458, tolerance); - compare_doubles(lats[138], 70.495888, tolerance); - compare_doubles(lats[139], 70.355318, tolerance); - compare_doubles(lats[140], 70.214748, tolerance); - compare_doubles(lats[141], 70.074178, tolerance); - compare_doubles(lats[142], 69.933608, tolerance); - compare_doubles(lats[143], 69.793038, tolerance); - compare_doubles(lats[144], 69.652468, tolerance); - compare_doubles(lats[145], 69.511898, tolerance); - compare_doubles(lats[146], 69.371328, tolerance); - compare_doubles(lats[147], 69.230758, tolerance); - compare_doubles(lats[148], 69.090188, tolerance); - compare_doubles(lats[149], 68.949618, tolerance); - compare_doubles(lats[150], 68.809048, tolerance); - compare_doubles(lats[151], 68.668478, tolerance); - compare_doubles(lats[152], 68.527908, tolerance); - compare_doubles(lats[153], 68.387338, tolerance); - compare_doubles(lats[154], 68.246768, tolerance); - compare_doubles(lats[155], 68.106198, tolerance); - compare_doubles(lats[156], 67.965628, tolerance); - compare_doubles(lats[157], 67.825058, tolerance); - compare_doubles(lats[158], 67.684488, tolerance); - compare_doubles(lats[159], 67.543918, tolerance); - compare_doubles(lats[160], 67.403348, tolerance); - compare_doubles(lats[161], 67.262778, tolerance); - compare_doubles(lats[162], 67.122208, tolerance); - compare_doubles(lats[163], 66.981638, tolerance); - compare_doubles(lats[164], 66.841067, tolerance); - compare_doubles(lats[165], 66.700497, tolerance); - compare_doubles(lats[166], 66.559927, tolerance); - compare_doubles(lats[167], 66.419357, tolerance); - compare_doubles(lats[168], 66.278787, tolerance); - compare_doubles(lats[169], 66.138217, tolerance); - compare_doubles(lats[170], 65.997647, tolerance); - compare_doubles(lats[171], 65.857077, tolerance); - compare_doubles(lats[172], 65.716507, tolerance); - compare_doubles(lats[173], 65.575937, tolerance); - compare_doubles(lats[174], 65.435367, tolerance); - compare_doubles(lats[175], 65.294797, tolerance); - compare_doubles(lats[176], 65.154227, tolerance); - compare_doubles(lats[177], 65.013657, tolerance); - compare_doubles(lats[178], 64.873087, tolerance); - compare_doubles(lats[179], 64.732517, tolerance); - compare_doubles(lats[180], 64.591947, tolerance); - compare_doubles(lats[181], 64.451377, tolerance); - compare_doubles(lats[182], 64.310807, tolerance); - compare_doubles(lats[183], 64.170237, tolerance); - compare_doubles(lats[184], 64.029667, tolerance); - compare_doubles(lats[185], 63.889097, tolerance); - compare_doubles(lats[186], 63.748527, tolerance); - compare_doubles(lats[187], 63.607957, tolerance); - compare_doubles(lats[188], 63.467387, tolerance); - compare_doubles(lats[189], 63.326817, tolerance); - compare_doubles(lats[190], 63.186247, tolerance); - compare_doubles(lats[191], 63.045677, tolerance); - compare_doubles(lats[192], 62.905107, tolerance); - compare_doubles(lats[193], 62.764537, tolerance); - compare_doubles(lats[194], 62.623967, tolerance); - compare_doubles(lats[195], 62.483397, tolerance); - compare_doubles(lats[196], 62.342826, tolerance); - compare_doubles(lats[197], 62.202256, tolerance); - compare_doubles(lats[198], 62.061686, tolerance); - compare_doubles(lats[199], 61.921116, tolerance); - compare_doubles(lats[200], 61.780546, tolerance); - compare_doubles(lats[201], 61.639976, tolerance); - compare_doubles(lats[202], 61.499406, tolerance); - compare_doubles(lats[203], 61.358836, tolerance); - compare_doubles(lats[204], 61.218266, tolerance); - compare_doubles(lats[205], 61.077696, tolerance); - compare_doubles(lats[206], 60.937126, tolerance); - compare_doubles(lats[207], 60.796556, tolerance); - compare_doubles(lats[208], 60.655986, tolerance); - compare_doubles(lats[209], 60.515416, tolerance); - compare_doubles(lats[210], 60.374846, tolerance); - compare_doubles(lats[211], 60.234276, tolerance); - compare_doubles(lats[212], 60.093706, tolerance); - compare_doubles(lats[213], 59.953136, tolerance); - compare_doubles(lats[214], 59.812566, tolerance); - compare_doubles(lats[215], 59.671996, tolerance); - compare_doubles(lats[216], 59.531426, tolerance); - compare_doubles(lats[217], 59.390856, tolerance); - compare_doubles(lats[218], 59.250286, tolerance); - compare_doubles(lats[219], 59.109715, tolerance); - compare_doubles(lats[220], 58.969145, tolerance); - compare_doubles(lats[221], 58.828575, tolerance); - compare_doubles(lats[222], 58.688005, tolerance); - compare_doubles(lats[223], 58.547435, tolerance); - compare_doubles(lats[224], 58.406865, tolerance); - compare_doubles(lats[225], 58.266295, tolerance); - compare_doubles(lats[226], 58.125725, tolerance); - compare_doubles(lats[227], 57.985155, tolerance); - compare_doubles(lats[228], 57.844585, tolerance); - compare_doubles(lats[229], 57.704015, tolerance); - compare_doubles(lats[230], 57.563445, tolerance); - compare_doubles(lats[231], 57.422875, tolerance); - compare_doubles(lats[232], 57.282305, tolerance); - compare_doubles(lats[233], 57.141735, tolerance); - compare_doubles(lats[234], 57.001165, tolerance); - compare_doubles(lats[235], 56.860595, tolerance); - compare_doubles(lats[236], 56.720025, tolerance); - compare_doubles(lats[237], 56.579455, tolerance); - compare_doubles(lats[238], 56.438884, tolerance); - compare_doubles(lats[239], 56.298314, tolerance); - compare_doubles(lats[240], 56.157744, tolerance); - compare_doubles(lats[241], 56.017174, tolerance); - compare_doubles(lats[242], 55.876604, tolerance); - compare_doubles(lats[243], 55.736034, tolerance); - compare_doubles(lats[244], 55.595464, tolerance); - compare_doubles(lats[245], 55.454894, tolerance); - compare_doubles(lats[246], 55.314324, tolerance); - compare_doubles(lats[247], 55.173754, tolerance); - compare_doubles(lats[248], 55.033184, tolerance); - compare_doubles(lats[249], 54.892614, tolerance); - compare_doubles(lats[250], 54.752044, tolerance); - compare_doubles(lats[251], 54.611474, tolerance); - compare_doubles(lats[252], 54.470904, tolerance); - compare_doubles(lats[253], 54.330334, tolerance); - compare_doubles(lats[254], 54.189764, tolerance); - compare_doubles(lats[255], 54.049194, tolerance); - compare_doubles(lats[256], 53.908623, tolerance); - compare_doubles(lats[257], 53.768053, tolerance); - compare_doubles(lats[258], 53.627483, tolerance); - compare_doubles(lats[259], 53.486913, tolerance); - compare_doubles(lats[260], 53.346343, tolerance); - compare_doubles(lats[261], 53.205773, tolerance); - compare_doubles(lats[262], 53.065203, tolerance); - compare_doubles(lats[263], 52.924633, tolerance); - compare_doubles(lats[264], 52.784063, tolerance); - compare_doubles(lats[265], 52.643493, tolerance); - compare_doubles(lats[266], 52.502923, tolerance); - compare_doubles(lats[267], 52.362353, tolerance); - compare_doubles(lats[268], 52.221783, tolerance); - compare_doubles(lats[269], 52.081213, tolerance); - compare_doubles(lats[270], 51.940643, tolerance); - compare_doubles(lats[271], 51.800073, tolerance); - compare_doubles(lats[272], 51.659502, tolerance); - compare_doubles(lats[273], 51.518932, tolerance); - compare_doubles(lats[274], 51.378362, tolerance); - compare_doubles(lats[275], 51.237792, tolerance); - compare_doubles(lats[276], 51.097222, tolerance); - compare_doubles(lats[277], 50.956652, tolerance); - compare_doubles(lats[278], 50.816082, tolerance); - compare_doubles(lats[279], 50.675512, tolerance); - compare_doubles(lats[280], 50.534942, tolerance); - compare_doubles(lats[281], 50.394372, tolerance); - compare_doubles(lats[282], 50.253802, tolerance); - compare_doubles(lats[283], 50.113232, tolerance); - compare_doubles(lats[284], 49.972662, tolerance); - compare_doubles(lats[285], 49.832092, tolerance); - compare_doubles(lats[286], 49.691522, tolerance); - compare_doubles(lats[287], 49.550952, tolerance); - compare_doubles(lats[288], 49.410381, tolerance); - compare_doubles(lats[289], 49.269811, tolerance); - compare_doubles(lats[290], 49.129241, tolerance); - compare_doubles(lats[291], 48.988671, tolerance); - compare_doubles(lats[292], 48.848101, tolerance); - compare_doubles(lats[293], 48.707531, tolerance); - compare_doubles(lats[294], 48.566961, tolerance); - compare_doubles(lats[295], 48.426391, tolerance); - compare_doubles(lats[296], 48.285821, tolerance); - compare_doubles(lats[297], 48.145251, tolerance); - compare_doubles(lats[298], 48.004681, tolerance); - compare_doubles(lats[299], 47.864111, tolerance); - compare_doubles(lats[300], 47.723541, tolerance); - compare_doubles(lats[301], 47.582971, tolerance); - compare_doubles(lats[302], 47.442401, tolerance); - compare_doubles(lats[303], 47.301830, tolerance); - compare_doubles(lats[304], 47.161260, tolerance); - compare_doubles(lats[305], 47.020690, tolerance); - compare_doubles(lats[306], 46.880120, tolerance); - compare_doubles(lats[307], 46.739550, tolerance); - compare_doubles(lats[308], 46.598980, tolerance); - compare_doubles(lats[309], 46.458410, tolerance); - compare_doubles(lats[310], 46.317840, tolerance); - compare_doubles(lats[311], 46.177270, tolerance); - compare_doubles(lats[312], 46.036700, tolerance); - compare_doubles(lats[313], 45.896130, tolerance); - compare_doubles(lats[314], 45.755560, tolerance); - compare_doubles(lats[315], 45.614990, tolerance); - compare_doubles(lats[316], 45.474420, tolerance); - compare_doubles(lats[317], 45.333850, tolerance); - compare_doubles(lats[318], 45.193279, tolerance); - compare_doubles(lats[319], 45.052709, tolerance); - compare_doubles(lats[320], 44.912139, tolerance); - compare_doubles(lats[321], 44.771569, tolerance); - compare_doubles(lats[322], 44.630999, tolerance); - compare_doubles(lats[323], 44.490429, tolerance); - compare_doubles(lats[324], 44.349859, tolerance); - compare_doubles(lats[325], 44.209289, tolerance); - compare_doubles(lats[326], 44.068719, tolerance); - compare_doubles(lats[327], 43.928149, tolerance); - compare_doubles(lats[328], 43.787579, tolerance); - compare_doubles(lats[329], 43.647009, tolerance); - compare_doubles(lats[330], 43.506439, tolerance); - compare_doubles(lats[331], 43.365869, tolerance); - compare_doubles(lats[332], 43.225299, tolerance); - compare_doubles(lats[333], 43.084728, tolerance); - compare_doubles(lats[334], 42.944158, tolerance); - compare_doubles(lats[335], 42.803588, tolerance); - compare_doubles(lats[336], 42.663018, tolerance); - compare_doubles(lats[337], 42.522448, tolerance); - compare_doubles(lats[338], 42.381878, tolerance); - compare_doubles(lats[339], 42.241308, tolerance); - compare_doubles(lats[340], 42.100738, tolerance); - compare_doubles(lats[341], 41.960168, tolerance); - compare_doubles(lats[342], 41.819598, tolerance); - compare_doubles(lats[343], 41.679028, tolerance); - compare_doubles(lats[344], 41.538458, tolerance); - compare_doubles(lats[345], 41.397888, tolerance); - compare_doubles(lats[346], 41.257318, tolerance); - compare_doubles(lats[347], 41.116747, tolerance); - compare_doubles(lats[348], 40.976177, tolerance); - compare_doubles(lats[349], 40.835607, tolerance); - compare_doubles(lats[350], 40.695037, tolerance); - compare_doubles(lats[351], 40.554467, tolerance); - compare_doubles(lats[352], 40.413897, tolerance); - compare_doubles(lats[353], 40.273327, tolerance); - compare_doubles(lats[354], 40.132757, tolerance); - compare_doubles(lats[355], 39.992187, tolerance); - compare_doubles(lats[356], 39.851617, tolerance); - compare_doubles(lats[357], 39.711047, tolerance); - compare_doubles(lats[358], 39.570477, tolerance); - compare_doubles(lats[359], 39.429907, tolerance); - compare_doubles(lats[360], 39.289337, tolerance); - compare_doubles(lats[361], 39.148766, tolerance); - compare_doubles(lats[362], 39.008196, tolerance); - compare_doubles(lats[363], 38.867626, tolerance); - compare_doubles(lats[364], 38.727056, tolerance); - compare_doubles(lats[365], 38.586486, tolerance); - compare_doubles(lats[366], 38.445916, tolerance); - compare_doubles(lats[367], 38.305346, tolerance); - compare_doubles(lats[368], 38.164776, tolerance); - compare_doubles(lats[369], 38.024206, tolerance); - compare_doubles(lats[370], 37.883636, tolerance); - compare_doubles(lats[371], 37.743066, tolerance); - compare_doubles(lats[372], 37.602496, tolerance); - compare_doubles(lats[373], 37.461926, tolerance); - compare_doubles(lats[374], 37.321356, tolerance); - compare_doubles(lats[375], 37.180785, tolerance); - compare_doubles(lats[376], 37.040215, tolerance); - compare_doubles(lats[377], 36.899645, tolerance); - compare_doubles(lats[378], 36.759075, tolerance); - compare_doubles(lats[379], 36.618505, tolerance); - compare_doubles(lats[380], 36.477935, tolerance); - compare_doubles(lats[381], 36.337365, tolerance); - compare_doubles(lats[382], 36.196795, tolerance); - compare_doubles(lats[383], 36.056225, tolerance); - compare_doubles(lats[384], 35.915655, tolerance); - compare_doubles(lats[385], 35.775085, tolerance); - compare_doubles(lats[386], 35.634515, tolerance); - compare_doubles(lats[387], 35.493945, tolerance); - compare_doubles(lats[388], 35.353374, tolerance); - compare_doubles(lats[389], 35.212804, tolerance); - compare_doubles(lats[390], 35.072234, tolerance); - compare_doubles(lats[391], 34.931664, tolerance); - compare_doubles(lats[392], 34.791094, tolerance); - compare_doubles(lats[393], 34.650524, tolerance); - compare_doubles(lats[394], 34.509954, tolerance); - compare_doubles(lats[395], 34.369384, tolerance); - compare_doubles(lats[396], 34.228814, tolerance); - compare_doubles(lats[397], 34.088244, tolerance); - compare_doubles(lats[398], 33.947674, tolerance); - compare_doubles(lats[399], 33.807104, tolerance); - compare_doubles(lats[400], 33.666534, tolerance); - compare_doubles(lats[401], 33.525964, tolerance); - compare_doubles(lats[402], 33.385393, tolerance); - compare_doubles(lats[403], 33.244823, tolerance); - compare_doubles(lats[404], 33.104253, tolerance); - compare_doubles(lats[405], 32.963683, tolerance); - compare_doubles(lats[406], 32.823113, tolerance); - compare_doubles(lats[407], 32.682543, tolerance); - compare_doubles(lats[408], 32.541973, tolerance); - compare_doubles(lats[409], 32.401403, tolerance); - compare_doubles(lats[410], 32.260833, tolerance); - compare_doubles(lats[411], 32.120263, tolerance); - compare_doubles(lats[412], 31.979693, tolerance); - compare_doubles(lats[413], 31.839123, tolerance); - compare_doubles(lats[414], 31.698553, tolerance); - compare_doubles(lats[415], 31.557982, tolerance); - compare_doubles(lats[416], 31.417412, tolerance); - compare_doubles(lats[417], 31.276842, tolerance); - compare_doubles(lats[418], 31.136272, tolerance); - compare_doubles(lats[419], 30.995702, tolerance); - compare_doubles(lats[420], 30.855132, tolerance); - compare_doubles(lats[421], 30.714562, tolerance); - compare_doubles(lats[422], 30.573992, tolerance); - compare_doubles(lats[423], 30.433422, tolerance); - compare_doubles(lats[424], 30.292852, tolerance); - compare_doubles(lats[425], 30.152282, tolerance); - compare_doubles(lats[426], 30.011712, tolerance); - compare_doubles(lats[427], 29.871142, tolerance); - compare_doubles(lats[428], 29.730572, tolerance); - compare_doubles(lats[429], 29.590001, tolerance); - compare_doubles(lats[430], 29.449431, tolerance); - compare_doubles(lats[431], 29.308861, tolerance); - compare_doubles(lats[432], 29.168291, tolerance); - compare_doubles(lats[433], 29.027721, tolerance); - compare_doubles(lats[434], 28.887151, tolerance); - compare_doubles(lats[435], 28.746581, tolerance); - compare_doubles(lats[436], 28.606011, tolerance); - compare_doubles(lats[437], 28.465441, tolerance); - compare_doubles(lats[438], 28.324871, tolerance); - compare_doubles(lats[439], 28.184301, tolerance); - compare_doubles(lats[440], 28.043731, tolerance); - compare_doubles(lats[441], 27.903161, tolerance); - compare_doubles(lats[442], 27.762590, tolerance); - compare_doubles(lats[443], 27.622020, tolerance); - compare_doubles(lats[444], 27.481450, tolerance); - compare_doubles(lats[445], 27.340880, tolerance); - compare_doubles(lats[446], 27.200310, tolerance); - compare_doubles(lats[447], 27.059740, tolerance); - compare_doubles(lats[448], 26.919170, tolerance); - compare_doubles(lats[449], 26.778600, tolerance); - compare_doubles(lats[450], 26.638030, tolerance); - compare_doubles(lats[451], 26.497460, tolerance); - compare_doubles(lats[452], 26.356890, tolerance); - compare_doubles(lats[453], 26.216320, tolerance); - compare_doubles(lats[454], 26.075750, tolerance); - compare_doubles(lats[455], 25.935179, tolerance); - compare_doubles(lats[456], 25.794609, tolerance); - compare_doubles(lats[457], 25.654039, tolerance); - compare_doubles(lats[458], 25.513469, tolerance); - compare_doubles(lats[459], 25.372899, tolerance); - compare_doubles(lats[460], 25.232329, tolerance); - compare_doubles(lats[461], 25.091759, tolerance); - compare_doubles(lats[462], 24.951189, tolerance); - compare_doubles(lats[463], 24.810619, tolerance); - compare_doubles(lats[464], 24.670049, tolerance); - compare_doubles(lats[465], 24.529479, tolerance); - compare_doubles(lats[466], 24.388909, tolerance); - compare_doubles(lats[467], 24.248339, tolerance); - compare_doubles(lats[468], 24.107768, tolerance); - compare_doubles(lats[469], 23.967198, tolerance); - compare_doubles(lats[470], 23.826628, tolerance); - compare_doubles(lats[471], 23.686058, tolerance); - compare_doubles(lats[472], 23.545488, tolerance); - compare_doubles(lats[473], 23.404918, tolerance); - compare_doubles(lats[474], 23.264348, tolerance); - compare_doubles(lats[475], 23.123778, tolerance); - compare_doubles(lats[476], 22.983208, tolerance); - compare_doubles(lats[477], 22.842638, tolerance); - compare_doubles(lats[478], 22.702068, tolerance); - compare_doubles(lats[479], 22.561498, tolerance); - compare_doubles(lats[480], 22.420928, tolerance); - compare_doubles(lats[481], 22.280357, tolerance); - compare_doubles(lats[482], 22.139787, tolerance); - compare_doubles(lats[483], 21.999217, tolerance); - compare_doubles(lats[484], 21.858647, tolerance); - compare_doubles(lats[485], 21.718077, tolerance); - compare_doubles(lats[486], 21.577507, tolerance); - compare_doubles(lats[487], 21.436937, tolerance); - compare_doubles(lats[488], 21.296367, tolerance); - compare_doubles(lats[489], 21.155797, tolerance); - compare_doubles(lats[490], 21.015227, tolerance); - compare_doubles(lats[491], 20.874657, tolerance); - compare_doubles(lats[492], 20.734087, tolerance); - compare_doubles(lats[493], 20.593517, tolerance); - compare_doubles(lats[494], 20.452946, tolerance); - compare_doubles(lats[495], 20.312376, tolerance); - compare_doubles(lats[496], 20.171806, tolerance); - compare_doubles(lats[497], 20.031236, tolerance); - compare_doubles(lats[498], 19.890666, tolerance); - compare_doubles(lats[499], 19.750096, tolerance); - compare_doubles(lats[500], 19.609526, tolerance); - compare_doubles(lats[501], 19.468956, tolerance); - compare_doubles(lats[502], 19.328386, tolerance); - compare_doubles(lats[503], 19.187816, tolerance); - compare_doubles(lats[504], 19.047246, tolerance); - compare_doubles(lats[505], 18.906676, tolerance); - compare_doubles(lats[506], 18.766106, tolerance); - compare_doubles(lats[507], 18.625535, tolerance); - compare_doubles(lats[508], 18.484965, tolerance); - compare_doubles(lats[509], 18.344395, tolerance); - compare_doubles(lats[510], 18.203825, tolerance); - compare_doubles(lats[511], 18.063255, tolerance); - compare_doubles(lats[512], 17.922685, tolerance); - compare_doubles(lats[513], 17.782115, tolerance); - compare_doubles(lats[514], 17.641545, tolerance); - compare_doubles(lats[515], 17.500975, tolerance); - compare_doubles(lats[516], 17.360405, tolerance); - compare_doubles(lats[517], 17.219835, tolerance); - compare_doubles(lats[518], 17.079265, tolerance); - compare_doubles(lats[519], 16.938694, tolerance); - compare_doubles(lats[520], 16.798124, tolerance); - compare_doubles(lats[521], 16.657554, tolerance); - compare_doubles(lats[522], 16.516984, tolerance); - compare_doubles(lats[523], 16.376414, tolerance); - compare_doubles(lats[524], 16.235844, tolerance); - compare_doubles(lats[525], 16.095274, tolerance); - compare_doubles(lats[526], 15.954704, tolerance); - compare_doubles(lats[527], 15.814134, tolerance); - compare_doubles(lats[528], 15.673564, tolerance); - compare_doubles(lats[529], 15.532994, tolerance); - compare_doubles(lats[530], 15.392424, tolerance); - compare_doubles(lats[531], 15.251854, tolerance); - compare_doubles(lats[532], 15.111283, tolerance); - compare_doubles(lats[533], 14.970713, tolerance); - compare_doubles(lats[534], 14.830143, tolerance); - compare_doubles(lats[535], 14.689573, tolerance); - compare_doubles(lats[536], 14.549003, tolerance); - compare_doubles(lats[537], 14.408433, tolerance); - compare_doubles(lats[538], 14.267863, tolerance); - compare_doubles(lats[539], 14.127293, tolerance); - compare_doubles(lats[540], 13.986723, tolerance); - compare_doubles(lats[541], 13.846153, tolerance); - compare_doubles(lats[542], 13.705583, tolerance); - compare_doubles(lats[543], 13.565013, tolerance); - compare_doubles(lats[544], 13.424443, tolerance); - compare_doubles(lats[545], 13.283872, tolerance); - compare_doubles(lats[546], 13.143302, tolerance); - compare_doubles(lats[547], 13.002732, tolerance); - compare_doubles(lats[548], 12.862162, tolerance); - compare_doubles(lats[549], 12.721592, tolerance); - compare_doubles(lats[550], 12.581022, tolerance); - compare_doubles(lats[551], 12.440452, tolerance); - compare_doubles(lats[552], 12.299882, tolerance); - compare_doubles(lats[553], 12.159312, tolerance); - compare_doubles(lats[554], 12.018742, tolerance); - compare_doubles(lats[555], 11.878172, tolerance); - compare_doubles(lats[556], 11.737602, tolerance); - compare_doubles(lats[557], 11.597032, tolerance); - compare_doubles(lats[558], 11.456461, tolerance); - compare_doubles(lats[559], 11.315891, tolerance); - compare_doubles(lats[560], 11.175321, tolerance); - compare_doubles(lats[561], 11.034751, tolerance); - compare_doubles(lats[562], 10.894181, tolerance); - compare_doubles(lats[563], 10.753611, tolerance); - compare_doubles(lats[564], 10.613041, tolerance); - compare_doubles(lats[565], 10.472471, tolerance); - compare_doubles(lats[566], 10.331901, tolerance); - compare_doubles(lats[567], 10.191331, tolerance); - compare_doubles(lats[568], 10.050761, tolerance); - compare_doubles(lats[569], 9.910191, tolerance); - compare_doubles(lats[570], 9.769620, tolerance); - compare_doubles(lats[571], 9.629050, tolerance); - compare_doubles(lats[572], 9.488480, tolerance); - compare_doubles(lats[573], 9.347910, tolerance); - compare_doubles(lats[574], 9.207340, tolerance); - compare_doubles(lats[575], 9.066770, tolerance); - compare_doubles(lats[576], 8.926200, tolerance); - compare_doubles(lats[577], 8.785630, tolerance); - compare_doubles(lats[578], 8.645060, tolerance); - compare_doubles(lats[579], 8.504490, tolerance); - compare_doubles(lats[580], 8.363920, tolerance); - compare_doubles(lats[581], 8.223350, tolerance); - compare_doubles(lats[582], 8.082780, tolerance); - compare_doubles(lats[583], 7.942209, tolerance); - compare_doubles(lats[584], 7.801639, tolerance); - compare_doubles(lats[585], 7.661069, tolerance); - compare_doubles(lats[586], 7.520499, tolerance); - compare_doubles(lats[587], 7.379929, tolerance); - compare_doubles(lats[588], 7.239359, tolerance); - compare_doubles(lats[589], 7.098789, tolerance); - compare_doubles(lats[590], 6.958219, tolerance); - compare_doubles(lats[591], 6.817649, tolerance); - compare_doubles(lats[592], 6.677079, tolerance); - compare_doubles(lats[593], 6.536509, tolerance); - compare_doubles(lats[594], 6.395939, tolerance); - compare_doubles(lats[595], 6.255369, tolerance); - compare_doubles(lats[596], 6.114798, tolerance); - compare_doubles(lats[597], 5.974228, tolerance); - compare_doubles(lats[598], 5.833658, tolerance); - compare_doubles(lats[599], 5.693088, tolerance); - compare_doubles(lats[600], 5.552518, tolerance); - compare_doubles(lats[601], 5.411948, tolerance); - compare_doubles(lats[602], 5.271378, tolerance); - compare_doubles(lats[603], 5.130808, tolerance); - compare_doubles(lats[604], 4.990238, tolerance); - compare_doubles(lats[605], 4.849668, tolerance); - compare_doubles(lats[606], 4.709098, tolerance); - compare_doubles(lats[607], 4.568528, tolerance); - compare_doubles(lats[608], 4.427957, tolerance); - compare_doubles(lats[609], 4.287387, tolerance); - compare_doubles(lats[610], 4.146817, tolerance); - compare_doubles(lats[611], 4.006247, tolerance); - compare_doubles(lats[612], 3.865677, tolerance); - compare_doubles(lats[613], 3.725107, tolerance); - compare_doubles(lats[614], 3.584537, tolerance); - compare_doubles(lats[615], 3.443967, tolerance); - compare_doubles(lats[616], 3.303397, tolerance); - compare_doubles(lats[617], 3.162827, tolerance); - compare_doubles(lats[618], 3.022257, tolerance); - compare_doubles(lats[619], 2.881687, tolerance); - compare_doubles(lats[620], 2.741117, tolerance); - compare_doubles(lats[621], 2.600546, tolerance); - compare_doubles(lats[622], 2.459976, tolerance); - compare_doubles(lats[623], 2.319406, tolerance); - compare_doubles(lats[624], 2.178836, tolerance); - compare_doubles(lats[625], 2.038266, tolerance); - compare_doubles(lats[626], 1.897696, tolerance); - compare_doubles(lats[627], 1.757126, tolerance); - compare_doubles(lats[628], 1.616556, tolerance); - compare_doubles(lats[629], 1.475986, tolerance); - compare_doubles(lats[630], 1.335416, tolerance); - compare_doubles(lats[631], 1.194846, tolerance); - compare_doubles(lats[632], 1.054276, tolerance); - compare_doubles(lats[633], 0.913706, tolerance); - compare_doubles(lats[634], 0.773135, tolerance); - compare_doubles(lats[635], 0.632565, tolerance); - compare_doubles(lats[636], 0.491995, tolerance); - compare_doubles(lats[637], 0.351425, tolerance); - compare_doubles(lats[638], 0.210855, tolerance); - compare_doubles(lats[639], 0.070285, tolerance); - compare_doubles(lats[640], -0.070285, tolerance); - compare_doubles(lats[641], -0.210855, tolerance); - compare_doubles(lats[642], -0.351425, tolerance); - compare_doubles(lats[643], -0.491995, tolerance); - compare_doubles(lats[644], -0.632565, tolerance); - compare_doubles(lats[645], -0.773135, tolerance); - compare_doubles(lats[646], -0.913706, tolerance); - compare_doubles(lats[647], -1.054276, tolerance); - compare_doubles(lats[648], -1.194846, tolerance); - compare_doubles(lats[649], -1.335416, tolerance); - compare_doubles(lats[650], -1.475986, tolerance); - compare_doubles(lats[651], -1.616556, tolerance); - compare_doubles(lats[652], -1.757126, tolerance); - compare_doubles(lats[653], -1.897696, tolerance); - compare_doubles(lats[654], -2.038266, tolerance); - compare_doubles(lats[655], -2.178836, tolerance); - compare_doubles(lats[656], -2.319406, tolerance); - compare_doubles(lats[657], -2.459976, tolerance); - compare_doubles(lats[658], -2.600546, tolerance); - compare_doubles(lats[659], -2.741117, tolerance); - compare_doubles(lats[660], -2.881687, tolerance); - compare_doubles(lats[661], -3.022257, tolerance); - compare_doubles(lats[662], -3.162827, tolerance); - compare_doubles(lats[663], -3.303397, tolerance); - compare_doubles(lats[664], -3.443967, tolerance); - compare_doubles(lats[665], -3.584537, tolerance); - compare_doubles(lats[666], -3.725107, tolerance); - compare_doubles(lats[667], -3.865677, tolerance); - compare_doubles(lats[668], -4.006247, tolerance); - compare_doubles(lats[669], -4.146817, tolerance); - compare_doubles(lats[670], -4.287387, tolerance); - compare_doubles(lats[671], -4.427957, tolerance); - compare_doubles(lats[672], -4.568528, tolerance); - compare_doubles(lats[673], -4.709098, tolerance); - compare_doubles(lats[674], -4.849668, tolerance); - compare_doubles(lats[675], -4.990238, tolerance); - compare_doubles(lats[676], -5.130808, tolerance); - compare_doubles(lats[677], -5.271378, tolerance); - compare_doubles(lats[678], -5.411948, tolerance); - compare_doubles(lats[679], -5.552518, tolerance); - compare_doubles(lats[680], -5.693088, tolerance); - compare_doubles(lats[681], -5.833658, tolerance); - compare_doubles(lats[682], -5.974228, tolerance); - compare_doubles(lats[683], -6.114798, tolerance); - compare_doubles(lats[684], -6.255369, tolerance); - compare_doubles(lats[685], -6.395939, tolerance); - compare_doubles(lats[686], -6.536509, tolerance); - compare_doubles(lats[687], -6.677079, tolerance); - compare_doubles(lats[688], -6.817649, tolerance); - compare_doubles(lats[689], -6.958219, tolerance); - compare_doubles(lats[690], -7.098789, tolerance); - compare_doubles(lats[691], -7.239359, tolerance); - compare_doubles(lats[692], -7.379929, tolerance); - compare_doubles(lats[693], -7.520499, tolerance); - compare_doubles(lats[694], -7.661069, tolerance); - compare_doubles(lats[695], -7.801639, tolerance); - compare_doubles(lats[696], -7.942209, tolerance); - compare_doubles(lats[697], -8.082780, tolerance); - compare_doubles(lats[698], -8.223350, tolerance); - compare_doubles(lats[699], -8.363920, tolerance); - compare_doubles(lats[700], -8.504490, tolerance); - compare_doubles(lats[701], -8.645060, tolerance); - compare_doubles(lats[702], -8.785630, tolerance); - compare_doubles(lats[703], -8.926200, tolerance); - compare_doubles(lats[704], -9.066770, tolerance); - compare_doubles(lats[705], -9.207340, tolerance); - compare_doubles(lats[706], -9.347910, tolerance); - compare_doubles(lats[707], -9.488480, tolerance); - compare_doubles(lats[708], -9.629050, tolerance); - compare_doubles(lats[709], -9.769620, tolerance); - compare_doubles(lats[710], -9.910191, tolerance); - compare_doubles(lats[711], -10.050761, tolerance); - compare_doubles(lats[712], -10.191331, tolerance); - compare_doubles(lats[713], -10.331901, tolerance); - compare_doubles(lats[714], -10.472471, tolerance); - compare_doubles(lats[715], -10.613041, tolerance); - compare_doubles(lats[716], -10.753611, tolerance); - compare_doubles(lats[717], -10.894181, tolerance); - compare_doubles(lats[718], -11.034751, tolerance); - compare_doubles(lats[719], -11.175321, tolerance); - compare_doubles(lats[720], -11.315891, tolerance); - compare_doubles(lats[721], -11.456461, tolerance); - compare_doubles(lats[722], -11.597032, tolerance); - compare_doubles(lats[723], -11.737602, tolerance); - compare_doubles(lats[724], -11.878172, tolerance); - compare_doubles(lats[725], -12.018742, tolerance); - compare_doubles(lats[726], -12.159312, tolerance); - compare_doubles(lats[727], -12.299882, tolerance); - compare_doubles(lats[728], -12.440452, tolerance); - compare_doubles(lats[729], -12.581022, tolerance); - compare_doubles(lats[730], -12.721592, tolerance); - compare_doubles(lats[731], -12.862162, tolerance); - compare_doubles(lats[732], -13.002732, tolerance); - compare_doubles(lats[733], -13.143302, tolerance); - compare_doubles(lats[734], -13.283872, tolerance); - compare_doubles(lats[735], -13.424443, tolerance); - compare_doubles(lats[736], -13.565013, tolerance); - compare_doubles(lats[737], -13.705583, tolerance); - compare_doubles(lats[738], -13.846153, tolerance); - compare_doubles(lats[739], -13.986723, tolerance); - compare_doubles(lats[740], -14.127293, tolerance); - compare_doubles(lats[741], -14.267863, tolerance); - compare_doubles(lats[742], -14.408433, tolerance); - compare_doubles(lats[743], -14.549003, tolerance); - compare_doubles(lats[744], -14.689573, tolerance); - compare_doubles(lats[745], -14.830143, tolerance); - compare_doubles(lats[746], -14.970713, tolerance); - compare_doubles(lats[747], -15.111283, tolerance); - compare_doubles(lats[748], -15.251854, tolerance); - compare_doubles(lats[749], -15.392424, tolerance); - compare_doubles(lats[750], -15.532994, tolerance); - compare_doubles(lats[751], -15.673564, tolerance); - compare_doubles(lats[752], -15.814134, tolerance); - compare_doubles(lats[753], -15.954704, tolerance); - compare_doubles(lats[754], -16.095274, tolerance); - compare_doubles(lats[755], -16.235844, tolerance); - compare_doubles(lats[756], -16.376414, tolerance); - compare_doubles(lats[757], -16.516984, tolerance); - compare_doubles(lats[758], -16.657554, tolerance); - compare_doubles(lats[759], -16.798124, tolerance); - compare_doubles(lats[760], -16.938694, tolerance); - compare_doubles(lats[761], -17.079265, tolerance); - compare_doubles(lats[762], -17.219835, tolerance); - compare_doubles(lats[763], -17.360405, tolerance); - compare_doubles(lats[764], -17.500975, tolerance); - compare_doubles(lats[765], -17.641545, tolerance); - compare_doubles(lats[766], -17.782115, tolerance); - compare_doubles(lats[767], -17.922685, tolerance); - compare_doubles(lats[768], -18.063255, tolerance); - compare_doubles(lats[769], -18.203825, tolerance); - compare_doubles(lats[770], -18.344395, tolerance); - compare_doubles(lats[771], -18.484965, tolerance); - compare_doubles(lats[772], -18.625535, tolerance); - compare_doubles(lats[773], -18.766106, tolerance); - compare_doubles(lats[774], -18.906676, tolerance); - compare_doubles(lats[775], -19.047246, tolerance); - compare_doubles(lats[776], -19.187816, tolerance); - compare_doubles(lats[777], -19.328386, tolerance); - compare_doubles(lats[778], -19.468956, tolerance); - compare_doubles(lats[779], -19.609526, tolerance); - compare_doubles(lats[780], -19.750096, tolerance); - compare_doubles(lats[781], -19.890666, tolerance); - compare_doubles(lats[782], -20.031236, tolerance); - compare_doubles(lats[783], -20.171806, tolerance); - compare_doubles(lats[784], -20.312376, tolerance); - compare_doubles(lats[785], -20.452946, tolerance); - compare_doubles(lats[786], -20.593517, tolerance); - compare_doubles(lats[787], -20.734087, tolerance); - compare_doubles(lats[788], -20.874657, tolerance); - compare_doubles(lats[789], -21.015227, tolerance); - compare_doubles(lats[790], -21.155797, tolerance); - compare_doubles(lats[791], -21.296367, tolerance); - compare_doubles(lats[792], -21.436937, tolerance); - compare_doubles(lats[793], -21.577507, tolerance); - compare_doubles(lats[794], -21.718077, tolerance); - compare_doubles(lats[795], -21.858647, tolerance); - compare_doubles(lats[796], -21.999217, tolerance); - compare_doubles(lats[797], -22.139787, tolerance); - compare_doubles(lats[798], -22.280357, tolerance); - compare_doubles(lats[799], -22.420928, tolerance); - compare_doubles(lats[800], -22.561498, tolerance); - compare_doubles(lats[801], -22.702068, tolerance); - compare_doubles(lats[802], -22.842638, tolerance); - compare_doubles(lats[803], -22.983208, tolerance); - compare_doubles(lats[804], -23.123778, tolerance); - compare_doubles(lats[805], -23.264348, tolerance); - compare_doubles(lats[806], -23.404918, tolerance); - compare_doubles(lats[807], -23.545488, tolerance); - compare_doubles(lats[808], -23.686058, tolerance); - compare_doubles(lats[809], -23.826628, tolerance); - compare_doubles(lats[810], -23.967198, tolerance); - compare_doubles(lats[811], -24.107768, tolerance); - compare_doubles(lats[812], -24.248339, tolerance); - compare_doubles(lats[813], -24.388909, tolerance); - compare_doubles(lats[814], -24.529479, tolerance); - compare_doubles(lats[815], -24.670049, tolerance); - compare_doubles(lats[816], -24.810619, tolerance); - compare_doubles(lats[817], -24.951189, tolerance); - compare_doubles(lats[818], -25.091759, tolerance); - compare_doubles(lats[819], -25.232329, tolerance); - compare_doubles(lats[820], -25.372899, tolerance); - compare_doubles(lats[821], -25.513469, tolerance); - compare_doubles(lats[822], -25.654039, tolerance); - compare_doubles(lats[823], -25.794609, tolerance); - compare_doubles(lats[824], -25.935179, tolerance); - compare_doubles(lats[825], -26.075750, tolerance); - compare_doubles(lats[826], -26.216320, tolerance); - compare_doubles(lats[827], -26.356890, tolerance); - compare_doubles(lats[828], -26.497460, tolerance); - compare_doubles(lats[829], -26.638030, tolerance); - compare_doubles(lats[830], -26.778600, tolerance); - compare_doubles(lats[831], -26.919170, tolerance); - compare_doubles(lats[832], -27.059740, tolerance); - compare_doubles(lats[833], -27.200310, tolerance); - compare_doubles(lats[834], -27.340880, tolerance); - compare_doubles(lats[835], -27.481450, tolerance); - compare_doubles(lats[836], -27.622020, tolerance); - compare_doubles(lats[837], -27.762590, tolerance); - compare_doubles(lats[838], -27.903161, tolerance); - compare_doubles(lats[839], -28.043731, tolerance); - compare_doubles(lats[840], -28.184301, tolerance); - compare_doubles(lats[841], -28.324871, tolerance); - compare_doubles(lats[842], -28.465441, tolerance); - compare_doubles(lats[843], -28.606011, tolerance); - compare_doubles(lats[844], -28.746581, tolerance); - compare_doubles(lats[845], -28.887151, tolerance); - compare_doubles(lats[846], -29.027721, tolerance); - compare_doubles(lats[847], -29.168291, tolerance); - compare_doubles(lats[848], -29.308861, tolerance); - compare_doubles(lats[849], -29.449431, tolerance); - compare_doubles(lats[850], -29.590001, tolerance); - compare_doubles(lats[851], -29.730572, tolerance); - compare_doubles(lats[852], -29.871142, tolerance); - compare_doubles(lats[853], -30.011712, tolerance); - compare_doubles(lats[854], -30.152282, tolerance); - compare_doubles(lats[855], -30.292852, tolerance); - compare_doubles(lats[856], -30.433422, tolerance); - compare_doubles(lats[857], -30.573992, tolerance); - compare_doubles(lats[858], -30.714562, tolerance); - compare_doubles(lats[859], -30.855132, tolerance); - compare_doubles(lats[860], -30.995702, tolerance); - compare_doubles(lats[861], -31.136272, tolerance); - compare_doubles(lats[862], -31.276842, tolerance); - compare_doubles(lats[863], -31.417412, tolerance); - compare_doubles(lats[864], -31.557982, tolerance); - compare_doubles(lats[865], -31.698553, tolerance); - compare_doubles(lats[866], -31.839123, tolerance); - compare_doubles(lats[867], -31.979693, tolerance); - compare_doubles(lats[868], -32.120263, tolerance); - compare_doubles(lats[869], -32.260833, tolerance); - compare_doubles(lats[870], -32.401403, tolerance); - compare_doubles(lats[871], -32.541973, tolerance); - compare_doubles(lats[872], -32.682543, tolerance); - compare_doubles(lats[873], -32.823113, tolerance); - compare_doubles(lats[874], -32.963683, tolerance); - compare_doubles(lats[875], -33.104253, tolerance); - compare_doubles(lats[876], -33.244823, tolerance); - compare_doubles(lats[877], -33.385393, tolerance); - compare_doubles(lats[878], -33.525964, tolerance); - compare_doubles(lats[879], -33.666534, tolerance); - compare_doubles(lats[880], -33.807104, tolerance); - compare_doubles(lats[881], -33.947674, tolerance); - compare_doubles(lats[882], -34.088244, tolerance); - compare_doubles(lats[883], -34.228814, tolerance); - compare_doubles(lats[884], -34.369384, tolerance); - compare_doubles(lats[885], -34.509954, tolerance); - compare_doubles(lats[886], -34.650524, tolerance); - compare_doubles(lats[887], -34.791094, tolerance); - compare_doubles(lats[888], -34.931664, tolerance); - compare_doubles(lats[889], -35.072234, tolerance); - compare_doubles(lats[890], -35.212804, tolerance); - compare_doubles(lats[891], -35.353374, tolerance); - compare_doubles(lats[892], -35.493945, tolerance); - compare_doubles(lats[893], -35.634515, tolerance); - compare_doubles(lats[894], -35.775085, tolerance); - compare_doubles(lats[895], -35.915655, tolerance); - compare_doubles(lats[896], -36.056225, tolerance); - compare_doubles(lats[897], -36.196795, tolerance); - compare_doubles(lats[898], -36.337365, tolerance); - compare_doubles(lats[899], -36.477935, tolerance); - compare_doubles(lats[900], -36.618505, tolerance); - compare_doubles(lats[901], -36.759075, tolerance); - compare_doubles(lats[902], -36.899645, tolerance); - compare_doubles(lats[903], -37.040215, tolerance); - compare_doubles(lats[904], -37.180785, tolerance); - compare_doubles(lats[905], -37.321356, tolerance); - compare_doubles(lats[906], -37.461926, tolerance); - compare_doubles(lats[907], -37.602496, tolerance); - compare_doubles(lats[908], -37.743066, tolerance); - compare_doubles(lats[909], -37.883636, tolerance); - compare_doubles(lats[910], -38.024206, tolerance); - compare_doubles(lats[911], -38.164776, tolerance); - compare_doubles(lats[912], -38.305346, tolerance); - compare_doubles(lats[913], -38.445916, tolerance); - compare_doubles(lats[914], -38.586486, tolerance); - compare_doubles(lats[915], -38.727056, tolerance); - compare_doubles(lats[916], -38.867626, tolerance); - compare_doubles(lats[917], -39.008196, tolerance); - compare_doubles(lats[918], -39.148766, tolerance); - compare_doubles(lats[919], -39.289337, tolerance); - compare_doubles(lats[920], -39.429907, tolerance); - compare_doubles(lats[921], -39.570477, tolerance); - compare_doubles(lats[922], -39.711047, tolerance); - compare_doubles(lats[923], -39.851617, tolerance); - compare_doubles(lats[924], -39.992187, tolerance); - compare_doubles(lats[925], -40.132757, tolerance); - compare_doubles(lats[926], -40.273327, tolerance); - compare_doubles(lats[927], -40.413897, tolerance); - compare_doubles(lats[928], -40.554467, tolerance); - compare_doubles(lats[929], -40.695037, tolerance); - compare_doubles(lats[930], -40.835607, tolerance); - compare_doubles(lats[931], -40.976177, tolerance); - compare_doubles(lats[932], -41.116747, tolerance); - compare_doubles(lats[933], -41.257318, tolerance); - compare_doubles(lats[934], -41.397888, tolerance); - compare_doubles(lats[935], -41.538458, tolerance); - compare_doubles(lats[936], -41.679028, tolerance); - compare_doubles(lats[937], -41.819598, tolerance); - compare_doubles(lats[938], -41.960168, tolerance); - compare_doubles(lats[939], -42.100738, tolerance); - compare_doubles(lats[940], -42.241308, tolerance); - compare_doubles(lats[941], -42.381878, tolerance); - compare_doubles(lats[942], -42.522448, tolerance); - compare_doubles(lats[943], -42.663018, tolerance); - compare_doubles(lats[944], -42.803588, tolerance); - compare_doubles(lats[945], -42.944158, tolerance); - compare_doubles(lats[946], -43.084728, tolerance); - compare_doubles(lats[947], -43.225299, tolerance); - compare_doubles(lats[948], -43.365869, tolerance); - compare_doubles(lats[949], -43.506439, tolerance); - compare_doubles(lats[950], -43.647009, tolerance); - compare_doubles(lats[951], -43.787579, tolerance); - compare_doubles(lats[952], -43.928149, tolerance); - compare_doubles(lats[953], -44.068719, tolerance); - compare_doubles(lats[954], -44.209289, tolerance); - compare_doubles(lats[955], -44.349859, tolerance); - compare_doubles(lats[956], -44.490429, tolerance); - compare_doubles(lats[957], -44.630999, tolerance); - compare_doubles(lats[958], -44.771569, tolerance); - compare_doubles(lats[959], -44.912139, tolerance); - compare_doubles(lats[960], -45.052709, tolerance); - compare_doubles(lats[961], -45.193279, tolerance); - compare_doubles(lats[962], -45.333850, tolerance); - compare_doubles(lats[963], -45.474420, tolerance); - compare_doubles(lats[964], -45.614990, tolerance); - compare_doubles(lats[965], -45.755560, tolerance); - compare_doubles(lats[966], -45.896130, tolerance); - compare_doubles(lats[967], -46.036700, tolerance); - compare_doubles(lats[968], -46.177270, tolerance); - compare_doubles(lats[969], -46.317840, tolerance); - compare_doubles(lats[970], -46.458410, tolerance); - compare_doubles(lats[971], -46.598980, tolerance); - compare_doubles(lats[972], -46.739550, tolerance); - compare_doubles(lats[973], -46.880120, tolerance); - compare_doubles(lats[974], -47.020690, tolerance); - compare_doubles(lats[975], -47.161260, tolerance); - compare_doubles(lats[976], -47.301830, tolerance); - compare_doubles(lats[977], -47.442401, tolerance); - compare_doubles(lats[978], -47.582971, tolerance); - compare_doubles(lats[979], -47.723541, tolerance); - compare_doubles(lats[980], -47.864111, tolerance); - compare_doubles(lats[981], -48.004681, tolerance); - compare_doubles(lats[982], -48.145251, tolerance); - compare_doubles(lats[983], -48.285821, tolerance); - compare_doubles(lats[984], -48.426391, tolerance); - compare_doubles(lats[985], -48.566961, tolerance); - compare_doubles(lats[986], -48.707531, tolerance); - compare_doubles(lats[987], -48.848101, tolerance); - compare_doubles(lats[988], -48.988671, tolerance); - compare_doubles(lats[989], -49.129241, tolerance); - compare_doubles(lats[990], -49.269811, tolerance); - compare_doubles(lats[991], -49.410381, tolerance); - compare_doubles(lats[992], -49.550952, tolerance); - compare_doubles(lats[993], -49.691522, tolerance); - compare_doubles(lats[994], -49.832092, tolerance); - compare_doubles(lats[995], -49.972662, tolerance); - compare_doubles(lats[996], -50.113232, tolerance); - compare_doubles(lats[997], -50.253802, tolerance); - compare_doubles(lats[998], -50.394372, tolerance); - compare_doubles(lats[999], -50.534942, tolerance); - compare_doubles(lats[1000], -50.675512, tolerance); - compare_doubles(lats[1001], -50.816082, tolerance); - compare_doubles(lats[1002], -50.956652, tolerance); - compare_doubles(lats[1003], -51.097222, tolerance); - compare_doubles(lats[1004], -51.237792, tolerance); - compare_doubles(lats[1005], -51.378362, tolerance); - compare_doubles(lats[1006], -51.518932, tolerance); - compare_doubles(lats[1007], -51.659502, tolerance); - compare_doubles(lats[1008], -51.800073, tolerance); - compare_doubles(lats[1009], -51.940643, tolerance); - compare_doubles(lats[1010], -52.081213, tolerance); - compare_doubles(lats[1011], -52.221783, tolerance); - compare_doubles(lats[1012], -52.362353, tolerance); - compare_doubles(lats[1013], -52.502923, tolerance); - compare_doubles(lats[1014], -52.643493, tolerance); - compare_doubles(lats[1015], -52.784063, tolerance); - compare_doubles(lats[1016], -52.924633, tolerance); - compare_doubles(lats[1017], -53.065203, tolerance); - compare_doubles(lats[1018], -53.205773, tolerance); - compare_doubles(lats[1019], -53.346343, tolerance); - compare_doubles(lats[1020], -53.486913, tolerance); - compare_doubles(lats[1021], -53.627483, tolerance); - compare_doubles(lats[1022], -53.768053, tolerance); - compare_doubles(lats[1023], -53.908623, tolerance); - compare_doubles(lats[1024], -54.049194, tolerance); - compare_doubles(lats[1025], -54.189764, tolerance); - compare_doubles(lats[1026], -54.330334, tolerance); - compare_doubles(lats[1027], -54.470904, tolerance); - compare_doubles(lats[1028], -54.611474, tolerance); - compare_doubles(lats[1029], -54.752044, tolerance); - compare_doubles(lats[1030], -54.892614, tolerance); - compare_doubles(lats[1031], -55.033184, tolerance); - compare_doubles(lats[1032], -55.173754, tolerance); - compare_doubles(lats[1033], -55.314324, tolerance); - compare_doubles(lats[1034], -55.454894, tolerance); - compare_doubles(lats[1035], -55.595464, tolerance); - compare_doubles(lats[1036], -55.736034, tolerance); - compare_doubles(lats[1037], -55.876604, tolerance); - compare_doubles(lats[1038], -56.017174, tolerance); - compare_doubles(lats[1039], -56.157744, tolerance); - compare_doubles(lats[1040], -56.298314, tolerance); - compare_doubles(lats[1041], -56.438884, tolerance); - compare_doubles(lats[1042], -56.579455, tolerance); - compare_doubles(lats[1043], -56.720025, tolerance); - compare_doubles(lats[1044], -56.860595, tolerance); - compare_doubles(lats[1045], -57.001165, tolerance); - compare_doubles(lats[1046], -57.141735, tolerance); - compare_doubles(lats[1047], -57.282305, tolerance); - compare_doubles(lats[1048], -57.422875, tolerance); - compare_doubles(lats[1049], -57.563445, tolerance); - compare_doubles(lats[1050], -57.704015, tolerance); - compare_doubles(lats[1051], -57.844585, tolerance); - compare_doubles(lats[1052], -57.985155, tolerance); - compare_doubles(lats[1053], -58.125725, tolerance); - compare_doubles(lats[1054], -58.266295, tolerance); - compare_doubles(lats[1055], -58.406865, tolerance); - compare_doubles(lats[1056], -58.547435, tolerance); - compare_doubles(lats[1057], -58.688005, tolerance); - compare_doubles(lats[1058], -58.828575, tolerance); - compare_doubles(lats[1059], -58.969145, tolerance); - compare_doubles(lats[1060], -59.109715, tolerance); - compare_doubles(lats[1061], -59.250286, tolerance); - compare_doubles(lats[1062], -59.390856, tolerance); - compare_doubles(lats[1063], -59.531426, tolerance); - compare_doubles(lats[1064], -59.671996, tolerance); - compare_doubles(lats[1065], -59.812566, tolerance); - compare_doubles(lats[1066], -59.953136, tolerance); - compare_doubles(lats[1067], -60.093706, tolerance); - compare_doubles(lats[1068], -60.234276, tolerance); - compare_doubles(lats[1069], -60.374846, tolerance); - compare_doubles(lats[1070], -60.515416, tolerance); - compare_doubles(lats[1071], -60.655986, tolerance); - compare_doubles(lats[1072], -60.796556, tolerance); - compare_doubles(lats[1073], -60.937126, tolerance); - compare_doubles(lats[1074], -61.077696, tolerance); - compare_doubles(lats[1075], -61.218266, tolerance); - compare_doubles(lats[1076], -61.358836, tolerance); - compare_doubles(lats[1077], -61.499406, tolerance); - compare_doubles(lats[1078], -61.639976, tolerance); - compare_doubles(lats[1079], -61.780546, tolerance); - compare_doubles(lats[1080], -61.921116, tolerance); - compare_doubles(lats[1081], -62.061686, tolerance); - compare_doubles(lats[1082], -62.202256, tolerance); - compare_doubles(lats[1083], -62.342826, tolerance); - compare_doubles(lats[1084], -62.483397, tolerance); - compare_doubles(lats[1085], -62.623967, tolerance); - compare_doubles(lats[1086], -62.764537, tolerance); - compare_doubles(lats[1087], -62.905107, tolerance); - compare_doubles(lats[1088], -63.045677, tolerance); - compare_doubles(lats[1089], -63.186247, tolerance); - compare_doubles(lats[1090], -63.326817, tolerance); - compare_doubles(lats[1091], -63.467387, tolerance); - compare_doubles(lats[1092], -63.607957, tolerance); - compare_doubles(lats[1093], -63.748527, tolerance); - compare_doubles(lats[1094], -63.889097, tolerance); - compare_doubles(lats[1095], -64.029667, tolerance); - compare_doubles(lats[1096], -64.170237, tolerance); - compare_doubles(lats[1097], -64.310807, tolerance); - compare_doubles(lats[1098], -64.451377, tolerance); - compare_doubles(lats[1099], -64.591947, tolerance); - compare_doubles(lats[1100], -64.732517, tolerance); - compare_doubles(lats[1101], -64.873087, tolerance); - compare_doubles(lats[1102], -65.013657, tolerance); - compare_doubles(lats[1103], -65.154227, tolerance); - compare_doubles(lats[1104], -65.294797, tolerance); - compare_doubles(lats[1105], -65.435367, tolerance); - compare_doubles(lats[1106], -65.575937, tolerance); - compare_doubles(lats[1107], -65.716507, tolerance); - compare_doubles(lats[1108], -65.857077, tolerance); - compare_doubles(lats[1109], -65.997647, tolerance); - compare_doubles(lats[1110], -66.138217, tolerance); - compare_doubles(lats[1111], -66.278787, tolerance); - compare_doubles(lats[1112], -66.419357, tolerance); - compare_doubles(lats[1113], -66.559927, tolerance); - compare_doubles(lats[1114], -66.700497, tolerance); - compare_doubles(lats[1115], -66.841067, tolerance); - compare_doubles(lats[1116], -66.981638, tolerance); - compare_doubles(lats[1117], -67.122208, tolerance); - compare_doubles(lats[1118], -67.262778, tolerance); - compare_doubles(lats[1119], -67.403348, tolerance); - compare_doubles(lats[1120], -67.543918, tolerance); - compare_doubles(lats[1121], -67.684488, tolerance); - compare_doubles(lats[1122], -67.825058, tolerance); - compare_doubles(lats[1123], -67.965628, tolerance); - compare_doubles(lats[1124], -68.106198, tolerance); - compare_doubles(lats[1125], -68.246768, tolerance); - compare_doubles(lats[1126], -68.387338, tolerance); - compare_doubles(lats[1127], -68.527908, tolerance); - compare_doubles(lats[1128], -68.668478, tolerance); - compare_doubles(lats[1129], -68.809048, tolerance); - compare_doubles(lats[1130], -68.949618, tolerance); - compare_doubles(lats[1131], -69.090188, tolerance); - compare_doubles(lats[1132], -69.230758, tolerance); - compare_doubles(lats[1133], -69.371328, tolerance); - compare_doubles(lats[1134], -69.511898, tolerance); - compare_doubles(lats[1135], -69.652468, tolerance); - compare_doubles(lats[1136], -69.793038, tolerance); - compare_doubles(lats[1137], -69.933608, tolerance); - compare_doubles(lats[1138], -70.074178, tolerance); - compare_doubles(lats[1139], -70.214748, tolerance); - compare_doubles(lats[1140], -70.355318, tolerance); - compare_doubles(lats[1141], -70.495888, tolerance); - compare_doubles(lats[1142], -70.636458, tolerance); - compare_doubles(lats[1143], -70.777028, tolerance); - compare_doubles(lats[1144], -70.917598, tolerance); - compare_doubles(lats[1145], -71.058168, tolerance); - compare_doubles(lats[1146], -71.198738, tolerance); - compare_doubles(lats[1147], -71.339308, tolerance); - compare_doubles(lats[1148], -71.479878, tolerance); - compare_doubles(lats[1149], -71.620448, tolerance); - compare_doubles(lats[1150], -71.761018, tolerance); - compare_doubles(lats[1151], -71.901588, tolerance); - compare_doubles(lats[1152], -72.042158, tolerance); - compare_doubles(lats[1153], -72.182728, tolerance); - compare_doubles(lats[1154], -72.323298, tolerance); - compare_doubles(lats[1155], -72.463867, tolerance); - compare_doubles(lats[1156], -72.604437, tolerance); - compare_doubles(lats[1157], -72.745007, tolerance); - compare_doubles(lats[1158], -72.885577, tolerance); - compare_doubles(lats[1159], -73.026147, tolerance); - compare_doubles(lats[1160], -73.166717, tolerance); - compare_doubles(lats[1161], -73.307287, tolerance); - compare_doubles(lats[1162], -73.447857, tolerance); - compare_doubles(lats[1163], -73.588427, tolerance); - compare_doubles(lats[1164], -73.728997, tolerance); - compare_doubles(lats[1165], -73.869567, tolerance); - compare_doubles(lats[1166], -74.010137, tolerance); - compare_doubles(lats[1167], -74.150707, tolerance); - compare_doubles(lats[1168], -74.291277, tolerance); - compare_doubles(lats[1169], -74.431847, tolerance); - compare_doubles(lats[1170], -74.572417, tolerance); - compare_doubles(lats[1171], -74.712987, tolerance); - compare_doubles(lats[1172], -74.853557, tolerance); - compare_doubles(lats[1173], -74.994127, tolerance); - compare_doubles(lats[1174], -75.134697, tolerance); - compare_doubles(lats[1175], -75.275266, tolerance); - compare_doubles(lats[1176], -75.415836, tolerance); - compare_doubles(lats[1177], -75.556406, tolerance); - compare_doubles(lats[1178], -75.696976, tolerance); - compare_doubles(lats[1179], -75.837546, tolerance); - compare_doubles(lats[1180], -75.978116, tolerance); - compare_doubles(lats[1181], -76.118686, tolerance); - compare_doubles(lats[1182], -76.259256, tolerance); - compare_doubles(lats[1183], -76.399826, tolerance); - compare_doubles(lats[1184], -76.540396, tolerance); - compare_doubles(lats[1185], -76.680966, tolerance); - compare_doubles(lats[1186], -76.821535, tolerance); - compare_doubles(lats[1187], -76.962105, tolerance); - compare_doubles(lats[1188], -77.102675, tolerance); - compare_doubles(lats[1189], -77.243245, tolerance); - compare_doubles(lats[1190], -77.383815, tolerance); - compare_doubles(lats[1191], -77.524385, tolerance); - compare_doubles(lats[1192], -77.664955, tolerance); - compare_doubles(lats[1193], -77.805524, tolerance); - compare_doubles(lats[1194], -77.946094, tolerance); - compare_doubles(lats[1195], -78.086664, tolerance); - compare_doubles(lats[1196], -78.227234, tolerance); - compare_doubles(lats[1197], -78.367804, tolerance); - compare_doubles(lats[1198], -78.508374, tolerance); - compare_doubles(lats[1199], -78.648943, tolerance); - compare_doubles(lats[1200], -78.789513, tolerance); - compare_doubles(lats[1201], -78.930083, tolerance); - compare_doubles(lats[1202], -79.070653, tolerance); - compare_doubles(lats[1203], -79.211223, tolerance); - compare_doubles(lats[1204], -79.351792, tolerance); - compare_doubles(lats[1205], -79.492362, tolerance); - compare_doubles(lats[1206], -79.632932, tolerance); - compare_doubles(lats[1207], -79.773502, tolerance); - compare_doubles(lats[1208], -79.914072, tolerance); - compare_doubles(lats[1209], -80.054641, tolerance); - compare_doubles(lats[1210], -80.195211, tolerance); - compare_doubles(lats[1211], -80.335781, tolerance); - compare_doubles(lats[1212], -80.476350, tolerance); - compare_doubles(lats[1213], -80.616920, tolerance); - compare_doubles(lats[1214], -80.757490, tolerance); - compare_doubles(lats[1215], -80.898059, tolerance); - compare_doubles(lats[1216], -81.038629, tolerance); - compare_doubles(lats[1217], -81.179199, tolerance); - compare_doubles(lats[1218], -81.319768, tolerance); - compare_doubles(lats[1219], -81.460338, tolerance); - compare_doubles(lats[1220], -81.600908, tolerance); - compare_doubles(lats[1221], -81.741477, tolerance); - compare_doubles(lats[1222], -81.882047, tolerance); - compare_doubles(lats[1223], -82.022616, tolerance); - compare_doubles(lats[1224], -82.163186, tolerance); - compare_doubles(lats[1225], -82.303755, tolerance); - compare_doubles(lats[1226], -82.444325, tolerance); - compare_doubles(lats[1227], -82.584894, tolerance); - compare_doubles(lats[1228], -82.725464, tolerance); - compare_doubles(lats[1229], -82.866033, tolerance); - compare_doubles(lats[1230], -83.006602, tolerance); - compare_doubles(lats[1231], -83.147172, tolerance); - compare_doubles(lats[1232], -83.287741, tolerance); - compare_doubles(lats[1233], -83.428310, tolerance); - compare_doubles(lats[1234], -83.568880, tolerance); - compare_doubles(lats[1235], -83.709449, tolerance); - compare_doubles(lats[1236], -83.850018, tolerance); - compare_doubles(lats[1237], -83.990587, tolerance); - compare_doubles(lats[1238], -84.131156, tolerance); - compare_doubles(lats[1239], -84.271725, tolerance); - compare_doubles(lats[1240], -84.412294, tolerance); - compare_doubles(lats[1241], -84.552863, tolerance); - compare_doubles(lats[1242], -84.693432, tolerance); - compare_doubles(lats[1243], -84.834001, tolerance); - compare_doubles(lats[1244], -84.974570, tolerance); - compare_doubles(lats[1245], -85.115138, tolerance); - compare_doubles(lats[1246], -85.255707, tolerance); - compare_doubles(lats[1247], -85.396275, tolerance); - compare_doubles(lats[1248], -85.536844, tolerance); - compare_doubles(lats[1249], -85.677412, tolerance); - compare_doubles(lats[1250], -85.817980, tolerance); - compare_doubles(lats[1251], -85.958548, tolerance); - compare_doubles(lats[1252], -86.099116, tolerance); - compare_doubles(lats[1253], -86.239684, tolerance); - compare_doubles(lats[1254], -86.380251, tolerance); - compare_doubles(lats[1255], -86.520818, tolerance); - compare_doubles(lats[1256], -86.661385, tolerance); - compare_doubles(lats[1257], -86.801952, tolerance); - compare_doubles(lats[1258], -86.942519, tolerance); - compare_doubles(lats[1259], -87.083085, tolerance); - compare_doubles(lats[1260], -87.223651, tolerance); - compare_doubles(lats[1261], -87.364216, tolerance); + compare_doubles(lats[1262], -87.504781, tolerance); compare_doubles(lats[1263], -87.645345, tolerance); compare_doubles(lats[1264], -87.785908, tolerance); @@ -1404,10 +158,10 @@ static void test_string_splitting() if (!list) { Assert(!"List is NULL"); return; } for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */ Assert(i == 4); - if (!list[0] || !STR_EQ(list[0], "Born")) Assert(0); - if (!list[1] || !STR_EQ(list[1], "To")) Assert(0); - if (!list[2] || !STR_EQ(list[2], "Be")) Assert(0); - if (!list[3] || !STR_EQ(list[3], "Wild")) Assert(0); + if (!list[0] || !STR_EQUAL(list[0], "Born")) Assert(0); + if (!list[1] || !STR_EQUAL(list[1], "To")) Assert(0); + if (!list[2] || !STR_EQUAL(list[2], "Be")) Assert(0); + if (!list[3] || !STR_EQUAL(list[3], "Wild")) Assert(0); Assert(list[4] == NULL); for (i = 0; list[i] != NULL; ++i) free(list[i]); free(list); @@ -1417,8 +171,8 @@ static void test_string_splitting() if (!list) { Assert(0); return; } for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */ Assert(i == 2); - if (!list[0] || !STR_EQ(list[0], "12345")) Assert(0); - if (!list[1] || !STR_EQ(list[1], "a gap")) Assert(0); + if (!list[0] || !STR_EQUAL(list[0], "12345")) Assert(0); + if (!list[1] || !STR_EQUAL(list[1], "a gap")) Assert(0); Assert(list[2] == NULL); for (i = 0; list[i] != NULL; ++i) free(list[i]); free(list); @@ -1428,7 +182,7 @@ static void test_string_splitting() if (!list) { Assert(0); return; } for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */ Assert(i == 1); - if (!list[0] || !STR_EQ(list[0], "Steppenwolf")) Assert(0); + if (!list[0] || !STR_EQUAL(list[0], "Steppenwolf")) Assert(0); Assert(list[1] == NULL); for (i = 0; list[i] != NULL; ++i) free(list[i]); free(list); @@ -1654,11 +408,45 @@ static void test_parse_keyval_string() free( (void*)values3[0].name ); } +static void test_dates() +{ + printf("Testing: dates...\n"); + Assert( is_date_valid(1979,12, 1, 0,0,0) ); + Assert( is_date_valid(1900, 1, 1, 0,0,0) ); + Assert( is_date_valid(1964, 4, 6, 0,0,0) ); + Assert( is_date_valid(2023, 3, 4, 0,0,0) ); + Assert( is_date_valid(2023, 3, 4, 12,0,0) ); + Assert( is_date_valid(2023, 3, 4, 0,10,0) ); + Assert( is_date_valid(2023, 3, 4, 0,0,59) ); + Assert( is_date_valid(0000, 3, 4, 0,0,0) ); + Assert( is_date_valid(2020, 2, 29, 0,0,0) );//leap year + + Assert( !is_date_valid( 10, -1, 1, 0,0,0) );// bad months + Assert( !is_date_valid(1900, 0, 1, 0,0,0) ); + Assert( !is_date_valid(1900, 13, 1, 0,0,0) ); + + Assert( !is_date_valid(1900, 5, 0, 0,0,0) ); // bad days + Assert( !is_date_valid(2000, 5, 32, 0,0,0) ); + Assert( !is_date_valid(2000, 5, -7, 0,0,0) ); + + Assert( !is_date_valid(2000, 5, 8, 99,0,0) );//bad hours + Assert( !is_date_valid(2000, 5, 9, -1,0,0) ); + + Assert( !is_date_valid(2000, 5, 8, 0, 61,0) );//bad mins + Assert( !is_date_valid(2000, 5, 9, 0,-1, 0) ); + + Assert( !is_date_valid(2000, 5, 8, 0, 1, -1) );//bad secs + Assert( !is_date_valid(2000, 5, 9, 0, 1, 60) ); + + Assert( !is_date_valid(2023, 2, 29, 0,0,0) );//Feb + +} int main(int argc, char** argv) { printf("Doing unit tests. ecCodes version = %ld\n", grib_get_api_version()); + test_dates(); test_logging_proc(); test_grib_binary_search(); test_parse_keyval_string(); diff --git a/tools/grib_filter.h b/tools/deprecated/grib_filter.h similarity index 100% rename from tools/grib_filter.h rename to tools/deprecated/grib_filter.h diff --git a/tools/grib_filtery.y b/tools/deprecated/grib_filtery.y similarity index 100% rename from tools/grib_filtery.y rename to tools/deprecated/grib_filtery.y diff --git a/tools/load.cc b/tools/deprecated/load.cc similarity index 100% rename from tools/load.cc rename to tools/deprecated/load.cc diff --git a/tools/load.h b/tools/deprecated/load.h similarity index 100% rename from tools/load.h rename to tools/deprecated/load.h diff --git a/tools/loadl.l b/tools/deprecated/loadl.l similarity index 100% rename from tools/loadl.l rename to tools/deprecated/loadl.l diff --git a/tools/loady.y b/tools/deprecated/loady.y similarity index 100% rename from tools/loady.y rename to tools/deprecated/loady.y diff --git a/tools/grib_check_gaussian_grid.cc b/tools/grib_check_gaussian_grid.cc index 0a26cea96..9a3aea661 100644 --- a/tools/grib_check_gaussian_grid.cc +++ b/tools/grib_check_gaussian_grid.cc @@ -16,13 +16,11 @@ */ #include #include -#include #include #include #include "grib_api_internal.h" -#define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) int exit_on_error = 1; /* By default exit if any check fails */ int verbose = 0; /* By default quiet unless errors */ @@ -65,16 +63,6 @@ static void error(const char* filename, int msg_num, const char* fmt, ...) } } -static double get_precision(long edition) -{ - if (edition == 1) - return 1.0 / 1000.0; /* milli degrees */ - if (edition == 2) - return 1.0 / 1000000.0; /* micro degrees */ - assert(!"Invalid edition"); - return 0.0; -} - static int process_file(const char* filename) { int err = 0, msg_num = 0; @@ -98,7 +86,7 @@ static int process_file(const char* filename) while ((h = grib_handle_new_from_file(0, in, &err)) != NULL) { int is_reduced_gaussian = 0, is_regular_gaussian = 0, grid_ok = 0; - long edition = 0, N = 0, Nj = 0, numberOfDataPoints; + long edition = 0, N = 0, Nj = 0, numberOfDataPoints, numberOfValues, angleSubdivisions; size_t len = 0, sizeOfValuesArray = 0; double* lats = NULL; long* pl = NULL; @@ -129,12 +117,16 @@ static int process_file(const char* filename) GRIB_CHECK(grib_get_long(h, "N", &N), 0); GRIB_CHECK(grib_get_long(h, "Nj", &Nj), 0); GRIB_CHECK(grib_get_long(h, "numberOfDataPoints", &numberOfDataPoints), 0); + GRIB_CHECK(grib_get_long(h, "numberOfValues", &numberOfValues), 0); GRIB_CHECK(grib_get_double(h, "latitudeOfFirstGridPointInDegrees", &lat1), 0); GRIB_CHECK(grib_get_double(h, "longitudeOfFirstGridPointInDegrees", &lon1), 0); GRIB_CHECK(grib_get_double(h, "latitudeOfLastGridPointInDegrees", &lat2), 0); GRIB_CHECK(grib_get_double(h, "longitudeOfLastGridPointInDegrees", &lon2), 0); - angular_tolerance = get_precision(edition); + GRIB_CHECK(grib_get_long(h, "angleSubdivisions", &angleSubdivisions), 0); + Assert(angleSubdivisions > 0); + angular_tolerance = 1.0/angleSubdivisions; + printf(" angular_tolerance=%g\n",angular_tolerance); if (N <= 0) { error(filename, msg_num, "N should be > 0\n", N); @@ -166,16 +158,17 @@ static int process_file(const char* filename) } if (is_reduced_gaussian) { - int pl_sum = 0, max_pl = 0, is_missing_Ni = 0, is_missing_Di = 0; + int is_missing_Ni = 0, is_missing_Di = 0; + long pl_sum = 0, max_pl = 0; size_t i = 0, pl_len = 0; long is_octahedral = 0; long interpretationOfNumberOfPoints = 0; long iDirectionIncrementGiven = 0; is_missing_Ni = grib_is_missing(h, "Ni", &err); - assert(err == GRIB_SUCCESS); + Assert(err == GRIB_SUCCESS); is_missing_Di = grib_is_missing(h, "iDirectionIncrement", &err); - assert(err == GRIB_SUCCESS); + Assert(err == GRIB_SUCCESS); GRIB_CHECK(grib_get_long(h, "iDirectionIncrementGiven", &iDirectionIncrementGiven), 0); if (iDirectionIncrementGiven) { error(filename, msg_num, "For a reduced grid, iDirectionIncrementGiven should be 0\n"); @@ -188,12 +181,12 @@ static int process_file(const char* filename) } GRIB_CHECK(grib_get_size(h, "pl", &pl_len), 0); - assert(pl_len > 0); + Assert(pl_len > 0); if (pl_len != (size_t)(2 * N)) { error(filename, msg_num, "Length of pl array is %ld but should be 2*N (%ld)\n", pl_len, 2 * N); } pl = (long*)malloc(pl_len * sizeof(long)); - assert(pl); + Assert(pl); GRIB_CHECK(grib_get_long_array(h, "pl", pl, &pl_len), 0); max_pl = pl[0]; @@ -216,6 +209,9 @@ static int process_file(const char* filename) if (pl_sum != numberOfDataPoints) { error(filename, msg_num, "Sum of pl array %ld does not match numberOfDataPoints %ld\n", pl_sum, numberOfDataPoints); } + if (pl_sum != numberOfValues) { + error(filename, msg_num, "Sum of pl array %ld does not match numberOfValues %ld\n", pl_sum, numberOfValues); + } GRIB_CHECK(grib_get_long(h, "isOctahedral", &is_octahedral), 0); if (is_octahedral) { if (verbose) diff --git a/tools/grib_to_netcdf.cc b/tools/grib_to_netcdf.cc index f485286c9..a9af32dbd 100644 --- a/tools/grib_to_netcdf.cc +++ b/tools/grib_to_netcdf.cc @@ -48,13 +48,9 @@ static double global_missing_value = 9.9692099683868690e+36; /* See GRIB-953 */ #define NUMBER(x) (sizeof(x) / sizeof(x[0])) -typedef int boolean; typedef int err; typedef off_t file_offset; -static int FALSE = 0; -static int TRUE = 1; - static int files = 0; struct value @@ -85,60 +81,60 @@ struct parameter typedef struct parameter parameter; static const char* get_value(const request*, const char* name, int n); -static boolean parsedate(const char* name, long* julian, long* second, boolean* isjul); +static bool parsedate(const char* name, long* julian, long* second, bool* isjul); -static boolean eq_string(const char* l, const char* r) +static bool eq_string(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } -static boolean eq_integer(const char* l, const char* r) +static bool eq_integer(const char* l, const char* r) { if (l && r) return atol(l) == atol(r); - return FALSE; + return false; } -static boolean eq_null(const char* l, const char* r) +static bool eq_null(const char* l, const char* r) { - return TRUE; + return true; } -static boolean eq_coord(const char* l, const char* r) +static bool eq_coord(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } -static boolean eq_range(const char* l, const char* r) +static bool eq_range(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } -static boolean eq_date(const char* l, const char* r) +static bool eq_date(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } -static boolean eq_param(const char* l, const char* r) +static bool eq_param(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } -static boolean eq_time(const char* l, const char* r) +static bool eq_time(const char* l, const char* r) { if (l && r) return strcmp(l, r) == 0; - return FALSE; + return false; } static value* new_value(const char* name) @@ -175,11 +171,11 @@ static void ecc_reqmerge(parameter* pa, const parameter* pb, request* a) value* va = pa->values; value* last = 0; const char* nb = vb->name; - boolean add = TRUE; + bool add = true; while (va) { if (strcmp(va->name, nb) == 0) { - add = FALSE; + add = false; break; } @@ -201,14 +197,14 @@ static void ecc_reqmerge(parameter* pa, const parameter* pb, request* a) } /* Fast version if a && b same */ -static boolean ecc_reqmerge1(request* a, const request* b) +static bool ecc_reqmerge1(request* a, const request* b) { parameter* pa = a->params; const parameter* pb = b->params; while (pa && pb) { if (strcmp(pa->name, pb->name) != 0) - return FALSE; + return false; ecc_reqmerge(pa, pb, a); @@ -248,13 +244,13 @@ static const char* parse1(const char* p, int* x, int* n) return p; } -static boolean is_number(const char* name) +static bool is_number(const char* name) { const char* p = name; int x, n; if (p == 0 || *p == 0) - return FALSE; + return false; if (*p == '-') p++; @@ -263,7 +259,7 @@ static boolean is_number(const char* name) p = parse1(p, &x, &n); if (n == 0 && *p != '.') - return FALSE; + return false; if (*p == '.') { p++; @@ -278,10 +274,10 @@ static boolean is_number(const char* name) p++; p = parse1(p, &x, &n); if (n == 0) - return FALSE; + return false; } - return *p == 0 ? TRUE : FALSE; + return *p == 0 ? true : false; } static parameter* new_parameter(char* name, value* v) { @@ -292,7 +288,7 @@ static parameter* new_parameter(char* name, value* v) return p; } -static void put_value(request* r, const char* parname, const char* valname, boolean append, boolean unique, boolean ascending) +static void put_value(request* r, const char* parname, const char* valname, bool append, bool unique, bool ascending) { parameter* p; value* v; @@ -393,7 +389,7 @@ static void add_value(request* r, const char* parname, const char* fmt, ...) vsnprintf(buffer, sizeof(buffer), fmt, list); va_end(list); - put_value(r, parname, buffer, TRUE, FALSE, FALSE); + put_value(r, parname, buffer, true, false, false); } static void ecc_reqmerge2(request* a, const request* b) @@ -406,7 +402,7 @@ static void ecc_reqmerge2(request* a, const request* b) if (pa == NULL) { value* v = pb->values; while (v) { - put_value(a, pb->name, v->name, TRUE, TRUE, FALSE); + put_value(a, pb->name, v->name, true, true, false); v = v->next; } } @@ -540,7 +536,7 @@ static void set_value(request* r, const char* parname, const char* fmt, ...) vsnprintf(buffer, sizeof(buffer), fmt, list); va_end(list); - put_value(r, parname, buffer, FALSE, FALSE, FALSE); + put_value(r, parname, buffer, false, false, false); } static err handle_to_request(request* r, grib_handle* g) @@ -624,7 +620,7 @@ static err handle_to_request(request* r, grib_handle* g) /*===============================================================================*/ /*===============================================================================*/ -typedef boolean (*namecmp)(const char*, const char*); +typedef bool (*namecmp)(const char*, const char*); typedef struct hypercube { @@ -682,8 +678,8 @@ typedef struct field /* missing fields/values */ - /*boolean is_missing;*/ /* field is missing */ - boolean has_bitmap; /* field has missing values (= bitmap) */ + /*bool is_missing;*/ /* field is missing */ + bool has_bitmap; /* field has missing values (= bitmap) */ field_request* r; @@ -719,7 +715,7 @@ static const char* get_axis(const hypercube* h, int pos); static const char* get_axis(const hypercube* h, int pos); static int cube_order(const hypercube* h, const request* r); static void free_hypercube(hypercube* h); -static int ecc_cube_position(const hypercube* h, const request* r, boolean remove_holes); +static int ecc_cube_position(const hypercube* h, const request* r, bool remove_holes); static value* clone_one_value(const value* p) { @@ -1143,14 +1139,14 @@ static request* fieldset_to_request(fieldset* fs) /* hypercube from mars client */ /*===============================================================================*/ -static boolean eq_string(const char*, const char*); -static boolean eq_integer(const char*, const char*); -static boolean eq_range(const char*, const char*); -static boolean eq_param(const char*, const char*); -static boolean eq_coord(const char*, const char*); -static boolean eq_date(const char*, const char*); -static boolean eq_time(const char*, const char*); -static boolean eq_null(const char*, const char*); +static bool eq_string(const char*, const char*); +static bool eq_integer(const char*, const char*); +static bool eq_range(const char*, const char*); +static bool eq_param(const char*, const char*); +static bool eq_coord(const char*, const char*); +static bool eq_date(const char*, const char*); +static bool eq_time(const char*, const char*); +static bool eq_null(const char*, const char*); static axis_t global_axis[] = { @@ -1319,7 +1315,7 @@ static axis_t global_axis[] = { static int axisindex(const char* name) { - int i = 0; + size_t i = 0; for (i = 0; i < NUMBER(global_axis); i++) { if (strcmp(name, global_axis[i].name) == 0) return i; @@ -1330,12 +1326,12 @@ static int axisindex(const char* name) static namecmp comparator(const char* name) { static char* dontcompare = NULL; - static boolean first = 1; + static bool first = 1; int i = 0; if (first) { dontcompare = getenv("MARS_DONT_CHECK"); - first = FALSE; + first = false; } if (dontcompare != NULL) { @@ -1460,11 +1456,11 @@ static void valcpy(request* a, request* b, char* aname, char* bname) { parameter* p; if (a && b && (p = find_parameter(b, bname))) { - boolean z = FALSE; + bool z = false; value* v = p->values; while (v) { - put_value(a, aname, v->name, z, FALSE, FALSE); - z = TRUE; + put_value(a, aname, v->name, z, false, false); + z = true; v = v->next; } } @@ -1521,7 +1517,8 @@ static int count_dimensions(const hypercube* h, const char* axis) static int count_hypercube(const request* r) { - int i = 0, count = 1; + int count = 1; + size_t i = 0; for (i = 0; i < NUMBER(global_axis); ++i) { int c = count_values(r, global_axis[i].name); count *= c ? c : 1; @@ -1532,17 +1529,17 @@ static int count_hypercube(const request* r) static int cube_order(const hypercube* h, const request* r) { - return ecc_cube_position(h, r, TRUE); + return ecc_cube_position(h, r, true); } static int cube_position(const hypercube* h, const request* r) { - return ecc_cube_position(h, r, FALSE); + return ecc_cube_position(h, r, false); } static void reserve_index_cache(hypercube* h, int size) { - if (size == 0) + if (size <= 0) return; if (h->index_cache != 0) @@ -1553,7 +1550,7 @@ static void reserve_index_cache(hypercube* h, int size) h->index_cache_size = size; } -static int ecc_cube_position(const hypercube* h, const request* r, boolean remove_holes) +static int ecc_cube_position(const hypercube* h, const request* r, bool remove_holes) { request* cube = h->cube; int c = count_axis(h); @@ -1627,7 +1624,7 @@ static void cube_indexes( int k = 0; int count = count_values(cube, axis); int last = h->index_cache[i]; - const boolean is_time_axis = (strcmp(axis, "time") == 0); + const bool is_time_axis = (strcmp(axis, "time") == 0); if (is_time_axis) { Assert(times_array); Assert(times_array_size == count); @@ -1669,7 +1666,7 @@ static hypercube* new_hypercube(const request* r) { hypercube* h = (hypercube*)calloc(sizeof(hypercube), 1); int total = 0, count = 0; - int n = 0; + size_t n = 0; const char* val = 0; Assert(h); h->r = clone_one_request(r); @@ -1850,10 +1847,10 @@ typedef struct filter_type double scale_factor; double add_offset; double missing; - boolean bitmap; + bool bitmap; ncatt_t att; request* filter_request; - boolean scale; + bool scale; } dataset_t; /* @@ -1865,19 +1862,19 @@ typedef struct filter_type typedef struct ncoptions { - boolean usevalidtime; /* Whether to use valid TIME only or not */ - boolean auto_refdate; /* Automatic Reference Date */ + bool usevalidtime; /* Whether to use valid TIME only or not */ + bool auto_refdate; /* Automatic Reference Date */ long refdate; /* Reference date */ const char* version; char* title; char* history; char* unlimited; - boolean checkvalidtime; + bool checkvalidtime; request* mars_description; - boolean mmeans; /* Whether this dataset is Monthly Means */ - boolean climatology; /* Whether this dataset is climatology */ - boolean shuffle; + bool mmeans; /* Whether this dataset is Monthly Means */ + bool climatology; /* Whether this dataset is climatology */ + bool shuffle; long deflate; } ncoptions_t; @@ -2020,7 +2017,7 @@ static void validation_time(request* r) date = atol(p); else { long second = 0; - boolean isjul, date_ok; + bool isjul, date_ok; date_ok = parsedate(p, &julian, &second, &isjul); if (!date_ok) grib_context_log(ctx, GRIB_LOG_ERROR, "Failed to parse date: '%s'", p); @@ -2031,9 +2028,9 @@ static void validation_time(request* r) if (strlen(p) == 3) { if (setup.usevalidtime) grib_context_log(ctx, GRIB_LOG_ERROR, "Climatology data. Setting usevalidtime=OFF"); - setup.auto_refdate = FALSE; - setup.usevalidtime = FALSE; - setup.climatology = TRUE; + setup.auto_refdate = false; + setup.usevalidtime = false; + setup.climatology = true; } } @@ -2103,11 +2100,11 @@ static void get_nc_options(const request* user_r) const char* history = get_value(user_r, "history", 0); const char* unlimited = get_value(user_r, "unlimited", 0); - setup.shuffle = shuffle ? (strcmp(shuffle, "true") == 0) : FALSE; + setup.shuffle = shuffle ? (strcmp(shuffle, "true") == 0) : false; setup.deflate = deflate ? ((strcmp(deflate, "none") == 0) ? -1 : atol(deflate)) : -1; - setup.usevalidtime = validtime ? (strcmp(validtime, "true") == 0) : FALSE; + setup.usevalidtime = validtime ? (strcmp(validtime, "true") == 0) : false; setup.refdate = refdate ? atol(refdate) : 19000101; - setup.auto_refdate = refdate ? (strcmp(get_value(user_r, "referencedate", 0), "AUTOMATIC") == 0) : FALSE; + setup.auto_refdate = refdate ? (strcmp(get_value(user_r, "referencedate", 0), "AUTOMATIC") == 0) : false; setup.title = title ? grib_context_strdup(ctx, (title)) : NULL; setup.history = history ? grib_context_strdup(ctx, (history)) : NULL; @@ -2266,7 +2263,7 @@ static int def_latlon(int ncid, fieldset* fs) n = nlats; set_dimension(ncid, "latitude", n, NC_FLOAT, "degrees_north", "latitude"); - /* g->purge_header = TRUE; */ + /* g->purge_header = true; */ release_field(g); return e; @@ -2275,7 +2272,7 @@ static int def_latlon(int ncid, fieldset* fs) static int put_latlon(int ncid, fieldset* fs) { int var_id = 0; - int i = 0; + size_t i = 0; size_t n = 0; int stat = 0; err e = 0; @@ -2364,7 +2361,7 @@ static int put_latlon(int ncid, fieldset* fs) stat = nc_put_var_float(ncid, var_id, fvalues); check_err("nc_put_var_float", stat, __LINE__); - /* g->purge_header = TRUE; */ + /* g->purge_header = true; */ release_field(g); grib_context_free(ctx, fvalues); grib_context_free(ctx, dvalues); @@ -2378,7 +2375,7 @@ static int compute_scale(dataset_t* subset) double min = DBL_MAX; double median = 0; long i = 0; - long j = 0; + size_t j = 0; int64_t scaled_max = 0; int64_t scaled_min = 0; int64_t scaled_median = 0; @@ -2417,7 +2414,7 @@ static int compute_scale(dataset_t* subset) } if (g->has_bitmap) { - subset->bitmap = TRUE; + subset->bitmap = true; for (j = 0; j < len; ++j) { if (vals && vals[j] != global_missing_value) { if (vals[j] > max) max = vals[j]; @@ -2433,7 +2430,7 @@ static int compute_scale(dataset_t* subset) } } } - /* g->purge_header = TRUE; */ + /* g->purge_header = true; */ release_field(g); } @@ -2754,7 +2751,7 @@ static int put_data(hypercube* h, int ncid, const char* name, dataset_t* subset) field* f = get_field(fs, 0, expand_mem); void* vscaled = NULL; - long vscaled_length = 0; + size_t vscaled_length = 0; long ni; long nj; @@ -2782,7 +2779,7 @@ static int put_data(hypercube* h, int ncid, const char* name, dataset_t* subset) count[naxis] = nj; /* latitude */ count[naxis + 1] = ni; /* longitude */ - /* f->purge_header = TRUE; */ + /* f->purge_header = true; */ release_field(f); stat = nc_inq_varid(ncid, name, &dataid); @@ -2797,7 +2794,7 @@ static int put_data(hypercube* h, int ncid, const char* name, dataset_t* subset) size_t len; static double* vals = NULL; static size_t vals_len = 0; - boolean missing = 0; + bool missing = 0; request* r; int j = 0; @@ -2821,7 +2818,7 @@ static int put_data(hypercube* h, int ncid, const char* name, dataset_t* subset) } #if 0 - boolean missing = (g->ksec4[0] < 0); /* If negative number of values, field is missing */ + bool missing = (g->ksec4[0] < 0); /* If negative number of values, field is missing */ #endif r = field_to_request(g); @@ -2865,7 +2862,7 @@ static int put_data(hypercube* h, int ncid, const char* name, dataset_t* subset) check_err("nc_put_vara_type", stat, __LINE__); } - /* g->purge_header = TRUE; */ + /* g->purge_header = true; */ release_field(g); } @@ -2993,7 +2990,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase } if (strcmp(axis, "time") == 0) { - boolean onedtime = (count_values(cube, "date") == 0 && count_values(cube, "step") == 0); + bool onedtime = (count_values(cube, "date") == 0 && count_values(cube, "step") == 0); snprintf(u, sizeof(u), "hours since 0000-00-00 00:00:00.0"); longname = "reference_time"; if (setup.usevalidtime || onedtime) { @@ -3370,7 +3367,7 @@ static void print_ignored_keys(FILE* f, request* data) #define NO_TABLE -1 #define NO_PARAM 0 -static void paramtable(const char* p, long* param, long* table, boolean paramIdMode) +static void paramtable(const char* p, long* param, long* table, bool paramIdMode) { const char* q = p; int len = strlen(p); @@ -3406,7 +3403,7 @@ static void find_nc_attributes(const request* subset_r, const request* user_r, n { const char* split = NULL; int j = 0; - boolean set_param_as_name = TRUE; + bool set_param_as_name = true; long datatable = 0; /* = atol(get_value(data_r,"_CODETABLE2",0)); */ if (count_values(user_r, "split") == 0) @@ -3415,18 +3412,18 @@ static void find_nc_attributes(const request* subset_r, const request* user_r, n while ((split = get_value(user_r, "split", j++)) != NULL) { if (strcmp(split, "param") != 0) { if (count_values(data_r, split) > 1) - set_param_as_name = FALSE; + set_param_as_name = false; } } j = 0; while ((split = get_value(user_r, "split", j++)) != NULL) { - boolean found = FALSE; + bool found = false; request* cfg = (request*)config_r; - boolean is_param = strcmp(split, "param") == 0; + bool is_param = strcmp(split, "param") == 0; /* Only use this parameter in the name if there is more than one value in the original request or if param */ - boolean setname = ((count_values(data_r, split) > 1) || (is_param && set_param_as_name)); + bool setname = ((count_values(data_r, split) > 1) || (is_param && set_param_as_name)); while (cfg) { const char* cfgname = get_value(cfg, "NAME", 0); @@ -3441,7 +3438,7 @@ static void find_nc_attributes(const request* subset_r, const request* user_r, n long cfgparam = atol(cfgval); long dataparam = atol(dataval); - paramtable(dataval, &dataparam, &datatable, FALSE); + paramtable(dataval, &dataparam, &datatable, false); /* If it is not param and they're EXACTLY equal or being param, they're the same parameter and table */ @@ -3473,7 +3470,7 @@ static void find_nc_attributes(const request* subset_r, const request* user_r, n strcat(att->name, "_"); strcat(att->name, pname); } - found = TRUE; + found = true; grib_context_log(ctx, GRIB_LOG_DEBUG, "grib_to_netcdf: Var. name found: '%s'", att->name); } @@ -3516,7 +3513,7 @@ static void reqcb(const request* r, int count, axis_t* names, char* vals[], void w->order = (*n)++; for (i = 0; i < count; i++) { if (vals[i]) - put_value(w, names[i].name, vals[i], FALSE, FALSE, FALSE); + put_value(w, names[i].name, vals[i], false, false, false); } if (first == NULL) @@ -3526,12 +3523,12 @@ static void reqcb(const request* r, int count, axis_t* names, char* vals[], void last = w; } -static boolean chk_152(int count, axis_t* names, char* vals[]) +static bool chk_152(int count, axis_t* names, char* vals[]) { - return TRUE; + return true; } -static void loop(const request* r, boolean ml, int index, int count, axis_t* strings, char* values[], loopproc callback, void* data) +static void loop(const request* r, bool ml, int index, int count, axis_t* strings, char* values[], loopproc callback, void* data) { if (index < count) { parameter* p = find_parameter(r, strings[index].name); @@ -3560,14 +3557,14 @@ static void values_loop(const request* r, int count, axis_t* parnames, loopproc { char** values = (char**)grib_context_malloc(ctx, sizeof(char*) * count); const char* p = get_value(r, "levtype", 0); - boolean ml = (boolean)(p && (strcmp(p, "ml") == 0)); + bool ml = (bool)(p && (strcmp(p, "ml") == 0)); if (ml) { p = get_value(r, "expect", 0); if (p && atol(p) != 0) { grib_context_log(ctx, GRIB_LOG_ERROR, "EXPECT provided, special treatment of LNSP"); grib_context_log(ctx, GRIB_LOG_ERROR, "and other single level parameters disabled"); - ml = FALSE; + ml = false; } } @@ -3622,14 +3619,14 @@ static int split_fieldset(fieldset* fs, request* data_r, dataset_t** subsets, co filters[i].fset = new_fieldset(1); filters[i].count = 0; filters[i].filter_request = clone_one_request(s); - filters[i].bitmap = FALSE; - /* filters[i].mmeans = FALSE; */ + filters[i].bitmap = false; + /* filters[i].mmeans = false; */ s = s->next; } for (i = 0; i < fs->count; ++i) { - boolean ok = FALSE; + bool ok = false; field* f = get_field(fs, i, packed_mem); request* g = field_to_request(f); int j = 0; @@ -3660,13 +3657,13 @@ static int split_fieldset(fieldset* fs, request* data_r, dataset_t** subsets, co print_hypercube(filters[0].filter); exit(1); } - /* f->purge_header = TRUE; */ + /* f->purge_header = true; */ release_field(f); } for (i = 0; i < count; ++i) { filters[i].att.nctype = nctype; - filters[i].scale = TRUE; + filters[i].scale = true; filters[i].missing = nc_type_values[nctype].nc_type_missing; find_nc_attributes(filters[i].filter_request, user_r, &(filters[i].att), config_r, data_r); grib_context_log(ctx, GRIB_LOG_DEBUG, "grib_to_netcdf: filter[%d] found.- Var. name '%s', nctype: %d, found nctype: %d", i, filters[i].att.name, nctype, filters[i].att.nctype); @@ -3680,10 +3677,10 @@ static int split_fieldset(fieldset* fs, request* data_r, dataset_t** subsets, co switch (filters[i].att.nctype) { case NC_FLOAT: case NC_DOUBLE: - filters[i].scale = FALSE; + filters[i].scale = false; break; default: - filters[i].scale = TRUE; + filters[i].scale = true; break; } } @@ -3740,17 +3737,17 @@ static int convert_month(const char* pMonthString) return -1; /*Failed*/ } -static boolean parsedate(const char* name, long* julian, long* second, boolean* isjul) +static bool parsedate(const char* name, long* julian, long* second, bool* isjul) { const char* p = name; int n; int y = 0, m = 0, d = 0, H = 0, M = 0, S = 0; *julian = *second = 0; - *isjul = FALSE; + *isjul = false; if (p == 0 || *p == 0) - return FALSE; + return false; /* Special ERA Interim grib1 date format: jul-21, sep-02 etc * See GRIB-416 @@ -3764,29 +3761,29 @@ static boolean parsedate(const char* name, long* julian, long* second, boolean* y = 1900; /* no year specified */ m = convert_month(month); if (m == -1) - return FALSE; + return false; *julian = grib_date_to_julian(y * 10000 + m * 100 + day); *second = 0; - return TRUE; + return true; } } /* year */ p = parse1(p, &y, &n); if (n != 2 && n != 4) /* year string must be 2 or 4 characters long: 93 or 1993 */ - return FALSE; + return false; if (*p++ != '-') - return FALSE; + return false; /* month */ p = parse1(p, &m, &n); if (n == 2) { /* day */ if (*p++ != '-') - return FALSE; + return false; p = parse1(p, &d, &n); if (n != 2) - return FALSE; + return false; } else if (n == 3) { long j = grib_date_to_julian(y * 10000 + 101) + m - 1; @@ -3794,13 +3791,13 @@ static boolean parsedate(const char* name, long* julian, long* second, boolean* /* julian day */; d = j % 100; m = (j % 10000) / 100; - *isjul = TRUE; + *isjul = true; } else - return FALSE; + return false; if (m == 0 || m > 12) { - return FALSE; /* month out of range */ + return false; /* month out of range */ } while (*p && isspace(*p)) @@ -3810,53 +3807,53 @@ static boolean parsedate(const char* name, long* julian, long* second, boolean* p = parse1(p, &H, &n); if (n != 0) { if (n != 2) - return FALSE; + return false; /* minute */ if (*p++ != ':') - return FALSE; + return false; p = parse1(p, &M, &n); if (n != 2) - return FALSE; + return false; if (*p != 0) { /* second */ if (*p++ != ':') - return FALSE; + return false; p = parse1(p, &S, &n); if (n != 2) - return FALSE; + return false; } } *julian = grib_date_to_julian(y * 10000 + m * 100 + d); *second = H * 3600 + M * 60 + S; - return *p == 0 ? TRUE : FALSE; + return *p == 0 ? true : false; } -static boolean check_dimension_name(const char* dim) +static bool check_dimension_name(const char* dim) { /* Dimension name must begin with an alphabetic character, followed by zero * or more alphanumeric characters including the underscore */ int i = 0, len = 0; if (!dim) - return FALSE; + return false; len = strlen(dim); if (len == 0) - return FALSE; + return false; if (!isalpha(dim[0])) - return FALSE; + return false; for (i = 1; i < len; ++i) { const char c = dim[i]; const int ok = isalnum(c) || c == '_'; if (!ok) - return FALSE; + return false; } - return TRUE; + return true; } static int get_creation_mode(int option_kind) @@ -4011,13 +4008,14 @@ int grib_tool_init(grib_runtime_options* options) /* Option -S: Split according to keys */ if (grib_options_on("S:")) { + char* lasts = NULL; list = grib_options_get_option("S:"); - p = strtok(list, ","); + p = strtok_r(list, ",", &lasts); set_value(user_r, "split", p); - p = strtok(NULL, ","); + p = strtok_r(NULL, ",", &lasts); while (p != NULL) { add_value(user_r, "split", p); - p = strtok(NULL, ","); + p = strtok_r(NULL, ",", &lasts); } } else { @@ -4027,13 +4025,14 @@ int grib_tool_init(grib_runtime_options* options) /* Option -I: Ignore keys */ if (grib_options_on("I:")) { + char* lasts = NULL; list = grib_options_get_option("I:"); - p = strtok(list, ","); + p = strtok_r(list, ",", &lasts); set_value(user_r, "ignore", p); - p = strtok(NULL, ","); + p = strtok_r(NULL, ",", &lasts); while (p != NULL) { add_value(user_r, "ignore", p); - p = strtok(NULL, ","); + p = strtok_r(NULL, ",", &lasts); } } else { @@ -4171,7 +4170,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil if (i == 1) { const char* mmeans = get_value(r, "_MONTHLY_MEANS", 0); - setup.mmeans = mmeans ? (atol(mmeans) == 1) : FALSE; + setup.mmeans = mmeans ? (atol(mmeans) == 1) : false; } fcmonth2nbmonths(r); @@ -4184,7 +4183,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil setup.refdate = atol(p); else { long julian = 0, second = 0; - boolean isjul; + bool isjul; parsedate(p, &julian, &second, &isjul); setup.refdate = grib_julian_to_date(julian); } @@ -4373,7 +4372,6 @@ int grib_no_handle_action(grib_runtime_options* options, int err) #else #include -#include int main(int argc, char** argv) { printf("\n"); diff --git a/tools/grib_tools.cc b/tools/grib_tools.cc index baaf2267d..8b6becee7 100644 --- a/tools/grib_tools.cc +++ b/tools/grib_tools.cc @@ -21,9 +21,8 @@ #endif #ifdef ENABLE_FLOATING_POINT_EXCEPTIONS -#define _GNU_SOURCE -#include -int feenableexcept(int excepts); + #include + int feenableexcept(int excepts); #endif GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) @@ -672,7 +671,7 @@ static void grib_print_header(grib_runtime_options* options, grib_handle* h) int width; int written_to_dump = 0; /* boolean */ if (options->json_output && !options->latlon) - return; /* For JSON output we do not print a single header for all msgs */ + return; // For JSON output we do not print a single header for all msgs if (options->handle_count != 1) return; @@ -713,9 +712,9 @@ static void grib_print_header(grib_runtime_options* options, grib_handle* h) static int cmpstringp(const void* p1, const void* p2) { - /* The actual arguments to this function are "pointers to - pointers to char", but strcmp(3) arguments are "pointers - to char", hence the following cast plus dereference */ + // The actual arguments to this function are "pointers to + // pointers to char", but strcmp(3) arguments are "pointers + // to char", hence the following cast plus dereference return strcmp(*(char* const*)p1, *(char* const*)p2); } @@ -756,15 +755,17 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle if (strlen(name) > options->default_print_width) options->default_print_width = (int)strlen(name); options->print_keys[options->print_keys_count].type = GRIB_TYPE_STRING; + // For the statistics namespace, do not force the type to be string. + // Setting it to undefined will use the keys' native type i.e. GRIB_TYPE_DOUBLE + if (strcmp(ns,"statistics")==0) + options->print_keys[options->print_keys_count].type = GRIB_TYPE_UNDEFINED; options->print_keys_count++; } grib_keys_iterator_delete(kiter); if (options->print_keys_count == 0 && options->latlon == 0) { int j = 0, k = 0, ns_count = 0; - const char* all_namespace_vals[1024] = { - NULL, - }; /* sorted array containing all namespaces */ + const char* all_namespace_vals[1024] = {NULL,}; // sorted array containing all namespaces printf("ERROR: namespace \"%s\" does not contain any key.\n", ns); printf("Here are the available namespaces in this message:\n"); for (i = 0; i < ACCESSORS_ARRAY_SIZE; i++) { @@ -784,7 +785,7 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle if (all_namespace_vals[i]) { int print_it = 1; if (i > 0 && strcmp(all_namespace_vals[i], all_namespace_vals[i - 1]) == 0) { - print_it = 0; /* skip duplicate entries */ + print_it = 0; // skip duplicate entries } if (print_it) printf("\t%s\n", all_namespace_vals[i]); @@ -795,7 +796,7 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle } } -static int to_skip(grib_handle* h, grib_values* v, int* err) +static int to_skip(grib_runtime_options* options, grib_handle* h, grib_values* v, int* err) { double dvalue = 0; int ret = 0; @@ -804,6 +805,13 @@ static int to_skip(grib_handle* h, grib_values* v, int* err) size_t len = MAX_STRING_LEN; *err = 0; + Assert(options->constraints_count > 0); + + if (strcmp(v->name, "count")==0 && v->long_value < 1) { + fprintf(dump_file, "ERROR: Invalid value for key '%s' (must be an integer greater than 0)\n", v->name); + exit(1); + } + switch (v->type) { case GRIB_TYPE_STRING: *err = grib_get_string(h, v->name, value, &len); @@ -849,7 +857,7 @@ void grib_skip_check(grib_runtime_options* options, grib_handle* h) if (v->equal) { options->skip = 1; while (v) { - if (!to_skip(h, v, &ret)) { + if (!to_skip(options, h, v, &ret)) { if (!strcmp(v->name, "count") && !v->next) { /* We have count=XX and nothing after that so we can * skip every other message after it @@ -870,7 +878,7 @@ void grib_skip_check(grib_runtime_options* options, grib_handle* h) else { options->skip = 0; while (v) { - if (to_skip(h, v, &ret)) { + if (to_skip(options, h, v, &ret)) { options->skip = 1; break; } @@ -990,7 +998,6 @@ static void get_value_for_key(grib_handle* h, const char* key_name, int key_type double dvalue = 0; long lvalue = 0; size_t len = MAX_STRING_LEN; - if (grib_is_missing(h, key_name, &ret) && ret == GRIB_SUCCESS) { snprintf(value_str, 32, "MISSING"); return; @@ -1041,7 +1048,9 @@ static void get_value_for_key(grib_handle* h, const char* key_name, int key_type if (ret == GRIB_NOT_FOUND) { snprintf(value_str, 32, "not_found"); } else { - fprintf(dump_file, "ERROR: Failed to get value for key %s\n", key_name); + fprintf(dump_file, "ERROR: Failed to get value for key '%s' (%s)\n", key_name, grib_get_error_message(ret)); + if (ret == GRIB_ARRAY_TOO_SMALL) + fprintf(dump_file, "\tHint: Tool %s cannot print keys of array type. Use grib_filter.\n", tool_name); exit(1); } } @@ -1198,12 +1207,18 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h) } if (ret != GRIB_SUCCESS) { - if (options->fail) - GRIB_CHECK_NOLINE(ret, options->print_keys[i].name); - if (ret == GRIB_NOT_FOUND) + if (options->fail) { // ECC-1551 + //GRIB_CHECK_NOLINE(ret, options->print_keys[i].name); + grib_context_log(h->context, GRIB_LOG_ERROR, "%s (%s)", + options->print_keys[i].name, grib_get_error_message(ret)); + exit(ret); + } + if (ret == GRIB_NOT_FOUND) { strcpy(value, notfound); - else { - fprintf(dump_file, "%s %s\n", grib_get_error_message(ret), options->print_keys[i].name); + } else { + fprintf(dump_file, "%s (%s)\n", options->print_keys[i].name, grib_get_error_message(ret)); + if (ret == GRIB_ARRAY_TOO_SMALL) + fprintf(dump_file, "\tHint: Tool %s cannot print keys of array type. Use grib_filter.\n", tool_name); exit(ret); } } diff --git a/tools/gts_compare.cc b/tools/gts_compare.cc index 9bb380fc3..e0237af03 100644 --- a/tools/gts_compare.cc +++ b/tools/gts_compare.cc @@ -665,7 +665,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h save_error(c, name); } if (err1 == GRIB_SUCCESS && err2 == GRIB_SUCCESS && len1 == len2) { - int i; + size_t i; countdiff = 0; for (i = 0; i < len1; i++) if (lval1[i] != lval2[i]) @@ -726,7 +726,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h if (err1 == GRIB_SUCCESS && err2 == GRIB_SUCCESS) { if (memcmp(uval1, uval2, len1) != 0) { - int i; + size_t i; for (i = 0; i < len1; i++) if (uval1[i] != uval2[i]) { printInfo(h1); @@ -735,7 +735,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h printf("[%s] byte values are different: [%02x] and [%02x]\n", name, uval1[i], uval2[i]); else - printf("[%s] byte value %d of %ld are different: [%02x] and [%02x]\n", + printf("[%s] byte value %zu of %ld are different: [%02x] and [%02x]\n", name, i, (long)len1, uval1[i], uval2[i]); err1 = GRIB_VALUE_MISMATCH; diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 0a6b35b18..000000000 --- a/tox.ini +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -ignore = F403