Merge branch 'develop' into feature/modernisation_merge_accessor_classes

This commit is contained in:
Eugen Betke 2024-09-04 16:56:29 +02:00
commit 16c4797aee
146 changed files with 2037 additions and 1217 deletions

View File

@ -69,6 +69,8 @@ jobs:
secrets: secrets:
url_debian_11: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_DEBIAN_11 }} url_debian_11: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_DEBIAN_11 }}
token_debian_11: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }} token_debian_11: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }}
url_debian_12: ${{ secrets.NEXUS_TEST_REPO_URL_DEBIAN_12 }}
token_debian_12: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }}
url_centos_7: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_CENTOS_7 }} url_centos_7: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_CENTOS_7 }}
token_centos_7: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }} token_centos_7: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }}
url_rocky_8: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_ROCKY_8 }} url_rocky_8: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_ROCKY_8 }}

View File

@ -379,6 +379,16 @@ if( HAVE_FORTRAN AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_Fortr
ecbuild_add_fortran_flags("-fallow-argument-mismatch") ecbuild_add_fortran_flags("-fallow-argument-mismatch")
endif() endif()
if(GIT_FOUND AND NOT ${GIT_EXECUTABLE} STREQUAL "")
ecbuild_info("Found git: ${GIT_EXECUTABLE} (found version \"${GIT_VERSION_STRING}\")")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE eccodes_GIT_BRANCH
RESULT_VARIABLE nok ERROR_VARIABLE error
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" )
ecbuild_info("ecCodes branch = ${eccodes_GIT_BRANCH}" )
endif()
############################################################################### ###############################################################################
# contents # contents

View File

@ -1 +1 @@
2.37.0 2.38.0

View File

@ -16,7 +16,7 @@ constant three=1 : hidden;
constant eight=8 : hidden; constant eight=8 : hidden;
constant eleven=11 : hidden; constant eleven=11 : hidden;
constant epsPoint=1 : hidden; constant epsPoint=1 : hidden;
constant epsContinous=11 : hidden; constant epsContinuous=11 : hidden;
constant epsStatisticsPoint=2 : hidden; constant epsStatisticsPoint=2 : hidden;
constant epsStatisticsContinous=12 : hidden; constant epsStatisticsContinous=12 : hidden;

View File

@ -32,7 +32,7 @@ if (stepType is "instant" ) {
} }
} else { } else {
if (numberOfForecastsInEnsemble!=0) { if (numberOfForecastsInEnsemble!=0) {
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} }
} }

View File

@ -40,7 +40,7 @@ if (stepType is "instant" ) {
} else { } else {
alias typeOfEnsembleForecast=three; alias typeOfEnsembleForecast=three;
} }
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} else { } else {
alias productDefinitionTemplateNumber=eight; alias productDefinitionTemplateNumber=eight;
} }

View File

@ -41,7 +41,7 @@ if (stepType is "instant" ) {
} else { } else {
alias typeOfEnsembleForecast=three; alias typeOfEnsembleForecast=three;
} }
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} else { } else {
alias productDefinitionTemplateNumber=eight; alias productDefinitionTemplateNumber=eight;
} }

View File

@ -11,15 +11,19 @@ alias totalNumber=numberOfForecastsInEnsemble;
unsigned[1] directionNumber : dump ; unsigned[1] directionNumber : dump ;
alias mars.direction = directionNumber; alias mars.direction = directionNumber;
alias waveDirectionNumber = directionNumber;
unsigned[1] frequencyNumber : dump ; unsigned[1] frequencyNumber : dump ;
alias mars.frequency = frequencyNumber; alias mars.frequency = frequencyNumber;
alias waveFrequencyNumber = frequencyNumber;
unsigned[1] numberOfDirections : dump ; unsigned[1] numberOfDirections : dump ;
alias totalNumberOfDirections = numberOfDirections ; alias totalNumberOfDirections = numberOfDirections ;
alias numberOfWaveDirections = numberOfDirections;
unsigned[1] numberOfFrequencies : dump; unsigned[1] numberOfFrequencies : dump;
alias totalNumberOfFrequencies = numberOfFrequencies ; alias totalNumberOfFrequencies = numberOfFrequencies ;
alias numberOfWaveFrequencies = numberOfFrequencies;
unsigned[4] directionScalingFactor : dump; unsigned[4] directionScalingFactor : dump;
alias integerScalingFactorAppliedToDirections = directionScalingFactor; alias integerScalingFactorAppliedToDirections = directionScalingFactor;
@ -161,4 +165,15 @@ if(localFlag == 4)
unsigned[4] scaledDirections[numberOfDirections] : dump; unsigned[4] scaledDirections[numberOfDirections] : dump;
unsigned[4] scaledFrequencies[numberOfFrequencies] : dump; unsigned[4] scaledFrequencies[numberOfFrequencies] : dump;
alias scaledValuesOfWaveDirections = scaledDirections : hidden;
alias scaledValuesOfWaveFrequencies = scaledFrequencies : hidden;
constant GRIBEXSection1Problem = 100 + 4 * numberOfDirections + 4 * numberOfFrequencies - section1Length ; constant GRIBEXSection1Problem = 100 + 4 * numberOfDirections + 4 * numberOfFrequencies - section1Length ;
# ECC-1907
constant ninety_nine = 99 : hidden;
if (stream is 'ewla' or stream is 'waef') {
alias productDefinitionTemplateNumber = hundred;
} else {
alias productDefinitionTemplateNumber = ninety_nine;
}

View File

@ -10,7 +10,7 @@ constant grib2LocalSectionNumber=18;
if (stepType is "instant" ) { if (stepType is "instant" ) {
alias productDefinitionTemplateNumber=epsPoint; alias productDefinitionTemplateNumber=epsPoint;
} else { } else {
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} }
template mars_labeling "grib1/mars_labeling.def"; template mars_labeling "grib1/mars_labeling.def";

View File

@ -10,7 +10,7 @@ constant grib2LocalSectionNumber=18;
if (stepType is "instant" ) { if (stepType is "instant" ) {
alias productDefinitionTemplateNumber=epsPoint; alias productDefinitionTemplateNumber=epsPoint;
} else { } else {
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} }
template mars_labeling "grib1/mars_labeling.def"; template mars_labeling "grib1/mars_labeling.def";

View File

@ -14,7 +14,7 @@ constant grib2LocalSectionNumber=26;
if (stepType is "instant" ) { if (stepType is "instant" ) {
alias productDefinitionTemplateNumber=epsPoint; alias productDefinitionTemplateNumber=epsPoint;
} else { } else {
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} }
constant wrongPadding=1 : hidden; constant wrongPadding=1 : hidden;

View File

@ -23,7 +23,7 @@ if (stepType is "instant" ) {
if (type is "em" || type is "es" ) { if (type is "em" || type is "es" ) {
alias productDefinitionTemplateNumber=epsStatisticsContinous; alias productDefinitionTemplateNumber=epsStatisticsContinous;
} else { } else {
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} }
} }

View File

@ -47,7 +47,7 @@ if (stepType is "instant" ) {
} else { } else {
alias typeOfEnsembleForecast=three; alias typeOfEnsembleForecast=three;
} }
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} else { } else {
alias productDefinitionTemplateNumber=eight; alias productDefinitionTemplateNumber=eight;
} }

View File

@ -42,10 +42,12 @@
141 141 Layer between two isobaric surfaces (mixed precision) pressure of top, in kPa 1100hPa minus pressure of bottom, in hPa 141 141 Layer between two isobaric surfaces (mixed precision) pressure of top, in kPa 1100hPa minus pressure of bottom, in hPa
# 142-159 Reserved # 142-159 Reserved
160 dp Depth below sea level meters (2 octets) 160 dp Depth below sea level meters (2 octets)
# 161-199Reserved # 161-199 Reserved
200 sfc Entire atmosphere considered as a single layer 0 (2 octets) 200 sfc Entire atmosphere considered as a single layer 0 (2 octets)
201 201 Entire ocean considered as a single layer 0 (2 octets) 201 201 Entire ocean considered as a single layer 0 (2 octets)
# 202-209 Reserved 202 al Abstract Single Level
203 al Abstract Multiple Level
# 204-209 Reserved
210 pl Isobaric surface (Pa) (ECMWF extension) 210 pl Isobaric surface (Pa) (ECMWF extension)
# 211-254 Reserved for local use # 211-254 Reserved for local use
211 wv Ocean wave level (ECMWF extension) 211 wv Ocean wave level (ECMWF extension)

View File

@ -48,7 +48,7 @@ if (stepType is "instant" ) {
} else { } else {
alias typeOfEnsembleForecast=three; alias typeOfEnsembleForecast=three;
} }
alias productDefinitionTemplateNumber=epsContinous; alias productDefinitionTemplateNumber=epsContinuous;
} else { } else {
alias productDefinitionTemplateNumber=eight; alias productDefinitionTemplateNumber=eight;
} }

View File

@ -121,7 +121,7 @@ constant numberOfUnusedBitsAtEndOfSection3 = 0;
constant tableReference = 0; constant tableReference = 0;
#position offsetBeforeBitmap; #position offsetBeforeBitmap;
meta bitmap gds_not_present_bitmap( missingValue,numberOfValues, # meta bitmap gds_not_present_bitmap( missingValue,numberOfValues,
numberOfPoints, # numberOfPoints,
latitudeOfFirstGridPoint, # latitudeOfFirstGridPoint,
Ni,numberOfUnusedBitsAtEndOfSection3) : read_only; # Ni,numberOfUnusedBitsAtEndOfSection3) : read_only;

View File

@ -105,7 +105,8 @@ if( indicatorOfTypeOfLevel == 109 ||
indicatorOfTypeOfLevel == 100 || indicatorOfTypeOfLevel == 100 ||
indicatorOfTypeOfLevel == 110 || indicatorOfTypeOfLevel == 110 ||
indicatorOfTypeOfLevel == 113 || indicatorOfTypeOfLevel == 113 ||
indicatorOfTypeOfLevel == 117) indicatorOfTypeOfLevel == 117 ||
indicatorOfTypeOfLevel == 203)
{ {
alias mars.levelist = level; alias mars.levelist = level;
} }

View File

@ -34,3 +34,5 @@
'depthBelowSea' = {indicatorOfTypeOfLevel=160;} 'depthBelowSea' = {indicatorOfTypeOfLevel=160;}
'entireAtmosphere' = {indicatorOfTypeOfLevel=200;} 'entireAtmosphere' = {indicatorOfTypeOfLevel=200;}
'entireOcean' = {indicatorOfTypeOfLevel=201;} 'entireOcean' = {indicatorOfTypeOfLevel=201;}
'abstractSingleLevel' = {indicatorOfTypeOfLevel=202; level=missing();}
'abstractMultipleLevels' = {indicatorOfTypeOfLevel=203;}

View File

@ -12,5 +12,7 @@ unsigned[1] SecondOfModelVersion = 0: edition_specific;
meta modelVersionDate g2date(YearOfModelVersion,MonthOfModelVersion,DayOfModelVersion) : dump; meta modelVersionDate g2date(YearOfModelVersion,MonthOfModelVersion,DayOfModelVersion) : dump;
meta modelVersionTime time(HourOfModelVersion, MinuteOfModelVersion, SecondOfModelVersion) : dump; meta modelVersionTime time(HourOfModelVersion, MinuteOfModelVersion, SecondOfModelVersion) : dump;
alias referenceDate = modelVersionDate ;
remove isHindcast; remove isHindcast;
constant isHindcast = 1; constant isHindcast = 1;

View File

@ -54,12 +54,9 @@ statisticalProcessesList list(numberOfTimeRanges)
if (numberOfTimeRanges == 1 || numberOfTimeRanges == 2) { if (numberOfTimeRanges == 1 || numberOfTimeRanges == 2) {
concept stepTypeInternal { concept stepTypeInternal {
"instant" = {typeOfStatisticalProcessing=255;} "instant" = {typeOfStatisticalProcessing=255;}
"avg" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=255;} "avg" = {typeOfStatisticalProcessing=0;}
"avg" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=2;}
"avg" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=3;}
"avgd" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=1;} "avgd" = {typeOfStatisticalProcessing=0;typeOfTimeIncrement=1;}
"accum" = {typeOfStatisticalProcessing=1;typeOfTimeIncrement=255;} "accum" = {typeOfStatisticalProcessing=1;}
"accum" = {typeOfStatisticalProcessing=1;typeOfTimeIncrement=2;}
"max" = {typeOfStatisticalProcessing=2;} "max" = {typeOfStatisticalProcessing=2;}
"min" = {typeOfStatisticalProcessing=3;} "min" = {typeOfStatisticalProcessing=3;}
"diff" = {typeOfStatisticalProcessing=4;} # end-start "diff" = {typeOfStatisticalProcessing=4;} # end-start

View File

@ -1,21 +1,21 @@
# (C) Copyright 2005- ECMWF. # (C) Copyright 2005- ECMWF.
# Template for wave parameters # Template for wave parameters
## Direction part # Direction part
unsigned[2] waveDirectionNumber : dump; unsigned[2] waveDirectionNumber : dump;
alias mars.direction = waveDirectionNumber; alias mars.direction = waveDirectionNumber;
alias directionNumber = waveDirectionNumber; alias directionNumber = waveDirectionNumber;
unsigned[2] numberOfWaveDirections = 1 : dump; unsigned[2] numberOfWaveDirections = 0 : dump;
alias totalNumberOfWaveDirections = numberOfWaveDirections; alias totalNumberOfWaveDirections = numberOfWaveDirections;
alias numberOfDirections = totalNumberOfWaveDirections; alias numberOfDirections = totalNumberOfWaveDirections;
## Frequency part # Frequency part
unsigned[2] waveFrequencyNumber : dump; unsigned[2] waveFrequencyNumber : dump;
alias mars.frequency = waveFrequencyNumber; alias mars.frequency = waveFrequencyNumber;
alias frequencyNumber = waveFrequencyNumber; alias frequencyNumber = waveFrequencyNumber;
unsigned[2] numberOfWaveFrequencies = 1 : dump; unsigned[2] numberOfWaveFrequencies = 0 : dump;
alias totalNumberOfWaveFrequencies = numberOfWaveFrequencies; alias totalNumberOfWaveFrequencies = numberOfWaveFrequencies;
alias numberOfFrequencies = totalNumberOfWaveFrequencies; alias numberOfFrequencies = totalNumberOfWaveFrequencies;

View File

@ -2,18 +2,22 @@
# Template for wave spectra defined using an array of frequencies and directions # Template for wave spectra defined using an array of frequencies and directions
## Direction part # Direction part
signed[1] scaleFactorOfWaveDirections : dump; signed[1] scaleFactorOfWaveDirections : dump;
alias integerScalingFactorAppliedToDirections = scaleFactorOfWaveDirections; alias integerScalingFactorAppliedToDirections = scaleFactorOfWaveDirections;
alias directionScalingFactor = integerScalingFactorAppliedToDirections; alias directionScalingFactor = integerScalingFactorAppliedToDirections;
unsigned[4] scaledValuesOfWaveDirections[numberOfWaveDirections] : dump; if (numberOfWaveDirections > 0) {
alias scaledDirections = scaledValuesOfWaveDirections ; unsigned[4] scaledValuesOfWaveDirections[numberOfWaveDirections] : dump;
alias scaledDirections = scaledValuesOfWaveDirections ;
}
## Frequency part # Frequency part
signed[1] scaleFactorOfWaveFrequencies : dump; signed[1] scaleFactorOfWaveFrequencies : dump;
alias integerScalingFactorAppliedToFrequencies = scaleFactorOfWaveFrequencies; alias integerScalingFactorAppliedToFrequencies = scaleFactorOfWaveFrequencies;
alias frequencyScalingFactor = integerScalingFactorAppliedToFrequencies; alias frequencyScalingFactor = integerScalingFactorAppliedToFrequencies;
unsigned[4] scaledValuesOfWaveFrequencies[numberOfWaveFrequencies] : dump; if (numberOfWaveFrequencies > 0) {
alias scaledFrequencies = scaledValuesOfWaveFrequencies; unsigned[4] scaledValuesOfWaveFrequencies[numberOfWaveFrequencies] : dump;
alias scaledFrequencies = scaledValuesOfWaveFrequencies;
}

View File

@ -115,6 +115,7 @@
#cmakedefine HAVE_GEOGRAPHY #cmakedefine HAVE_GEOGRAPHY
#cmakedefine HAVE_MEMFS #cmakedefine HAVE_MEMFS
#cmakedefine HAVE_FORTRAN
#ifdef HAVE_MEMFS #ifdef HAVE_MEMFS
#undef ECCODES_DEFINITION_PATH #undef ECCODES_DEFINITION_PATH

View File

