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:
url_debian_11: ${{ secrets.NEXUS_TEST_REPO_NIGHTLY_URL_DEBIAN_11 }}
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 }}
token_centos_7: ${{ secrets.NEXUS_TEST_REPO_UPLOAD_TOKEN }}
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")
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

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 eleven=11 : hidden;
constant epsPoint=1 : hidden;
constant epsContinous=11 : hidden;
constant epsContinuous=11 : hidden;
constant epsStatisticsPoint=2 : hidden;
constant epsStatisticsContinous=12 : hidden;

View File

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

View File

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

View File

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

View File

@ -11,15 +11,19 @@ alias totalNumber=numberOfForecastsInEnsemble;
unsigned[1] directionNumber : dump ;
alias mars.direction = directionNumber;
alias waveDirectionNumber = directionNumber;
unsigned[1] frequencyNumber : dump ;
alias mars.frequency = frequencyNumber;
alias waveFrequencyNumber = frequencyNumber;
unsigned[1] numberOfDirections : dump ;
alias totalNumberOfDirections = numberOfDirections ;
alias numberOfWaveDirections = numberOfDirections;
unsigned[1] numberOfFrequencies : dump;
alias totalNumberOfFrequencies = numberOfFrequencies ;
alias numberOfWaveFrequencies = numberOfFrequencies;
unsigned[4] directionScalingFactor : dump;
alias integerScalingFactorAppliedToDirections = directionScalingFactor;
@ -161,4 +165,15 @@ if(localFlag == 4)
unsigned[4] scaledDirections[numberOfDirections] : dump;
unsigned[4] scaledFrequencies[numberOfFrequencies] : dump;
alias scaledValuesOfWaveDirections = scaledDirections : hidden;
alias scaledValuesOfWaveFrequencies = scaledFrequencies : hidden;
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" ) {
alias productDefinitionTemplateNumber=epsPoint;
} else {
alias productDefinitionTemplateNumber=epsContinous;
alias productDefinitionTemplateNumber=epsContinuous;
}
template mars_labeling "grib1/mars_labeling.def";

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ if (stepType is "instant" ) {
} else {
alias typeOfEnsembleForecast=three;
}
alias productDefinitionTemplateNumber=epsContinous;
alias productDefinitionTemplateNumber=epsContinuous;
} else {
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
# 142-159 Reserved
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)
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)
# 211-254 Reserved for local use
211 wv Ocean wave level (ECMWF extension)

View File

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

View File

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

View File

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

View File

@ -34,3 +34,5 @@
'depthBelowSea' = {indicatorOfTypeOfLevel=160;}
'entireAtmosphere' = {indicatorOfTypeOfLevel=200;}
'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 modelVersionTime time(HourOfModelVersion, MinuteOfModelVersion, SecondOfModelVersion) : dump;
alias referenceDate = modelVersionDate ;
remove isHindcast;
constant isHindcast = 1;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,11 +18,6 @@
#include <stdio.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[])
{
FILE* in = NULL;
@ -36,7 +31,6 @@ int main(int argc, char* argv[])
int i, err = 0;
if (argc != 3) {
usage(argv[0]);
return 1;
}

View File

@ -18,11 +18,6 @@
#include <stdio.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[])
{
FILE* in = NULL;
@ -33,7 +28,6 @@ int main(int argc, char* argv[])
int err = 0;
if (argc != 3) {
usage(argv[0]);
return 1;
}

View File

@ -18,11 +18,6 @@
#include "eccodes.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[])
{
FILE* in = NULL;
@ -30,7 +25,6 @@ int main(int argc, char* argv[])
int err = 0;
if (argc != 3) {
usage(argv[0]);
return 1;
}

View File

@ -42,14 +42,14 @@ int main(int argc, char** argv)
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);
printf("grib_count_in_file counted %d messages\n", mcount);
printf("count_in_file counted %d messages\n", mcount);
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);
printf("grib_count_in_filename counted %d messages\n", mcount);
printf("count_in_filename counted %d messages\n", mcount);
mcount = 0;
while ((h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err)) != NULL) {

View File

@ -19,12 +19,6 @@
#include <assert.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 err = 0;
@ -40,7 +34,7 @@ int main(int argc, char** argv)
codes_handle* h = NULL;
const void* buffer = NULL;
if (argc != 3) usage(argv[0]);
if (argc != 3) return 1;
infile = argv[1];
outfile = argv[2];

View File

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

View File

@ -9,7 +9,7 @@
*/
#include "eccodes.h"
void usage(char* prog)
void usage(const char* prog)
{
printf("usage: %s in.nc\n", prog);
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 )
# Executables without a shell script
ecbuild_add_executable( TARGET eccodes_f_new_from_file
NOINSTALL
SOURCES new_from_file.f90
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes )
#ecbuild_add_executable( TARGET eccodes_f_new_from_file
# NOINSTALL
# SOURCES new_from_file.f90
# CONDITION HAVE_FORTRAN
# LINKER_LANGUAGE Fortran
# LIBS eccodes_f90 eccodes )
ecbuild_add_executable( TARGET eccodes_f_grib_set_gvc
NOINSTALL
SOURCES grib_set_gvc.f90

View File

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

View File

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

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
! 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.
!
!
! Author: Cristian D. Codorean
!
!

View File

@ -2765,12 +2765,29 @@
call grib_skip_read_only(iterid, status)
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
subroutine codes_set_debug(dmode)
integer(kind=kindOfInt), intent(in) :: dmode
call grib_set_debug(dmode)
end subroutine codes_set_debug
!> Set the definition path
!>
!> 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, &
codes_skip_coded, &
codes_skip_duplicates, &
codes_skip_function, &
codes_skip_edition_specific, &
codes_skip_read_only
public :: codes_keys_iterator_get_name, &
codes_keys_iterator_rewind

View File

@ -3177,6 +3177,34 @@
end if
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
subroutine grib_set_debug(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)
{
grib_context* c;
int err=0;
FILE* f=get_file(*fid);
FILE* f = get_file(*fid);
if (f) {
c=grib_context_get_default( );
err=grib_read_any_from_file(c,f,buffer,nbytes);
grib_context* c = grib_context_get_default( );
int err=grib_read_any_from_file(c,f,buffer,nbytes);
return err;
} else {
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)
{
int err=0;
char buf[1024];
grib_handle* h;
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);
else
*iterid=-1;
return err;
return GRIB_SUCCESS;
}
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)
{
int err=0;
grib_handle* h;
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);
else
*iterid=-1;
return err;
return GRIB_SUCCESS;
}
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) {
return GRIB_INVALID_INDEX;
} else {
int err = grib_index_add_file(i,cast_char(buf,file,lfile));
return err;
return grib_index_add_file(i,cast_char(buf,file,lfile));
}
}
@ -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)
{
grib_index *i = get_index(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
if (!i) {
return GRIB_INVALID_GRIB;
} else {
err = grib_index_write(i,cast_char(buf,file,lfile));
return err;
return grib_index_write(i,cast_char(buf,file,lfile));
}
}
@ -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)
{
grib_handle* h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
size_t tsize = 0;
if (!h) {
return GRIB_INVALID_GRIB;
}
else {
err = grib_get_size(h, cast_char(buf, key, len), &tsize);
*val = tsize;
return err;
}
if (!h) return GRIB_INVALID_GRIB;
int err = grib_get_size(h, cast_char(buf, key, len), &tsize);
*val = tsize;
return err;
}
int grib_f_get_size_long_(int* gid, char* key, long* val, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
size_t tsize = 0;
if(!h){
return GRIB_INVALID_GRIB;
}else{
err = grib_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
return err;
}
if (!h) return GRIB_INVALID_GRIB;
int err = grib_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
return err;
}
/*****************************************************************************/
int grib_f_index_get_size_int_(int* index_id, char* key, int* val, int len)
{
grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
char buf[1024];
size_t tsize = 0;
if(!h){
return GRIB_INVALID_GRIB;
}else{
err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
return err;
}
if (!h) return GRIB_INVALID_GRIB;
int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
return err;
}
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];
size_t tsize = 0;
if (!h){
return GRIB_INVALID_GRIB;
} else{
int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
return err;
}
if (!h) return GRIB_INVALID_GRIB;
int err = grib_index_get_size(h, cast_char(buf,key,len), &tsize);
*val = tsize;
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);
long long_val;
int err = GRIB_SUCCESS;
char buf[1024];
if(!h) return GRIB_INVALID_GRIB;
err = grib_get_long(h, cast_char(buf,key,len),&long_val);
if (!h) return GRIB_INVALID_GRIB;
int err = grib_get_long(h, cast_char(buf,key,len),&long_val);
*val = long_val;
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)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
if(!h) return GRIB_INVALID_GRIB;
err = grib_get_long(h, cast_char(buf,key,len),val);
if (!h) return GRIB_INVALID_GRIB;
int err = grib_get_long(h, cast_char(buf,key,len),val);
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);
int type_val = 0;
int err = GRIB_SUCCESS;
char buf[1024];
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;
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)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
size_t lsize = *size;
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;
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)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
size_t lsize = *size;
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;
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)
{
grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
int i;
char buf[1024];
size_t lsize = *size;
char** bufval;
char* p=val;
char* p = val;
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;
if (err) return err;
for (i=0;i<lsize;i++) {
for (size_t i=0;i<lsize;i++) {
int l=strlen(bufval[i]);
int j;
if (*eachsize < l ) {
fprintf(stderr, "eachsize=%d strlen(bufval[i])=%zu\n",
*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);
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);
return err;
return err;
}
/*****************************************************************************/
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);
char buf[1024];
size_t lsize = *size;
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;
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)
{
grib_index *h = get_index(*index_id);
int err = GRIB_SUCCESS;
char buf[1024];
size_t lsize = *size, i = 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);
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];
*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 err = 0;
grib_index* h = get_index(*index_id);
char buf[1024];
size_t lsize = *size;
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;
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)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
char buf[1024];
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;
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_complex_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_select_step_template.cc
accessor/grib_accessor_class_local_definition.cc

View File

@ -21,7 +21,6 @@ public:
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) {}
virtual ~grib_accessor() {}
virtual void init_accessor(const long, grib_arguments*) = 0;

View File