@ -26,7 +26,6 @@ list( APPEND test_bins
grib_get_data grib_get_data
grib_sections_copy grib_sections_copy
grib_copy_keys grib_copy_keys
grib_iterator_bitmap
grib_clone grib_clone
grib_copy_message grib_copy_message
grib_ensemble_index grib_ensemble_index

View File

@ -18,11 +18,6 @@
#include <stdio.h> #include <stdio.h>
#include "eccodes.h" #include "eccodes.h"
static void usage(const char* app)
{
fprintf(stderr, "Usage is: %s input_file ouput_file\n", app);
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
@ -36,7 +31,6 @@ int main(int argc, char* argv[])
int i, err = 0; int i, err = 0;
if (argc != 3) { if (argc != 3) {
usage(argv[0]);
return 1; return 1;
} }

View File

@ -18,11 +18,6 @@
#include <stdio.h> #include <stdio.h>
#include "eccodes.h" #include "eccodes.h"
static void usage(const char* app)
{
fprintf(stderr, "Usage is: %s input_file ouput_file\n", app);
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
@ -33,7 +28,6 @@ int main(int argc, char* argv[])
int err = 0; int err = 0;
if (argc != 3) { if (argc != 3) {
usage(argv[0]);
return 1; return 1;
} }

View File

@ -18,11 +18,6 @@
#include "eccodes.h" #include "eccodes.h"
#include <assert.h> #include <assert.h>
static void usage(const char* prog)
{
fprintf(stderr, "Usage is: %s input_file ouput_file\n", prog);
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
@ -30,7 +25,6 @@ int main(int argc, char* argv[])
int err = 0; int err = 0;
if (argc != 3) { if (argc != 3) {
usage(argv[0]);
return 1; return 1;
} }

View File

@ -42,14 +42,14 @@ int main(int argc, char** argv)
return 1; return 1;
} }
CODES_CHECK(grib_count_in_file(NULL, in, &mcount), 0); CODES_CHECK(codes_count_in_file(NULL, in, &mcount), 0);
assert(mcount == 56); assert(mcount == 56);
printf("grib_count_in_file counted %d messages\n", mcount); printf("count_in_file counted %d messages\n", mcount);
mcount = 0; mcount = 0;
CODES_CHECK(grib_count_in_filename(NULL, filename, &mcount), 0); CODES_CHECK(codes_count_in_filename(NULL, filename, &mcount), 0);
assert(mcount == 56); assert(mcount == 56);
printf("grib_count_in_filename counted %d messages\n", mcount); printf("count_in_filename counted %d messages\n", mcount);
mcount = 0; mcount = 0;
while ((h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err)) != NULL) { while ((h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err)) != NULL) {

View File

@ -19,12 +19,6 @@
#include <assert.h> #include <assert.h>
#include "eccodes.h" #include "eccodes.h"
static void usage(const char* prog)
{
fprintf(stderr, "usage: %s in out\n", prog);
exit(1);
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int err = 0; int err = 0;
@ -40,7 +34,7 @@ int main(int argc, char** argv)
codes_handle* h = NULL; codes_handle* h = NULL;
const void* buffer = NULL; const void* buffer = NULL;
if (argc != 3) usage(argv[0]); if (argc != 3) return 1;
infile = argv[1]; infile = argv[1];
outfile = argv[2]; outfile = argv[2];

View File

@ -20,14 +20,11 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
codes_string_list* list; const codes_string_list* list = codes_grib_util_get_param_id("11.2");
codes_string_list* list2;
list = codes_grib_util_get_param_id("11.2");
printf("mars.param=11.2 -> paramId= "); printf("mars.param=11.2 -> paramId= ");
while (list) { while (list) {
const codes_string_list* list2 = codes_grib_util_get_param_id("130.128");
printf("%s ", list->value); printf("%s ", list->value);
list2 = codes_grib_util_get_param_id("130.128");
printf("mars.param=11.2 -> paramId= "); printf("mars.param=11.2 -> paramId= ");
while (list2) { while (list2) {
printf("%s ", list2->value); printf("%s ", list2->value);

View File

@ -9,7 +9,7 @@
*/ */
#include "eccodes.h" #include "eccodes.h"
void usage(char* prog) void usage(const char* prog)
{ {
printf("usage: %s in.nc\n", prog); printf("usage: %s in.nc\n", prog);
exit(1); exit(1);

View File

@ -155,12 +155,12 @@ ecbuild_add_test( TARGET eccodes_f_grib_set_packing
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_set_packing.sh ) COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_set_packing.sh )
# Executables without a shell script # Executables without a shell script
ecbuild_add_executable( TARGET eccodes_f_new_from_file #ecbuild_add_executable( TARGET eccodes_f_new_from_file
NOINSTALL # NOINSTALL
SOURCES new_from_file.f90 # SOURCES new_from_file.f90
CONDITION HAVE_FORTRAN # CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran # LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes ) # LIBS eccodes_f90 eccodes )
ecbuild_add_executable( TARGET eccodes_f_grib_set_gvc ecbuild_add_executable( TARGET eccodes_f_grib_set_gvc
NOINSTALL NOINSTALL
SOURCES grib_set_gvc.f90 SOURCES grib_set_gvc.f90

View File

@ -21,6 +21,7 @@ program codes_dump_test
call getarg(2, infile_name) call getarg(2, infile_name)
call codes_set_debug(-1)
call codes_open_file(ifile, infile_name, 'r') call codes_open_file(ifile, infile_name, 'r')
print *, "===== FILE:", infile_name print *, "===== FILE:", infile_name
@ -29,7 +30,9 @@ program codes_dump_test
!call codes_any_new_from_file(ifile, msgid, iret) !call codes_any_new_from_file(ifile, msgid, iret)
if (iret == CODES_END_OF_FILE) exit if (iret == CODES_END_OF_FILE) exit
call codes_set_debug(0)
call codes_dump(msgid) call codes_dump(msgid)
call codes_set_debug(1)
call codes_release(msgid) call codes_release(msgid)

View File

@ -15,13 +15,12 @@ program keys_iterator_skip
character(len=256) :: key character(len=256) :: key
character(len=256) :: value character(len=256) :: value
character(len=512) :: all1 character(len=512) :: all1
integer :: grib_count integer :: grib_count = 0
call codes_open_file(ifile, & call codes_open_file(ifile, &
'../../data/regular_latlon_surface.grib1', 'r') '../../data/regular_latlon_surface.grib1', 'r')
! Loop on all the messages in a file ! Loop on all the messages in a file
grib_count = 0
do while (.true.) do while (.true.)
call codes_grib_new_from_file(ifile, igrib, iret) call codes_grib_new_from_file(ifile, igrib, iret)
if (iret == CODES_END_OF_FILE) exit if (iret == CODES_END_OF_FILE) exit
@ -37,15 +36,20 @@ program keys_iterator_skip
call codes_skip_coded(kiter) call codes_skip_coded(kiter)
call codes_skip_duplicates(kiter) call codes_skip_duplicates(kiter)
call codes_skip_read_only(kiter) call codes_skip_read_only(kiter)
call codes_skip_function(kiter)
call codes_skip_edition_specific(kiter)
do do
call codes_keys_iterator_next(kiter, iret) call codes_keys_iterator_next(kiter, iret)
if (iret .ne. CODES_SUCCESS) exit !terminate the loop if (iret .ne. CODES_SUCCESS) exit ! Terminate the loop
call codes_keys_iterator_get_name(kiter, key) ! All keys should be skipped so should not get here
call codes_get(igrib, trim(key), value) call codes_check(CODES_INTERNAL_ERROR, 'Error', 'iterator next should have failed')
all1 = trim(key)//' = '//trim(value)
write (*, *) trim(all1) !call codes_keys_iterator_get_name(kiter, key)
!call codes_get(igrib, trim(key), value)
!all1 = trim(key)//' = '//trim(value)
!write (*, *) trim(all1)
end do end do
call codes_keys_iterator_delete(kiter) call codes_keys_iterator_delete(kiter)

View File

@ -1,40 +0,0 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
!
program new_from_file
use eccodes
implicit none
integer :: ifile
integer :: iret
integer :: count1 = 0
! Message identifier.
integer :: igrib
ifile = 5
call codes_open_file(ifile, '../../data/collection.grib1', 'r')
! Loop on all the messages in a file.
call codes_grib_new_from_file(ifile, igrib, iret)
do while (iret == CODES_SUCCESS)
count1 = count1 + 1
print *, "===== Message #", count1
call codes_grib_new_from_file(ifile, igrib, iret)
end do
if (iret /= CODES_END_OF_FILE) then
call codes_check(iret, 'new_from_file', '')
end if
call codes_close_file(ifile)
end program

View File

@ -6,10 +6,9 @@
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by ! 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. ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
! !
! Description: how to create a new GRIB message by cloning ! Description: how to create a new GRIB message by cloning
! an existing message. ! an existing message.
! !
!
! Author: Cristian D. Codorean ! Author: Cristian D. Codorean
! !
! !

View File

@ -2765,12 +2765,29 @@
call grib_skip_read_only(iterid, status) call grib_skip_read_only(iterid, status)
end subroutine codes_skip_read_only end subroutine codes_skip_read_only
subroutine codes_skip_function(iterid, status)
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt), optional, intent(out) :: status
call grib_skip_function(iterid, status)
end subroutine codes_skip_function
subroutine codes_skip_edition_specific(iterid, status)
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt), optional, intent(out) :: status
call grib_skip_edition_specific(iterid, status)
end subroutine codes_skip_edition_specific
!> Set debug mode !> Set debug mode
subroutine codes_set_debug(dmode) subroutine codes_set_debug(dmode)
integer(kind=kindOfInt), intent(in) :: dmode integer(kind=kindOfInt), intent(in) :: dmode
call grib_set_debug(dmode) call grib_set_debug(dmode)
end subroutine codes_set_debug end subroutine codes_set_debug
!> Set the definition path !> Set the definition path
!> !>
!> In case of error, if the status parameter (optional) is not given, the program will !> In case of error, if the status parameter (optional) is not given, the program will

View File

@ -7,6 +7,8 @@ public :: codes_keys_iterator_new, &
public :: codes_skip_computed, & public :: codes_skip_computed, &
codes_skip_coded, & codes_skip_coded, &
codes_skip_duplicates, & codes_skip_duplicates, &
codes_skip_function, &
codes_skip_edition_specific, &
codes_skip_read_only codes_skip_read_only
public :: codes_keys_iterator_get_name, & public :: codes_keys_iterator_get_name, &
codes_keys_iterator_rewind codes_keys_iterator_rewind

View File

@ -3177,6 +3177,34 @@
end if end if
end subroutine grib_skip_read_only end subroutine grib_skip_read_only
subroutine grib_skip_function(iterid, status)
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_function(iterid)
if (present(status)) then
status = iret
else
call grib_check(iret, 'skip_function', '')
end if
end subroutine grib_skip_function
!!!
subroutine grib_skip_edition_specific(iterid, status)
integer(kind=kindOfInt), intent(in) :: iterid
integer(kind=kindOfInt), optional, intent(out) :: status
integer(kind=kindOfInt) :: iret
iret = grib_f_skip_edition_specific(iterid)
if (present(status)) then
status = iret
else
call grib_check(iret, 'skip_edition_specific', '')
end if
end subroutine grib_skip_edition_specific
!> Set debug mode !> Set debug mode
subroutine grib_set_debug(dmode) subroutine grib_set_debug(dmode)
integer(kind=kindOfInt), intent(in) :: dmode integer(kind=kindOfInt), intent(in) :: dmode

View File

@ -865,13 +865,11 @@ int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbyt
/*****************************************************************************/ /*****************************************************************************/
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes) int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes)
{ {
grib_context* c; FILE* f = get_file(*fid);
int err=0;
FILE* f=get_file(*fid);
if (f) { if (f) {
c=grib_context_get_default( ); grib_context* c = grib_context_get_default( );
err=grib_read_any_from_file(c,f,buffer,nbytes); int err=grib_read_any_from_file(c,f,buffer,nbytes);
return err; return err;
} else { } else {
return GRIB_INVALID_FILE; return GRIB_INVALID_FILE;
@ -1141,7 +1139,6 @@ int grib_f_iterator_delete_(int* iterid) {
/*****************************************************************************/ /*****************************************************************************/
static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len)
{ {
int err=0;
char buf[1024]; char buf[1024];
grib_handle* h; grib_handle* h;
grib_keys_iterator* iter; grib_keys_iterator* iter;
@ -1156,7 +1153,7 @@ static int _grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int
*iterid=push_keys_iterator(iter); *iterid=push_keys_iterator(iter);
else else
*iterid=-1; *iterid=-1;
return err; return GRIB_SUCCESS;
} }
int grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len) int grib_f_keys_iterator_new_(int* gid,int* iterid,char* name_space,int len)
{ {
@ -1276,7 +1273,6 @@ int grib_f_keys_iterator_rewind_(int* kiter)
/*****************************************************************************/ /*****************************************************************************/
static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
{ {
int err=0;
grib_handle* h; grib_handle* h;
bufr_keys_iterator* iter; bufr_keys_iterator* iter;
@ -1291,7 +1287,7 @@ static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
*iterid=push_bufr_keys_iterator(iter); *iterid=push_bufr_keys_iterator(iter);
else else
*iterid=-1; *iterid=-1;
return err; return GRIB_SUCCESS;
} }
int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
{ {
@ -1767,8 +1763,7 @@ int grib_f_index_add_file_(int* index_id, char* file, int lfile)
if (!i) { if (!i) {
return GRIB_INVALID_INDEX; return GRIB_INVALID_INDEX;
} else { } else {
int err = grib_index_add_file(i,cast_char(buf,file,lfile)); return grib_index_add_file(i,cast_char(buf,file,lfile));
return err;
} }
} }
@ -1799,14 +1794,12 @@ int grib_f_index_read_(char* file, int* gid, int lfile)
int grib_f_index_write_(int* gid, char* file, int lfile) int grib_f_index_write_(int* gid, char* file, int lfile)
{ {
grib_index *i = get_index(*gid); grib_index *i = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
if (!i) { if (!i) {
return GRIB_INVALID_GRIB; return GRIB_INVALID_GRIB;
} else { } else {
err = grib_index_write(i,cast_char(buf,file,lfile)); return grib_index_write(i,cast_char(buf,file,lfile));
return err;
} }
} }
@ -1898,51 +1891,44 @@ int grib_f_get_api_version_(int* apiVersion,int len)
int grib_f_get_size_int_(int* gid, char* key, int* val, int len) int grib_f_get_size_int_(int* gid, char* key, int* val, int len)
{ {
grib_handle* h = get_handle(*gid); grib_handle* h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t tsize = 0; size_t tsize = 0;
if (!h) { if (!h) return GRIB_INVALID_GRIB;
return GRIB_INVALID_GRIB;
} int err = grib_get_size(h, cast_char(buf, key, len), &tsize);
else { *val = tsize;
err = grib_get_size(h, cast_char(buf, key, len), &tsize); return err;
*val = tsize;
return err;
}
} }
int grib_f_get_size_long_(int* gid, char* key, long* val, int len) int grib_f_get_size_long_(int* gid, char* key, long* val, int len)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t tsize = 0; size_t tsize = 0;
if(!h){ if (!h) return GRIB_INVALID_GRIB;
return GRIB_INVALID_GRIB;
}else{ int err = grib_get_size(h, cast_char(buf,key,len), &tsize);
err = grib_get_size(h, cast_char(buf,key,len), &tsize); *val = tsize;
*val = tsize; return err;
return err;
}
} }
/*****************************************************************************/ /*****************************************************************************/
int grib_f_index_get_size_int_(int* index_id, char* key, int* val, int len) int grib_f_index_get_size_int_(int* index_id, char* key, int* val, int len)
{ {
grib_index *h = get_index(*index_id); grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t tsize = 0; size_t tsize = 0;
if(!h){ if (!h) return GRIB_INVALID_GRIB;
return GRIB_INVALID_GRIB;
}else{ int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
err = grib_index_get_size(h, cast_char(buf,key,len), &tsize); *val = tsize;
*val = tsize; return err;
return err;
}
} }
int grib_f_index_get_size_long_(int* index_id, char* key, long* val, int len) int grib_f_index_get_size_long_(int* index_id, char* key, long* val, int len)
@ -1951,13 +1937,11 @@ int grib_f_index_get_size_long_(int* index_id, char* key, long* val, int len)
char buf[1024]; char buf[1024];
size_t tsize = 0; size_t tsize = 0;
if (!h){ if (!h) return GRIB_INVALID_GRIB;
return GRIB_INVALID_GRIB;
} else{ int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize); *val = tsize;
*val = tsize; return err;
return err;
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1965,11 +1949,10 @@ int grib_f_get_int_(int* gid, char* key, int* val, int len)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
long long_val; long long_val;
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
if(!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_get_long(h, cast_char(buf,key,len),&long_val); int err = grib_get_long(h, cast_char(buf,key,len),&long_val);
*val = long_val; *val = long_val;
return err; return err;
} }
@ -1977,11 +1960,11 @@ int grib_f_get_int_(int* gid, char* key, int* val, int len)
int grib_f_get_long_(int* gid, char* key, long* val, int len) int grib_f_get_long_(int* gid, char* key, long* val, int len)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
if(!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_get_long(h, cast_char(buf,key,len),val); int err = grib_get_long(h, cast_char(buf,key,len),val);
return err; return err;
} }
@ -1990,11 +1973,10 @@ int grib_f_get_native_type_(int* gid, char* key, int* val, int len)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int type_val = 0; int type_val = 0;
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
if (!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_get_native_type(h, cast_char(buf,key,len), &type_val); int err = grib_get_native_type(h, cast_char(buf,key,len), &type_val);
*val = type_val; *val = type_val;
return err; return err;
} }
@ -2034,13 +2016,13 @@ int grib_f_get_int_array_(int* gid, char* key, int *val, int* size, int len)
int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len) int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
if(!h) return GRIB_INVALID_GRIB; if(!h) return GRIB_INVALID_GRIB;
err = grib_get_long_array(h, cast_char(buf,key,len), val, &lsize); int err = grib_get_long_array(h, cast_char(buf,key,len), val, &lsize);
*size=lsize; *size=lsize;
return err; return err;
@ -2050,13 +2032,13 @@ int grib_f_get_long_array_(int* gid, char* key, long *val, int* size, int len)
int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv) int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
if(!h) return GRIB_INVALID_GRIB; if(!h) return GRIB_INVALID_GRIB;
err = grib_get_bytes(h, cast_char(buf,key,len), val, &lsize); int err = grib_get_bytes(h, cast_char(buf,key,len), val, &lsize);
*size = (int) lsize; *size = (int) lsize;
return err; return err;
@ -2066,25 +2048,22 @@ int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, i
int grib_f_index_get_string_(int* index_id, char* key, char* val, int *eachsize,int* size, int len) int grib_f_index_get_string_(int* index_id, char* key, char* val, int *eachsize,int* size, int len)
{ {
grib_index *h = get_index(*index_id); grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
int i;
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
char** bufval; char* p = val;
char* p=val;
if(!h) return GRIB_INVALID_GRIB; if(!h) return GRIB_INVALID_GRIB;
bufval=(char**)grib_context_malloc_clear(h->context,sizeof(char*)* *size); char** bufval=(char**)grib_context_malloc_clear(h->context,sizeof(char*)* *size);
err = grib_index_get_string(h, cast_char(buf,key,len), bufval, &lsize); int err = grib_index_get_string(h, cast_char(buf,key,len), bufval, &lsize);
*size = lsize; *size = lsize;
if (err) return err; if (err) return err;
for (i=0;i<lsize;i++) { for (size_t i=0;i<lsize;i++) {
int l=strlen(bufval[i]); int l=strlen(bufval[i]);
int j;
if (*eachsize < l ) { if (*eachsize < l ) {
fprintf(stderr, "eachsize=%d strlen(bufval[i])=%zu\n", fprintf(stderr, "eachsize=%d strlen(bufval[i])=%zu\n",
*eachsize, strlen(bufval[i])); *eachsize, strlen(bufval[i]));
@ -2093,26 +2072,25 @@ int grib_f_index_get_string_(int* index_id, char* key, char* val, int *eachsize,
} }
memcpy(p,bufval[i],l); memcpy(p,bufval[i],l);
p+=l; p+=l;
for (j=0;j<*eachsize-l;j++) *(p++)=' '; for (int j=0;j<*eachsize-l;j++) *(p++)=' ';
} }
for (i=0;i<lsize;i++) { for (size_t i=0;i<lsize;i++) {
grib_context_free(h->context, bufval[i]); grib_context_free(h->context, bufval[i]);
} }
grib_context_free(h->context,bufval); grib_context_free(h->context,bufval);
return err; return err;
} }
/*****************************************************************************/ /*****************************************************************************/
int grib_f_index_get_long_(int* index_id, char* key, long *val, int* size, int len) int grib_f_index_get_long_(int* index_id, char* key, long *val, int* size, int len)
{ {
int err = 0;
grib_index* h = get_index(*index_id); grib_index* h = get_index(*index_id);
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
if (!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_index_get_long(h, cast_char(buf,key,len), val, &lsize); int err = grib_index_get_long(h, cast_char(buf,key,len), val, &lsize);
*size = lsize; *size = lsize;
return err; return err;
} }
@ -2121,17 +2099,17 @@ int grib_f_index_get_long_(int* index_id, char* key, long *val, int* size, int l
int grib_f_index_get_int_(int* index_id, char* key, int *val, int* size, int len) int grib_f_index_get_int_(int* index_id, char* key, int *val, int* size, int len)
{ {
grib_index *h = get_index(*index_id); grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t lsize = *size, i = 0; size_t lsize = *size, i = 0;
long* lval=0; long* lval=0;
if(!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
lval=(long*)grib_context_malloc(h->context,sizeof(long)* *size); lval=(long*)grib_context_malloc(h->context,sizeof(long)* *size);
if (!lval) return GRIB_OUT_OF_MEMORY; if (!lval) return GRIB_OUT_OF_MEMORY;
err = grib_index_get_long(h, cast_char(buf,key,len), lval, &lsize); int err = grib_index_get_long(h, cast_char(buf,key,len), lval, &lsize);
for (i=0;i<lsize;i++) val[i]=lval[i]; for (i=0;i<lsize;i++) val[i]=lval[i];
*size = lsize; *size = lsize;
@ -2142,13 +2120,12 @@ int grib_f_index_get_int_(int* index_id, char* key, int *val, int* size, int len
/*****************************************************************************/ /*****************************************************************************/
int grib_f_index_get_real8_(int* index_id, char* key, double *val, int* size, int len) int grib_f_index_get_real8_(int* index_id, char* key, double *val, int* size, int len)
{ {
int err = 0;
grib_index* h = get_index(*index_id); grib_index* h = get_index(*index_id);
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
if (!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_index_get_double(h, cast_char(buf,key,len), val, &lsize); int err = grib_index_get_double(h, cast_char(buf,key,len), val, &lsize);
*size = lsize; *size = lsize;
return err; return err;
} }
@ -2201,15 +2178,14 @@ int grib_f_set_long_array_(int* gid, char* key, long* val, int* size, int len)
int grib_f_set_byte_array_(int* gid, char* key, unsigned char* val, int* size, int len, int lenv) int grib_f_set_byte_array_(int* gid, char* key, unsigned char* val, int* size, int len, int lenv)
{ {
grib_handle *h = get_handle(*gid); grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024]; char buf[1024];
size_t lsize = *size; size_t lsize = *size;
if(!h) return GRIB_INVALID_GRIB; if (!h) return GRIB_INVALID_GRIB;
err = grib_set_bytes(h, cast_char(buf,key,len), val, &lsize); int err = grib_set_bytes(h, cast_char(buf,key,len), val, &lsize);
*size = (int) lsize; *size = (int) lsize;
return err; return err;
} }

View File

@ -217,7 +217,6 @@ list( APPEND eccodes_src_files
accessor/grib_accessor_class_data_raw_packing.cc accessor/grib_accessor_class_data_raw_packing.cc
accessor/grib_accessor_class_data_complex_packing.cc accessor/grib_accessor_class_data_complex_packing.cc
accessor/grib_accessor_class_data_g1complex_packing.cc accessor/grib_accessor_class_data_g1complex_packing.cc
accessor/grib_accessor_class_gds_not_present_bitmap.cc
accessor/grib_accessor_class_gds_is_present.cc accessor/grib_accessor_class_gds_is_present.cc
accessor/grib_accessor_class_select_step_template.cc accessor/grib_accessor_class_select_step_template.cc
accessor/grib_accessor_class_local_definition.cc accessor/grib_accessor_class_local_definition.cc

View File

@ -21,7 +21,6 @@ public:
grib_accessor(const char* name) : grib_accessor(const char* name) :
context_(nullptr), name_(name), class_name_(nullptr), name_space_(nullptr), h_(nullptr), creator_(nullptr), length_(0), offset_(0), parent_(nullptr), next_(nullptr), previous_(nullptr), flags_(0), sub_section_(nullptr), dirty_(0), same_(nullptr), loop_(0), vvalue_(nullptr), set_(nullptr), parent_as_attribute_(nullptr) {} context_(nullptr), name_(name), class_name_(nullptr), name_space_(nullptr), h_(nullptr), creator_(nullptr), length_(0), offset_(0), parent_(nullptr), next_(nullptr), previous_(nullptr), flags_(0), sub_section_(nullptr), dirty_(0), same_(nullptr), loop_(0), vvalue_(nullptr), set_(nullptr), parent_as_attribute_(nullptr) {}
virtual ~grib_accessor() {} virtual ~grib_accessor() {}
virtual void init_accessor(const long, grib_arguments*) = 0; virtual void init_accessor(const long, grib_arguments*) = 0;

View File

@ -10,6 +10,9 @@
*/ */
#include "grib_accessor_class_concept.h" #include "grib_accessor_class_concept.h"
#include <unordered_map>
#include <string>
#include <utility>
grib_accessor_concept_t _grib_accessor_concept{}; grib_accessor_concept_t _grib_accessor_concept{};
grib_accessor* grib_accessor_concept = &_grib_accessor_concept; grib_accessor* grib_accessor_concept = &_grib_accessor_concept;
@ -43,8 +46,28 @@ void grib_accessor_concept_t::dump(grib_dumper* dumper)
grib_dump_string(dumper, this, NULL); grib_dump_string(dumper, this, NULL);
} }
// See ECC-1905
static int grib_get_long_memoize(
grib_handle* h, const char* key, long* value,
std::unordered_map<std::string_view, long>& memo)
{
int err = 0;
auto pos = memo.find(key);
if (pos == memo.end()) { // not in map so decode & insert
err = grib_get_long(h, key, value);
if (!err) {
memo.insert( std::make_pair(key, *value) );
}
} else {
*value = pos->second; // found in map
}
return err;
}
/* Return 1 (=True) or 0 (=False) */ /* Return 1 (=True) or 0 (=False) */
static int concept_condition_expression_true(grib_handle* h, grib_concept_condition* c) static int concept_condition_expression_true(
grib_handle* h, grib_concept_condition* c,
std::unordered_map<std::string_view, long>& memo)
{ {
long lval; long lval;
long lres = 0; long lres = 0;
@ -55,8 +78,10 @@ static int concept_condition_expression_true(grib_handle* h, grib_concept_condit
switch (type) { switch (type) {
case GRIB_TYPE_LONG: case GRIB_TYPE_LONG:
grib_expression_evaluate_long(h, c->expression, &lres); grib_expression_evaluate_long(h, c->expression, &lres);
ok = (grib_get_long(h, c->name, &lval) == GRIB_SUCCESS) && // Use memoization for the most common type (integer keys)
ok = (grib_get_long_memoize(h, c->name, &lval, memo) == GRIB_SUCCESS) &&
(lval == lres); (lval == lres);
//ok = (grib_get_long(h, c->name, &lval) == GRIB_SUCCESS) && (lval == lres);
break; break;
case GRIB_TYPE_DOUBLE: { case GRIB_TYPE_DOUBLE: {
@ -120,12 +145,14 @@ static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition*
} }
/* Return 1 (=True) or 0 (=False) */ /* Return 1 (=True) or 0 (=False) */
static int concept_condition_true(grib_handle* h, grib_concept_condition* c) static int concept_condition_true(
grib_handle* h, grib_concept_condition* c,
std::unordered_map<std::string_view, long>& memo)
{ {
if (c->expression == NULL) if (c->expression == NULL)
return concept_condition_iarray_true(h, c); return concept_condition_iarray_true(h, c);
else else
return concept_condition_expression_true(h, c); return concept_condition_expression_true(h, c, memo);
} }
static const char* concept_evaluate(grib_accessor* a) static const char* concept_evaluate(grib_accessor* a)
@ -136,12 +163,14 @@ static const char* concept_evaluate(grib_accessor* a)
grib_concept_value* c = action_concept_get_concept(a); grib_concept_value* c = action_concept_get_concept(a);
grib_handle* h = grib_handle_of_accessor(a); grib_handle* h = grib_handle_of_accessor(a);
std::unordered_map<std::string_view, long> memo; // See ECC-1905
// fprintf(stderr, "DEBUG: concept_evaluate: %s %s\n", name_ , c->name); // fprintf(stderr, "DEBUG: concept_evaluate: %s %s\n", name_ , c->name);
while (c) { while (c) {
grib_concept_condition* e = c->conditions; grib_concept_condition* e = c->conditions;
int cnt = 0; int cnt = 0;
while (e) { while (e) {
if (!concept_condition_true(h, e)) if (!concept_condition_true(h, e, memo))
break; break;
e = e->next; e = e->next;
cnt++; cnt++;

View File

@ -138,25 +138,27 @@ static grib_trie* load_dictionary(grib_accessor* a, int* err)
fclose(f); fclose(f);
if (localFilename != 0) { if (localFilename != 0) {
f = codes_fopen(localFilename, "r"); *err = GRIB_NOT_IMPLEMENTED;
if (!f) { return NULL;
*err = GRIB_IO_PROBLEM; // f = codes_fopen(localFilename, "r");
return NULL; // if (!f) {
} // *err = GRIB_IO_PROBLEM;
// return NULL;
// }
while (fgets(line, sizeof(line) - 1, f)) { //while (fgets(line, sizeof(line) - 1, f)) {
i = 0; // i = 0;
while (line[i] != '|' && line[i] != 0) { // while (line[i] != '|' && line[i] != 0) {
key[i] = line[i]; // key[i] = line[i];
i++; // i++;
} // }
key[i] = 0; // key[i] = 0;
list = (char*)grib_context_malloc_clear(c, strlen(line) + 1); // list = (char*)grib_context_malloc_clear(c, strlen(line) + 1);
memcpy(list, line, strlen(line)); // memcpy(list, line, strlen(line));
grib_trie_insert(dictionary, key, list); // grib_trie_insert(dictionary, key, list);
} //}
fclose(f); //fclose(f);
} }
grib_trie_insert(c->lists, filename, dictionary); grib_trie_insert(c->lists, filename, dictionary);
return dictionary; return dictionary;

View File

@ -203,7 +203,7 @@ int grib_accessor_local_definition_t::pack_long(const long* val, size_t* len)
// 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(context_, GRIB_LOG_ERROR, grib_context_log(context_, GRIB_LOG_ERROR,
"grib_accessor_local_definition_t: Invalid localDefinitionNumber %d", localDefinitionNumber); "grib_accessor_local_definition_t: Invalid localDefinitionNumber %d", localDefinitionNumber);
return GRIB_ENCODING_ERROR; // return GRIB_ENCODING_ERROR;
#endif #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; productDefinitionTemplateNumberNew = productDefinitionTemplateNumber;

View File

@ -85,7 +85,6 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh
|---grib_accessor_class_g2_mars_labeling |---grib_accessor_class_g2_mars_labeling
|---grib_accessor_class_g2step_range |---grib_accessor_class_g2step_range
|---grib_accessor_class_gaussian_grid_name |---grib_accessor_class_gaussian_grid_name
|---grib_accessor_class_gds_not_present_bitmap
|---grib_accessor_class_group |---grib_accessor_class_group
|---grib_accessor_class_hash_array |---grib_accessor_class_hash_array
|---grib_accessor_class_headers_only |---grib_accessor_class_headers_only

View File

@ -95,7 +95,6 @@ static void grib_dump(grib_action* a, FILE* f, int l)
} }
c = c->super ? *(c->super) : NULL; c = c->super ? *(c->super) : NULL;
} }
DEBUG_ASSERT(0);
} }
// void grib_xref(grib_action* a, FILE* f, const char* path) // void grib_xref(grib_action* a, FILE* f, const char* path)
@ -210,7 +209,27 @@ void grib_dump_action_tree(grib_context* ctx, FILE* out)
Assert(ctx->grib_reader); Assert(ctx->grib_reader);
Assert(ctx->grib_reader->first); Assert(ctx->grib_reader->first);
Assert(out); Assert(out);
grib_dump_action_branch(out, ctx->grib_reader->first->root, 0);
// grib_dump_action_branch(out, ctx->grib_reader->first->root, 0);
// grib_action* next = ctx->grib_reader->first->root;
// while (next) {
// fprintf(out, "Dump %s\n", next->name);
// grib_dump_action_branch(out, next, 0);
// next = next->next;
// }
grib_action_file* fr = ctx->grib_reader->first;
grib_action_file* fn = fr;
while (fn) {
fr = fn;
fn = fn->next;
grib_action* a = fr->root;
while (a) {
grib_action* na = a->next;
grib_dump_action_branch(out, a, 0);
a = na;
}
}
} }
// void grib_xref_action_branch(FILE* out, grib_action* a, const char* path) // void grib_xref_action_branch(FILE* out, grib_action* a, const char* path)

View File

@ -17,20 +17,17 @@ MEMBERS
extern grib_action_class* SUPER; extern grib_action_class* SUPER;
static grib_action_class _grib_action_class_NAME = { static grib_action_class _grib_action_class_NAME = {
&SUPER, /* super */ &SUPER, /* super */
"action_class_NAME", /* name */ "action_class_NAME", /* name */
sizeof(grib_action_NAME), /* size */ sizeof(grib_action_NAME), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
&init, /* init */ &init, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ &xref, /* xref */
&xref, /* xref */ &create_accessor, /* create_accessor */
&notify_change, /* notify_change */
&create_accessor, /* create_accessor*/
&notify_change, /* notify_change */
&reparse, /* reparse */ &reparse, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -49,20 +49,17 @@ typedef struct grib_action_alias {
static grib_action_class _grib_action_class_alias = { static grib_action_class _grib_action_class_alias = {
0, /* super */ 0, /* super */
"action_class_alias", /* name */ "action_class_alias", /* name */
sizeof(grib_action_alias), /* size */ sizeof(grib_action_alias), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -49,20 +49,17 @@ typedef struct grib_action_assert {
static grib_action_class _grib_action_class_assert = { static grib_action_class _grib_action_class_assert = {
0, /* super */ 0, /* super */
"action_class_assert", /* name */ "action_class_assert", /* name */
sizeof(grib_action_assert), /* size */ sizeof(grib_action_assert), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
&notify_change, /* notify_change */
&create_accessor, /* create_accessor*/
&notify_change, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -43,20 +43,17 @@ typedef struct grib_action_close {
static grib_action_class _grib_action_class_close = { static grib_action_class _grib_action_class_close = {
0, /* super */ 0, /* super */
"action_class_close", /* name */ "action_class_close", /* name */
sizeof(grib_action_close), /* size */ sizeof(grib_action_close), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -60,20 +60,17 @@ typedef struct grib_action_concept {
extern grib_action_class* grib_action_class_gen; extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_concept = { static grib_action_class _grib_action_class_concept = {
&grib_action_class_gen, /* super */ &grib_action_class_gen, /* super */
"action_class_concept", /* name */ "action_class_concept", /* name */
sizeof(grib_action_concept), /* size */ sizeof(grib_action_concept), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };
@ -187,15 +184,12 @@ grib_action* grib_action_create_concept(grib_context* context,
static void dump(grib_action* act, FILE* f, int lvl) static void dump(grib_action* act, FILE* f, int lvl)
{ {
int i = 0; for (int i = 0; i < lvl; i++)
for (i = 0; i < lvl; i++)
grib_context_print(act->context, f, " "); grib_context_print(act->context, f, " ");
printf("concept(%s) { ", act->name); printf("concept(%s) { \n", act->name);
printf("\n");
for (i = 0; i < lvl; i++) for (int i = 0; i < lvl; i++)
grib_context_print(act->context, f, " "); grib_context_print(act->context, f, " ");
printf("}\n"); printf("}\n");
} }

View File

@ -54,20 +54,17 @@ typedef struct grib_action_gen {
static grib_action_class _grib_action_class_gen = { static grib_action_class _grib_action_class_gen = {
0, /* super */ 0, /* super */
"action_class_gen", /* name */ "action_class_gen", /* name */
sizeof(grib_action_gen), /* size */ sizeof(grib_action_gen), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
&notify_change, /* notify_change */
&create_accessor, /* create_accessor*/
&notify_change, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -61,20 +61,17 @@ typedef struct grib_action_hash_array {
extern grib_action_class* grib_action_class_gen; extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_hash_array = { static grib_action_class _grib_action_class_hash_array = {
&grib_action_class_gen, /* super */ &grib_action_class_gen, /* super */
"action_class_hash_array", /* name */ "action_class_hash_array", /* name */
sizeof(grib_action_hash_array), /* size */ sizeof(grib_action_hash_array), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -61,20 +61,17 @@ typedef struct grib_action_if {
extern grib_action_class* grib_action_class_section; extern grib_action_class* grib_action_class_section;
static grib_action_class _grib_action_class_if = { static grib_action_class _grib_action_class_if = {
&grib_action_class_section, /* super */ &grib_action_class_section, /* super */
"action_class_if", /* name */ "action_class_if", /* name */
sizeof(grib_action_if), /* size */ sizeof(grib_action_if), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
&reparse, /* reparse */ &reparse, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -56,20 +56,17 @@ typedef struct grib_action_list {
extern grib_action_class* grib_action_class_section; extern grib_action_class* grib_action_class_section;
static grib_action_class _grib_action_class_list = { static grib_action_class _grib_action_class_list = {
&grib_action_class_section, /* super */ &grib_action_class_section, /* super */
"action_class_list", /* name */ "action_class_list", /* name */
sizeof(grib_action_list), /* size */ sizeof(grib_action_list), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
&reparse, /* reparse */ &reparse, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -51,20 +51,17 @@ typedef struct grib_action_meta {
extern grib_action_class* grib_action_class_gen; extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_meta = { static grib_action_class _grib_action_class_meta = {
&grib_action_class_gen, /* super */ &grib_action_class_gen, /* super */
"action_class_meta", /* name */ "action_class_meta", /* name */
sizeof(grib_action_meta), /* size */ sizeof(grib_action_meta), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
0, /* destroy */ 0, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -49,20 +49,17 @@ typedef struct grib_action_modify {
static grib_action_class _grib_action_class_modify = { static grib_action_class _grib_action_class_modify = {
0, /* super */ 0, /* super */
"action_class_modify", /* name */ "action_class_modify", /* name */
sizeof(grib_action_modify), /* size */ sizeof(grib_action_modify), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -44,20 +44,17 @@ typedef struct grib_action_noop {
static grib_action_class _grib_action_class_noop = { static grib_action_class _grib_action_class_noop = {
0, /* super */ 0, /* super */
"action_class_noop", /* name */ "action_class_noop", /* name */
sizeof(grib_action_noop), /* size */ sizeof(grib_action_noop), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -48,20 +48,17 @@ typedef struct grib_action_print {
static grib_action_class _grib_action_class_print = { static grib_action_class _grib_action_class_print = {
0, /* super */ 0, /* super */
"action_class_print", /* name */ "action_class_print", /* name */
sizeof(grib_action_print), /* size */ sizeof(grib_action_print), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -49,20 +49,17 @@ typedef struct grib_action_remove {
static grib_action_class _grib_action_class_remove = { static grib_action_class _grib_action_class_remove = {
0, /* super */ 0, /* super */
"action_class_remove", /* name */ "action_class_remove", /* name */
sizeof(grib_action_remove), /* size */ sizeof(grib_action_remove), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -51,20 +51,17 @@ typedef struct grib_action_rename {
static grib_action_class _grib_action_class_rename = { static grib_action_class _grib_action_class_rename = {
0, /* super */ 0, /* super */
"action_class_rename", /* name */ "action_class_rename", /* name */
sizeof(grib_action_rename), /* size */ sizeof(grib_action_rename), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };
@ -127,12 +124,12 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
static void dump(grib_action* act, FILE* f, int lvl) static void dump(grib_action* act, FILE* f, int lvl)
{ {
// grib_action_rename* a = (grib_action_rename*)act; grib_action_rename* a = (grib_action_rename*)act;
// int i = 0; int i = 0;
// for (i = 0; i < lvl; i++) for (i = 0; i < lvl; i++)
// grib_context_print(act->context, f, " "); grib_context_print(act->context, f, " ");
// grib_context_print(act->context, f, "rename %s as %s in %s\n", a->the_old, act->name, a->the_new); grib_context_print(act->context, f, "rename %s as %s in %s\n", a->the_old, act->name, a->the_new);
} }
static void destroy(grib_context* context, grib_action* act) static void destroy(grib_context* context, grib_action* act)

View File

@ -44,20 +44,17 @@ typedef struct grib_action_section {
static grib_action_class _grib_action_class_section = { static grib_action_class _grib_action_class_section = {
0, /* super */ 0, /* super */
"action_class_section", /* name */ "action_class_section", /* name */
sizeof(grib_action_section), /* size */ sizeof(grib_action_section), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
0, /* destroy */ 0, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
&notify_change, /* notify_change */
0, /* create_accessor*/
&notify_change, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -49,20 +49,17 @@ typedef struct grib_action_set {
static grib_action_class _grib_action_class_set = { static grib_action_class _grib_action_class_set = {
0, /* super */ 0, /* super */
"action_class_set", /* name */ "action_class_set", /* name */
sizeof(grib_action_set), /* size */ sizeof(grib_action_set), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -47,20 +47,17 @@ typedef struct grib_action_set_darray {
static grib_action_class _grib_action_class_set_darray = { static grib_action_class _grib_action_class_set_darray = {
0, /* super */ 0, /* super */
"action_class_set_darray", /* name */ "action_class_set_darray", /* name */
sizeof(grib_action_set_darray), /* size */ sizeof(grib_action_set_darray), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -45,20 +45,17 @@ typedef struct grib_action_set_missing {
static grib_action_class _grib_action_class_set_missing = { static grib_action_class _grib_action_class_set_missing = {
0, /* super */ 0, /* super */
"action_class_set_missing", /* name */ "action_class_set_missing", /* name */
sizeof(grib_action_set_missing), /* size */ sizeof(grib_action_set_missing), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -47,20 +47,17 @@ typedef struct grib_action_set_sarray {
static grib_action_class _grib_action_class_set_sarray = { static grib_action_class _grib_action_class_set_sarray = {
0, /* super */ 0, /* super */
"action_class_set_sarray", /* name */ "action_class_set_sarray", /* name */
sizeof(grib_action_set_sarray), /* size */ sizeof(grib_action_set_sarray), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -51,20 +51,17 @@ typedef struct grib_action_switch {
extern grib_action_class* grib_action_class_section; extern grib_action_class* grib_action_class_section;
static grib_action_class _grib_action_class_switch = { static grib_action_class _grib_action_class_switch = {
&grib_action_class_section, /* super */ &grib_action_class_section, /* super */
"action_class_switch", /* name */ "action_class_switch", /* name */
sizeof(grib_action_switch), /* size */ sizeof(grib_action_switch), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -57,20 +57,17 @@ typedef struct grib_action_template {
extern grib_action_class* grib_action_class_section; extern grib_action_class* grib_action_class_section;
static grib_action_class _grib_action_class_template = { static grib_action_class _grib_action_class_template = {
&grib_action_class_section, /* super */ &grib_action_class_section, /* super */
"action_class_template", /* name */ "action_class_template", /* name */
sizeof(grib_action_template), /* size */ sizeof(grib_action_template), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
0, /* notify_change */
&create_accessor, /* create_accessor*/
0, /* notify_change */
&reparse, /* reparse */ &reparse, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -52,20 +52,17 @@ typedef struct grib_action_transient_darray {
extern grib_action_class* grib_action_class_gen; extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_transient_darray = { static grib_action_class _grib_action_class_transient_darray = {
&grib_action_class_gen, /* super */ &grib_action_class_gen, /* super */
"action_class_transient_darray", /* name */ "action_class_transient_darray", /* name */
sizeof(grib_action_transient_darray), /* size */ sizeof(grib_action_transient_darray), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -48,20 +48,17 @@ typedef struct grib_action_variable {
extern grib_action_class* grib_action_class_gen; extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_variable = { static grib_action_class _grib_action_class_variable = {
&grib_action_class_gen, /* super */ &grib_action_class_gen, /* super */
"action_class_variable", /* name */ "action_class_variable", /* name */
sizeof(grib_action_variable), /* size */ sizeof(grib_action_variable), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
0, /* destroy */ 0, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -53,20 +53,17 @@ typedef struct grib_action_when {
static grib_action_class _grib_action_class_when = { static grib_action_class _grib_action_class_when = {
0, /* super */ 0, /* super */
"action_class_when", /* name */ "action_class_when", /* name */
sizeof(grib_action_when), /* size */ sizeof(grib_action_when), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
&dump, /* dump */
&dump, /* dump */ 0, /* xref */
0, /* xref */ &create_accessor, /* create_accessor */
&notify_change, /* notify_change */
&create_accessor, /* create_accessor*/
&notify_change, /* notify_change */
0, /* reparse */ 0, /* reparse */
0, /* execute */ 0, /* execute */
}; };

View File

@ -47,20 +47,17 @@ typedef struct grib_action_write {
static grib_action_class _grib_action_class_write = { static grib_action_class _grib_action_class_write = {
0, /* super */ 0, /* super */
"action_class_write", /* name */ "action_class_write", /* name */
sizeof(grib_action_write), /* size */ sizeof(grib_action_write), /* size */
0, /* inited */ 0, /* inited */
&init_class, /* init_class */ &init_class, /* init_class */
0, /* init */ 0, /* init */
&destroy, /* destroy */ &destroy, /* destroy */
0, /* dump */
0, /* dump */ 0, /* xref */
0, /* xref */ 0, /* create_accessor */
0, /* notify_change */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */ 0, /* reparse */
&execute, /* execute */ &execute, /* execute */
}; };

View File

@ -9,6 +9,7 @@
*/ */
#include "grib_api_internal.h" #include "grib_api_internal.h"
#include "eccodes.h"
// Input lon must be in degrees not radians // Input lon must be in degrees not radians
// Not to be used for latitudes as they can be -ve // Not to be used for latitudes as they can be -ve
@ -279,7 +280,7 @@ long convert_to_minutes(long step, long stepUnits)
return (long)result; return (long)result;
} }
bool is_sorted_ascending(double arr[], size_t n) bool is_sorted_ascending(const double arr[], size_t n)
{ {
for (size_t i = 0; i < n-1; i++) { for (size_t i = 0; i < n-1; i++) {
if (arr[i] > arr[i+1]) { if (arr[i] > arr[i+1]) {
@ -289,7 +290,7 @@ bool is_sorted_ascending(double arr[], size_t n)
return true; return true;
} }
bool is_sorted_descending(double arr[], size_t n) bool is_sorted_descending(const double arr[], size_t n)
{ {
for (size_t i = 0; i < n-1; i++) { for (size_t i = 0; i < n-1; i++) {
if (arr[i] < arr[i+1]) { if (arr[i] < arr[i+1]) {
@ -404,3 +405,143 @@ int compute_scaled_value_and_scale_factor(
} }
return err; return err;
} }
static const char* known_features[] = {
"AEC",
"MEMFS",
"JPG",
"PNG",
"ECCODES_THREADS",
"ECCODES_OMP_THREADS",
"NETCDF",
"FORTRAN",
"GEOGRAPHY"
};
#define NUMBER(x) (sizeof(x) / sizeof(x[0]))
int codes_is_feature_enabled(const char* feature)
{
int aec_enabled = 0; // or CCSDS
int memfs_enabled = 0;
int jpg_enabled = 0; // JasPer or OpenJPEG or both
int png_enabled = 0;
int posix_threads_enabled = 0;
int omp_threads_enabled = 0;
int netcdf_enabled = 0;
int fortran_enabled = 0;
int geography_enabled = 0;
int found_feature = 0;
const size_t num = NUMBER(known_features);
for (size_t i = 0; i < num; ++i) {
if (STR_EQUAL(feature, known_features[i])) {
found_feature = 1;
break;
}
}
if (!found_feature) {
const grib_context* c = grib_context_get_default();
grib_context_log(c, GRIB_LOG_ERROR, "Unknown feature '%s'. Select one of:", feature);
for (size_t i = 0; i < num; ++i) {
grib_context_log(c, GRIB_LOG_ERROR, "\t%s", known_features[i]);
}
return 0;
}
#if defined(HAVE_LIBAEC) || defined(HAVE_AEC)
aec_enabled = 1;
#endif
#if HAVE_JPEG
#if HAVE_LIBJASPER
jpg_enabled = 1;
#endif
#if HAVE_LIBOPENJPEG
jpg_enabled = 1;
#endif
#endif
#if HAVE_LIBPNG
png_enabled = 1;
#endif
#if defined(HAVE_MEMFS)
memfs_enabled = 1;
#endif
#if GRIB_PTHREADS
posix_threads_enabled = 1;
#endif
#if GRIB_OMP_THREADS
omp_threads_enabled = 1;
#endif
#if defined(HAVE_NETCDF)
netcdf_enabled = 1;
#endif
#if defined(HAVE_FORTRAN)
fortran_enabled = 1;
#endif
#if defined(HAVE_GEOGRAPHY)
geography_enabled = 1;
#endif
if (STR_EQUAL(feature, "AEC") || STR_EQUAL(feature, "CCSDS")) {
return aec_enabled;
}
if (STR_EQUAL(feature, "JPG") || STR_EQUAL(feature, "JPEG")) {
return jpg_enabled;
}
if (STR_EQUAL(feature, "PNG")) {
return png_enabled;
}
if (STR_EQUAL(feature, "MEMFS")) {
return memfs_enabled;
}
if (STR_EQUAL(feature, "ECCODES_THREADS")) {
return posix_threads_enabled;
}
if (STR_EQUAL(feature, "ECCODES_OMP_THREADS")) {
return omp_threads_enabled;
}
if (STR_EQUAL(feature, "NETCDF")) {
return netcdf_enabled;
}
if (STR_EQUAL(feature, "FORTRAN")) {
return fortran_enabled;
}
if (STR_EQUAL(feature, "GEOGRAPHY")) {
return geography_enabled;
}
return 0;
}
int codes_get_features(char* result, size_t* length, int select)
{
Assert(select == CODES_FEATURES_ALL || select == CODES_FEATURES_ENABLED || select == CODES_FEATURES_DISABLED);
const size_t num = NUMBER(known_features);
result[0] = '\0';
for (size_t i = 0; i < num; ++i) {
if (select == CODES_FEATURES_ALL) {
strcat(result, known_features[i]);
strcat(result, " ");
}
else if (select == CODES_FEATURES_ENABLED) {
if (codes_is_feature_enabled(known_features[i])) {
strcat(result, known_features[i]);
strcat(result, " ");
}
}
else if (select == CODES_FEATURES_DISABLED) {
if (!codes_is_feature_enabled(known_features[i])) {
strcat(result, known_features[i]);
strcat(result, " ");
}
}
}
const size_t actual_length = strlen(result);
if (result[actual_length - 1] == ' ')
result[actual_length - 1] = '\0';
Assert(*length >= actual_length);
*length = actual_length;
return GRIB_SUCCESS;
}

View File

@ -0,0 +1,117 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_accessor_class_gds_not_present_bitmap.h"
grib_accessor_class_gds_not_present_bitmap_t _grib_accessor_class_gds_not_present_bitmap{ "gds_not_present_bitmap" };
grib_accessor_class* grib_accessor_class_gds_not_present_bitmap = &_grib_accessor_class_gds_not_present_bitmap;
void grib_accessor_class_gds_not_present_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args)
{
Assert(!"grib_accessor_class_gds_not_present_bitmap_t::init should not be called");
// grib_accessor_class_gen_t::init(a, v, args);
// int n = 0;
// grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
// grib_handle* hand = grib_handle_of_accessor(a);
// self->missing_value = grib_arguments_get_name(hand, args, n++);
// self->number_of_values = grib_arguments_get_name(hand, args, n++);
// self->number_of_points = grib_arguments_get_name(hand, args, n++);
// self->latitude_of_first_point = grib_arguments_get_name(hand, args, n++);
// self->ni = grib_arguments_get_name(hand, args, n++);
// a->length = 0;
}
int grib_accessor_class_gds_not_present_bitmap_t::value_count(grib_accessor* a, long* number_of_points)
{
return GRIB_NOT_IMPLEMENTED;
// grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
// *number_of_points = 0;
// return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_points, number_of_points);
}
int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
// grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a;
// grib_handle* hand = grib_handle_of_accessor(a);
// long number_of_points = 0, number_of_values = 0, ni = 0;
// long latitude_of_first_point = 0;
// size_t i = 0;
// size_t n_vals = 0;
// long nn = 0;
// long missing_value;
// double* coded_vals = NULL;
// int err = a->value_count(&nn);
// n_vals = nn;
// if (err)
// return err;
// if ((err = grib_get_long(hand, self->number_of_points, &number_of_points)) != GRIB_SUCCESS)
// return err;
// if ((err = grib_get_long(hand, self->number_of_values, &number_of_values)) != GRIB_SUCCESS)
// return err;
// if ((err = grib_get_long(hand, self->latitude_of_first_point, &latitude_of_first_point)) != GRIB_SUCCESS)
// return err;
// if ((err = grib_get_long(hand, self->missing_value, &missing_value)) != GRIB_SUCCESS)
// return err;
// if ((err = grib_get_long(hand, self->ni, &ni)) != GRIB_SUCCESS)
// return err;
// if (*len < number_of_points) {
// *len = n_vals;
// return GRIB_ARRAY_TOO_SMALL;
// }
// if (number_of_values > 0) {
// coded_vals = (double*)grib_context_malloc(a->context, number_of_values * sizeof(double));
// if (coded_vals == NULL)
// return GRIB_OUT_OF_MEMORY;
// }
// if (latitude_of_first_point == 0) {
// for (i = 0; i < number_of_values; i++)
// val[i] = 1;
// for (i = number_of_values; i < number_of_points; i++)
// val[i] = 0;
// }
// else {
// for (i = 0; i < ni - 1; i++)
// val[i] = 0;
// for (i = ni - 1; i < number_of_points; i++)
// val[i] = 1;
// }
// *len = number_of_points;
// grib_context_free(a->context, coded_vals);
// return err;
}
int grib_accessor_class_gds_not_present_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
{
// See deprecated/grib_accessor_class_gds_not_present_bitmap.cc for
// a possible implementation
return GRIB_NOT_IMPLEMENTED;
}
int grib_accessor_class_gds_not_present_bitmap_t::get_native_type(grib_accessor* a)
{
return GRIB_TYPE_DOUBLE;
}

View File

@ -28,6 +28,11 @@ const char* codes_get_git_sha1()
{ {
return grib_get_git_sha1(); return grib_get_git_sha1();
} }
const char* codes_get_git_branch()
{
return grib_get_git_branch();
}
const char* codes_get_package_name(void) const char* codes_get_package_name(void)
{ {
return grib_get_package_name(); return grib_get_package_name();
@ -475,7 +480,7 @@ void codes_gribex_mode_on(grib_context* c)
{ {
grib_gribex_mode_on(c); grib_gribex_mode_on(c);
} }
int codes_get_gribex_mode(grib_context* c) int codes_get_gribex_mode(const grib_context* c)
{ {
return grib_get_gribex_mode(c); return grib_get_gribex_mode(c);
} }

View File

@ -809,12 +809,12 @@ int codes_get_float_elements(const codes_handle* h, const char* key, const int*
* *
* @param h : the handle to get the data from * @param h : the handle to get the data from
* @param key : the key to be searched * @param key : the key to be searched
* @param mesg : the address of a string where the data will be retrieved * @param value : 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, * @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 * and that contains the actual length of the string on output
* @return 0 if OK, integer value on error * @return 0 if OK, integer value on error
*/ */
int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t* length); int codes_get_string(const codes_handle* h, const char* key, char* value, size_t* length);
/** /**
* Get string array values from a key. If several keys of the same name are present, the last one is returned * Get string array values from a key. If several keys of the same name are present, the last one is returned
@ -910,12 +910,12 @@ int codes_set_double(codes_handle* h, const char* key, double val);
* *
* @param h : the handle to set the data to * @param h : the handle to set the data to
* @param key : the key to be searched * @param key : the key to be searched
* @param mesg : the address of a string where the data will be read * @param value : 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, * @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 * and that contains the actual packed length of the string on output
* @return 0 if OK, integer value on error * @return 0 if OK, integer value on error
*/ */
int codes_set_string(codes_handle* h, const char* key, const char* mesg, size_t* length); int codes_set_string(codes_handle* h, const char* key, const char* value, size_t* length);
/** /**
* Set a bytes array from a key. If several keys of the same name are present, the last one is set * Set a bytes array from a key. If several keys of the same name are present, the last one is set
@ -1143,7 +1143,7 @@ void codes_gribex_mode_on(codes_context* c);
* *
* @param c : the context * @param c : the context
*/ */
int codes_get_gribex_mode(codes_context* c); int codes_get_gribex_mode(const codes_context* c);
/** /**
* Set the GRIBEX mode off. * Set the GRIBEX mode off.
@ -1264,6 +1264,7 @@ long codes_get_api_version(void);
*/ */
const char* codes_get_git_sha1(void); const char* codes_get_git_sha1(void);
const char* codes_get_git_branch(void);
const char* codes_get_build_date(void); const char* codes_get_build_date(void);
/** /**
@ -1399,6 +1400,14 @@ int codes_get_product_kind(const codes_handle* h, ProductKind* product_kind);
int codes_check_message_header(const void* bytes, size_t length, ProductKind product); int codes_check_message_header(const void* bytes, size_t length, ProductKind product);
int codes_check_message_footer(const void* bytes, size_t length, ProductKind product); int codes_check_message_footer(const void* bytes, size_t length, ProductKind product);
/* Features */
#define CODES_FEATURES_ALL 0
#define CODES_FEATURES_ENABLED 1
#define CODES_FEATURES_DISABLED 2
int codes_is_feature_enabled(const char* feature);
/* result is a space-separated list of features and
must be allocated by the caller (its length must be large enough) */
int codes_get_features(char* result, size_t* length, int select);
/* --------------------------------------- */ /* --------------------------------------- */
#define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL #define CODES_UTIL_GRID_SPEC_REGULAR_LL GRIB_UTIL_GRID_SPEC_REGULAR_LL

View File

@ -402,8 +402,8 @@ void codes_dump_bufr_flat(grib_accessors_list* al, grib_handle* h, FILE* f, cons
size_t grib_context_read(const grib_context* c, void* ptr, size_t size, void* stream); size_t grib_context_read(const grib_context* c, void* ptr, size_t size, void* stream);
off_t grib_context_tell(const grib_context* c, void* stream); off_t grib_context_tell(const grib_context* c, void* stream);
int grib_context_seek(const grib_context* c, off_t offset, int whence, void* stream); int grib_context_seek(const grib_context* c, off_t offset, int whence, void* stream);
int grib_context_eof(const grib_context* c, void* stream); // int grib_context_eof(const grib_context* c, void* stream);
size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream); // size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream);
void grib_context_set_print_proc(grib_context* c, grib_print_proc p); void grib_context_set_print_proc(grib_context* c, grib_print_proc p);
void grib_context_set_debug(grib_context* c, int mode); void grib_context_set_debug(grib_context* c, int mode);
void grib_context_set_logging_proc(grib_context* c, grib_log_proc p); void grib_context_set_logging_proc(grib_context* c, grib_log_proc p);
@ -450,7 +450,7 @@ bufr_descriptors_array* grib_context_expanded_descriptors_list_get(grib_context*
void grib_context_expanded_descriptors_list_push(grib_context* c, const char* key, bufr_descriptors_array* expanded, bufr_descriptors_array* unexpanded); void grib_context_expanded_descriptors_list_push(grib_context* c, const char* key, bufr_descriptors_array* expanded, bufr_descriptors_array* unexpanded);
void codes_set_codes_assertion_failed_proc(codes_assertion_failed_proc proc); void codes_set_codes_assertion_failed_proc(codes_assertion_failed_proc proc);
void codes_assertion_failed(const char* message, const char* file, int line); void codes_assertion_failed(const char* message, const char* file, int line);
int grib_get_gribex_mode(grib_context* c); int grib_get_gribex_mode(const grib_context* c);
void grib_gribex_mode_on(grib_context* c); void grib_gribex_mode_on(grib_context* c);
void grib_gribex_mode_off(grib_context* c); void grib_gribex_mode_off(grib_context* c);
void grib_gts_header_on(grib_context* c); void grib_gts_header_on(grib_context* c);
@ -466,7 +466,6 @@ long grib_julian_to_date(long jdate);
long grib_date_to_julian(long ddate); long grib_date_to_julian(long ddate);
/* grib_fieldset.cc */ /* grib_fieldset.cc */
int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type);
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, const char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err); grib_fieldset* grib_fieldset_new_from_files(grib_context* c, const char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string); int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string);
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string); int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string);
@ -855,9 +854,12 @@ int codes_flush_sync_close_file(FILE* f);
int is_date_valid(long year, long month, long day, long hour, long minute, double second); int is_date_valid(long year, long month, long day, long hour, long minute, double second);
int is_time_valid(long number); // number is HHMM int is_time_valid(long number); // number is HHMM
long convert_to_minutes(long step, long stepUnits); long convert_to_minutes(long step, long stepUnits);
bool is_sorted_ascending(double arr[], size_t n); bool is_sorted_ascending(const double arr[], size_t n);
bool is_sorted_descending(double arr[], size_t n); bool is_sorted_descending(const double arr[], size_t n);
int compute_scaled_value_and_scale_factor(double input, int64_t scaled_value_max, int64_t scale_factor_max, int64_t* ret_value, int64_t* ret_factor); int compute_scaled_value_and_scale_factor(double input, int64_t scaled_value_max, int64_t scale_factor_max, int64_t* ret_value, int64_t* ret_factor);
int codes_is_feature_enabled(const char* feature);
int codes_get_features(char* result, size_t* length, int select);
/* grib_util.cc */ /* grib_util.cc */
grib_handle* grib_util_sections_copy(grib_handle* hfrom, grib_handle* hto, int what, int* err); grib_handle* grib_util_sections_copy(grib_handle* hfrom, grib_handle* hto, int what, int* err);
@ -942,6 +944,7 @@ int grib_optimize_decimal_factor(grib_accessor* a, const char* reference_value,
/* grib_api_version.cc */ /* grib_api_version.cc */
const char* grib_get_git_sha1(void); const char* grib_get_git_sha1(void);
const char* grib_get_git_branch(void);
const char* codes_get_build_date(void); const char* codes_get_build_date(void);
/* grib_bits_any_endian.cc */ /* grib_bits_any_endian.cc */

View File

@ -2,7 +2,7 @@ typedef const char* string; /* to keep make_class.pl happy */
static void init(grib_expression* e); static void init(grib_expression* e);
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -18,12 +18,12 @@ typedef struct grib_expression_NAME{
extern grib_expression_class* SUPER; extern grib_expression_class* SUPER;
static grib_expression_class _grib_expression_class_NAME = { static grib_expression_class _grib_expression_class_NAME = {
&SUPER, /* super */ &SUPER, /* super */
"NAME", /* name */ "NAME", /* name */
sizeof(grib_expression_NAME),/* size of instance */ sizeof(grib_expression_NAME),/* size of instance */
0, /* inited */ 0, /* inited */
&init, /* constructor */ &init, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -74,7 +74,7 @@ static struct table_entry table[] = {
grib_section* grib_create_root_section(const grib_context* context, grib_handle* h) grib_section* grib_create_root_section(const grib_context* context, grib_handle* h)
{ {
char* fpath = 0; const char* fpath = 0;
grib_section* s = (grib_section*)grib_context_malloc_clear(context, sizeof(grib_section)); grib_section* s = (grib_section*)grib_context_malloc_clear(context, sizeof(grib_section));
GRIB_MUTEX_INIT_ONCE(&once, &init_mutex); GRIB_MUTEX_INIT_ONCE(&once, &init_mutex);

View File

@ -101,7 +101,6 @@ extern grib_accessor* grib_accessor_g2lon;
extern grib_accessor* grib_accessor_g2step_range; extern grib_accessor* grib_accessor_g2step_range;
extern grib_accessor* grib_accessor_gaussian_grid_name; extern grib_accessor* grib_accessor_gaussian_grid_name;
extern grib_accessor* grib_accessor_gds_is_present; extern grib_accessor* grib_accessor_gds_is_present;
extern grib_accessor* grib_accessor_gds_not_present_bitmap;
extern grib_accessor* grib_accessor_gen; extern grib_accessor* grib_accessor_gen;
extern grib_accessor* grib_accessor_getenv; extern grib_accessor* grib_accessor_getenv;
extern grib_accessor* grib_accessor_global_gaussian; extern grib_accessor* grib_accessor_global_gaussian;

View File

@ -37,12 +37,12 @@
#line 6 "accessor_class_list.gperf" #line 6 "accessor_class_list.gperf"
struct accessor_class_hash { const char *name; grib_accessor **cclass;}; struct accessor_class_hash { const char *name; grib_accessor **cclass;};
#define TOTAL_KEYWORDS 206 #define TOTAL_KEYWORDS 205
#define MIN_WORD_LENGTH 1 #define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44 #define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 1 #define MIN_HASH_VALUE 1
#define MAX_HASH_VALUE 545 #define MAX_HASH_VALUE 665
/* maximum key range = 545, duplicates = 0 */ /* maximum key range = 665, duplicates = 0 */
#ifdef __GNUC__ #ifdef __GNUC__
@ -56,32 +56,32 @@ grib_accessor_classes_get_id (const char *str, size_t len)
{ {
static const unsigned short asso_values[] = static const unsigned short asso_values[] =
{ {
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 0, 546, 546, 546, 546, 546, 546, 546, 666, 666, 0, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 1, 145, 666, 666, 666, 666, 666, 666, 666, 666, 1, 189,
23, 6, 2, 546, 4, 546, 1, 546, 546, 546, 23, 11, 4, 666, 10, 666, 0, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 0, 546, 0, 69, 84, 666, 666, 666, 666, 666, 0, 666, 0, 69, 85,
0, 0, 200, 24, 219, 1, 8, 6, 87, 102, 0, 0, 175, 24, 230, 1, 0, 4, 74, 223,
13, 51, 6, 546, 118, 1, 40, 59, 171, 0, 13, 50, 6, 666, 129, 1, 40, 71, 191, 0,
28, 11, 546, 546, 546, 546, 546, 546, 546, 546, 52, 5, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
546, 546, 546, 546, 546, 546 666, 666, 666, 666, 666, 666
}; };
unsigned int hval = len; unsigned int hval = len;
@ -118,30 +118,30 @@ static const struct accessor_class_hash classes[] =
#line 9 "accessor_class_list.gperf" #line 9 "accessor_class_list.gperf"
{" "}, {" "},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 179 "accessor_class_list.gperf" #line 178 "accessor_class_list.gperf"
{"size", &grib_accessor_size}, {"size", &grib_accessor_size},
#line 12 "accessor_class_list.gperf" #line 12 "accessor_class_list.gperf"
{"ascii", &grib_accessor_ascii}, {"ascii", &grib_accessor_ascii},
#line 176 "accessor_class_list.gperf" #line 175 "accessor_class_list.gperf"
{"signed", &grib_accessor_signed}, {"signed", &grib_accessor_signed},
#line 156 "accessor_class_list.gperf" #line 155 "accessor_class_list.gperf"
{"pad", &grib_accessor_pad}, {"pad", &grib_accessor_pad},
#line 182 "accessor_class_list.gperf" #line 181 "accessor_class_list.gperf"
{"spd", &grib_accessor_spd}, {"spd", &grib_accessor_spd},
{""}, {""}, {""}, #line 75 "accessor_class_list.gperf"
#line 177 "accessor_class_list.gperf" {"dirty", &grib_accessor_dirty},
{""}, {""},
#line 176 "accessor_class_list.gperf"
{"signed_bits", &grib_accessor_signed_bits}, {"signed_bits", &grib_accessor_signed_bits},
{""}, {""},
#line 66 "accessor_class_list.gperf" #line 66 "accessor_class_list.gperf"
{"data_raw_packing", &grib_accessor_data_raw_packing}, {"data_raw_packing", &grib_accessor_data_raw_packing},
#line 75 "accessor_class_list.gperf" {""}, {""}, {""},
{"dirty", &grib_accessor_dirty},
{""}, {""},
#line 72 "accessor_class_list.gperf" #line 72 "accessor_class_list.gperf"
{"data_simple_packing", &grib_accessor_data_simple_packing}, {"data_simple_packing", &grib_accessor_data_simple_packing},
#line 68 "accessor_class_list.gperf" #line 68 "accessor_class_list.gperf"
{"data_secondary_bitmap", &grib_accessor_data_secondary_bitmap}, {"data_secondary_bitmap", &grib_accessor_data_secondary_bitmap},
#line 170 "accessor_class_list.gperf" #line 169 "accessor_class_list.gperf"
{"section", &grib_accessor_section}, {"section", &grib_accessor_section},
#line 43 "accessor_class_list.gperf" #line 43 "accessor_class_list.gperf"
{"data_apply_bitmap", &grib_accessor_data_apply_bitmap}, {"data_apply_bitmap", &grib_accessor_data_apply_bitmap},
@ -149,40 +149,40 @@ static const struct accessor_class_hash classes[] =
#line 74 "accessor_class_list.gperf" #line 74 "accessor_class_list.gperf"
{"dictionary", &grib_accessor_dictionary}, {"dictionary", &grib_accessor_dictionary},
{""}, {""},
#line 112 "accessor_class_list.gperf" #line 111 "accessor_class_list.gperf"
{"gen", &grib_accessor_gen}, {"gen", &grib_accessor_gen},
#line 64 "accessor_class_list.gperf" #line 64 "accessor_class_list.gperf"
{"data_jpeg2000_packing", &grib_accessor_data_jpeg2000_packing}, {"data_jpeg2000_packing", &grib_accessor_data_jpeg2000_packing},
#line 65 "accessor_class_list.gperf" #line 65 "accessor_class_list.gperf"
{"data_png_packing", &grib_accessor_data_png_packing}, {"data_png_packing", &grib_accessor_data_png_packing},
#line 172 "accessor_class_list.gperf" #line 171 "accessor_class_list.gperf"
{"section_padding", &grib_accessor_section_padding}, {"section_padding", &grib_accessor_section_padding},
#line 173 "accessor_class_list.gperf" #line 172 "accessor_class_list.gperf"
{"section_pointer", &grib_accessor_section_pointer}, {"section_pointer", &grib_accessor_section_pointer},
#line 44 "accessor_class_list.gperf" #line 44 "accessor_class_list.gperf"
{"data_apply_boustrophedonic", &grib_accessor_data_apply_boustrophedonic}, {"data_apply_boustrophedonic", &grib_accessor_data_apply_boustrophedonic},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 157 "accessor_class_list.gperf" #line 156 "accessor_class_list.gperf"
{"padding", &grib_accessor_padding}, {"padding", &grib_accessor_padding},
#line 45 "accessor_class_list.gperf" #line 45 "accessor_class_list.gperf"
{"data_apply_boustrophedonic_bitmap", &grib_accessor_data_apply_boustrophedonic_bitmap}, {"data_apply_boustrophedonic_bitmap", &grib_accessor_data_apply_boustrophedonic_bitmap},
#line 110 "accessor_class_list.gperf" #line 110 "accessor_class_list.gperf"
{"gds_is_present", &grib_accessor_gds_is_present}, {"gds_is_present", &grib_accessor_gds_is_present},
#line 169 "accessor_class_list.gperf" #line 168 "accessor_class_list.gperf"
{"second_order_bits_per_value", &grib_accessor_second_order_bits_per_value}, {"second_order_bits_per_value", &grib_accessor_second_order_bits_per_value},
#line 171 "accessor_class_list.gperf" #line 170 "accessor_class_list.gperf"
{"section_length", &grib_accessor_section_length}, {"section_length", &grib_accessor_section_length},
#line 113 "accessor_class_list.gperf" #line 112 "accessor_class_list.gperf"
{"getenv", &grib_accessor_getenv}, {"getenv", &grib_accessor_getenv},
#line 57 "accessor_class_list.gperf" #line 57 "accessor_class_list.gperf"
{"data_g22order_packing", &grib_accessor_data_g22order_packing}, {"data_g22order_packing", &grib_accessor_data_g22order_packing},
#line 191 "accessor_class_list.gperf" #line 190 "accessor_class_list.gperf"
{"time", &grib_accessor_time}, {"time", &grib_accessor_time},
{""}, {""},
#line 61 "accessor_class_list.gperf" #line 61 "accessor_class_list.gperf"
{"data_g2shsimple_packing", &grib_accessor_data_g2shsimple_packing}, {"data_g2shsimple_packing", &grib_accessor_data_g2shsimple_packing},
{""}, {""},
#line 155 "accessor_class_list.gperf" #line 154 "accessor_class_list.gperf"
{"packing_type", &grib_accessor_packing_type}, {"packing_type", &grib_accessor_packing_type},
#line 62 "accessor_class_list.gperf" #line 62 "accessor_class_list.gperf"
{"data_g2simple_packing", &grib_accessor_data_g2simple_packing}, {"data_g2simple_packing", &grib_accessor_data_g2simple_packing},
@ -196,173 +196,204 @@ static const struct accessor_class_hash classes[] =
{"g2end_step", &grib_accessor_g2end_step}, {"g2end_step", &grib_accessor_g2end_step},
#line 98 "accessor_class_list.gperf" #line 98 "accessor_class_list.gperf"
{"g2_eps", &grib_accessor_g2_eps}, {"g2_eps", &grib_accessor_g2_eps},
#line 142 "accessor_class_list.gperf" #line 141 "accessor_class_list.gperf"
{"nearest", &grib_accessor_nearest}, {"nearest", &grib_accessor_nearest},
#line 80 "accessor_class_list.gperf" #line 157 "accessor_class_list.gperf"
{"expanded_descriptors", &grib_accessor_expanded_descriptors},
#line 158 "accessor_class_list.gperf"
{"padto", &grib_accessor_padto}, {"padto", &grib_accessor_padto},
#line 189 "accessor_class_list.gperf" {""}, {""}, {""},
{"sum", &grib_accessor_sum},
{""},
#line 107 "accessor_class_list.gperf" #line 107 "accessor_class_list.gperf"
{"g2lon", &grib_accessor_g2lon}, {"g2lon", &grib_accessor_g2lon},
#line 203 "accessor_class_list.gperf" {""}, {""},
{"uint8", &grib_accessor_uint8}, #line 187 "accessor_class_list.gperf"
{""},
#line 188 "accessor_class_list.gperf"
{"step_in_units", &grib_accessor_step_in_units}, {"step_in_units", &grib_accessor_step_in_units},
#line 63 "accessor_class_list.gperf" #line 63 "accessor_class_list.gperf"
{"data_g2simple_packing_with_preprocessing", &grib_accessor_data_g2simple_packing_with_preprocessing}, {"data_g2simple_packing_with_preprocessing", &grib_accessor_data_g2simple_packing_with_preprocessing},
#line 201 "accessor_class_list.gperf"
{"uint64", &grib_accessor_uint64},
#line 47 "accessor_class_list.gperf" #line 47 "accessor_class_list.gperf"
{"data_complex_packing", &grib_accessor_data_complex_packing}, {"data_complex_packing", &grib_accessor_data_complex_packing},
#line 199 "accessor_class_list.gperf" {""}, {""},
{"uint32", &grib_accessor_uint32},
#line 13 "accessor_class_list.gperf" #line 13 "accessor_class_list.gperf"
{"bit", &grib_accessor_bit}, {"bit", &grib_accessor_bit},
#line 15 "accessor_class_list.gperf" #line 15 "accessor_class_list.gperf"
{"bits", &grib_accessor_bits}, {"bits", &grib_accessor_bits},
#line 48 "accessor_class_list.gperf" #line 188 "accessor_class_list.gperf"
{"data_dummy_field", &grib_accessor_data_dummy_field}, {"sum", &grib_accessor_sum},
#line 14 "accessor_class_list.gperf" #line 14 "accessor_class_list.gperf"
{"bitmap", &grib_accessor_bitmap}, {"bitmap", &grib_accessor_bitmap},
#line 124 "accessor_class_list.gperf" #line 202 "accessor_class_list.gperf"
{"julian_day", &grib_accessor_julian_day}, {"uint8", &grib_accessor_uint8},
#line 123 "accessor_class_list.gperf" #line 142 "accessor_class_list.gperf"
{"julian_date", &grib_accessor_julian_date},
#line 143 "accessor_class_list.gperf"
{"non_alpha", &grib_accessor_non_alpha}, {"non_alpha", &grib_accessor_non_alpha},
{""}, {""}, {""},
#line 67 "accessor_class_list.gperf" #line 29 "accessor_class_list.gperf"
{"data_run_length_packing", &grib_accessor_data_run_length_packing}, {"bytes", &grib_accessor_bytes},
#line 123 "accessor_class_list.gperf"
{"julian_day", &grib_accessor_julian_day},
#line 122 "accessor_class_list.gperf"
{"julian_date", &grib_accessor_julian_date},
#line 108 "accessor_class_list.gperf" #line 108 "accessor_class_list.gperf"
{"g2step_range", &grib_accessor_g2step_range}, {"g2step_range", &grib_accessor_g2step_range},
#line 16 "accessor_class_list.gperf" #line 16 "accessor_class_list.gperf"
{"bits_per_value", &grib_accessor_bits_per_value}, {"bits_per_value", &grib_accessor_bits_per_value},
#line 80 "accessor_class_list.gperf"
{"expanded_descriptors", &grib_accessor_expanded_descriptors},
{""}, {""},
#line 29 "accessor_class_list.gperf" #line 48 "accessor_class_list.gperf"
{"bytes", &grib_accessor_bytes}, {"data_dummy_field", &grib_accessor_data_dummy_field},
{""}, {""}, {""}, #line 200 "accessor_class_list.gperf"
#line 167 "accessor_class_list.gperf" {"uint64", &grib_accessor_uint64},
#line 198 "accessor_class_list.gperf"
{"uint32", &grib_accessor_uint32},
{""},
#line 166 "accessor_class_list.gperf"
{"scale", &grib_accessor_scale}, {"scale", &grib_accessor_scale},
{""}, #line 184 "accessor_class_list.gperf"
#line 185 "accessor_class_list.gperf"
{"statistics", &grib_accessor_statistics}, {"statistics", &grib_accessor_statistics},
#line 102 "accessor_class_list.gperf" #line 102 "accessor_class_list.gperf"
{"g2date", &grib_accessor_g2date}, {"g2date", &grib_accessor_g2date},
#line 145 "accessor_class_list.gperf" #line 67 "accessor_class_list.gperf"
{"number_of_points", &grib_accessor_number_of_points}, {"data_run_length_packing", &grib_accessor_data_run_length_packing},
#line 100 "accessor_class_list.gperf" #line 100 "accessor_class_list.gperf"
{"g2bitmap", &grib_accessor_g2bitmap}, {"g2bitmap", &grib_accessor_g2bitmap},
{""},
#line 60 "accessor_class_list.gperf" #line 60 "accessor_class_list.gperf"
{"data_g2secondary_bitmap", &grib_accessor_data_g2secondary_bitmap}, {"data_g2secondary_bitmap", &grib_accessor_data_g2secondary_bitmap},
#line 58 "accessor_class_list.gperf" #line 58 "accessor_class_list.gperf"
{"data_g2bifourier_packing", &grib_accessor_data_g2bifourier_packing}, {"data_g2bifourier_packing", &grib_accessor_data_g2bifourier_packing},
#line 111 "accessor_class_list.gperf" {""},
{"gds_not_present_bitmap", &grib_accessor_gds_not_present_bitmap}, #line 121 "accessor_class_list.gperf"
#line 122 "accessor_class_list.gperf"
{"iterator", &grib_accessor_iterator}, {"iterator", &grib_accessor_iterator},
#line 186 "accessor_class_list.gperf" #line 177 "accessor_class_list.gperf"
{"simple_packing_error", &grib_accessor_simple_packing_error},
#line 185 "accessor_class_list.gperf"
{"statistics_spectral", &grib_accessor_statistics_spectral}, {"statistics_spectral", &grib_accessor_statistics_spectral},
{""},
#line 46 "accessor_class_list.gperf" #line 46 "accessor_class_list.gperf"
{"data_ccsds_packing", &grib_accessor_data_ccsds_packing}, {"data_ccsds_packing", &grib_accessor_data_ccsds_packing},
#line 146 "accessor_class_list.gperf"
{"number_of_points_gaussian", &grib_accessor_number_of_points_gaussian},
#line 206 "accessor_class_list.gperf"
{"unsigned", &grib_accessor_unsigned},
#line 138 "accessor_class_list.gperf"
{"md5", &grib_accessor_md5},
{""}, {""}, {""}, {""},
#line 144 "accessor_class_list.gperf"
{"number_of_points", &grib_accessor_number_of_points},
#line 96 "accessor_class_list.gperf" #line 96 "accessor_class_list.gperf"
{"g2_aerosol", &grib_accessor_g2_aerosol}, {"g2_aerosol", &grib_accessor_g2_aerosol},
#line 139 "accessor_class_list.gperf" {""}, {""}, {""}, {""},
{"message", &grib_accessor_message}, #line 173 "accessor_class_list.gperf"
#line 207 "accessor_class_list.gperf"
{"unsigned_bits", &grib_accessor_unsigned_bits},
#line 174 "accessor_class_list.gperf"
{"select_step_template", &grib_accessor_select_step_template}, {"select_step_template", &grib_accessor_select_step_template},
#line 136 "accessor_class_list.gperf" #line 192 "accessor_class_list.gperf"
{"mars_param", &grib_accessor_mars_param},
#line 204 "accessor_class_list.gperf"
{"unexpanded_descriptors", &grib_accessor_unexpanded_descriptors},
#line 193 "accessor_class_list.gperf"
{"to_integer", &grib_accessor_to_integer}, {"to_integer", &grib_accessor_to_integer},
#line 178 "accessor_class_list.gperf" #line 113 "accessor_class_list.gperf"
{"simple_packing_error", &grib_accessor_simple_packing_error},
{""}, {""}, {""},
#line 187 "accessor_class_list.gperf"
{"step_human_readable", &grib_accessor_step_human_readable},
#line 140 "accessor_class_list.gperf"
{"message_copy", &grib_accessor_message_copy},
#line 163 "accessor_class_list.gperf"
{"raw", &grib_accessor_raw},
{""}, {""},
#line 202 "accessor_class_list.gperf"
{"uint64_little_endian", &grib_accessor_uint64_little_endian},
{""},
#line 200 "accessor_class_list.gperf"
{"uint32_little_endian", &grib_accessor_uint32_little_endian},
#line 114 "accessor_class_list.gperf"
{"global_gaussian", &grib_accessor_global_gaussian}, {"global_gaussian", &grib_accessor_global_gaussian},
#line 145 "accessor_class_list.gperf"
{"number_of_points_gaussian", &grib_accessor_number_of_points_gaussian},
#line 205 "accessor_class_list.gperf"
{"unsigned", &grib_accessor_unsigned},
{""}, {""}, {""}, {""},
#line 76 "accessor_class_list.gperf" #line 174 "accessor_class_list.gperf"
{"divdouble", &grib_accessor_divdouble},
{""},
#line 175 "accessor_class_list.gperf"
{"sexagesimal2decimal", &grib_accessor_sexagesimal2decimal}, {"sexagesimal2decimal", &grib_accessor_sexagesimal2decimal},
#line 99 "accessor_class_list.gperf" {""},
{"g2_mars_labeling", &grib_accessor_g2_mars_labeling},
#line 78 "accessor_class_list.gperf" #line 78 "accessor_class_list.gperf"
{"element", &grib_accessor_element}, {"element", &grib_accessor_element},
#line 160 "accessor_class_list.gperf" #line 206 "accessor_class_list.gperf"
{"padtomultiple", &grib_accessor_padtomultiple}, {"unsigned_bits", &grib_accessor_unsigned_bits},
#line 127 "accessor_class_list.gperf" #line 126 "accessor_class_list.gperf"
{"latitudes", &grib_accessor_latitudes}, {"latitudes", &grib_accessor_latitudes},
#line 164 "accessor_class_list.gperf" {""},
{"rdbtime_guess_date", &grib_accessor_rdbtime_guess_date}, #line 203 "accessor_class_list.gperf"
{""}, {""}, {""}, {"unexpanded_descriptors", &grib_accessor_unexpanded_descriptors},
#line 194 "accessor_class_list.gperf" {""}, {""},
{"to_string", &grib_accessor_to_string}, #line 131 "accessor_class_list.gperf"
#line 132 "accessor_class_list.gperf"
{"long", &grib_accessor_long}, {"long", &grib_accessor_long},
#line 19 "accessor_class_list.gperf" #line 76 "accessor_class_list.gperf"
{"bufr_data_array", &grib_accessor_bufr_data_array}, {"divdouble", &grib_accessor_divdouble},
#line 77 "accessor_class_list.gperf" #line 77 "accessor_class_list.gperf"
{"double", &grib_accessor_double}, {"double", &grib_accessor_double},
#line 20 "accessor_class_list.gperf" #line 186 "accessor_class_list.gperf"
{"bufr_data_element", &grib_accessor_bufr_data_element}, {"step_human_readable", &grib_accessor_step_human_readable},
#line 162 "accessor_class_list.gperf"
{"raw", &grib_accessor_raw},
#line 99 "accessor_class_list.gperf"
{"g2_mars_labeling", &grib_accessor_g2_mars_labeling},
{""}, {""}, {""}, {""}, {""}, {""},
#line 193 "accessor_class_list.gperf"
{"to_string", &grib_accessor_to_string},
{""},
#line 201 "accessor_class_list.gperf"
{"uint64_little_endian", &grib_accessor_uint64_little_endian},
#line 199 "accessor_class_list.gperf"
{"uint32_little_endian", &grib_accessor_uint32_little_endian},
{""},
#line 105 "accessor_class_list.gperf" #line 105 "accessor_class_list.gperf"
{"g2latlon", &grib_accessor_g2latlon}, {"g2latlon", &grib_accessor_g2latlon},
{""}, {""}, #line 159 "accessor_class_list.gperf"
#line 26 "accessor_class_list.gperf" {"padtomultiple", &grib_accessor_padtomultiple},
{"bufr_simple_thinning", &grib_accessor_bufr_simple_thinning},
{""},
#line 137 "accessor_class_list.gperf"
{"mars_step", &grib_accessor_mars_step},
{""},
#line 115 "accessor_class_list.gperf"
{"group", &grib_accessor_group},
{""},
#line 28 "accessor_class_list.gperf"
{"bufrdc_expanded_descriptors", &grib_accessor_bufrdc_expanded_descriptors},
#line 161 "accessor_class_list.gperf"
{"position", &grib_accessor_position},
{""}, {""}, {""},
#line 17 "accessor_class_list.gperf" #line 17 "accessor_class_list.gperf"
{"blob", &grib_accessor_blob}, {"blob", &grib_accessor_blob},
#line 163 "accessor_class_list.gperf"
{"rdbtime_guess_date", &grib_accessor_rdbtime_guess_date},
{""}, {""}, {""},
#line 118 "accessor_class_list.gperf"
{"ibmfloat", &grib_accessor_ibmfloat},
#line 125 "accessor_class_list.gperf"
{"label", &grib_accessor_label},
#line 160 "accessor_class_list.gperf"
{"position", &grib_accessor_position},
#line 19 "accessor_class_list.gperf"
{"bufr_data_array", &grib_accessor_bufr_data_array},
{""},
#line 20 "accessor_class_list.gperf"
{"bufr_data_element", &grib_accessor_bufr_data_element},
{""}, {""}, {""},
#line 26 "accessor_class_list.gperf"
{"bufr_simple_thinning", &grib_accessor_bufr_simple_thinning},
{""}, {""},
#line 114 "accessor_class_list.gperf"
{"group", &grib_accessor_group},
{""}, {""},
#line 28 "accessor_class_list.gperf"
{"bufrdc_expanded_descriptors", &grib_accessor_bufrdc_expanded_descriptors},
{""}, {""}, {""}, {""},
#line 109 "accessor_class_list.gperf" #line 109 "accessor_class_list.gperf"
{"gaussian_grid_name", &grib_accessor_gaussian_grid_name}, {"gaussian_grid_name", &grib_accessor_gaussian_grid_name},
#line 197 "accessor_class_list.gperf" #line 196 "accessor_class_list.gperf"
{"trim", &grib_accessor_trim}, {"trim", &grib_accessor_trim},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 119 "accessor_class_list.gperf" #line 194 "accessor_class_list.gperf"
{"ibmfloat", &grib_accessor_ibmfloat},
{""}, {""},
#line 195 "accessor_class_list.gperf"
{"transient", &grib_accessor_transient}, {"transient", &grib_accessor_transient},
{""}, {""},
#line 38 "accessor_class_list.gperf"
{"concept", &grib_accessor_concept},
{""},
#line 165 "accessor_class_list.gperf"
{"round", &grib_accessor_round},
{""},
#line 195 "accessor_class_list.gperf"
{"transient_darray", &grib_accessor_transient_darray},
{""},
#line 18 "accessor_class_list.gperf"
{"budgdate", &grib_accessor_budgdate},
{""}, {""},
#line 143 "accessor_class_list.gperf"
{"number_of_coded_values", &grib_accessor_number_of_coded_values},
{""}, {""}, {""},
#line 182 "accessor_class_list.gperf"
{"spectral_truncation", &grib_accessor_spectral_truncation},
#line 39 "accessor_class_list.gperf"
{"constant", &grib_accessor_constant},
#line 209 "accessor_class_list.gperf"
{"values", &grib_accessor_values},
{""}, {""},
#line 149 "accessor_class_list.gperf"
{"octet_number", &grib_accessor_octet_number},
#line 134 "accessor_class_list.gperf"
{"lookup", &grib_accessor_lookup},
#line 183 "accessor_class_list.gperf"
{"sprintf", &grib_accessor_sprintf},
{""}, {""}, {""},
#line 133 "accessor_class_list.gperf"
{"longitudes", &grib_accessor_longitudes},
{""}, {""}, {""},
#line 161 "accessor_class_list.gperf"
{"proj_string", &grib_accessor_proj_string},
{""},
#line 189 "accessor_class_list.gperf"
{"suppressed", &grib_accessor_suppressed},
#line 55 "accessor_class_list.gperf" #line 55 "accessor_class_list.gperf"
{"data_g1shsimple_packing", &grib_accessor_data_g1shsimple_packing}, {"data_g1shsimple_packing", &grib_accessor_data_g1shsimple_packing},
{""}, {""}, {""}, {""},
@ -370,263 +401,249 @@ static const struct accessor_class_hash classes[] =
{"data_g1simple_packing", &grib_accessor_data_g1simple_packing}, {"data_g1simple_packing", &grib_accessor_data_g1simple_packing},
#line 49 "accessor_class_list.gperf" #line 49 "accessor_class_list.gperf"
{"data_g1complex_packing", &grib_accessor_data_g1complex_packing}, {"data_g1complex_packing", &grib_accessor_data_g1complex_packing},
#line 166 "accessor_class_list.gperf" #line 191 "accessor_class_list.gperf"
{"round", &grib_accessor_round}, {"to_double", &grib_accessor_to_double},
#line 196 "accessor_class_list.gperf" {""}, {""}, {""},
{"transient_darray", &grib_accessor_transient_darray}, #line 27 "accessor_class_list.gperf"
#line 18 "accessor_class_list.gperf" {"bufr_string_values", &grib_accessor_bufr_string_values},
{"budgdate", &grib_accessor_budgdate},
#line 210 "accessor_class_list.gperf"
{"values", &grib_accessor_values},
#line 144 "accessor_class_list.gperf"
{"number_of_coded_values", &grib_accessor_number_of_coded_values},
#line 126 "accessor_class_list.gperf"
{"label", &grib_accessor_label},
{""}, {""},
#line 38 "accessor_class_list.gperf"
{"concept", &grib_accessor_concept},
{""}, {""},
#line 183 "accessor_class_list.gperf" #line 129 "accessor_class_list.gperf"
{"spectral_truncation", &grib_accessor_spectral_truncation}, {"library_version", &grib_accessor_library_version},
{""},
#line 137 "accessor_class_list.gperf"
{"md5", &grib_accessor_md5},
#line 130 "accessor_class_list.gperf"
{"local_definition", &grib_accessor_local_definition},
{""}, {""}, {""}, {""},
#line 138 "accessor_class_list.gperf"
{"message", &grib_accessor_message},
#line 83 "accessor_class_list.gperf" #line 83 "accessor_class_list.gperf"
{"g1_message_length", &grib_accessor_g1_message_length}, {"g1_message_length", &grib_accessor_g1_message_length},
{""}, #line 101 "accessor_class_list.gperf"
#line 190 "accessor_class_list.gperf" {"g2bitmap_present", &grib_accessor_g2bitmap_present},
{"suppressed", &grib_accessor_suppressed},
{""}, {""}, {""}, {""},
#line 180 "accessor_class_list.gperf"
{"smart_table", &grib_accessor_smart_table},
{""},
#line 39 "accessor_class_list.gperf"
{"constant", &grib_accessor_constant},
{""}, {""},
#line 162 "accessor_class_list.gperf"
{"proj_string", &grib_accessor_proj_string},
#line 150 "accessor_class_list.gperf"
{"octet_number", &grib_accessor_octet_number},
#line 181 "accessor_class_list.gperf"
{"smart_table_column", &grib_accessor_smart_table_column},
{""},
#line 135 "accessor_class_list.gperf" #line 135 "accessor_class_list.gperf"
{"lookup", &grib_accessor_lookup}, {"mars_param", &grib_accessor_mars_param},
#line 212 "accessor_class_list.gperf"
{"when", &grib_accessor_when},
#line 119 "accessor_class_list.gperf"
{"ieeefloat", &grib_accessor_ieeefloat},
#line 150 "accessor_class_list.gperf"
{"offset_file", &grib_accessor_offset_file},
{""}, {""}, {""}, {""},
#line 139 "accessor_class_list.gperf"
{"message_copy", &grib_accessor_message_copy},
{""}, {""},
#line 207 "accessor_class_list.gperf"
{"validity_date", &grib_accessor_validity_date},
#line 208 "accessor_class_list.gperf"
{"validity_time", &grib_accessor_validity_time},
#line 21 "accessor_class_list.gperf"
{"bufr_elements_table", &grib_accessor_bufr_elements_table},
#line 211 "accessor_class_list.gperf"
{"vector", &grib_accessor_vector},
{""}, {""},
#line 94 "accessor_class_list.gperf" #line 94 "accessor_class_list.gperf"
{"g1step_range", &grib_accessor_g1step_range}, {"g1step_range", &grib_accessor_g1step_range},
#line 73 "accessor_class_list.gperf"
{"decimal_precision", &grib_accessor_decimal_precision},
{""}, {""},
#line 134 "accessor_class_list.gperf" #line 33 "accessor_class_list.gperf"
{"longitudes", &grib_accessor_longitudes}, {"closest_date", &grib_accessor_closest_date},
#line 70 "accessor_class_list.gperf"
{"data_sh_unpacked", &grib_accessor_data_sh_unpacked},
#line 35 "accessor_class_list.gperf"
{"codetable", &grib_accessor_codetable},
{""}, {""},
#line 158 "accessor_class_list.gperf"
{"padtoeven", &grib_accessor_padtoeven},
#line 71 "accessor_class_list.gperf"
{"data_shsimple_packing", &grib_accessor_data_shsimple_packing},
{""}, {""},
#line 27 "accessor_class_list.gperf"
{"bufr_string_values", &grib_accessor_bufr_string_values},
#line 198 "accessor_class_list.gperf"
{"uint16", &grib_accessor_uint16},
{""}, {""}, {""},
#line 86 "accessor_class_list.gperf" #line 86 "accessor_class_list.gperf"
{"g1date", &grib_accessor_g1date}, {"g1date", &grib_accessor_g1date},
{""}, {""},
#line 85 "accessor_class_list.gperf" #line 85 "accessor_class_list.gperf"
{"g1bitmap", &grib_accessor_g1bitmap}, {"g1bitmap", &grib_accessor_g1bitmap},
{""},
#line 54 "accessor_class_list.gperf" #line 54 "accessor_class_list.gperf"
{"data_g1secondary_bitmap", &grib_accessor_data_g1secondary_bitmap}, {"data_g1secondary_bitmap", &grib_accessor_data_g1secondary_bitmap},
#line 192 "accessor_class_list.gperf" {""},
{"to_double", &grib_accessor_to_double}, #line 132 "accessor_class_list.gperf"
#line 101 "accessor_class_list.gperf" {"long_vector", &grib_accessor_long_vector},
{"g2bitmap_present", &grib_accessor_g2bitmap_present}, {""}, {""},
#line 197 "accessor_class_list.gperf"
{"uint16", &grib_accessor_uint16},
{""},
#line 127 "accessor_class_list.gperf"
{"latlon_increment", &grib_accessor_latlon_increment},
{""}, {""},
#line 213 "accessor_class_list.gperf" #line 213 "accessor_class_list.gperf"
{"when", &grib_accessor_when}, {"cf_var_name", &grib_accessor_cf_var_name},
#line 208 "accessor_class_list.gperf" #line 136 "accessor_class_list.gperf"
{"validity_date", &grib_accessor_validity_date}, {"mars_step", &grib_accessor_mars_step},
#line 209 "accessor_class_list.gperf" #line 210 "accessor_class_list.gperf"
{"validity_time", &grib_accessor_validity_time}, {"variable", &grib_accessor_variable},
{""},
#line 184 "accessor_class_list.gperf"
{"sprintf", &grib_accessor_sprintf},
#line 212 "accessor_class_list.gperf"
{"vector", &grib_accessor_vector},
#line 84 "accessor_class_list.gperf"
{"g1_section4_length", &grib_accessor_g1_section4_length},
#line 141 "accessor_class_list.gperf"
{"multdouble", &grib_accessor_multdouble},
#line 52 "accessor_class_list.gperf" #line 52 "accessor_class_list.gperf"
{"data_g1second_order_general_packing", &grib_accessor_data_g1second_order_general_packing}, {"data_g1second_order_general_packing", &grib_accessor_data_g1second_order_general_packing},
#line 130 "accessor_class_list.gperf" #line 84 "accessor_class_list.gperf"
{"library_version", &grib_accessor_library_version}, {"g1_section4_length", &grib_accessor_g1_section4_length},
{""}, {""},
#line 53 "accessor_class_list.gperf" #line 53 "accessor_class_list.gperf"
{"data_g1second_order_row_by_row_packing", &grib_accessor_data_g1second_order_row_by_row_packing}, {"data_g1second_order_row_by_row_packing", &grib_accessor_data_g1second_order_row_by_row_packing},
{""}, {""}, {""},
#line 159 "accessor_class_list.gperf" #line 25 "accessor_class_list.gperf"
{"padtoeven", &grib_accessor_padtoeven}, {"bufr_group", &grib_accessor_bufr_group},
{""},
#line 50 "accessor_class_list.gperf" #line 50 "accessor_class_list.gperf"
{"data_g1second_order_constant_width_packing", &grib_accessor_data_g1second_order_constant_width_packing}, {"data_g1second_order_constant_width_packing", &grib_accessor_data_g1second_order_constant_width_packing},
{""}, {""},
#line 51 "accessor_class_list.gperf" #line 51 "accessor_class_list.gperf"
{"data_g1second_order_general_extended_packing", &grib_accessor_data_g1second_order_general_extended_packing}, {"data_g1second_order_general_extended_packing", &grib_accessor_data_g1second_order_general_extended_packing},
#line 70 "accessor_class_list.gperf" #line 153 "accessor_class_list.gperf"
{"data_sh_unpacked", &grib_accessor_data_sh_unpacked},
{""}, {""}, {""}, {""},
#line 71 "accessor_class_list.gperf"
{"data_shsimple_packing", &grib_accessor_data_shsimple_packing},
#line 21 "accessor_class_list.gperf"
{"bufr_elements_table", &grib_accessor_bufr_elements_table},
{""}, {""}, {""}, {""},
#line 154 "accessor_class_list.gperf"
{"pack_bufr_values", &grib_accessor_pack_bufr_values}, {"pack_bufr_values", &grib_accessor_pack_bufr_values},
#line 35 "accessor_class_list.gperf" {""}, {""}, {""}, {""},
{"codetable", &grib_accessor_codetable}, #line 167 "accessor_class_list.gperf"
#line 131 "accessor_class_list.gperf" {"scale_values", &grib_accessor_scale_values},
{"local_definition", &grib_accessor_local_definition},
{""}, {""},
#line 25 "accessor_class_list.gperf" #line 146 "accessor_class_list.gperf"
{"bufr_group", &grib_accessor_bufr_group},
{""},
#line 88 "accessor_class_list.gperf"
{"g1end_of_interval_monthly", &grib_accessor_g1end_of_interval_monthly},
#line 147 "accessor_class_list.gperf"
{"number_of_values", &grib_accessor_number_of_values}, {"number_of_values", &grib_accessor_number_of_values},
{""}, {""}, {""}, {""}, {""},
#line 24 "accessor_class_list.gperf" #line 24 "accessor_class_list.gperf"
{"bufr_extract_subsets", &grib_accessor_bufr_extract_subsets}, {"bufr_extract_subsets", &grib_accessor_bufr_extract_subsets},
#line 120 "accessor_class_list.gperf"
{"ieeefloat", &grib_accessor_ieeefloat},
#line 151 "accessor_class_list.gperf"
{"offset_file", &grib_accessor_offset_file},
#line 33 "accessor_class_list.gperf"
{"closest_date", &grib_accessor_closest_date},
#line 153 "accessor_class_list.gperf"
{"optimal_step_units", &grib_accessor_optimal_step_units},
#line 22 "accessor_class_list.gperf"
{"bufr_extract_area_subsets", &grib_accessor_bufr_extract_area_subsets},
#line 211 "accessor_class_list.gperf"
{"variable", &grib_accessor_variable},
#line 133 "accessor_class_list.gperf"
{"long_vector", &grib_accessor_long_vector},
#line 168 "accessor_class_list.gperf"
{"scale_values", &grib_accessor_scale_values},
#line 23 "accessor_class_list.gperf"
{"bufr_extract_datetime_subsets", &grib_accessor_bufr_extract_datetime_subsets},
{""}, {""},
#line 128 "accessor_class_list.gperf"
{"latlon_increment", &grib_accessor_latlon_increment},
{""}, {""}, {""},
#line 148 "accessor_class_list.gperf"
{"number_of_values_data_raw_packing", &grib_accessor_number_of_values_data_raw_packing},
{""},
#line 79 "accessor_class_list.gperf"
{"evaluate", &grib_accessor_evaluate},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 11 "accessor_class_list.gperf" #line 11 "accessor_class_list.gperf"
{"abstract_vector", &grib_accessor_abstract_vector}, {"abstract_vector", &grib_accessor_abstract_vector},
{""}, {""}, {""}, {""},
#line 41 "accessor_class_list.gperf"
{"count_missing", &grib_accessor_count_missing},
#line 205 "accessor_class_list.gperf"
{"unpack_bufr_values", &grib_accessor_unpack_bufr_values},
#line 116 "accessor_class_list.gperf"
{"gts_header", &grib_accessor_gts_header},
{""},
#line 214 "accessor_class_list.gperf"
{"cf_var_name", &grib_accessor_cf_var_name},
{""}, {""}, {""},
#line 36 "accessor_class_list.gperf" #line 36 "accessor_class_list.gperf"
{"codetable_title", &grib_accessor_codetable_title}, {"codetable_title", &grib_accessor_codetable_title},
{""}, {""}, {""},
#line 89 "accessor_class_list.gperf"
{"g1fcperiod", &grib_accessor_g1fcperiod},
{""}, {""}, {""}, {""}, {""},
#line 125 "accessor_class_list.gperf"
{"ksec1expver", &grib_accessor_ksec1expver},
{""}, {""},
#line 106 "accessor_class_list.gperf"
{"g2level", &grib_accessor_g2level},
#line 42 "accessor_class_list.gperf" #line 42 "accessor_class_list.gperf"
{"count_total", &grib_accessor_count_total}, {"count_total", &grib_accessor_count_total},
#line 88 "accessor_class_list.gperf"
{"g1end_of_interval_monthly", &grib_accessor_g1end_of_interval_monthly},
#line 22 "accessor_class_list.gperf"
{"bufr_extract_area_subsets", &grib_accessor_bufr_extract_area_subsets},
{""},
#line 115 "accessor_class_list.gperf"
{"gts_header", &grib_accessor_gts_header},
{""},
#line 23 "accessor_class_list.gperf"
{"bufr_extract_datetime_subsets", &grib_accessor_bufr_extract_datetime_subsets},
{""},
#line 147 "accessor_class_list.gperf"
{"number_of_values_data_raw_packing", &grib_accessor_number_of_values_data_raw_packing},
#line 151 "accessor_class_list.gperf"
{"offset_values", &grib_accessor_offset_values},
#line 79 "accessor_class_list.gperf"
{"evaluate", &grib_accessor_evaluate},
{""}, {""}, {""}, {""}, {""}, {""},
#line 73 "accessor_class_list.gperf"
{"decimal_precision", &grib_accessor_decimal_precision},
#line 179 "accessor_class_list.gperf"
{"smart_table", &grib_accessor_smart_table},
#line 204 "accessor_class_list.gperf"
{"unpack_bufr_values", &grib_accessor_unpack_bufr_values},
#line 117 "accessor_class_list.gperf"
{"headers_only", &grib_accessor_headers_only},
#line 34 "accessor_class_list.gperf"
{"codeflag", &grib_accessor_codeflag},
#line 106 "accessor_class_list.gperf"
{"g2level", &grib_accessor_g2level},
#line 120 "accessor_class_list.gperf"
{"ifs_param", &grib_accessor_ifs_param},
{""},
#line 180 "accessor_class_list.gperf"
{"smart_table_column", &grib_accessor_smart_table_column},
{""}, {""}, {""}, {""},
#line 128 "accessor_class_list.gperf"
{"latlonvalues", &grib_accessor_latlonvalues},
{""},
#line 69 "accessor_class_list.gperf" #line 69 "accessor_class_list.gperf"
{"data_sh_packed", &grib_accessor_data_sh_packed}, {"data_sh_packed", &grib_accessor_data_sh_packed},
#line 37 "accessor_class_list.gperf" #line 37 "accessor_class_list.gperf"
{"codetable_units", &grib_accessor_codetable_units}, {"codetable_units", &grib_accessor_codetable_units},
#line 118 "accessor_class_list.gperf"
{"headers_only", &grib_accessor_headers_only},
{""},
#line 129 "accessor_class_list.gperf"
{"latlonvalues", &grib_accessor_latlonvalues},
{""},
#line 152 "accessor_class_list.gperf"
{"offset_values", &grib_accessor_offset_values},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 121 "accessor_class_list.gperf" {""}, {""}, {""}, {""},
{"ifs_param", &grib_accessor_ifs_param},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 10 "accessor_class_list.gperf" #line 10 "accessor_class_list.gperf"
{"abstract_long_vector", &grib_accessor_abstract_long_vector}, {"abstract_long_vector", &grib_accessor_abstract_long_vector},
#line 34 "accessor_class_list.gperf" {""}, {""}, {""}, {""},
{"codeflag", &grib_accessor_codeflag}, #line 89 "accessor_class_list.gperf"
{""}, {""}, {""}, {"g1fcperiod", &grib_accessor_g1fcperiod},
#line 117 "accessor_class_list.gperf"
{"hash_array", &grib_accessor_hash_array},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 30 "accessor_class_list.gperf"
{"change_alternative_row_scanning", &grib_accessor_change_alternative_row_scanning},
{""}, {""}, {""}, {""}, {""}, {""},
#line 31 "accessor_class_list.gperf"
{"change_scanning_direction", &grib_accessor_change_scanning_direction},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 149 "accessor_class_list.gperf"
{"octahedral_gaussian", &grib_accessor_octahedral_gaussian},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 40 "accessor_class_list.gperf" #line 40 "accessor_class_list.gperf"
{"count_file", &grib_accessor_count_file}, {"count_file", &grib_accessor_count_file},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 116 "accessor_class_list.gperf"
{"hash_array", &grib_accessor_hash_array},
#line 30 "accessor_class_list.gperf"
{"change_alternative_row_scanning", &grib_accessor_change_alternative_row_scanning},
#line 152 "accessor_class_list.gperf"
{"optimal_step_units", &grib_accessor_optimal_step_units},
{""}, {""}, {""},
#line 140 "accessor_class_list.gperf"
{"multdouble", &grib_accessor_multdouble},
{""},
#line 31 "accessor_class_list.gperf"
{"change_scanning_direction", &grib_accessor_change_scanning_direction},
{""}, {""}, {""}, {""}, {""}, {""},
#line 148 "accessor_class_list.gperf"
{"octahedral_gaussian", &grib_accessor_octahedral_gaussian},
{""},
#line 124 "accessor_class_list.gperf"
{"ksec1expver", &grib_accessor_ksec1expver},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 41 "accessor_class_list.gperf"
{"count_missing", &grib_accessor_count_missing},
{""}, {""}, {""}, {""}, {""}, {""},
#line 81 "accessor_class_list.gperf"
{"from_scale_factor_scaled_value", &grib_accessor_from_scale_factor_scaled_value},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 82 "accessor_class_list.gperf"
{"g1_half_byte_codeflag", &grib_accessor_g1_half_byte_codeflag},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 91 "accessor_class_list.gperf" #line 91 "accessor_class_list.gperf"
{"g1monthlydate", &grib_accessor_g1monthlydate}, {"g1monthlydate", &grib_accessor_g1monthlydate},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""},
#line 82 "accessor_class_list.gperf"
{"g1_half_byte_codeflag", &grib_accessor_g1_half_byte_codeflag},
{""}, {""},
#line 81 "accessor_class_list.gperf"
{"from_scale_factor_scaled_value", &grib_accessor_from_scale_factor_scaled_value},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 165 "accessor_class_list.gperf"
{"reference_value_error", &grib_accessor_reference_value_error},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 32 "accessor_class_list.gperf" #line 32 "accessor_class_list.gperf"
{"check_internal_version", &grib_accessor_check_internal_version}, {"check_internal_version", &grib_accessor_check_internal_version},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 97 "accessor_class_list.gperf" #line 164 "accessor_class_list.gperf"
{"g2_chemical", &grib_accessor_g2_chemical}, {"reference_value_error", &grib_accessor_reference_value_error},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 87 "accessor_class_list.gperf" #line 87 "accessor_class_list.gperf"
{"g1day_of_the_year_date", &grib_accessor_g1day_of_the_year_date}, {"g1day_of_the_year_date", &grib_accessor_g1day_of_the_year_date},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""},
#line 90 "accessor_class_list.gperf"
{"g1forecastmonth", &grib_accessor_g1forecastmonth},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 95 "accessor_class_list.gperf"
{"g1verificationdate", &grib_accessor_g1verificationdate},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 97 "accessor_class_list.gperf"
{"g2_chemical", &grib_accessor_g2_chemical},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""},
#line 93 "accessor_class_list.gperf" #line 93 "accessor_class_list.gperf"
{"g1number_of_coded_values_sh_simple", &grib_accessor_g1number_of_coded_values_sh_simple}, {"g1number_of_coded_values_sh_simple", &grib_accessor_g1number_of_coded_values_sh_simple},
#line 92 "accessor_class_list.gperf" #line 92 "accessor_class_list.gperf"
{"g1number_of_coded_values_sh_complex", &grib_accessor_g1number_of_coded_values_sh_complex}, {"g1number_of_coded_values_sh_complex", &grib_accessor_g1number_of_coded_values_sh_complex},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 90 "accessor_class_list.gperf"
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {"g1forecastmonth", &grib_accessor_g1forecastmonth}
{""}, {""},
#line 95 "accessor_class_list.gperf"
{"g1verificationdate", &grib_accessor_g1verificationdate}
}; };
const struct accessor_class_hash * const struct accessor_class_hash *

View File

@ -100,7 +100,6 @@
{ "g2step_range", &grib_accessor_g2step_range, }, { "g2step_range", &grib_accessor_g2step_range, },
{ "gaussian_grid_name", &grib_accessor_gaussian_grid_name, }, { "gaussian_grid_name", &grib_accessor_gaussian_grid_name, },
{ "gds_is_present", &grib_accessor_gds_is_present, }, { "gds_is_present", &grib_accessor_gds_is_present, },
{ "gds_not_present_bitmap", &grib_accessor_gds_not_present_bitmap, },
{ "gen", &grib_accessor_gen, }, { "gen", &grib_accessor_gen, },
{ "getenv", &grib_accessor_getenv, }, { "getenv", &grib_accessor_getenv, },
{ "global_gaussian", &grib_accessor_global_gaussian, }, { "global_gaussian", &grib_accessor_global_gaussian, },

View File

@ -101,7 +101,6 @@ g2lon, &grib_accessor_g2lon
g2step_range, &grib_accessor_g2step_range g2step_range, &grib_accessor_g2step_range
gaussian_grid_name, &grib_accessor_gaussian_grid_name gaussian_grid_name, &grib_accessor_gaussian_grid_name
gds_is_present, &grib_accessor_gds_is_present gds_is_present, &grib_accessor_gds_is_present
gds_not_present_bitmap, &grib_accessor_gds_not_present_bitmap
gen, &grib_accessor_gen gen, &grib_accessor_gen
getenv, &grib_accessor_getenv getenv, &grib_accessor_getenv
global_gaussian, &grib_accessor_global_gaussian global_gaussian, &grib_accessor_global_gaussian

View File

@ -815,13 +815,14 @@ int grib_get_float_elements(const grib_handle* h, const char* key, const int* in
* Get a string value from a key, if several keys of the same name are present, the last one is returned * 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 * @see grib_set_string
* *
* @param h : the handle to get the data from * @param h : the handle to get the data from
* @param key : the key to be searched * @param key : the key to be searched
* @param mesg : the address of a string where the data will be retrieved * @param value : 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 * @param length : the address of a size_t that contains allocated length of the string on input,
* @return 0 if OK, integer value on error * 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); int grib_get_string(const grib_handle* h, const char* key, char* value, size_t* length);
/** /**
* Get string array values from a key. If several keys of the same name are present, the last one is returned * Get string array values from a key. If several keys of the same name are present, the last one is returned
@ -912,11 +913,12 @@ int grib_set_double(grib_handle* h, const char* key, double val);
* *
* @param h : the handle to set the data to * @param h : the handle to set the data to
* @param key : the key to be searched * @param key : the key to be searched
* @param mesg : the address of a string where the data will be read * @param value : 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 * @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 * @return 0 if OK, integer value on error
*/ */
int grib_set_string(grib_handle* h, const char* key, const char* mesg, size_t* length); int grib_set_string(grib_handle* h, const char* key, const char* value, size_t* length);
/** /**
* Set a bytes array from a key. If several keys of the same name are present, the last one is set * Set a bytes array from a key. If several keys of the same name are present, the last one is set
@ -1143,7 +1145,7 @@ void grib_gribex_mode_on(grib_context* c);
* *
* @param c : the context * @param c : the context
*/ */
int grib_get_gribex_mode(grib_context* c); int grib_get_gribex_mode(const grib_context* c);
/** /**
* Set the GRIBEX mode off. * Set the GRIBEX mode off.
@ -1259,6 +1261,8 @@ long grib_get_api_version(void);
*/ */
const char* grib_get_git_sha1(void); const char* grib_get_git_sha1(void);
const char* grib_get_git_branch(void);
/** /**
* Get the package name * Get the package name
* *

View File

@ -13,6 +13,12 @@ const char* grib_get_git_sha1(void)
{ {
return "@eccodes_GIT_SHA1@"; return "@eccodes_GIT_SHA1@";
} }
const char* grib_get_git_branch(void)
{
return "@eccodes_GIT_BRANCH@";
}
const char* codes_get_build_date(void) const char* codes_get_build_date(void)
{ {
return "@eccodes_BUILD_DATE@"; return "@eccodes_BUILD_DATE@";

View File

@ -185,19 +185,19 @@ int grib_context_seek(const grib_context* c, off_t offset, int whence, void* str
return c->seek(c, offset, whence, stream); return c->seek(c, offset, whence, stream);
} }
int grib_context_eof(const grib_context* c, void* stream) // int grib_context_eof(const grib_context* c, void* stream)
{ // {
if (!c) // if (!c)
c = grib_context_get_default(); // c = grib_context_get_default();
return c->eof(c, stream); // return c->eof(c, stream);
} // }
size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream) // size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream)
{ // {
if (!c) // if (!c)
c = grib_context_get_default(); // c = grib_context_get_default();
return c->write(c, ptr, size, stream); // return c->write(c, ptr, size, stream);
} // }
static void default_log(const grib_context* c, int level, const char* mess) static void default_log(const grib_context* c, int level, const char* mess)
{ {
@ -237,7 +237,7 @@ static void default_print(const grib_context* c, void* descriptor, const char* m
void grib_context_set_print_proc(grib_context* c, grib_print_proc p) void grib_context_set_print_proc(grib_context* c, grib_print_proc p)
{ {
c = c ? c : grib_context_get_default(); c = c ? c : grib_context_get_default();
/* Set logging back to the default if p is NULL */ /* Set printing back to the default if p is NULL */
c->print = (p ? p : &default_print); c->print = (p ? p : &default_print);
} }
@ -661,20 +661,19 @@ static int init_definition_files_dir(grib_context* c)
} }
else { else {
/* Definitions path contains multiple directories */ /* Definitions path contains multiple directories */
char* dir = NULL; const char* dir = strtok_r(path, ECC_PATH_DELIMITER_STR, &lasts);
dir = strtok_r(path, ECC_PATH_DELIMITER_STR, &lasts);
while (dir != NULL) { while (dir != NULL) {
if (next) { if (next) {
next->next = (grib_string_list*)grib_context_malloc_clear_persistent(c, sizeof(grib_string_list)); next->next = (grib_string_list*)grib_context_malloc_clear_persistent(c, sizeof(grib_string_list));
next = next->next; next = next->next;
} }
else { else {
c->grib_definition_files_dir = (grib_string_list*)grib_context_malloc_clear_persistent(c, sizeof(grib_string_list)); c->grib_definition_files_dir = (grib_string_list*)grib_context_malloc_clear_persistent(c, sizeof(grib_string_list));
next = c->grib_definition_files_dir; next = c->grib_definition_files_dir;
} }
next->value = codes_resolve_path(c, dir); next->value = codes_resolve_path(c, dir);
dir = strtok_r(NULL, ECC_PATH_DELIMITER_STR, &lasts); dir = strtok_r(NULL, ECC_PATH_DELIMITER_STR, &lasts);
} }
} }
@ -1233,7 +1232,7 @@ void codes_assertion_failed(const char* message, const char* file, int line)
/* Default behaviour is to abort /* Default behaviour is to abort
* unless user has supplied his own assertion routine */ * unless user has supplied his own assertion routine */
if (assertion == NULL) { if (assertion == NULL) {
grib_context* c = grib_context_get_default(); const grib_context* c = grib_context_get_default();
fprintf(stderr, "ecCodes assertion failed: `%s' in %s:%d\n", message, file, line); fprintf(stderr, "ecCodes assertion failed: `%s' in %s:%d\n", message, file, line);
if (!c->no_abort) { if (!c->no_abort) {
abort(); abort();
@ -1246,7 +1245,7 @@ void codes_assertion_failed(const char* message, const char* file, int line)
} }
} }
int grib_get_gribex_mode(grib_context* c) int grib_get_gribex_mode(const grib_context* c)
{ {
if (!c) if (!c)
c = grib_context_get_default(); c = grib_context_get_default();

View File

@ -264,22 +264,21 @@ static int test_bit(long a, long b)
static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
{ {
grib_dumper_debug* self = (grib_dumper_debug*)d; grib_dumper_debug* self = (grib_dumper_debug*)d;
long value = 0;
size_t size = 1;
int err = a->unpack_long(&value, &size);
int i;
if (a->length_ == 0 && if (a->length_ == 0 &&
(d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0)
return; return;
size_t size = 1;
long value = 0;
int err = a->unpack_long(&value, &size);
set_begin_end(d, a); set_begin_end(d, a);
for (i = 0; i < d->depth; i++) for (int i = 0; i < d->depth; i++)
fprintf(self->dumper.out, " "); fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "%ld-%ld %s %s = %ld [", self->begin, self->theEnd, a->creator_->op, a->name_, value); fprintf(self->dumper.out, "%ld-%ld %s %s = %ld [", self->begin, self->theEnd, a->creator_->op, a->name_, value);
for (i = 0; i < (a->length_ * 8); i++) { for (long i = 0; i < (a->length_ * 8); i++) {
if (test_bit(value, a->length_ * 8 - i - 1)) if (test_bit(value, a->length_ * 8 - i - 1))
fprintf(self->dumper.out, "1"); fprintf(self->dumper.out, "1");
else else

View File

@ -212,28 +212,15 @@ static int test_bit(long a, long b)
static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
{ {
grib_dumper_default* self = (grib_dumper_default*)d; grib_dumper_default* self = (grib_dumper_default*)d;
int i;
long lvalue = 0; long lvalue = 0;
double dvalue = 0;
size_t size = 1; size_t size = 1;
int err = 0; int err = 0;
int isDouble = 0;
switch (a->get_native_type()) {
case GRIB_TYPE_LONG:
a->unpack_long(&lvalue, &size);
break;
case GRIB_TYPE_DOUBLE:
a->unpack_double(&dvalue, &size);
isDouble = 1;
break;
default:
break;
}
if ((a->flags_ & GRIB_ACCESSOR_FLAG_DUMP) == 0) if ((a->flags_ & GRIB_ACCESSOR_FLAG_DUMP) == 0)
return; return;
err = a->unpack_long(&lvalue, &size);
print_offset(self->dumper.out, d, a); print_offset(self->dumper.out, d, a);
if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) { if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) {
@ -249,7 +236,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
fprintf(self->dumper.out, " "); fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "# flags: "); fprintf(self->dumper.out, "# flags: ");
for (i = 0; i < (a->length_ * 8); i++) { for (long i = 0; i < (a->length_ * 8); i++) {
if (test_bit(lvalue, a->length_ * 8 - i - 1)) if (test_bit(lvalue, a->length_ * 8 - i - 1))
fprintf(self->dumper.out, "1"); fprintf(self->dumper.out, "1");
else else
@ -261,19 +248,16 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
fprintf(self->dumper.out, " "); fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "#-READ ONLY- "); fprintf(self->dumper.out, "#-READ ONLY- ");
} }
else else {
fprintf(self->dumper.out, " "); fprintf(self->dumper.out, " ");
}
if (((a->flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) if (((a->flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal())
fprintf(self->dumper.out, "%s = MISSING;", a->name_); fprintf(self->dumper.out, "%s = MISSING;", a->name_);
else { else {
if (isDouble) fprintf(self->dumper.out, "%s = %ld;", a->name_, lvalue);
fprintf(self->dumper.out, "%s = %g;", a->name_, dvalue);
else
fprintf(self->dumper.out, "%s = %ld;", a->name_, lvalue);
} }
if (err) { if (err) {
fprintf(self->dumper.out, " "); fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "# *** ERR=%d (%s) [grib_dumper_default::dump_bits]", err, grib_get_error_message(err)); fprintf(self->dumper.out, "# *** ERR=%d (%s) [grib_dumper_default::dump_bits]", err, grib_get_error_message(err));

View File

@ -219,7 +219,6 @@ static int test_bit(long a, long b)
static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
{ {
grib_dumper_wmo* self = (grib_dumper_wmo*)d; grib_dumper_wmo* self = (grib_dumper_wmo*)d;
int i;
long value = 0; long value = 0;
size_t size = 1; size_t size = 1;
int err = 0; int err = 0;
@ -237,7 +236,8 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
fprintf(self->dumper.out, "%s (int) ", a->creator_->op); fprintf(self->dumper.out, "%s (int) ", a->creator_->op);
fprintf(self->dumper.out, "%s = %ld [", a->name_, value); fprintf(self->dumper.out, "%s = %ld [", a->name_, value);
for (i = 0; i < (a->length_ * 8); i++) {
for (long i = 0; i < (a->length_ * 8); i++) {
if (test_bit(value, a->length_ * 8 - i - 1)) if (test_bit(value, a->length_ * 8 - i - 1))
fprintf(self->dumper.out, "1"); fprintf(self->dumper.out, "1");
else else

View File

@ -42,7 +42,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*, FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -60,12 +60,12 @@ typedef struct grib_expression_accessor{
static grib_expression_class _grib_expression_class_accessor = { static grib_expression_class _grib_expression_class_accessor = {
0, /* super */ 0, /* super */
"accessor", /* name */ "accessor", /* name */
sizeof(grib_expression_accessor),/* size of instance */ sizeof(grib_expression_accessor),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -42,7 +42,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*, FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
static int evaluate_long(grib_expression*,grib_handle*,long*); static int evaluate_long(grib_expression*,grib_handle*,long*);
@ -60,12 +60,12 @@ typedef struct grib_expression_binop{
static grib_expression_class _grib_expression_class_binop = { static grib_expression_class _grib_expression_class_binop = {
0, /* super */ 0, /* super */
"binop", /* name */ "binop", /* name */
sizeof(grib_expression_binop),/* size of instance */ sizeof(grib_expression_binop),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,
@ -85,7 +85,6 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
long v2 = 0; long v2 = 0;
grib_expression_binop* e = (grib_expression_binop*)g; grib_expression_binop* e = (grib_expression_binop*)g;
// #if DEBUGGING
// { // {
// int typeLeft, typeRight; // int typeLeft, typeRight;
// const char* nameLeft; // const char* nameLeft;
@ -117,7 +116,6 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* dres)
double v2 = 0.0; double v2 = 0.0;
grib_expression_binop* e = (grib_expression_binop*)g; grib_expression_binop* e = (grib_expression_binop*)g;
// #if DEBUGGING
// { // {
// int typeLeft, typeRight; // int typeLeft, typeRight;
// const char* nameLeft; // const char* nameLeft;

View File

@ -38,7 +38,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*, FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
static int evaluate_long(grib_expression*,grib_handle*,long*); static int evaluate_long(grib_expression*,grib_handle*,long*);
@ -52,12 +52,12 @@ typedef struct grib_expression_double{
static grib_expression_class _grib_expression_class_double = { static grib_expression_class _grib_expression_class_double = {
0, /* super */ 0, /* super */
"double", /* name */ "double", /* name */
sizeof(grib_expression_double),/* size of instance */ sizeof(grib_expression_double),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -38,7 +38,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*,FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
static int evaluate_long(grib_expression*,grib_handle*,long*); static int evaluate_long(grib_expression*,grib_handle*,long*);
@ -52,12 +52,12 @@ typedef struct grib_expression_functor{
static grib_expression_class _grib_expression_class_functor = { static grib_expression_class _grib_expression_class_functor = {
0, /* super */ 0, /* super */
"functor", /* name */ "functor", /* name */
sizeof(grib_expression_functor),/* size of instance */ sizeof(grib_expression_functor),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -39,7 +39,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void print(grib_context*,grib_expression*,grib_handle*,FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -56,12 +56,12 @@ typedef struct grib_expression_is_in_dict{
static grib_expression_class _grib_expression_class_is_in_dict = { static grib_expression_class _grib_expression_class_is_in_dict = {
0, /* super */ 0, /* super */
"is_in_dict", /* name */ "is_in_dict", /* name */
sizeof(grib_expression_is_in_dict),/* size of instance */ sizeof(grib_expression_is_in_dict),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
0, /* destructor */ 0, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -41,7 +41,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*,FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -58,12 +58,12 @@ typedef struct grib_expression_is_in_list{
static grib_expression_class _grib_expression_class_is_in_list = { static grib_expression_class _grib_expression_class_is_in_list = {
0, /* super */ 0, /* super */
"is_in_list", /* name */ "is_in_list", /* name */
sizeof(grib_expression_is_in_list),/* size of instance */ sizeof(grib_expression_is_in_list),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -42,7 +42,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*, FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -60,12 +60,12 @@ typedef struct grib_expression_is_integer{
static grib_expression_class _grib_expression_class_is_integer = { static grib_expression_class _grib_expression_class_is_integer = {
0, /* super */ 0, /* super */
"is_integer", /* name */ "is_integer", /* name */
sizeof(grib_expression_is_integer),/* size of instance */ sizeof(grib_expression_is_integer),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -42,7 +42,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*,FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static string get_name(grib_expression* e); static string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
@ -60,12 +60,12 @@ typedef struct grib_expression_length{
static grib_expression_class _grib_expression_class_length = { static grib_expression_class _grib_expression_class_length = {
0, /* super */ 0, /* super */
"length", /* name */ "length", /* name */
sizeof(grib_expression_length),/* size of instance */ sizeof(grib_expression_length),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

View File

@ -39,7 +39,7 @@ or edit "expression.class" and rerun ./make_class.pl
typedef const char* string; /* to keep make_class.pl happy */ typedef const char* string; /* to keep make_class.pl happy */
static void destroy(grib_context*,grib_expression* e); static void destroy(grib_context*,grib_expression* e);
static void print(grib_context*,grib_expression*,grib_handle*, FILE*); static void print(grib_context*, grib_expression*, grib_handle*, FILE*);
static void add_dependency(grib_expression* e, grib_accessor* observer); static void add_dependency(grib_expression* e, grib_accessor* observer);
static int native_type(grib_expression*,grib_handle*); static int native_type(grib_expression*,grib_handle*);
static int evaluate_long(grib_expression*,grib_handle*,long*); static int evaluate_long(grib_expression*,grib_handle*,long*);
@ -54,12 +54,12 @@ typedef struct grib_expression_logical_and{
static grib_expression_class _grib_expression_class_logical_and = { static grib_expression_class _grib_expression_class_logical_and = {
0, /* super */ 0, /* super */
"logical_and", /* name */ "logical_and", /* name */
sizeof(grib_expression_logical_and),/* size of instance */ sizeof(grib_expression_logical_and),/* size of instance */
0, /* inited */ 0, /* inited */
0, /* constructor */ 0, /* constructor */
&destroy, /* destructor */ &destroy, /* destructor */
&print, &print,
&add_dependency, &add_dependency,
&native_type, &native_type,

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