@ -10,6 +10,9 @@
*/
#include "grib_accessor_class_concept.h"
#include <unordered_map>
#include <string>
#include <utility>
grib_accessor_concept_t _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);
}
// 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) */
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 lres = 0;
@ -55,8 +78,10 @@ static int concept_condition_expression_true(grib_handle* h, grib_concept_condit
switch (type) {
case GRIB_TYPE_LONG:
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);
//ok = (grib_get_long(h, c->name, &lval) == GRIB_SUCCESS) && (lval == lres);
break;
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) */
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)
return concept_condition_iarray_true(h, c);
else
return concept_condition_expression_true(h, c);
return concept_condition_expression_true(h, c, memo);
}
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_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);
while (c) {
grib_concept_condition* e = c->conditions;
int cnt = 0;
while (e) {
if (!concept_condition_true(h, e))
if (!concept_condition_true(h, e, memo))
break;
e = e->next;
cnt++;

View File

@ -138,25 +138,27 @@ static grib_trie* load_dictionary(grib_accessor* a, int* err)
fclose(f);
if (localFilename != 0) {
f = codes_fopen(localFilename, "r");
if (!f) {
*err = GRIB_IO_PROBLEM;
return NULL;
}
*err = GRIB_NOT_IMPLEMENTED;
return NULL;
// f = codes_fopen(localFilename, "r");
// if (!f) {
// *err = GRIB_IO_PROBLEM;
// return NULL;
// }
while (fgets(line, sizeof(line) - 1, f)) {
i = 0;
while (line[i] != '|' && line[i] != 0) {
key[i] = line[i];
i++;
}
key[i] = 0;
list = (char*)grib_context_malloc_clear(c, strlen(line) + 1);
memcpy(list, line, strlen(line));
grib_trie_insert(dictionary, key, list);
}
//while (fgets(line, sizeof(line) - 1, f)) {
// i = 0;
// while (line[i] != '|' && line[i] != 0) {
// key[i] = line[i];
// i++;
// }
// key[i] = 0;
// list = (char*)grib_context_malloc_clear(c, strlen(line) + 1);
// memcpy(list, line, strlen(line));
// grib_trie_insert(dictionary, key, list);
//}
fclose(f);
//fclose(f);
}
grib_trie_insert(c->lists, filename, 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
grib_context_log(context_, GRIB_LOG_ERROR,
"grib_accessor_local_definition_t: Invalid localDefinitionNumber %d", localDefinitionNumber);
return GRIB_ENCODING_ERROR;
// return GRIB_ENCODING_ERROR;
#endif
// ECC-1253: Do not fail in operations. Leave PDTN as is
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_g2step_range
|---grib_accessor_class_gaussian_grid_name
|---grib_accessor_class_gds_not_present_bitmap
|---grib_accessor_class_group
|---grib_accessor_class_hash_array
|---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;
}
DEBUG_ASSERT(0);
}
// 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->first);
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)

View File

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

View File

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

View File

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

View File

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

View File

@ -60,20 +60,17 @@ typedef struct grib_action_concept {
extern grib_action_class* grib_action_class_gen;
static grib_action_class _grib_action_class_concept = {
&grib_action_class_gen, /* super */
"action_class_concept", /* name */
sizeof(grib_action_concept), /* size */
0, /* inited */
&grib_action_class_gen, /* super */
"action_class_concept", /* name */
sizeof(grib_action_concept), /* size */
0, /* inited */
&init_class, /* init_class */
0, /* init */
0, /* init */
&destroy, /* destroy */
&dump, /* dump */
0, /* xref */
0, /* create_accessor*/
0, /* notify_change */
&dump, /* dump */
0, /* xref */
0, /* create_accessor */
0, /* notify_change */
0, /* reparse */
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)
{
int i = 0;
for (i = 0; i < lvl; i++)
for (int i = 0; i < lvl; i++)
grib_context_print(act->context, f, " ");
printf("concept(%s) { ", act->name);
printf("\n");
printf("concept(%s) { \n", act->name);
for (i = 0; i < lvl; i++)
for (int i = 0; i < lvl; i++)
grib_context_print(act->context, f, " ");
printf("}\n");
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,20 +51,17 @@ typedef struct grib_action_rename {
static grib_action_class _grib_action_class_rename = {
0, /* super */
"action_class_rename", /* name */
sizeof(grib_action_rename), /* size */
0, /* inited */
0, /* super */
"action_class_rename", /* name */
sizeof(grib_action_rename), /* size */
0, /* inited */
&init_class, /* init_class */
0, /* init */
0, /* init */
&destroy, /* destroy */
&dump, /* dump */
0, /* xref */
&create_accessor, /* create_accessor*/
0, /* notify_change */
&dump, /* dump */
0, /* xref */
&create_accessor, /* create_accessor */
0, /* notify_change */
0, /* reparse */
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)
{
// grib_action_rename* a = (grib_action_rename*)act;
// int i = 0;
// for (i = 0; i < lvl; i++)
// grib_context_print(act->context, f, " ");
grib_action_rename* a = (grib_action_rename*)act;
int i = 0;
for (i = 0; i < lvl; i++)
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@
*/
#include "grib_api_internal.h"
#include "eccodes.h"
// Input lon must be in degrees not radians
// 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;
}
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++) {
if (arr[i] > arr[i+1]) {
@ -289,7 +290,7 @@ bool is_sorted_ascending(double arr[], size_t n)
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++) {
if (arr[i] < arr[i+1]) {
@ -404,3 +405,143 @@ int compute_scaled_value_and_scale_factor(
}
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();
}
const char* codes_get_git_branch()
{
return grib_get_git_branch();
}
const char* codes_get_package_name(void)
{
return grib_get_package_name();
@ -475,7 +480,7 @@ void codes_gribex_mode_on(grib_context* 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);
}

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 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
* @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
@ -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 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
* @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
@ -1143,7 +1143,7 @@ void codes_gribex_mode_on(codes_context* c);
*
* @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.
@ -1264,6 +1264,7 @@ long codes_get_api_version(void);
*/
const char* codes_get_git_sha1(void);
const char* codes_get_git_branch(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_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

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);
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_eof(const grib_context* c, void* stream);
size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, 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);
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_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 codes_set_codes_assertion_failed_proc(codes_assertion_failed_proc proc);
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_off(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);
/* 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);
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);
@ -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_time_valid(long number); // number is HHMM
long convert_to_minutes(long step, long stepUnits);
bool is_sorted_ascending(double arr[], size_t n);
bool is_sorted_descending(double arr[], size_t n);
bool is_sorted_ascending(const 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 codes_is_feature_enabled(const char* feature);
int codes_get_features(char* result, size_t* length, int select);
/* grib_util.cc */
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 */
const char* grib_get_git_sha1(void);
const char* grib_get_git_branch(void);
const char* codes_get_build_date(void);
/* 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 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 string get_name(grib_expression* e);
static int native_type(grib_expression*,grib_handle*);
@ -18,12 +18,12 @@ typedef struct grib_expression_NAME{
extern grib_expression_class* SUPER;
static grib_expression_class _grib_expression_class_NAME = {
&SUPER, /* super */
"NAME", /* name */
sizeof(grib_expression_NAME),/* size of instance */
&SUPER, /* super */
"NAME", /* name */
sizeof(grib_expression_NAME),/* size of instance */
0, /* inited */
&init, /* constructor */
&destroy, /* destructor */
&init, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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)
{
char* fpath = 0;
const char* fpath = 0;
grib_section* s = (grib_section*)grib_context_malloc_clear(context, sizeof(grib_section));
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_gaussian_grid_name;
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_getenv;
extern grib_accessor* grib_accessor_global_gaussian;

View File

@ -37,12 +37,12 @@
#line 6 "accessor_class_list.gperf"
struct accessor_class_hash { const char *name; grib_accessor **cclass;};
#define TOTAL_KEYWORDS 206
#define TOTAL_KEYWORDS 205
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 1
#define MAX_HASH_VALUE 545
/* maximum key range = 545, duplicates = 0 */
#define MAX_HASH_VALUE 665
/* maximum key range = 665, duplicates = 0 */
#ifdef __GNUC__
@ -56,32 +56,32 @@ grib_accessor_classes_get_id (const char *str, size_t len)
{
static const unsigned short asso_values[] =
{
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 0, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 1, 145,
23, 6, 2, 546, 4, 546, 1, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 0, 546, 0, 69, 84,
0, 0, 200, 24, 219, 1, 8, 6, 87, 102,
13, 51, 6, 546, 118, 1, 40, 59, 171, 0,
28, 11, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
546, 546, 546, 546, 546, 546
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 0, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 1, 189,
23, 11, 4, 666, 10, 666, 0, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 0, 666, 0, 69, 85,
0, 0, 175, 24, 230, 1, 0, 4, 74, 223,
13, 50, 6, 666, 129, 1, 40, 71, 191, 0,
52, 5, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
666, 666, 666, 666, 666, 666
};
unsigned int hval = len;
@ -118,30 +118,30 @@ static const struct accessor_class_hash classes[] =
#line 9 "accessor_class_list.gperf"
{" "},
{""}, {""}, {""}, {""},
#line 179 "accessor_class_list.gperf"
#line 178 "accessor_class_list.gperf"
{"size", &grib_accessor_size},
#line 12 "accessor_class_list.gperf"
{"ascii", &grib_accessor_ascii},
#line 176 "accessor_class_list.gperf"
#line 175 "accessor_class_list.gperf"
{"signed", &grib_accessor_signed},
#line 156 "accessor_class_list.gperf"
#line 155 "accessor_class_list.gperf"
{"pad", &grib_accessor_pad},
#line 182 "accessor_class_list.gperf"
#line 181 "accessor_class_list.gperf"
{"spd", &grib_accessor_spd},
{""}, {""}, {""},
#line 177 "accessor_class_list.gperf"
#line 75 "accessor_class_list.gperf"
{"dirty", &grib_accessor_dirty},
{""}, {""},
#line 176 "accessor_class_list.gperf"
{"signed_bits", &grib_accessor_signed_bits},
{""},
#line 66 "accessor_class_list.gperf"
{"data_raw_packing", &grib_accessor_data_raw_packing},
#line 75 "accessor_class_list.gperf"
{"dirty", &grib_accessor_dirty},
{""}, {""},
{""}, {""}, {""},
#line 72 "accessor_class_list.gperf"
{"data_simple_packing", &grib_accessor_data_simple_packing},
#line 68 "accessor_class_list.gperf"
{"data_secondary_bitmap", &grib_accessor_data_secondary_bitmap},
#line 170 "accessor_class_list.gperf"
#line 169 "accessor_class_list.gperf"
{"section", &grib_accessor_section},
#line 43 "accessor_class_list.gperf"
{"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"
{"dictionary", &grib_accessor_dictionary},
{""},
#line 112 "accessor_class_list.gperf"
#line 111 "accessor_class_list.gperf"
{"gen", &grib_accessor_gen},
#line 64 "accessor_class_list.gperf"
{"data_jpeg2000_packing", &grib_accessor_data_jpeg2000_packing},
#line 65 "accessor_class_list.gperf"
{"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},
#line 173 "accessor_class_list.gperf"
#line 172 "accessor_class_list.gperf"
{"section_pointer", &grib_accessor_section_pointer},
#line 44 "accessor_class_list.gperf"
{"data_apply_boustrophedonic", &grib_accessor_data_apply_boustrophedonic},
{""}, {""}, {""}, {""}, {""},
#line 157 "accessor_class_list.gperf"
#line 156 "accessor_class_list.gperf"
{"padding", &grib_accessor_padding},
#line 45 "accessor_class_list.gperf"
{"data_apply_boustrophedonic_bitmap", &grib_accessor_data_apply_boustrophedonic_bitmap},
#line 110 "accessor_class_list.gperf"
{"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},
#line 171 "accessor_class_list.gperf"
#line 170 "accessor_class_list.gperf"
{"section_length", &grib_accessor_section_length},
#line 113 "accessor_class_list.gperf"
#line 112 "accessor_class_list.gperf"
{"getenv", &grib_accessor_getenv},
#line 57 "accessor_class_list.gperf"
{"data_g22order_packing", &grib_accessor_data_g22order_packing},
#line 191 "accessor_class_list.gperf"
#line 190 "accessor_class_list.gperf"
{"time", &grib_accessor_time},
{""},
#line 61 "accessor_class_list.gperf"
{"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},
#line 62 "accessor_class_list.gperf"
{"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},
#line 98 "accessor_class_list.gperf"
{"g2_eps", &grib_accessor_g2_eps},
#line 142 "accessor_class_list.gperf"
#line 141 "accessor_class_list.gperf"
{"nearest", &grib_accessor_nearest},
#line 80 "accessor_class_list.gperf"
{"expanded_descriptors", &grib_accessor_expanded_descriptors},
#line 158 "accessor_class_list.gperf"
#line 157 "accessor_class_list.gperf"
{"padto", &grib_accessor_padto},
#line 189 "accessor_class_list.gperf"
{"sum", &grib_accessor_sum},
{""},
{""}, {""}, {""},
#line 107 "accessor_class_list.gperf"
{"g2lon", &grib_accessor_g2lon},
#line 203 "accessor_class_list.gperf"
{"uint8", &grib_accessor_uint8},
{""},
#line 188 "accessor_class_list.gperf"
{""}, {""},
#line 187 "accessor_class_list.gperf"
{"step_in_units", &grib_accessor_step_in_units},
#line 63 "accessor_class_list.gperf"
{"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"
{"data_complex_packing", &grib_accessor_data_complex_packing},
#line 199 "accessor_class_list.gperf"
{"uint32", &grib_accessor_uint32},
{""}, {""},
#line 13 "accessor_class_list.gperf"
{"bit", &grib_accessor_bit},
#line 15 "accessor_class_list.gperf"
{"bits", &grib_accessor_bits},
#line 48 "accessor_class_list.gperf"
{"data_dummy_field", &grib_accessor_data_dummy_field},
#line 188 "accessor_class_list.gperf"
{"sum", &grib_accessor_sum},
#line 14 "accessor_class_list.gperf"
{"bitmap", &grib_accessor_bitmap},
#line 124 "accessor_class_list.gperf"
{"julian_day", &grib_accessor_julian_day},
#line 123 "accessor_class_list.gperf"
{"julian_date", &grib_accessor_julian_date},
#line 143 "accessor_class_list.gperf"
#line 202 "accessor_class_list.gperf"
{"uint8", &grib_accessor_uint8},
#line 142 "accessor_class_list.gperf"
{"non_alpha", &grib_accessor_non_alpha},
{""}, {""},
#line 67 "accessor_class_list.gperf"
{"data_run_length_packing", &grib_accessor_data_run_length_packing},
{""},
#line 29 "accessor_class_list.gperf"
{"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"
{"g2step_range", &grib_accessor_g2step_range},
#line 16 "accessor_class_list.gperf"
{"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"
{"bytes", &grib_accessor_bytes},
{""}, {""}, {""},
#line 167 "accessor_class_list.gperf"
#line 48 "accessor_class_list.gperf"
{"data_dummy_field", &grib_accessor_data_dummy_field},
#line 200 "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},
{""},
#line 185 "accessor_class_list.gperf"
#line 184 "accessor_class_list.gperf"
{"statistics", &grib_accessor_statistics},
#line 102 "accessor_class_list.gperf"
{"g2date", &grib_accessor_g2date},
#line 145 "accessor_class_list.gperf"
{"number_of_points", &grib_accessor_number_of_points},
#line 67 "accessor_class_list.gperf"
{"data_run_length_packing", &grib_accessor_data_run_length_packing},
#line 100 "accessor_class_list.gperf"
{"g2bitmap", &grib_accessor_g2bitmap},
{""},
#line 60 "accessor_class_list.gperf"
{"data_g2secondary_bitmap", &grib_accessor_data_g2secondary_bitmap},
#line 58 "accessor_class_list.gperf"
{"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 122 "accessor_class_list.gperf"
{""},
#line 121 "accessor_class_list.gperf"
{"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},
{""},
#line 46 "accessor_class_list.gperf"
{"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"
{"g2_aerosol", &grib_accessor_g2_aerosol},
#line 139 "accessor_class_list.gperf"
{"message", &grib_accessor_message},
#line 207 "accessor_class_list.gperf"
{"unsigned_bits", &grib_accessor_unsigned_bits},
#line 174 "accessor_class_list.gperf"
{""}, {""}, {""}, {""},
#line 173 "accessor_class_list.gperf"
{"select_step_template", &grib_accessor_select_step_template},
#line 136 "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"
#line 192 "accessor_class_list.gperf"
{"to_integer", &grib_accessor_to_integer},
#line 178 "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"
#line 113 "accessor_class_list.gperf"
{"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"
{"divdouble", &grib_accessor_divdouble},
{""},
#line 175 "accessor_class_list.gperf"
#line 174 "accessor_class_list.gperf"
{"sexagesimal2decimal", &grib_accessor_sexagesimal2decimal},
#line 99 "accessor_class_list.gperf"
{"g2_mars_labeling", &grib_accessor_g2_mars_labeling},
{""},
#line 78 "accessor_class_list.gperf"
{"element", &grib_accessor_element},
#line 160 "accessor_class_list.gperf"
{"padtomultiple", &grib_accessor_padtomultiple},
#line 127 "accessor_class_list.gperf"
#line 206 "accessor_class_list.gperf"
{"unsigned_bits", &grib_accessor_unsigned_bits},
#line 126 "accessor_class_list.gperf"
{"latitudes", &grib_accessor_latitudes},
#line 164 "accessor_class_list.gperf"
{"rdbtime_guess_date", &grib_accessor_rdbtime_guess_date},
{""}, {""}, {""},
#line 194 "accessor_class_list.gperf"
{"to_string", &grib_accessor_to_string},
#line 132 "accessor_class_list.gperf"
{""},
#line 203 "accessor_class_list.gperf"
{"unexpanded_descriptors", &grib_accessor_unexpanded_descriptors},
{""}, {""},
#line 131 "accessor_class_list.gperf"
{"long", &grib_accessor_long},
#line 19 "accessor_class_list.gperf"
{"bufr_data_array", &grib_accessor_bufr_data_array},
#line 76 "accessor_class_list.gperf"
{"divdouble", &grib_accessor_divdouble},
#line 77 "accessor_class_list.gperf"
{"double", &grib_accessor_double},
#line 20 "accessor_class_list.gperf"
{"bufr_data_element", &grib_accessor_bufr_data_element},
#line 186 "accessor_class_list.gperf"
{"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"
{"g2latlon", &grib_accessor_g2latlon},
{""}, {""},
#line 26 "accessor_class_list.gperf"
{"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 159 "accessor_class_list.gperf"
{"padtomultiple", &grib_accessor_padtomultiple},
#line 17 "accessor_class_list.gperf"
{"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"
{"gaussian_grid_name", &grib_accessor_gaussian_grid_name},
#line 197 "accessor_class_list.gperf"
#line 196 "accessor_class_list.gperf"
{"trim", &grib_accessor_trim},
{""}, {""},
#line 119 "accessor_class_list.gperf"
{"ibmfloat", &grib_accessor_ibmfloat},
{""}, {""},
#line 195 "accessor_class_list.gperf"
{""}, {""}, {""}, {""}, {""},
#line 194 "accessor_class_list.gperf"
{"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"
{"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},
#line 49 "accessor_class_list.gperf"
{"data_g1complex_packing", &grib_accessor_data_g1complex_packing},
#line 166 "accessor_class_list.gperf"
{"round", &grib_accessor_round},
#line 196 "accessor_class_list.gperf"
{"transient_darray", &grib_accessor_transient_darray},
#line 18 "accessor_class_list.gperf"
{"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 191 "accessor_class_list.gperf"
{"to_double", &grib_accessor_to_double},
{""}, {""}, {""},
#line 27 "accessor_class_list.gperf"
{"bufr_string_values", &grib_accessor_bufr_string_values},
{""},
#line 183 "accessor_class_list.gperf"
{"spectral_truncation", &grib_accessor_spectral_truncation},
#line 129 "accessor_class_list.gperf"
{"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"
{"g1_message_length", &grib_accessor_g1_message_length},
{""},
#line 190 "accessor_class_list.gperf"
{"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 101 "accessor_class_list.gperf"
{"g2bitmap_present", &grib_accessor_g2bitmap_present},
#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"
{"g1step_range", &grib_accessor_g1step_range},
#line 73 "accessor_class_list.gperf"
{"decimal_precision", &grib_accessor_decimal_precision},
{""},
#line 134 "accessor_class_list.gperf"
{"longitudes", &grib_accessor_longitudes},
#line 33 "accessor_class_list.gperf"
{"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"
{"g1date", &grib_accessor_g1date},
{""},
#line 85 "accessor_class_list.gperf"
{"g1bitmap", &grib_accessor_g1bitmap},
{""},
#line 54 "accessor_class_list.gperf"
{"data_g1secondary_bitmap", &grib_accessor_data_g1secondary_bitmap},
#line 192 "accessor_class_list.gperf"
{"to_double", &grib_accessor_to_double},
#line 101 "accessor_class_list.gperf"
{"g2bitmap_present", &grib_accessor_g2bitmap_present},
{""},
#line 132 "accessor_class_list.gperf"
{"long_vector", &grib_accessor_long_vector},
{""}, {""},
#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"
{"when", &grib_accessor_when},
#line 208 "accessor_class_list.gperf"
{"validity_date", &grib_accessor_validity_date},
#line 209 "accessor_class_list.gperf"
{"validity_time", &grib_accessor_validity_time},
{""},
#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},
{"cf_var_name", &grib_accessor_cf_var_name},
#line 136 "accessor_class_list.gperf"
{"mars_step", &grib_accessor_mars_step},
#line 210 "accessor_class_list.gperf"
{"variable", &grib_accessor_variable},
#line 52 "accessor_class_list.gperf"
{"data_g1second_order_general_packing", &grib_accessor_data_g1second_order_general_packing},
#line 130 "accessor_class_list.gperf"
{"library_version", &grib_accessor_library_version},
#line 84 "accessor_class_list.gperf"
{"g1_section4_length", &grib_accessor_g1_section4_length},
{""},
#line 53 "accessor_class_list.gperf"
{"data_g1second_order_row_by_row_packing", &grib_accessor_data_g1second_order_row_by_row_packing},
{""}, {""},
#line 159 "accessor_class_list.gperf"
{"padtoeven", &grib_accessor_padtoeven},
{""},
#line 25 "accessor_class_list.gperf"
{"bufr_group", &grib_accessor_bufr_group},
{""},
#line 50 "accessor_class_list.gperf"
{"data_g1second_order_constant_width_packing", &grib_accessor_data_g1second_order_constant_width_packing},
{""},
#line 51 "accessor_class_list.gperf"
{"data_g1second_order_general_extended_packing", &grib_accessor_data_g1second_order_general_extended_packing},
#line 70 "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"
#line 153 "accessor_class_list.gperf"
{"pack_bufr_values", &grib_accessor_pack_bufr_values},
#line 35 "accessor_class_list.gperf"
{"codetable", &grib_accessor_codetable},
#line 131 "accessor_class_list.gperf"
{"local_definition", &grib_accessor_local_definition},
{""}, {""}, {""}, {""},
#line 167 "accessor_class_list.gperf"
{"scale_values", &grib_accessor_scale_values},
{""},
#line 25 "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"
#line 146 "accessor_class_list.gperf"
{"number_of_values", &grib_accessor_number_of_values},
{""}, {""}, {""}, {""}, {""},
#line 24 "accessor_class_list.gperf"
{"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"
{"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"
{"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"
{"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"
{"data_sh_packed", &grib_accessor_data_sh_packed},
#line 37 "accessor_class_list.gperf"
{"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"
{"abstract_long_vector", &grib_accessor_abstract_long_vector},
#line 34 "accessor_class_list.gperf"
{"codeflag", &grib_accessor_codeflag},
{""}, {""}, {""},
#line 117 "accessor_class_list.gperf"
{"hash_array", &grib_accessor_hash_array},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""},
#line 89 "accessor_class_list.gperf"
{"g1fcperiod", &grib_accessor_g1fcperiod},
{""},
#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"
{"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"
{"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"
{"check_internal_version", &grib_accessor_check_internal_version},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""},
#line 97 "accessor_class_list.gperf"
{"g2_chemical", &grib_accessor_g2_chemical},
{""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 164 "accessor_class_list.gperf"
{"reference_value_error", &grib_accessor_reference_value_error},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 87 "accessor_class_list.gperf"
{"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"
{"g1number_of_coded_values_sh_simple", &grib_accessor_g1number_of_coded_values_sh_simple},
#line 92 "accessor_class_list.gperf"
{"g1number_of_coded_values_sh_complex", &grib_accessor_g1number_of_coded_values_sh_complex},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""},
#line 95 "accessor_class_list.gperf"
{"g1verificationdate", &grib_accessor_g1verificationdate}
#line 90 "accessor_class_list.gperf"
{"g1forecastmonth", &grib_accessor_g1forecastmonth}
};
const struct accessor_class_hash *

View File

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

View File

@ -101,7 +101,6 @@ g2lon, &grib_accessor_g2lon
g2step_range, &grib_accessor_g2step_range
gaussian_grid_name, &grib_accessor_gaussian_grid_name
gds_is_present, &grib_accessor_gds_is_present
gds_not_present_bitmap, &grib_accessor_gds_not_present_bitmap
gen, &grib_accessor_gen
getenv, &grib_accessor_getenv
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
* @see grib_set_string
*
* @param h : the handle to get the data from
* @param key : the key to be searched
* @param mesg : the address of a string where the data will be retrieved
* @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output
* @return 0 if OK, integer value on error
* @param h : the handle to get the data from
* @param key : the key to be searched
* @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
* @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
@ -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 key : the key to be searched
* @param mesg : the address of a string where the data will be read
* @param length : the address of a size_t that contains the length of the string on input, and that contains the actual packed length of the string on output
* @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
* @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
@ -1143,7 +1145,7 @@ void grib_gribex_mode_on(grib_context* c);
*
* @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.
@ -1259,6 +1261,8 @@ long grib_get_api_version(void);
*/
const char* grib_get_git_sha1(void);
const char* grib_get_git_branch(void);
/**
* Get the package name
*

View File

@ -13,6 +13,12 @@ const char* grib_get_git_sha1(void)
{
return "@eccodes_GIT_SHA1@";
}
const char* grib_get_git_branch(void)
{
return "@eccodes_GIT_BRANCH@";
}
const char* codes_get_build_date(void)
{
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);
}
int grib_context_eof(const grib_context* c, void* stream)
{
if (!c)
c = grib_context_get_default();
return c->eof(c, stream);
}
// int grib_context_eof(const grib_context* c, void* stream)
// {
// if (!c)
// c = grib_context_get_default();
// return c->eof(c, stream);
// }
size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream)
{
if (!c)
c = grib_context_get_default();
return c->write(c, ptr, size, stream);
}
// size_t grib_context_write(const grib_context* c, const void* ptr, size_t size, void* stream)
// {
// if (!c)
// c = grib_context_get_default();
// return c->write(c, ptr, size, stream);
// }
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)
{
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);
}
@ -661,20 +661,19 @@ static int init_definition_files_dir(grib_context* c)
}
else {
/* Definitions path contains multiple directories */
char* dir = NULL;
dir = strtok_r(path, ECC_PATH_DELIMITER_STR, &lasts);
const char* dir = strtok_r(path, ECC_PATH_DELIMITER_STR, &lasts);
while (dir != NULL) {
if (next) {
next->next = (grib_string_list*)grib_context_malloc_clear_persistent(c, sizeof(grib_string_list));
next = next->next;
next = next->next;
}
else {
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);
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
* unless user has supplied his own assertion routine */
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);
if (!c->no_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)
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)
{
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 &&
(d->option_flags & GRIB_DUMP_FLAG_CODED) != 0)
return;
size_t size = 1;
long value = 0;
int err = a->unpack_long(&value, &size);
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, "%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))
fprintf(self->dumper.out, "1");
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)
{
grib_dumper_default* self = (grib_dumper_default*)d;
int i;
long lvalue = 0;
double dvalue = 0;
size_t size = 1;
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)
return;
err = a->unpack_long(&lvalue, &size);
print_offset(self->dumper.out, d, a);
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, "# 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))
fprintf(self->dumper.out, "1");
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, "#-READ ONLY- ");
}
else
else {
fprintf(self->dumper.out, " ");
}
if (((a->flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal())
fprintf(self->dumper.out, "%s = MISSING;", a->name_);
else {
if (isDouble)
fprintf(self->dumper.out, "%s = %g;", a->name_, dvalue);
else
fprintf(self->dumper.out, "%s = %ld;", a->name_, lvalue);
fprintf(self->dumper.out, "%s = %ld;", a->name_, lvalue);
}
if (err) {
fprintf(self->dumper.out, " ");
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)
{
grib_dumper_wmo* self = (grib_dumper_wmo*)d;
int i;
long value = 0;
size_t size = 1;
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 = %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))
fprintf(self->dumper.out, "1");
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 */
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 string get_name(grib_expression* e);
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 = {
0, /* super */
"accessor", /* name */
sizeof(grib_expression_accessor),/* size of instance */
0, /* super */
"accessor", /* name */
sizeof(grib_expression_accessor),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 int native_type(grib_expression*,grib_handle*);
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 = {
0, /* super */
"binop", /* name */
sizeof(grib_expression_binop),/* size of instance */
0, /* super */
"binop", /* name */
sizeof(grib_expression_binop),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&native_type,
@ -85,7 +85,6 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
long v2 = 0;
grib_expression_binop* e = (grib_expression_binop*)g;
// #if DEBUGGING
// {
// int typeLeft, typeRight;
// const char* nameLeft;
@ -117,7 +116,6 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* dres)
double v2 = 0.0;
grib_expression_binop* e = (grib_expression_binop*)g;
// #if DEBUGGING
// {
// int typeLeft, typeRight;
// 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 */
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 int native_type(grib_expression*,grib_handle*);
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 = {
0, /* super */
"double", /* name */
sizeof(grib_expression_double),/* size of instance */
0, /* super */
"double", /* name */
sizeof(grib_expression_double),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 int native_type(grib_expression*,grib_handle*);
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 = {
0, /* super */
"functor", /* name */
sizeof(grib_expression_functor),/* size of instance */
0, /* super */
"functor", /* name */
sizeof(grib_expression_functor),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 string get_name(grib_expression* e);
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 = {
0, /* super */
"is_in_dict", /* name */
sizeof(grib_expression_is_in_dict),/* size of instance */
0, /* super */
"is_in_dict", /* name */
sizeof(grib_expression_is_in_dict),/* size of instance */
0, /* inited */
0, /* constructor */
0, /* destructor */
0, /* constructor */
0, /* destructor */
&print,
&add_dependency,
&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 */
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 string get_name(grib_expression* e);
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 = {
0, /* super */
"is_in_list", /* name */
sizeof(grib_expression_is_in_list),/* size of instance */
0, /* super */
"is_in_list", /* name */
sizeof(grib_expression_is_in_list),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 string get_name(grib_expression* e);
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 = {
0, /* super */
"is_integer", /* name */
sizeof(grib_expression_is_integer),/* size of instance */
0, /* super */
"is_integer", /* name */
sizeof(grib_expression_is_integer),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 string get_name(grib_expression* e);
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 = {
0, /* super */
"length", /* name */
sizeof(grib_expression_length),/* size of instance */
0, /* super */
"length", /* name */
sizeof(grib_expression_length),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&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 */
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 int native_type(grib_expression*,grib_handle*);
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 = {
0, /* super */
"logical_and", /* name */
sizeof(grib_expression_logical_and),/* size of instance */
0, /* super */
"logical_and", /* name */
sizeof(grib_expression_logical_and),/* size of instance */
0, /* inited */
0, /* constructor */
&destroy, /* destructor */
0, /* constructor */
&destroy, /* destructor */
&print,
&add_dependency,
&native_type,

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