mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/ocean-mmsf-fc
This commit is contained in:
commit
91372746f7
|
@ -18,12 +18,12 @@ constant defaultTypeOfLevel="unknown" : hidden;
|
|||
|
||||
gribDataQualityChecks = getenv("ECCODES_GRIB_DATA_QUALITY_CHECKS","0") : hidden;
|
||||
if (gribDataQualityChecks) {
|
||||
template LIMITS "param_limits.def";
|
||||
template LIMITS "param_limits.def";
|
||||
}
|
||||
|
||||
# GRIBEX special boustrophedonic mode. See GRIB-472
|
||||
# If the environment variable is not defined, the key will be 0
|
||||
GRIBEX_boustrophedonic = getenv("ECCODES_GRIBEX_BOUSTROPHEDONIC","0") :hidden;
|
||||
GRIBEX_boustrophedonic = getenv("ECCODES_GRIBEX_BOUSTROPHEDONIC","0") :hidden;
|
||||
|
||||
constant zero=0 : hidden;
|
||||
constant one=1 : hidden;
|
||||
|
@ -61,65 +61,65 @@ transient produceLargeConstantFields = 0 : hidden;
|
|||
|
||||
meta libraryVersion library_version() : hidden;
|
||||
|
||||
lookup[4] kindOfProduct (0,identifier) : hidden;
|
||||
lookup[4] kindOfProduct (0,identifier) : hidden;
|
||||
# grib templates
|
||||
# `ABCD` is a number, each letter being a byte
|
||||
|
||||
if(kindOfProduct == `GRIB`){
|
||||
lookup[1] GRIBEditionNumber (7,editionNumber) : edition_specific ;
|
||||
template GRIB "grib[GRIBEditionNumber:l]/boot.def" ;
|
||||
lookup[1] GRIBEditionNumber (7,editionNumber) : edition_specific;
|
||||
template GRIB "grib[GRIBEditionNumber:l]/boot.def" ;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `BUDG` ){
|
||||
template BUDG "budg/boot.def" ;
|
||||
template BUDG "budg/boot.def" ;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `DIAG`){
|
||||
template DIAG "diag/boot.def" ;
|
||||
template DIAG "diag/boot.def" ;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `TIDE`){
|
||||
template TIDE "tide/boot.def" ;
|
||||
template TIDE "tide/boot.def" ;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `BUFR`){
|
||||
template BUFR "bufr/boot.def" ;
|
||||
#constant BUFRstr="BUFR"; #ECC-742
|
||||
template BUFR "bufr/boot.def" ;
|
||||
#constant BUFRstr="BUFR"; #ECC-742
|
||||
#alias identifier=BUFRstr;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `CDFX`){
|
||||
template CDF "cdf/boot.def" ;
|
||||
constant CDFstr="netCDF";
|
||||
template CDF "cdf/boot.def" ;
|
||||
constant CDFstr="netCDF";
|
||||
alias ls.identifier=CDFstr;
|
||||
}
|
||||
|
||||
if(kindOfProduct == 17632522 ){
|
||||
template GTS "gts/boot.def" ;
|
||||
template GTS "gts/boot.def" ;
|
||||
constant GTSstr="GTS";
|
||||
alias ls.identifier=GTSstr;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `META` ){
|
||||
template METAR "metar/boot.def" ;
|
||||
template METAR "metar/boot.def" ;
|
||||
constant METARstr="METAR";
|
||||
alias identifier=METARstr;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `TAF ` ){
|
||||
template TAF "taf/boot.def" ;
|
||||
template TAF "taf/boot.def" ;
|
||||
constant TAFstr="TAF";
|
||||
alias ls.identifier=TAFstr;
|
||||
}
|
||||
|
||||
if(kindOfProduct == 2303214662){
|
||||
template HDF5 "hdf5/boot.def" ;
|
||||
constant HDF5str="HDF5";
|
||||
template HDF5 "hdf5/boot.def" ;
|
||||
constant HDF5str="HDF5";
|
||||
alias ls.identifier=HDF5str;
|
||||
}
|
||||
|
||||
if(kindOfProduct == `WRAP`){
|
||||
template WRAP "wrap/boot.def" ;
|
||||
constant WRAPstr="WRAP";
|
||||
template WRAP "wrap/boot.def" ;
|
||||
constant WRAPstr="WRAP";
|
||||
alias ls.identifier=WRAPstr;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ if (horizontalCoordinateDefinition == 0) {
|
|||
{
|
||||
meta coordinateIndexNumber evaluate(coordinate4Flag+coordinate3Flag);
|
||||
|
||||
# levelist latitude longitude
|
||||
# levelist latitude longitude
|
||||
if (coordinateIndexNumber== 3) {
|
||||
meta marsLatitude divdouble( coordinate1Start,1000000);
|
||||
meta marsLongitude divdouble( coordinate2Start,1000000);
|
||||
|
@ -145,15 +145,15 @@ if (horizontalCoordinateDefinition == 0) {
|
|||
alias mars.range = marsRange;
|
||||
}
|
||||
}
|
||||
# product
|
||||
alias mars.product = coordAveragingTims;
|
||||
# date
|
||||
if (marsType == TYPE_OR && averaging1Flag == P_INST) {
|
||||
#remove mars.date;
|
||||
alias mars.date = verificationDate;
|
||||
#remove mars.step;
|
||||
constant stepZero = 0;
|
||||
alias mars.step =stepZero;
|
||||
}
|
||||
# product
|
||||
alias mars.product = coordAveragingTims;
|
||||
# date
|
||||
if (marsType == TYPE_OR && averaging1Flag == P_INST) {
|
||||
#remove mars.date;
|
||||
alias mars.date = verificationDate;
|
||||
#remove mars.step;
|
||||
constant stepZero = 0;
|
||||
alias mars.step =stepZero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ constant tablesVersionLatest = 32 : edition_specific;
|
|||
constant false = 0 : hidden;
|
||||
constant true = 1 : hidden;
|
||||
constant million = 1000000 : hidden;
|
||||
constant grib2divider = 1000000;
|
||||
alias extraDimensionPresent=zero;
|
||||
transient angleSubdivisions=grib2divider; # micro degrees
|
||||
constant grib2divider = 1000000;
|
||||
alias extraDimensionPresent = zero;
|
||||
transient angleSubdivisions = grib2divider; # micro degrees
|
||||
transient forceStepUnits = 255 : hidden;
|
||||
|
||||
meta gts_header gts_header() : no_copy,hidden,read_only;
|
||||
|
@ -26,8 +26,8 @@ meta gts_TTAAii gts_header(20,6) : no_copy,hidden,read_only;
|
|||
meta gts_CCCC gts_header(27,4) : no_copy,hidden,read_only;
|
||||
meta gts_ddhh00 gts_header(32,6) : no_copy,hidden,read_only;
|
||||
|
||||
transient missingValue = 9999;
|
||||
constant ieeeFloats = 1 : edition_specific;
|
||||
transient missingValue = 9999;
|
||||
constant ieeeFloats = 1 : edition_specific;
|
||||
constant isHindcast = 0;
|
||||
|
||||
include "grib2/section.0.def"
|
||||
|
|
|
@ -7841,7 +7841,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
#Sea water potential temperature tendency due to newtonian relaxation
|
||||
'thetaodmp' = {
|
||||
|
@ -9028,7 +9030,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time-mean sea water potential temperature tendency due to newtonian relaxation
|
||||
|
|
|
@ -157,3 +157,20 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
lengthOfTimeRange = 24 ;
|
||||
}
|
||||
#Upward sea water velocity
|
||||
'wo' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
}
|
||||
#Time-mean upward sea water velocity
|
||||
'avg_wo' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
|
|
|
@ -7841,7 +7841,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
#Sea water potential temperature tendency due to newtonian relaxation
|
||||
'Sea water potential temperature tendency due to newtonian relaxation' = {
|
||||
|
@ -9028,7 +9030,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time-mean sea water potential temperature tendency due to newtonian relaxation
|
||||
|
|
|
@ -157,3 +157,20 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
lengthOfTimeRange = 24 ;
|
||||
}
|
||||
#Upward sea water velocity
|
||||
'Upward sea water velocity' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
}
|
||||
#Time-mean upward sea water velocity
|
||||
'Time-mean upward sea water velocity' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
|
|
|
@ -7841,7 +7841,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
#Sea water potential temperature tendency due to newtonian relaxation
|
||||
'262508' = {
|
||||
|
@ -9028,7 +9030,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time-mean sea water potential temperature tendency due to newtonian relaxation
|
||||
|
|
|
@ -157,3 +157,20 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
lengthOfTimeRange = 24 ;
|
||||
}
|
||||
#Upward sea water velocity
|
||||
'262507' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
}
|
||||
#Time-mean upward sea water velocity
|
||||
'263507' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
|
|
|
@ -7841,7 +7841,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
#Sea water potential temperature tendency due to newtonian relaxation
|
||||
'thetaodmp' = {
|
||||
|
@ -9028,7 +9030,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time-mean sea water potential temperature tendency due to newtonian relaxation
|
||||
|
|
|
@ -157,3 +157,20 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
lengthOfTimeRange = 24 ;
|
||||
}
|
||||
#Upward sea water velocity
|
||||
'wo' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
}
|
||||
#Time-mean upward sea water velocity
|
||||
'avg_wo' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
|
|
|
@ -62,12 +62,12 @@ include "grib2/template.3.scanning_mode.def"
|
|||
|
||||
# Latin 1 - first latitude from the pole at which the secant cone cuts the sphere
|
||||
signed[4] Latin1 : edition_specific;
|
||||
alias FirstLatitude=Latin1;
|
||||
alias firstLatitude=Latin1;
|
||||
meta geography.Latin1InDegrees scale(Latin1,one,grib2divider,truncateDegrees) : dump;
|
||||
|
||||
# Latin 2 - second latitude from the pole at which the secant cone cuts the sphere
|
||||
signed[4] Latin2 : dump;
|
||||
alias SecondLatitude=Latin2;
|
||||
alias secondLatitude=Latin2;
|
||||
meta geography.Latin2InDegrees scale(Latin2,one,grib2divider,truncateDegrees) : dump;
|
||||
|
||||
# Latitude of the southern pole of projection
|
||||
|
|
|
@ -38,12 +38,12 @@ flags[1] projectionCentreFlag 'grib2/tables/[tablesVersion]/3.5.table' : dump;
|
|||
|
||||
# Latin 1 - first latitude from the pole at which the secant cone cuts the sphere
|
||||
signed[4] Latin1 : edition_specific;
|
||||
alias FirstLatitude=Latin1;
|
||||
alias firstLatitude=Latin1;
|
||||
meta geography.Latin1InDegrees scale(Latin1,one,grib2divider,truncateDegrees) : dump;
|
||||
|
||||
# Latin 2 - second latitude from the pole at which the secant cone cuts the sphere
|
||||
signed[4] Latin2 : dump;
|
||||
alias SecondLatitude=Latin2;
|
||||
alias secondLatitude=Latin2;
|
||||
meta geography.Latin2InDegrees scale(Latin2,one,grib2divider,truncateDegrees) : dump;
|
||||
|
||||
# Latitude of the southern pole of projection
|
||||
|
|
|
@ -73,12 +73,12 @@ _if (shapeOfTheEarth == 3){
|
|||
# ECC-979
|
||||
# The 'scale' accessor works with integers so rounds its first argument
|
||||
# which is not what we want because the inputs are doubles with decimal
|
||||
# expansions. So use the trick of dividing by 0.001 to multiply by 1000
|
||||
# expansions.
|
||||
#
|
||||
# meta earthMajorAxisInMetres scale(earthMajorAxis, thousand, one, zero);
|
||||
# meta earthMinorAxisInMetres scale(earthMinorAxis, thousand, one, zero);
|
||||
meta earthMajorAxisInMetres divdouble(earthMajorAxis, 0.001);
|
||||
meta earthMinorAxisInMetres divdouble(earthMinorAxis, 0.001);
|
||||
meta earthMajorAxisInMetres multdouble(earthMajorAxis, 1000);
|
||||
meta earthMinorAxisInMetres multdouble(earthMinorAxis, 1000);
|
||||
}
|
||||
_if (shapeOfTheEarth == 7){
|
||||
# Major and minor axes specified (in m) by data producer
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 4.1100, Hovmoller-type grid with no averaging or other statistical processing
|
||||
# This template is experimental, was not validated at the time of publication and should be used only for bilateral previously agreed tests
|
||||
|
||||
include "grib2/template.4.parameter.def"
|
||||
include "grib2/template.4.generating_process.def"
|
||||
|
|
|
@ -2,8 +2,26 @@
|
|||
|
||||
# TEMPLATE 4.1101, Hovmoller-type grid with averaging or other statistical processing
|
||||
|
||||
# This template is experimental, was not validated at the time of publication and should be used only for bilateral previously agreed tests.
|
||||
# (Octets 35-50 are very similar to octets 43-58 of product definition template 4.8, but the meaning of some fields differs slightly)
|
||||
|
||||
include "grib2/template.4.parameter.def"
|
||||
include "grib2/template.4.generating_process.def"
|
||||
include "grib2/template.4.forecast_time.def"
|
||||
include "grib2/template.4.horizontal.def"
|
||||
include "grib2/template.4.statistical.def"
|
||||
|
||||
unsigned[4] numberOfMissingInStatisticalProcess = 0 : edition_specific;
|
||||
alias totalNumberOfDataValuesMissingInStatisticalProcess=numberOfMissingInStatisticalProcess;
|
||||
|
||||
codetable[1] typeOfStatisticalProcessing ('4.10.table',masterDir,localDir) : edition_specific;
|
||||
|
||||
codetable[1] typeOfTimeIncrement ('4.11.table',masterDir,localDir) = 2 : edition_specific;
|
||||
alias typeOfTimeIncrementBetweenSuccessiveFieldsUsedInTheStatisticalProcessing=typeOfTimeIncrement;
|
||||
|
||||
codetable[1] indicatorOfUnitForTimeRange ('4.4.table',masterDir,localDir) =1 ;
|
||||
unsigned[4] lengthOfTimeRange=0 ;
|
||||
codetable[1] indicatorOfUnitForTimeIncrement ('4.4.table',masterDir,localDir)=255 ;
|
||||
unsigned[4] timeIncrement=0 ;
|
||||
alias timeIncrementBetweenSuccessiveFields=timeIncrement;
|
||||
|
||||
# include "grib2/template.4.statistical.def"
|
||||
|
|
|
@ -8,3 +8,12 @@ signed[1] scaleFactorOfFirstWavelength : dump;
|
|||
signed[4] scaledValueOfFirstWavelength : dump;
|
||||
signed[1] scaleFactorOfSecondWavelength = missing(): can_be_missing,dump;
|
||||
signed[4] scaledValueOfSecondWavelength = missing(): can_be_missing,dump;
|
||||
|
||||
meta firstWavelength from_scale_factor_scaled_value(scaleFactorOfFirstWavelength, scaledValueOfFirstWavelength);
|
||||
meta secondWavelength from_scale_factor_scaled_value(scaleFactorOfSecondWavelength, scaledValueOfSecondWavelength);
|
||||
alias firstWavelengthInMetres = firstWavelength;
|
||||
alias secondWavelengthInMetres = secondWavelength;
|
||||
|
||||
constant billion = 1000000000 : hidden;
|
||||
meta firstWavelengthInNanometres multdouble(firstWavelength, billion);
|
||||
meta secondWavelengthInNanometres multdouble(secondWavelength, billion);
|
||||
|
|
|
@ -3,16 +3,20 @@
|
|||
## Direction part
|
||||
unsigned[2] waveDirectionNumber : dump;
|
||||
alias mars.direction = waveDirectionNumber;
|
||||
alias directionNumber = waveDirectionNumber;
|
||||
|
||||
unsigned[2] numberOfWaveDirections = 1 : dump;
|
||||
alias totalNumberOfWaveDirections = numberOfWaveDirections;
|
||||
alias numberOfDirections = totalNumberOfWaveDirections;
|
||||
|
||||
## Frequency part
|
||||
unsigned[2] waveFrequencyNumber : dump;
|
||||
alias mars.frequency = waveFrequencyNumber;
|
||||
alias frequencyNumber = waveFrequencyNumber;
|
||||
|
||||
unsigned[2] numberOfWaveFrequencies = 1 : dump;
|
||||
alias totalNumberOfWaveFrequencies = numberOfWaveFrequencies;
|
||||
alias numberOfFrequencies = totalNumberOfWaveFrequencies;
|
||||
|
||||
constant waveLevType="sfc";
|
||||
alias mars.levtype = waveLevType;
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
## Direction part
|
||||
signed[1] scaleFactorOfWaveDirections : dump;
|
||||
alias integerScalingFactorAppliedToDirections = scaleFactorOfWaveDirections;
|
||||
alias directionScalingFactor = integerScalingFactorAppliedToDirections;
|
||||
|
||||
unsigned[4] scaledValuesOfWaveDirections[numberOfWaveDirections] : dump;
|
||||
alias scaledDirections = scaledValuesOfWaveDirections ;
|
||||
|
||||
## Frequency part
|
||||
signed[1] scaleFactorOfWaveFrequencies : dump;
|
||||
alias integerScalingFactorAppliedToFrequencies = scaleFactorOfWaveFrequencies;
|
||||
alias frequencyScalingFactor = integerScalingFactorAppliedToFrequencies;
|
||||
|
||||
unsigned[4] scaledValuesOfWaveFrequencies[numberOfWaveFrequencies] : dump;
|
||||
alias scaledFrequencies = scaledValuesOfWaveFrequencies;
|
||||
|
|
|
@ -7841,7 +7841,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
#Sea water potential temperature tendency due to newtonian relaxation
|
||||
'K s**-1' = {
|
||||
|
@ -9028,7 +9030,9 @@
|
|||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time-mean sea water potential temperature tendency due to newtonian relaxation
|
||||
|
|
|
@ -157,3 +157,20 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
lengthOfTimeRange = 24 ;
|
||||
}
|
||||
#Upward sea water velocity
|
||||
'm s**-1' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
}
|
||||
#Time-mean upward sea water velocity
|
||||
'm s**-1' = {
|
||||
discipline = 10 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 27 ;
|
||||
typeOfFirstFixedSurface = 168 ;
|
||||
typeOfSecondFixedSurface = 168 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
|
|
|
@ -73,12 +73,12 @@ _if (shapeOfTheEarth == 3){
|
|||
# ECC-979
|
||||
# The 'scale' accessor works with integers so rounds its first argument
|
||||
# which is not what we want because the inputs are doubles with decimal
|
||||
# expansions. So use the trick of dividing by 0.001 to multiply by 1000
|
||||
# expansions.
|
||||
#
|
||||
# meta earthMajorAxisInMetres scale(earthMajorAxis, thousand, one, zero);
|
||||
# meta earthMinorAxisInMetres scale(earthMinorAxis, thousand, one, zero);
|
||||
meta earthMajorAxisInMetres divdouble(earthMajorAxis, 0.001);
|
||||
meta earthMinorAxisInMetres divdouble(earthMinorAxis, 0.001);
|
||||
meta earthMajorAxisInMetres multdouble(earthMajorAxis, 1000);
|
||||
meta earthMinorAxisInMetres multdouble(earthMinorAxis, 1000);
|
||||
}
|
||||
_if (shapeOfTheEarth == 7){
|
||||
# Major and minor axes specified (in m) by data producer
|
||||
|
|
|
@ -56,7 +56,6 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_clone
|
||||
grib_ecc-1316
|
||||
bufr_attributes
|
||||
bufr_copy_data
|
||||
bufr_clone
|
||||
bufr_expanded
|
||||
bufr_get_keys
|
||||
|
@ -130,6 +129,12 @@ foreach( atest ${tests_sanity} )
|
|||
RESOURCES bufr_read_scatterometer_f.ref
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${atest}.sh )
|
||||
endforeach()
|
||||
|
||||
if( HAVE_BUILD_TOOLS AND NOT CMAKE_CXX_COMPILER_ID MATCHES NVHPC )
|
||||
# Test which fails on Leonardo
|
||||
list( APPEND tests_extra bufr_copy_data )
|
||||
endif()
|
||||
|
||||
foreach( atest ${tests_extra} )
|
||||
ecbuild_add_test( TARGET eccodes_f_${atest}
|
||||
SOURCES ${atest}.f90
|
||||
|
|
|
@ -25,9 +25,9 @@ program bufr_read_tempf
|
|||
integer :: ibufr
|
||||
integer :: i, count = 0
|
||||
integer :: iflag
|
||||
integer :: status_id, status_ht, status_time = 0, status_p
|
||||
integer :: status_airt, status_dewt
|
||||
integer :: status_rsno, status_rssoft, status_balloonwt
|
||||
integer :: status_id, status_bl, status_num, status_ht, status_time = 0, status_p
|
||||
integer :: status_airt, status_dewt, status_wdir, status_wsp
|
||||
integer :: status_rsno, status_rssoft, status_balloonwt, statid_missing
|
||||
integer(kind=4) :: sizews
|
||||
integer(kind=4) :: blockNumber, stationNumber
|
||||
integer(kind=4) :: ymd, hms
|
||||
|
@ -74,9 +74,10 @@ program bufr_read_tempf
|
|||
IF (status_id /= CODES_SUCCESS) statid = dropid
|
||||
! call codes_is_missing(ibufr, 'shipOrMobileLandStationIdentifier', statid_missing)
|
||||
! IF (statid_missing == 1) statid = "MISSING"
|
||||
call codes_get(ibufr, 'blockNumber', blockNumber)
|
||||
call codes_get(ibufr, 'stationNumber', stationNumber)
|
||||
IF (blockNumber <= 99.0 .AND. stationNumber <= 1000) write (statid, '(I2.2,I3.3,3X)') blockNumber, stationNumber
|
||||
blockNumber = 9999
|
||||
call codes_get(ibufr, 'blockNumber', blockNumber, status_bl)
|
||||
call codes_get(ibufr, 'stationNumber', stationNumber, status_num)
|
||||
IF (blockNumber <= 99 .AND. stationNumber <= 1000) write (statid, '(I2.2,I3.3,3X)') blockNumber, stationNumber
|
||||
|
||||
call codes_get(ibufr, 'year', year)
|
||||
call codes_get(ibufr, 'month', month)
|
||||
|
@ -118,8 +119,8 @@ program bufr_read_tempf
|
|||
call codes_get(ibufr, 'extendedVerticalSoundingSignificance', vssVal)
|
||||
call codes_get(ibufr, 'airTemperature', tVal, status_airt)
|
||||
call codes_get(ibufr, 'dewpointTemperature', tdVal, status_dewt)
|
||||
call codes_get(ibufr, 'windDirection', wdirVal)
|
||||
call codes_get(ibufr, 'windSpeed', wspVal)
|
||||
call codes_get(ibufr, 'windDirection', wdirVal, status_wdir)
|
||||
call codes_get(ibufr, 'windSpeed', wspVal, status_wsp)
|
||||
|
||||
! ---- Array sizes (pressure size can be larger - wind shear levels)
|
||||
sizews = size(wspVal)
|
||||
|
@ -140,13 +141,21 @@ program bufr_read_tempf
|
|||
allocate(tdVal(sizews))
|
||||
tdVal(:) = -999999999.0
|
||||
END IF
|
||||
IF (status_wdir /= CODES_SUCCESS) THEN
|
||||
allocate(wdirVal(sizews))
|
||||
wdirVal(:) = -999999999.0
|
||||
END IF
|
||||
IF (status_wsp /= CODES_SUCCESS) THEN
|
||||
allocate(wspVal(sizews))
|
||||
wspVal(:) = -999999999.0
|
||||
END IF
|
||||
|
||||
! ---- Print the values --------------------------------
|
||||
write (*, '(A,I7,A,A8,I9,I7.6,F9.3,F10.3,2F7.1,I4,I5)') 'Ob: ', count, &
|
||||
' ', statid, ymd, hms, lat(1), lon(1), htg, htp, INT(sondeType), sizews
|
||||
IF (status_rsno == CODES_SUCCESS) write (*, '(A,A,A,F7.3)') &
|
||||
'RS number/software/balloonwt: ', rsnumber, rssoftware, balloonwt
|
||||
IF (status_ht == CODES_SUCCESS .AND. SIZE(lat) > 1) write (*, '(A,A,F9.3,F10.3,F7.1)') &
|
||||
IF (status_ht == CODES_SUCCESS .AND. SIZE(lat) > 1) write (*, '(A,A10,F9.3,F10.3,F7.1)') &
|
||||
'WMO list lat, lon, ht: ', statid, lat(2), lon(2), htec
|
||||
write (*, '(A)') 'level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif'
|
||||
do i = 1, sizews
|
||||
|
|
|
@ -80,6 +80,7 @@ list( APPEND eccodes_src_files
|
|||
grib_accessor_class_hash_array.cc
|
||||
grib_accessor_class_decimal_precision.cc
|
||||
grib_accessor_class_divdouble.cc
|
||||
grib_accessor_class_multdouble.cc
|
||||
grib_accessor_class_budgdate.cc
|
||||
grib_accessor_class_validity_date.cc
|
||||
grib_accessor_class_validity_time.cc
|
||||
|
|
|
@ -128,7 +128,7 @@ grib_concept_value* action_concept_get_concept(grib_accessor* a)
|
|||
|
||||
int action_concept_get_nofail(grib_accessor* a)
|
||||
{
|
||||
grib_action_concept* self = (grib_action_concept*)a->creator;
|
||||
const grib_action_concept* self = (grib_action_concept*)a->creator;
|
||||
return self->nofail;
|
||||
}
|
||||
|
||||
|
@ -397,9 +397,9 @@ int get_concept_condition_string(grib_handle* h, const char* key, const char* va
|
|||
grib_concept_condition* concept_condition = concept_value->conditions;
|
||||
if (strcmp(pValue, concept_value->name) == 0) {
|
||||
while (concept_condition) {
|
||||
grib_expression* expression = concept_condition->expression;
|
||||
//grib_expression* expression = concept_condition->expression;
|
||||
const char* condition_name = concept_condition->name;
|
||||
Assert(expression);
|
||||
//Assert(expression);
|
||||
if (concept_condition_expression_true(h, concept_condition, exprVal) && strcmp(condition_name, "one") != 0) {
|
||||
length += snprintf(result + length, 2048, "%s%s=%s",
|
||||
(length == 0 ? "" : ","), condition_name, exprVal);
|
||||
|
|
|
@ -98,15 +98,14 @@ grib_action* grib_action_create_set_darray(grib_context* context,
|
|||
|
||||
static int execute(grib_action* a, grib_handle* h)
|
||||
{
|
||||
grib_action_set_darray* self = (grib_action_set_darray*)a;
|
||||
|
||||
const grib_action_set_darray* self = (grib_action_set_darray*)a;
|
||||
return grib_set_double_array(h, self->name, self->darray->v, self->darray->n);
|
||||
}
|
||||
|
||||
static void dump(grib_action* act, FILE* f, int lvl)
|
||||
{
|
||||
int i = 0;
|
||||
grib_action_set_darray* self = (grib_action_set_darray*)act;
|
||||
const grib_action_set_darray* self = (grib_action_set_darray*)act;
|
||||
for (i = 0; i < lvl; i++)
|
||||
grib_context_print(act->context, f, " ");
|
||||
grib_context_print(act->context, f, self->name);
|
||||
|
|
|
@ -73,8 +73,7 @@ static void init_class(grib_action_class* c)
|
|||
}
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
grib_action* grib_action_create_set_missing(grib_context* context,
|
||||
const char* name)
|
||||
grib_action* grib_action_create_set_missing(grib_context* context, const char* name)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
|
@ -98,15 +97,14 @@ grib_action* grib_action_create_set_missing(grib_context* context,
|
|||
|
||||
static int execute(grib_action* a, grib_handle* h)
|
||||
{
|
||||
grib_action_set_missing* self = (grib_action_set_missing*)a;
|
||||
|
||||
const grib_action_set_missing* self = (grib_action_set_missing*)a;
|
||||
return grib_set_missing(h, self->name);
|
||||
}
|
||||
|
||||
static void dump(grib_action* act, FILE* f, int lvl)
|
||||
{
|
||||
int i = 0;
|
||||
grib_action_set_missing* self = (grib_action_set_missing*)act;
|
||||
int i = 0;
|
||||
const grib_action_set_missing* self = (grib_action_set_missing*)act;
|
||||
for (i = 0; i < lvl; i++)
|
||||
grib_context_print(act->context, f, " ");
|
||||
grib_context_print(act->context, f, self->name);
|
||||
|
|
|
@ -72,9 +72,7 @@ static void init_class(grib_action_class* c)
|
|||
}
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
grib_action* grib_action_create_set_sarray(grib_context* context,
|
||||
const char* name,
|
||||
grib_sarray* sarray)
|
||||
grib_action* grib_action_create_set_sarray(grib_context* context, const char* name, grib_sarray* sarray)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
|
@ -100,14 +98,13 @@ grib_action* grib_action_create_set_sarray(grib_context* context,
|
|||
static int execute(grib_action* a, grib_handle* h)
|
||||
{
|
||||
grib_action_set_sarray* self = (grib_action_set_sarray*)a;
|
||||
|
||||
return grib_set_string_array(h, self->name, (const char**)self->sarray->v, self->sarray->n);
|
||||
}
|
||||
|
||||
static void dump(grib_action* act, FILE* f, int lvl)
|
||||
{
|
||||
int i = 0;
|
||||
grib_action_set_sarray* self = (grib_action_set_sarray*)act;
|
||||
int i = 0;
|
||||
const grib_action_set_sarray* self = (grib_action_set_sarray*)act;
|
||||
for (i = 0; i < lvl; i++)
|
||||
grib_context_print(act->context, f, " ");
|
||||
grib_context_print(act->context, f, self->name);
|
||||
|
|
|
@ -1311,7 +1311,6 @@ const char* grib_expression_get_name(grib_expression* g);
|
|||
void grib_expression_print(grib_context* ctx, grib_expression* g, grib_handle* f);
|
||||
void grib_expression_free(grib_context* ctx, grib_expression* g);
|
||||
void grib_expression_add_dependency(grib_expression* e, grib_accessor* observer);
|
||||
int grib_expression_set_value(grib_handle* h, grib_expression* g, grib_values* v);
|
||||
grib_arguments* grib_arguments_new(grib_context* c, grib_expression* g, grib_arguments* n);
|
||||
void grib_arguments_free(grib_context* c, grib_arguments* g);
|
||||
void grib_arguments_print(grib_context* c, grib_arguments* g, grib_handle* f);
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
|
||||
/***************************************************************************
|
||||
* Jean Baptiste Filippi - 01.11.2005
|
||||
* Enrico Fucile
|
||||
***************************************************************************/
|
||||
|
||||
#include "grib_accessor.h"
|
||||
|
||||
/* Note: A fast cut-down version of strcmp which does NOT return -1 */
|
||||
/* 0 means input strings are equal and 1 means not equal */
|
||||
// Note: A fast cut-down version of strcmp which does NOT return -1
|
||||
// 0 means input strings are equal and 1 means not equal
|
||||
GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
|
||||
{
|
||||
if (*a != *b)
|
||||
|
@ -44,7 +43,7 @@ void grib_accessor_dump(grib_accessor* a, grib_dumper* f)
|
|||
int grib_pack_missing(grib_accessor* a)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->pack_missing) {
|
||||
return c->pack_missing(a);
|
||||
|
@ -58,7 +57,6 @@ int grib_pack_missing(grib_accessor* a)
|
|||
int grib_pack_zero(grib_accessor* a)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
while (c) {
|
||||
if (c->clear) {
|
||||
return c->clear(a);
|
||||
|
@ -72,7 +70,8 @@ int grib_pack_zero(grib_accessor* a)
|
|||
int grib_is_missing_internal(grib_accessor* a)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
// grib_context_log(a->context, GRIB_LOG_DEBUG,
|
||||
// "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->is_missing) {
|
||||
return c->is_missing(a);
|
||||
|
@ -86,7 +85,7 @@ int grib_is_missing_internal(grib_accessor* a)
|
|||
int grib_pack_double(grib_accessor* a, const double* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->pack_double) {
|
||||
return c->pack_double(a, v, len);
|
||||
|
@ -113,7 +112,7 @@ int grib_pack_float(grib_accessor* a, const float* v, size_t* len)
|
|||
int grib_pack_expression(grib_accessor* a, grib_expression* e)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->pack_expression) {
|
||||
return c->pack_expression(a, e);
|
||||
|
@ -127,7 +126,7 @@ int grib_pack_expression(grib_accessor* a, grib_expression* e)
|
|||
int grib_pack_string(grib_accessor* a, const char* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (string) %s",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?v:"(null)");*/
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (string) %s",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?v:"(null)");
|
||||
while (c) {
|
||||
if (c->pack_string) {
|
||||
return c->pack_string(a, v, len);
|
||||
|
@ -141,7 +140,7 @@ int grib_pack_string(grib_accessor* a, const char* v, size_t* len)
|
|||
int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (string) %s",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?v:"(null)");*/
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (string) %s",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?v:"(null)");
|
||||
while (c) {
|
||||
if (c->pack_string_array) {
|
||||
return c->pack_string_array(a, v, len);
|
||||
|
@ -155,7 +154,7 @@ int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len)
|
|||
int grib_pack_long(grib_accessor* a, const long* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->pack_long) {
|
||||
return c->pack_long(a, v, len);
|
||||
|
@ -169,7 +168,7 @@ int grib_pack_long(grib_accessor* a, const long* v, size_t* len)
|
|||
int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (bytes) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (bytes) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->pack_bytes) {
|
||||
return c->pack_bytes(a, v, len);
|
||||
|
@ -183,7 +182,7 @@ int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len)
|
|||
int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (bytes)",(a->parent->owner)?(a->parent->owner->name):"root", a->name ); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (bytes)",(a->parent->owner)?(a->parent->owner->name):"root", a->name);
|
||||
while (c) {
|
||||
if (c->unpack_bytes) {
|
||||
return c->unpack_bytes(a, v, len);
|
||||
|
@ -210,7 +209,7 @@ int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_
|
|||
int grib_unpack_double(grib_accessor* a, double* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (double)",(a->parent->owner)?(a->parent->owner->name):"root", a->name ); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (double)",(a->parent->owner)?(a->parent->owner->name):"root", a->name);
|
||||
while (c) {
|
||||
if (c->unpack_double) {
|
||||
return c->unpack_double(a, v, len);
|
||||
|
@ -225,7 +224,7 @@ int grib_unpack_float(grib_accessor* a, float* v, size_t* len)
|
|||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
while (c) {
|
||||
/* printf("grib_accessor.c grib_unpack_float:: c->name=%s\n",c->name); */
|
||||
//printf("grib_accessor.c grib_unpack_float:: c->name=%s\n",c->name);
|
||||
if (c->unpack_float) {
|
||||
return c->unpack_float(a, v, len);
|
||||
}
|
||||
|
@ -260,20 +259,19 @@ int grib_unpack_double_element(grib_accessor* a, size_t i, double* v)
|
|||
}
|
||||
int grib_unpack_float_element(grib_accessor* a, size_t i, float* v)
|
||||
{
|
||||
/* grib_accessor_class* c = a->cclass;
|
||||
* while (c) {
|
||||
* if (c->unpack_float_element) {
|
||||
* return c->unpack_float_element(a, i, v);
|
||||
* }
|
||||
* c = c->super ? *(c->super) : NULL;
|
||||
* }
|
||||
*/
|
||||
// grib_accessor_class* c = a->cclass;
|
||||
// while (c) {
|
||||
// if (c->unpack_float_element) {
|
||||
// return c->unpack_float_element(a, i, v);
|
||||
// }
|
||||
// c = c->super ? *(c->super) : NULL;
|
||||
//}
|
||||
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Get the values for the indices passed in.
|
||||
* The length of the 'index_array' argument should be 'len' and 'val_array' should also contain at least 'len' elements
|
||||
*/
|
||||
// Get the values for the indices passed in.
|
||||
// The length of the 'index_array' argument should be 'len' and 'val_array' should also contain at least 'len' elements
|
||||
int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
|
@ -288,23 +286,22 @@ int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array,
|
|||
}
|
||||
int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, size_t len, float* val_array)
|
||||
{
|
||||
/*
|
||||
*grib_accessor_class* c = a->cclass;
|
||||
*DEBUG_ASSERT(len > 0);
|
||||
*while (c) {
|
||||
* if (c->unpack_float_element_set) {
|
||||
* return c->unpack_float_element_set(a, index_array, len, val_array);
|
||||
* }
|
||||
* c = c->super ? *(c->super) : NULL;
|
||||
*}
|
||||
*/
|
||||
// grib_accessor_class* c = a->cclass;
|
||||
// DEBUG_ASSERT(len > 0);
|
||||
// while (c) {
|
||||
// if (c->unpack_float_element_set) {
|
||||
// return c->unpack_float_element_set(a, index_array, len, val_array);
|
||||
// }
|
||||
// c = c->super ? *(c->super) : NULL;
|
||||
// }
|
||||
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int grib_unpack_string(grib_accessor* a, char* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/* grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (string)",(a->parent->owner)?(a->parent->owner->name):"root", a->name ); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (string)",(a->parent->owner)?(a->parent->owner->name):"root", a->name );
|
||||
while (c) {
|
||||
if (c->unpack_string) {
|
||||
return c->unpack_string(a, v, len);
|
||||
|
@ -399,7 +396,7 @@ int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_
|
|||
int grib_unpack_long(grib_accessor* a, long* v, size_t* len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (long)",(a->parent->owner)?(a->parent->owner->name):"root", a->name ); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is unpacking (long)",(a->parent->owner)?(a->parent->owner->name):"root", a->name );
|
||||
while (c) {
|
||||
if (c->unpack_long) {
|
||||
return c->unpack_long(a, v, len);
|
||||
|
@ -428,7 +425,8 @@ long grib_accessor_get_native_type(grib_accessor* a)
|
|||
long grib_get_next_position_offset(grib_accessor* a)
|
||||
{
|
||||
grib_accessor_class* c = NULL;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is checking next (long)",(a->parent->owner)?(a->parent->owner->name):"root", a->name ); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG,
|
||||
// "(%s)%s is checking next (long)",(a->parent->owner)?(a->parent->owner->name):"root", a->name );
|
||||
if (a)
|
||||
c = a->cclass;
|
||||
|
||||
|
@ -533,8 +531,7 @@ int grib_accessor_notify_change(grib_accessor* a, grib_accessor* changed)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* For this one, ALL init are called */
|
||||
|
||||
// For this one, ALL init are called
|
||||
static void init_accessor(grib_accessor_class* c, grib_accessor* a, const long len, grib_arguments* args)
|
||||
{
|
||||
if (c) {
|
||||
|
@ -550,27 +547,26 @@ void grib_init_accessor(grib_accessor* a, const long len, grib_arguments* args)
|
|||
init_accessor(a->cclass, a, len, args);
|
||||
}
|
||||
|
||||
/* For this one, ALL destroy are called */
|
||||
|
||||
// For this one, ALL destroy are called
|
||||
void grib_accessor_delete(grib_context* ct, grib_accessor* a)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
while (c) {
|
||||
grib_accessor_class* s = c->super ? *(c->super) : NULL;
|
||||
/*printf("grib_accessor_delete: before destroy a=%p c->name=%s ==> a->name=%s\n", (void*)a, c->name, a->name);*/
|
||||
//printf("grib_accessor_delete: before destroy a=%p c->name=%s ==> a->name=%s\n", (void*)a, c->name, a->name);
|
||||
if (c->destroy) {
|
||||
c->destroy(ct, a);
|
||||
}
|
||||
c = s;
|
||||
}
|
||||
/*printf("grib_accessor_delete before free a=%p\n", (void*)a);*/
|
||||
// printf("grib_accessor_delete before free a=%p\n", (void*)a);
|
||||
grib_context_free(ct, a);
|
||||
}
|
||||
|
||||
grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
grib_context* ct = a->context;
|
||||
const grib_context* ct = a->context;
|
||||
while (c) {
|
||||
grib_accessor_class* super = c->super ? *(c->super) : NULL;
|
||||
grib_context_log(ct, GRIB_LOG_DEBUG, "clone %s ==> %s", c->name, a->name);
|
||||
|
@ -585,7 +581,8 @@ grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err)
|
|||
void grib_update_size(grib_accessor* a, size_t len)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG,
|
||||
// "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->update_size) {
|
||||
c->update_size(a, len);
|
||||
|
@ -613,7 +610,8 @@ int grib_nearest_smaller_value(grib_accessor* a, double val, double* nearest)
|
|||
size_t grib_preferred_size(grib_accessor* a, int from_handle)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
// grib_context_log(a->context, GRIB_LOG_DEBUG,
|
||||
// "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->preferred_size) {
|
||||
return c->preferred_size(a, from_handle);
|
||||
|
@ -640,7 +638,8 @@ grib_accessor* grib_next_accessor(grib_accessor* a)
|
|||
void grib_resize(grib_accessor* a, size_t new_size)
|
||||
{
|
||||
grib_accessor_class* c = a->cclass;
|
||||
/*grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); */
|
||||
//grib_context_log(a->context, GRIB_LOG_DEBUG,
|
||||
// "(%s)%s is packing (long) %d",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
||||
while (c) {
|
||||
if (c->resize) {
|
||||
c->resize(a, new_size);
|
||||
|
@ -714,7 +713,7 @@ int grib_accessor_add_attribute(grib_accessor* a, grib_accessor* attr, int nest_
|
|||
|
||||
for (id = 0; id < MAX_ACCESSOR_ATTRIBUTES; id++) {
|
||||
if (aloc->attributes[id] == NULL) {
|
||||
/* attr->parent=a->parent; */
|
||||
// attr->parent=a->parent;
|
||||
aloc->attributes[id] = attr;
|
||||
attr->parent_as_attribute = aloc;
|
||||
if (aloc->same)
|
||||
|
@ -823,7 +822,7 @@ grib_accessors_list* grib_accessors_list_create(grib_context* c)
|
|||
void grib_accessors_list_push(grib_accessors_list* al, grib_accessor* a, int rank)
|
||||
{
|
||||
grib_accessors_list* last;
|
||||
grib_context* c = a->context;
|
||||
const grib_context* c = a->context;
|
||||
|
||||
last = grib_accessors_list_last(al);
|
||||
if (last && last->accessor) {
|
||||
|
@ -842,15 +841,13 @@ void grib_accessors_list_push(grib_accessors_list* al, grib_accessor* a, int ran
|
|||
|
||||
grib_accessors_list* grib_accessors_list_last(grib_accessors_list* al)
|
||||
{
|
||||
/*grib_accessors_list* last=al;*/
|
||||
/*grib_accessors_list* next=al->next;*/
|
||||
// grib_accessors_list* last=al;
|
||||
// grib_accessors_list* next=al->next;
|
||||
// while(next) {
|
||||
// last=next;
|
||||
// next=last->next;
|
||||
// }
|
||||
|
||||
/*
|
||||
while(next) {
|
||||
last=next;
|
||||
next=last->next;
|
||||
}
|
||||
*/
|
||||
return al->last;
|
||||
}
|
||||
|
||||
|
@ -875,7 +872,7 @@ void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al)
|
|||
|
||||
while (al) {
|
||||
tmp = al->next;
|
||||
/*grib_accessor_delete(c, al->accessor);*/
|
||||
//grib_accessor_delete(c, al->accessor);
|
||||
grib_context_free(c, al);
|
||||
al = tmp;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ extern grib_accessor_class* grib_accessor_class_mars_step;
|
|||
extern grib_accessor_class* grib_accessor_class_md5;
|
||||
extern grib_accessor_class* grib_accessor_class_message;
|
||||
extern grib_accessor_class* grib_accessor_class_message_copy;
|
||||
extern grib_accessor_class* grib_accessor_class_multdouble;
|
||||
extern grib_accessor_class* grib_accessor_class_nearest;
|
||||
extern grib_accessor_class* grib_accessor_class_non_alpha;
|
||||
extern grib_accessor_class* grib_accessor_class_number_of_coded_values;
|
||||
|
|
|
@ -147,19 +147,19 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
const size_t alen = a->length;
|
||||
|
||||
if (len[0] < (alen + 1)) {
|
||||
if (*len < (alen + 1)) {
|
||||
const char* cclass_name = a->cclass->name;
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
cclass_name, a->name, alen+1, *len);
|
||||
len[0] = alen + 1;
|
||||
*len = alen + 1;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
for (i = 0; i < alen; i++)
|
||||
val[i] = hand->buffer->data[a->offset + i];
|
||||
val[i] = 0;
|
||||
len[0] = i;
|
||||
*len = i;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
val[i] = hand->buffer->data[a->offset + i];
|
||||
}
|
||||
|
||||
len[0] = a->length;
|
||||
*len = a->length;
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -7,11 +7,6 @@
|
|||
* 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.
|
||||
*/
|
||||
|
||||
/*****************************************
|
||||
* Enrico Fucile
|
||||
****************************************/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
@ -108,7 +103,7 @@ grib_accessor_class* grib_accessor_class_divdouble = &_grib_accessor_class_divdo
|
|||
static void init(grib_accessor* a, const long l, grib_arguments* c)
|
||||
{
|
||||
grib_accessor_divdouble* self = (grib_accessor_divdouble*)a;
|
||||
int n = 0;
|
||||
int n = 0;
|
||||
|
||||
self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||
self->divisor = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++);
|
||||
|
@ -116,22 +111,17 @@ static void init(grib_accessor* a, const long l, grib_arguments* c)
|
|||
|
||||
static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||
{
|
||||
grib_accessor_divdouble* self = (grib_accessor_divdouble*)a;
|
||||
int ret = GRIB_SUCCESS;
|
||||
double value = 0;
|
||||
|
||||
if (*len < 1) {
|
||||
*len = 1;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
const grib_accessor_divdouble* self = (grib_accessor_divdouble*)a;
|
||||
int ret = GRIB_SUCCESS;
|
||||
double value = 0;
|
||||
|
||||
ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value);
|
||||
|
||||
if (ret != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* fprintf(stdout,"\nname %s %s %g/%g\n",a->name ,self->val,value,divisor);*/
|
||||
Assert(self->divisor != 0);
|
||||
if (self->divisor == 0) {
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
*val = value / self->divisor;
|
||||
|
||||
*len = 1;
|
||||
|
|
|
@ -223,7 +223,7 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
|
|||
* Its max size is X (from FXY) which is 6 bits so no need for malloc */
|
||||
bufr_descriptor* ur[65] = {0,};
|
||||
bufr_descriptor* urc = NULL;
|
||||
int idx;
|
||||
size_t idx = 0;
|
||||
bufr_descriptor* u0 = NULL;
|
||||
grib_context* c = a->context;
|
||||
bufr_descriptor* us = NULL;
|
||||
|
|
|
@ -211,6 +211,11 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
if ((ret = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
// TODO(maee): A better solution should be found
|
||||
if (h->loader) { // h->loader is set only when rebuilding or reparsing
|
||||
force_step_units = 255; // See ECC-1768
|
||||
}
|
||||
|
||||
try {
|
||||
std::vector<eccodes::Step> steps = parse_range(val, eccodes::Unit{force_step_units});
|
||||
if (steps.size() == 0) {
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
||||
START_CLASS_DEF
|
||||
CLASS = accessor
|
||||
SUPER = grib_accessor_class_double
|
||||
IMPLEMENTS = unpack_double
|
||||
IMPLEMENTS = init
|
||||
MEMBERS = const char* val
|
||||
MEMBERS = double multiplier
|
||||
END_CLASS_DEF
|
||||
|
||||
*/
|
||||
|
||||
/* START_CLASS_IMP */
|
||||
|
||||
/*
|
||||
|
||||
Don't edit anything between START_CLASS_IMP and END_CLASS_IMP
|
||||
Instead edit values between START_CLASS_DEF and END_CLASS_DEF
|
||||
or edit "accessor.class" and rerun ./make_class.pl
|
||||
|
||||
*/
|
||||
|
||||
static int unpack_double(grib_accessor*, double* val, size_t* len);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
|
||||
typedef struct grib_accessor_multdouble
|
||||
{
|
||||
grib_accessor att;
|
||||
/* Members defined in gen */
|
||||
/* Members defined in double */
|
||||
/* Members defined in multdouble */
|
||||
const char* val;
|
||||
double multiplier;
|
||||
} grib_accessor_multdouble;
|
||||
|
||||
extern grib_accessor_class* grib_accessor_class_double;
|
||||
|
||||
static grib_accessor_class _grib_accessor_class_multdouble = {
|
||||
&grib_accessor_class_double, /* super */
|
||||
"multdouble", /* name */
|
||||
sizeof(grib_accessor_multdouble), /* size */
|
||||
0, /* inited */
|
||||
0, /* init_class */
|
||||
&init, /* init */
|
||||
0, /* post_init */
|
||||
0, /* destroy */
|
||||
0, /* dump */
|
||||
0, /* next_offset */
|
||||
0, /* get length of string */
|
||||
0, /* get number of values */
|
||||
0, /* get number of bytes */
|
||||
0, /* get offset to bytes */
|
||||
0, /* get native type */
|
||||
0, /* get sub_section */
|
||||
0, /* pack_missing */
|
||||
0, /* is_missing */
|
||||
0, /* pack_long */
|
||||
0, /* unpack_long */
|
||||
0, /* pack_double */
|
||||
0, /* pack_float */
|
||||
&unpack_double, /* unpack_double */
|
||||
0, /* unpack_float */
|
||||
0, /* pack_string */
|
||||
0, /* unpack_string */
|
||||
0, /* pack_string_array */
|
||||
0, /* unpack_string_array */
|
||||
0, /* pack_bytes */
|
||||
0, /* unpack_bytes */
|
||||
0, /* pack_expression */
|
||||
0, /* notify_change */
|
||||
0, /* update_size */
|
||||
0, /* preferred_size */
|
||||
0, /* resize */
|
||||
0, /* nearest_smaller_value */
|
||||
0, /* next accessor */
|
||||
0, /* compare vs. another accessor */
|
||||
0, /* unpack only ith value (double) */
|
||||
0, /* unpack only ith value (float) */
|
||||
0, /* unpack a given set of elements (double) */
|
||||
0, /* unpack a given set of elements (float) */
|
||||
0, /* unpack a subarray */
|
||||
0, /* clear */
|
||||
0, /* clone accessor */
|
||||
};
|
||||
|
||||
|
||||
grib_accessor_class* grib_accessor_class_multdouble = &_grib_accessor_class_multdouble;
|
||||
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
static void init(grib_accessor* a, const long l, grib_arguments* c)
|
||||
{
|
||||
grib_accessor_multdouble* self = (grib_accessor_multdouble*)a;
|
||||
int n = 0;
|
||||
|
||||
self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||
self->multiplier = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++);
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||
{
|
||||
const grib_accessor_multdouble* self = (grib_accessor_multdouble*)a;
|
||||
int ret = GRIB_SUCCESS;
|
||||
double value = 0;
|
||||
|
||||
ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value);
|
||||
if (ret != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
*val = value * self->multiplier;
|
||||
|
||||
*len = 1;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
|
@ -149,20 +149,20 @@ static int get_native_type(grib_accessor* a)
|
|||
static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||
{
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
int i = 0;
|
||||
long i = 0;
|
||||
|
||||
if (len[0] < (a->length + 1)) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s it contains %ld values",
|
||||
len[0], a->name, a->length + 1);
|
||||
len[0] = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
if (*len < (a->length + 1)) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values",
|
||||
*len, a->name, a->length + 1);
|
||||
*len = a->length + 1;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
for (i = 0; i < a->length; i++) {
|
||||
val[i] = hand->buffer->data[a->offset + i];
|
||||
}
|
||||
val[i] = 0;
|
||||
len[0] = i;
|
||||
*len = i;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,6 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
|
|||
|
||||
*v = strtol(val, &last, 10);
|
||||
|
||||
grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -204,7 +203,6 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len)
|
|||
*v = strtod(val, &last);
|
||||
|
||||
if (*last == 0) {
|
||||
grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,18 +166,17 @@ static int get_native_type(grib_accessor* a)
|
|||
|
||||
static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||
{
|
||||
int err = 0;
|
||||
grib_accessor_to_double* self = (grib_accessor_to_double*)a;
|
||||
char buff[512] = {0,};
|
||||
size_t length;
|
||||
|
||||
int err = 0;
|
||||
char buff[512] = {0,};
|
||||
size_t size = 512;
|
||||
size_t length = string_length(a);
|
||||
|
||||
length = string_length(a);
|
||||
|
||||
if (len[0] < length + 1) {
|
||||
if (*len < length + 1) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values",
|
||||
len[0], a->name, a->length + 1);
|
||||
len[0] = 0;
|
||||
*len, a->name, a->length + 1);
|
||||
*len = length + 1;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
||||
|
@ -192,7 +191,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
memcpy(val, buff + self->start, length);
|
||||
|
||||
val[length] = 0;
|
||||
len[0] = length;
|
||||
*len = length;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,19 +164,21 @@ static int get_native_type(grib_accessor* a)
|
|||
|
||||
static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||
{
|
||||
int err = 0;
|
||||
grib_accessor_to_integer* self = (grib_accessor_to_integer*)a;
|
||||
char buff[512] = {0,};
|
||||
size_t length;
|
||||
|
||||
int err = 0;
|
||||
char buff[512] = {0,};
|
||||
size_t size = 512;
|
||||
|
||||
length = string_length(a);
|
||||
size_t length = string_length(a);
|
||||
|
||||
if (len[0] < length + 1) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values",
|
||||
len[0], a->name, a->length + 1);
|
||||
len[0] = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
if (*len < length + 1) {
|
||||
const char* cclass_name = a->cclass->name;
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
cclass_name, a->name, length+1, *len);
|
||||
*len = length + 1;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size);
|
||||
|
@ -190,7 +192,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
memcpy(val, buff + self->start, length);
|
||||
|
||||
val[length] = 0;
|
||||
len[0] = length;
|
||||
*len = length;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,16 +163,18 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
{
|
||||
grib_accessor_to_string* self = (grib_accessor_to_string*)a;
|
||||
|
||||
int err = 0;
|
||||
int err = 0;
|
||||
char buff[512] = {0,};
|
||||
|
||||
size_t length = string_length(a);
|
||||
|
||||
if (len[0] < length + 1) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values",
|
||||
len[0], a->name, a->length + 1);
|
||||
len[0] = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
if (*len < length + 1) {
|
||||
const char* cclass_name = a->cclass->name;
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
cclass_name, a->name, length+1, *len);
|
||||
*len = length + 1;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
size_t size = sizeof(buff);
|
||||
|
@ -187,7 +189,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
|||
memcpy(val, buff + self->start, length);
|
||||
|
||||
val[length] = 0;
|
||||
len[0] = length;
|
||||
*len = length;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#line 6 "accessor_class_list.gperf"
|
||||
struct accessor_class_hash { char *name; grib_accessor_class **cclass;};
|
||||
|
||||
#define TOTAL_KEYWORDS 204
|
||||
#define TOTAL_KEYWORDS 205
|
||||
#define MIN_WORD_LENGTH 1
|
||||
#define MAX_WORD_LENGTH 44
|
||||
#define MIN_HASH_VALUE 1
|
||||
|
@ -117,21 +117,21 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 9 "accessor_class_list.gperf"
|
||||
{" "},
|
||||
{""}, {""}, {""}, {""},
|
||||
#line 178 "accessor_class_list.gperf"
|
||||
#line 179 "accessor_class_list.gperf"
|
||||
{"size", &grib_accessor_class_size},
|
||||
#line 12 "accessor_class_list.gperf"
|
||||
{"ascii", &grib_accessor_class_ascii},
|
||||
#line 175 "accessor_class_list.gperf"
|
||||
#line 176 "accessor_class_list.gperf"
|
||||
{"signed", &grib_accessor_class_signed},
|
||||
#line 155 "accessor_class_list.gperf"
|
||||
#line 156 "accessor_class_list.gperf"
|
||||
{"pad", &grib_accessor_class_pad},
|
||||
#line 181 "accessor_class_list.gperf"
|
||||
#line 182 "accessor_class_list.gperf"
|
||||
{"spd", &grib_accessor_class_spd},
|
||||
{""},
|
||||
#line 75 "accessor_class_list.gperf"
|
||||
{"dirty", &grib_accessor_class_dirty},
|
||||
{""},
|
||||
#line 176 "accessor_class_list.gperf"
|
||||
#line 177 "accessor_class_list.gperf"
|
||||
{"signed_bits", &grib_accessor_class_signed_bits},
|
||||
{""},
|
||||
#line 66 "accessor_class_list.gperf"
|
||||
|
@ -141,7 +141,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{"data_simple_packing", &grib_accessor_class_data_simple_packing},
|
||||
#line 68 "accessor_class_list.gperf"
|
||||
{"data_secondary_bitmap", &grib_accessor_class_data_secondary_bitmap},
|
||||
#line 169 "accessor_class_list.gperf"
|
||||
#line 170 "accessor_class_list.gperf"
|
||||
{"section", &grib_accessor_class_section},
|
||||
#line 43 "accessor_class_list.gperf"
|
||||
{"data_apply_bitmap", &grib_accessor_class_data_apply_bitmap},
|
||||
|
@ -155,36 +155,36 @@ static const struct accessor_class_hash classes[] =
|
|||
{"data_jpeg2000_packing", &grib_accessor_class_data_jpeg2000_packing},
|
||||
#line 65 "accessor_class_list.gperf"
|
||||
{"data_png_packing", &grib_accessor_class_data_png_packing},
|
||||
#line 171 "accessor_class_list.gperf"
|
||||
{"section_padding", &grib_accessor_class_section_padding},
|
||||
#line 172 "accessor_class_list.gperf"
|
||||
{"section_padding", &grib_accessor_class_section_padding},
|
||||
#line 173 "accessor_class_list.gperf"
|
||||
{"section_pointer", &grib_accessor_class_section_pointer},
|
||||
#line 44 "accessor_class_list.gperf"
|
||||
{"data_apply_boustrophedonic", &grib_accessor_class_data_apply_boustrophedonic},
|
||||
{""}, {""}, {""}, {""},
|
||||
#line 80 "accessor_class_list.gperf"
|
||||
{"expanded_descriptors", &grib_accessor_class_expanded_descriptors},
|
||||
#line 156 "accessor_class_list.gperf"
|
||||
#line 157 "accessor_class_list.gperf"
|
||||
{"padding", &grib_accessor_class_padding},
|
||||
#line 45 "accessor_class_list.gperf"
|
||||
{"data_apply_boustrophedonic_bitmap", &grib_accessor_class_data_apply_boustrophedonic_bitmap},
|
||||
#line 110 "accessor_class_list.gperf"
|
||||
{"gds_is_present", &grib_accessor_class_gds_is_present},
|
||||
#line 168 "accessor_class_list.gperf"
|
||||
#line 169 "accessor_class_list.gperf"
|
||||
{"second_order_bits_per_value", &grib_accessor_class_second_order_bits_per_value},
|
||||
#line 170 "accessor_class_list.gperf"
|
||||
#line 171 "accessor_class_list.gperf"
|
||||
{"section_length", &grib_accessor_class_section_length},
|
||||
#line 113 "accessor_class_list.gperf"
|
||||
{"getenv", &grib_accessor_class_getenv},
|
||||
#line 57 "accessor_class_list.gperf"
|
||||
{"data_g22order_packing", &grib_accessor_class_data_g22order_packing},
|
||||
#line 190 "accessor_class_list.gperf"
|
||||
#line 191 "accessor_class_list.gperf"
|
||||
{"time", &grib_accessor_class_time},
|
||||
{""},
|
||||
#line 61 "accessor_class_list.gperf"
|
||||
{"data_g2shsimple_packing", &grib_accessor_class_data_g2shsimple_packing},
|
||||
{""},
|
||||
#line 154 "accessor_class_list.gperf"
|
||||
#line 155 "accessor_class_list.gperf"
|
||||
{"packing_type", &grib_accessor_class_packing_type},
|
||||
#line 62 "accessor_class_list.gperf"
|
||||
{"data_g2simple_packing", &grib_accessor_class_data_g2simple_packing},
|
||||
|
@ -198,28 +198,28 @@ static const struct accessor_class_hash classes[] =
|
|||
{"g2end_step", &grib_accessor_class_g2end_step},
|
||||
#line 98 "accessor_class_list.gperf"
|
||||
{"g2_eps", &grib_accessor_class_g2_eps},
|
||||
#line 141 "accessor_class_list.gperf"
|
||||
#line 142 "accessor_class_list.gperf"
|
||||
{"nearest", &grib_accessor_class_nearest},
|
||||
{""},
|
||||
#line 157 "accessor_class_list.gperf"
|
||||
#line 158 "accessor_class_list.gperf"
|
||||
{"padto", &grib_accessor_class_padto},
|
||||
#line 188 "accessor_class_list.gperf"
|
||||
#line 189 "accessor_class_list.gperf"
|
||||
{"sum", &grib_accessor_class_sum},
|
||||
{""},
|
||||
#line 107 "accessor_class_list.gperf"
|
||||
{"g2lon", &grib_accessor_class_g2lon},
|
||||
#line 202 "accessor_class_list.gperf"
|
||||
#line 203 "accessor_class_list.gperf"
|
||||
{"uint8", &grib_accessor_class_uint8},
|
||||
{""},
|
||||
#line 187 "accessor_class_list.gperf"
|
||||
#line 188 "accessor_class_list.gperf"
|
||||
{"step_in_units", &grib_accessor_class_step_in_units},
|
||||
#line 63 "accessor_class_list.gperf"
|
||||
{"data_g2simple_packing_with_preprocessing", &grib_accessor_class_data_g2simple_packing_with_preprocessing},
|
||||
#line 200 "accessor_class_list.gperf"
|
||||
#line 201 "accessor_class_list.gperf"
|
||||
{"uint64", &grib_accessor_class_uint64},
|
||||
#line 47 "accessor_class_list.gperf"
|
||||
{"data_complex_packing", &grib_accessor_class_data_complex_packing},
|
||||
#line 198 "accessor_class_list.gperf"
|
||||
#line 199 "accessor_class_list.gperf"
|
||||
{"uint32", &grib_accessor_class_uint32},
|
||||
#line 13 "accessor_class_list.gperf"
|
||||
{"bit", &grib_accessor_class_bit},
|
||||
|
@ -233,7 +233,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{"julian_day", &grib_accessor_class_julian_day},
|
||||
#line 123 "accessor_class_list.gperf"
|
||||
{"julian_date", &grib_accessor_class_julian_date},
|
||||
#line 142 "accessor_class_list.gperf"
|
||||
#line 143 "accessor_class_list.gperf"
|
||||
{"non_alpha", &grib_accessor_class_non_alpha},
|
||||
{""},
|
||||
#line 29 "accessor_class_list.gperf"
|
||||
|
@ -245,14 +245,14 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 16 "accessor_class_list.gperf"
|
||||
{"bits_per_value", &grib_accessor_class_bits_per_value},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
#line 166 "accessor_class_list.gperf"
|
||||
#line 167 "accessor_class_list.gperf"
|
||||
{"scale", &grib_accessor_class_scale},
|
||||
{""},
|
||||
#line 184 "accessor_class_list.gperf"
|
||||
#line 185 "accessor_class_list.gperf"
|
||||
{"statistics", &grib_accessor_class_statistics},
|
||||
#line 102 "accessor_class_list.gperf"
|
||||
{"g2date", &grib_accessor_class_g2date},
|
||||
#line 144 "accessor_class_list.gperf"
|
||||
#line 145 "accessor_class_list.gperf"
|
||||
{"number_of_points", &grib_accessor_class_number_of_points},
|
||||
#line 100 "accessor_class_list.gperf"
|
||||
{"g2bitmap", &grib_accessor_class_g2bitmap},
|
||||
|
@ -265,13 +265,13 @@ static const struct accessor_class_hash classes[] =
|
|||
{"gds_not_present_bitmap", &grib_accessor_class_gds_not_present_bitmap},
|
||||
#line 122 "accessor_class_list.gperf"
|
||||
{"iterator", &grib_accessor_class_iterator},
|
||||
#line 185 "accessor_class_list.gperf"
|
||||
#line 186 "accessor_class_list.gperf"
|
||||
{"statistics_spectral", &grib_accessor_class_statistics_spectral},
|
||||
#line 46 "accessor_class_list.gperf"
|
||||
{"data_ccsds_packing", &grib_accessor_class_data_ccsds_packing},
|
||||
#line 145 "accessor_class_list.gperf"
|
||||
#line 146 "accessor_class_list.gperf"
|
||||
{"number_of_points_gaussian", &grib_accessor_class_number_of_points_gaussian},
|
||||
#line 205 "accessor_class_list.gperf"
|
||||
#line 206 "accessor_class_list.gperf"
|
||||
{"unsigned", &grib_accessor_class_unsigned},
|
||||
#line 138 "accessor_class_list.gperf"
|
||||
{"md5", &grib_accessor_class_md5},
|
||||
|
@ -280,30 +280,30 @@ static const struct accessor_class_hash classes[] =
|
|||
{"g2_aerosol", &grib_accessor_class_g2_aerosol},
|
||||
#line 139 "accessor_class_list.gperf"
|
||||
{"message", &grib_accessor_class_message},
|
||||
#line 206 "accessor_class_list.gperf"
|
||||
#line 207 "accessor_class_list.gperf"
|
||||
{"unsigned_bits", &grib_accessor_class_unsigned_bits},
|
||||
#line 173 "accessor_class_list.gperf"
|
||||
#line 174 "accessor_class_list.gperf"
|
||||
{"select_step_template", &grib_accessor_class_select_step_template},
|
||||
#line 136 "accessor_class_list.gperf"
|
||||
{"mars_param", &grib_accessor_class_mars_param},
|
||||
#line 203 "accessor_class_list.gperf"
|
||||
#line 204 "accessor_class_list.gperf"
|
||||
{"unexpanded_descriptors", &grib_accessor_class_unexpanded_descriptors},
|
||||
#line 192 "accessor_class_list.gperf"
|
||||
#line 193 "accessor_class_list.gperf"
|
||||
{"to_integer", &grib_accessor_class_to_integer},
|
||||
{""}, {""}, {""},
|
||||
#line 177 "accessor_class_list.gperf"
|
||||
#line 178 "accessor_class_list.gperf"
|
||||
{"simple_packing_error", &grib_accessor_class_simple_packing_error},
|
||||
#line 186 "accessor_class_list.gperf"
|
||||
#line 187 "accessor_class_list.gperf"
|
||||
{"step_human_readable", &grib_accessor_class_step_human_readable},
|
||||
#line 140 "accessor_class_list.gperf"
|
||||
{"message_copy", &grib_accessor_class_message_copy},
|
||||
#line 162 "accessor_class_list.gperf"
|
||||
#line 163 "accessor_class_list.gperf"
|
||||
{"raw", &grib_accessor_class_raw},
|
||||
{""}, {""},
|
||||
#line 201 "accessor_class_list.gperf"
|
||||
#line 202 "accessor_class_list.gperf"
|
||||
{"uint64_little_endian", &grib_accessor_class_uint64_little_endian},
|
||||
{""},
|
||||
#line 199 "accessor_class_list.gperf"
|
||||
#line 200 "accessor_class_list.gperf"
|
||||
{"uint32_little_endian", &grib_accessor_class_uint32_little_endian},
|
||||
#line 114 "accessor_class_list.gperf"
|
||||
{"global_gaussian", &grib_accessor_class_global_gaussian},
|
||||
|
@ -311,20 +311,20 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 76 "accessor_class_list.gperf"
|
||||
{"divdouble", &grib_accessor_class_divdouble},
|
||||
{""},
|
||||
#line 174 "accessor_class_list.gperf"
|
||||
#line 175 "accessor_class_list.gperf"
|
||||
{"sexagesimal2decimal", &grib_accessor_class_sexagesimal2decimal},
|
||||
#line 99 "accessor_class_list.gperf"
|
||||
{"g2_mars_labeling", &grib_accessor_class_g2_mars_labeling},
|
||||
#line 78 "accessor_class_list.gperf"
|
||||
{"element", &grib_accessor_class_element},
|
||||
#line 159 "accessor_class_list.gperf"
|
||||
#line 160 "accessor_class_list.gperf"
|
||||
{"padtomultiple", &grib_accessor_class_padtomultiple},
|
||||
#line 127 "accessor_class_list.gperf"
|
||||
{"latitudes", &grib_accessor_class_latitudes},
|
||||
#line 163 "accessor_class_list.gperf"
|
||||
#line 164 "accessor_class_list.gperf"
|
||||
{"rdbtime_guess_date", &grib_accessor_class_rdbtime_guess_date},
|
||||
{""}, {""}, {""},
|
||||
#line 193 "accessor_class_list.gperf"
|
||||
#line 194 "accessor_class_list.gperf"
|
||||
{"to_string", &grib_accessor_class_to_string},
|
||||
#line 132 "accessor_class_list.gperf"
|
||||
{"long", &grib_accessor_class_long},
|
||||
|
@ -348,20 +348,20 @@ static const struct accessor_class_hash classes[] =
|
|||
{""},
|
||||
#line 28 "accessor_class_list.gperf"
|
||||
{"bufrdc_expanded_descriptors", &grib_accessor_class_bufrdc_expanded_descriptors},
|
||||
#line 160 "accessor_class_list.gperf"
|
||||
#line 161 "accessor_class_list.gperf"
|
||||
{"position", &grib_accessor_class_position},
|
||||
{""}, {""}, {""},
|
||||
#line 17 "accessor_class_list.gperf"
|
||||
{"blob", &grib_accessor_class_blob},
|
||||
#line 109 "accessor_class_list.gperf"
|
||||
{"gaussian_grid_name", &grib_accessor_class_gaussian_grid_name},
|
||||
#line 196 "accessor_class_list.gperf"
|
||||
#line 197 "accessor_class_list.gperf"
|
||||
{"trim", &grib_accessor_class_trim},
|
||||
{""}, {""},
|
||||
#line 119 "accessor_class_list.gperf"
|
||||
{"ibmfloat", &grib_accessor_class_ibmfloat},
|
||||
{""}, {""},
|
||||
#line 194 "accessor_class_list.gperf"
|
||||
#line 195 "accessor_class_list.gperf"
|
||||
{"transient", &grib_accessor_class_transient},
|
||||
#line 55 "accessor_class_list.gperf"
|
||||
{"data_g1shsimple_packing", &grib_accessor_class_data_g1shsimple_packing},
|
||||
|
@ -370,15 +370,15 @@ static const struct accessor_class_hash classes[] =
|
|||
{"data_g1simple_packing", &grib_accessor_class_data_g1simple_packing},
|
||||
#line 49 "accessor_class_list.gperf"
|
||||
{"data_g1complex_packing", &grib_accessor_class_data_g1complex_packing},
|
||||
#line 165 "accessor_class_list.gperf"
|
||||
#line 166 "accessor_class_list.gperf"
|
||||
{"round", &grib_accessor_class_round},
|
||||
#line 195 "accessor_class_list.gperf"
|
||||
#line 196 "accessor_class_list.gperf"
|
||||
{"transient_darray", &grib_accessor_class_transient_darray},
|
||||
#line 18 "accessor_class_list.gperf"
|
||||
{"budgdate", &grib_accessor_class_budgdate},
|
||||
#line 209 "accessor_class_list.gperf"
|
||||
#line 210 "accessor_class_list.gperf"
|
||||
{"values", &grib_accessor_class_values},
|
||||
#line 143 "accessor_class_list.gperf"
|
||||
#line 144 "accessor_class_list.gperf"
|
||||
{"number_of_coded_values", &grib_accessor_class_number_of_coded_values},
|
||||
#line 126 "accessor_class_list.gperf"
|
||||
{"label", &grib_accessor_class_label},
|
||||
|
@ -386,30 +386,30 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 38 "accessor_class_list.gperf"
|
||||
{"concept", &grib_accessor_class_concept},
|
||||
{""},
|
||||
#line 182 "accessor_class_list.gperf"
|
||||
#line 183 "accessor_class_list.gperf"
|
||||
{"spectral_truncation", &grib_accessor_class_spectral_truncation},
|
||||
{""}, {""},
|
||||
#line 83 "accessor_class_list.gperf"
|
||||
{"g1_message_length", &grib_accessor_class_g1_message_length},
|
||||
#line 183 "accessor_class_list.gperf"
|
||||
#line 184 "accessor_class_list.gperf"
|
||||
{"sprintf", &grib_accessor_class_sprintf},
|
||||
#line 189 "accessor_class_list.gperf"
|
||||
#line 190 "accessor_class_list.gperf"
|
||||
{"suppressed", &grib_accessor_class_suppressed},
|
||||
{""},
|
||||
#line 212 "accessor_class_list.gperf"
|
||||
#line 213 "accessor_class_list.gperf"
|
||||
{"when", &grib_accessor_class_when},
|
||||
{""}, {""},
|
||||
#line 179 "accessor_class_list.gperf"
|
||||
#line 180 "accessor_class_list.gperf"
|
||||
{"smart_table", &grib_accessor_class_smart_table},
|
||||
{""},
|
||||
#line 39 "accessor_class_list.gperf"
|
||||
{"constant", &grib_accessor_class_constant},
|
||||
{""}, {""},
|
||||
#line 161 "accessor_class_list.gperf"
|
||||
#line 162 "accessor_class_list.gperf"
|
||||
{"proj_string", &grib_accessor_class_proj_string},
|
||||
#line 149 "accessor_class_list.gperf"
|
||||
#line 150 "accessor_class_list.gperf"
|
||||
{"octet_number", &grib_accessor_class_octet_number},
|
||||
#line 180 "accessor_class_list.gperf"
|
||||
#line 181 "accessor_class_list.gperf"
|
||||
{"smart_table_column", &grib_accessor_class_smart_table_column},
|
||||
{""},
|
||||
#line 135 "accessor_class_list.gperf"
|
||||
|
@ -426,7 +426,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{"data_sh_unpacked", &grib_accessor_class_data_sh_unpacked},
|
||||
#line 27 "accessor_class_list.gperf"
|
||||
{"bufr_string_values", &grib_accessor_class_bufr_string_values},
|
||||
#line 197 "accessor_class_list.gperf"
|
||||
#line 198 "accessor_class_list.gperf"
|
||||
{"uint16", &grib_accessor_class_uint16},
|
||||
{""}, {""},
|
||||
#line 71 "accessor_class_list.gperf"
|
||||
|
@ -439,26 +439,27 @@ static const struct accessor_class_hash classes[] =
|
|||
{""},
|
||||
#line 54 "accessor_class_list.gperf"
|
||||
{"data_g1secondary_bitmap", &grib_accessor_class_data_g1secondary_bitmap},
|
||||
#line 191 "accessor_class_list.gperf"
|
||||
#line 192 "accessor_class_list.gperf"
|
||||
{"to_double", &grib_accessor_class_to_double},
|
||||
#line 101 "accessor_class_list.gperf"
|
||||
{"g2bitmap_present", &grib_accessor_class_g2bitmap_present},
|
||||
#line 120 "accessor_class_list.gperf"
|
||||
{"ieeefloat", &grib_accessor_class_ieeefloat},
|
||||
#line 150 "accessor_class_list.gperf"
|
||||
#line 151 "accessor_class_list.gperf"
|
||||
{"offset_file", &grib_accessor_class_offset_file},
|
||||
#line 207 "accessor_class_list.gperf"
|
||||
{"validity_date", &grib_accessor_class_validity_date},
|
||||
#line 208 "accessor_class_list.gperf"
|
||||
{"validity_date", &grib_accessor_class_validity_date},
|
||||
#line 209 "accessor_class_list.gperf"
|
||||
{"validity_time", &grib_accessor_class_validity_time},
|
||||
{""},
|
||||
#line 130 "accessor_class_list.gperf"
|
||||
{"library_version", &grib_accessor_class_library_version},
|
||||
#line 211 "accessor_class_list.gperf"
|
||||
#line 212 "accessor_class_list.gperf"
|
||||
{"vector", &grib_accessor_class_vector},
|
||||
#line 84 "accessor_class_list.gperf"
|
||||
{"g1_section4_length", &grib_accessor_class_g1_section4_length},
|
||||
{""},
|
||||
#line 141 "accessor_class_list.gperf"
|
||||
{"multdouble", &grib_accessor_class_multdouble},
|
||||
#line 52 "accessor_class_list.gperf"
|
||||
{"data_g1second_order_general_packing", &grib_accessor_class_data_g1second_order_general_packing},
|
||||
{""}, {""},
|
||||
|
@ -467,7 +468,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{""},
|
||||
#line 24 "accessor_class_list.gperf"
|
||||
{"bufr_extract_subsets", &grib_accessor_class_bufr_extract_subsets},
|
||||
#line 158 "accessor_class_list.gperf"
|
||||
#line 159 "accessor_class_list.gperf"
|
||||
{"padtoeven", &grib_accessor_class_padtoeven},
|
||||
#line 50 "accessor_class_list.gperf"
|
||||
{"data_g1second_order_constant_width_packing", &grib_accessor_class_data_g1second_order_constant_width_packing},
|
||||
|
@ -483,7 +484,7 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 21 "accessor_class_list.gperf"
|
||||
{"bufr_elements_table", &grib_accessor_class_bufr_elements_table},
|
||||
{""}, {""}, {""}, {""},
|
||||
#line 153 "accessor_class_list.gperf"
|
||||
#line 154 "accessor_class_list.gperf"
|
||||
{"pack_bufr_values", &grib_accessor_class_pack_bufr_values},
|
||||
#line 35 "accessor_class_list.gperf"
|
||||
{"codetable", &grib_accessor_class_codetable},
|
||||
|
@ -495,7 +496,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{""},
|
||||
#line 88 "accessor_class_list.gperf"
|
||||
{"g1end_of_interval_monthly", &grib_accessor_class_g1end_of_interval_monthly},
|
||||
#line 146 "accessor_class_list.gperf"
|
||||
#line 147 "accessor_class_list.gperf"
|
||||
{"number_of_values", &grib_accessor_class_number_of_values},
|
||||
{""},
|
||||
#line 116 "accessor_class_list.gperf"
|
||||
|
@ -503,26 +504,26 @@ static const struct accessor_class_hash classes[] =
|
|||
{""},
|
||||
#line 33 "accessor_class_list.gperf"
|
||||
{"closest_date", &grib_accessor_class_closest_date},
|
||||
#line 152 "accessor_class_list.gperf"
|
||||
#line 153 "accessor_class_list.gperf"
|
||||
{"optimal_step_units", &grib_accessor_class_optimal_step_units},
|
||||
{""},
|
||||
#line 210 "accessor_class_list.gperf"
|
||||
#line 211 "accessor_class_list.gperf"
|
||||
{"variable", &grib_accessor_class_variable},
|
||||
#line 133 "accessor_class_list.gperf"
|
||||
{"long_vector", &grib_accessor_class_long_vector},
|
||||
#line 167 "accessor_class_list.gperf"
|
||||
#line 168 "accessor_class_list.gperf"
|
||||
{"scale_values", &grib_accessor_class_scale_values},
|
||||
{""}, {""}, {""},
|
||||
#line 128 "accessor_class_list.gperf"
|
||||
{"latlon_increment", &grib_accessor_class_latlon_increment},
|
||||
{""}, {""}, {""},
|
||||
#line 147 "accessor_class_list.gperf"
|
||||
#line 148 "accessor_class_list.gperf"
|
||||
{"number_of_values_data_raw_packing", &grib_accessor_class_number_of_values_data_raw_packing},
|
||||
{""},
|
||||
#line 79 "accessor_class_list.gperf"
|
||||
{"evaluate", &grib_accessor_class_evaluate},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
#line 151 "accessor_class_list.gperf"
|
||||
#line 152 "accessor_class_list.gperf"
|
||||
{"offset_values", &grib_accessor_class_offset_values},
|
||||
#line 69 "accessor_class_list.gperf"
|
||||
{"data_sh_packed", &grib_accessor_class_data_sh_packed},
|
||||
|
@ -535,7 +536,7 @@ static const struct accessor_class_hash classes[] =
|
|||
{""}, {""},
|
||||
#line 41 "accessor_class_list.gperf"
|
||||
{"count_missing", &grib_accessor_class_count_missing},
|
||||
#line 204 "accessor_class_list.gperf"
|
||||
#line 205 "accessor_class_list.gperf"
|
||||
{"unpack_bufr_values", &grib_accessor_class_unpack_bufr_values},
|
||||
{""}, {""},
|
||||
#line 121 "accessor_class_list.gperf"
|
||||
|
@ -569,7 +570,7 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 31 "accessor_class_list.gperf"
|
||||
{"change_scanning_direction", &grib_accessor_class_change_scanning_direction},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
#line 148 "accessor_class_list.gperf"
|
||||
#line 149 "accessor_class_list.gperf"
|
||||
{"octahedral_gaussian", &grib_accessor_class_octahedral_gaussian},
|
||||
#line 10 "accessor_class_list.gperf"
|
||||
{"abstract_long_vector", &grib_accessor_class_abstract_long_vector},
|
||||
|
@ -600,7 +601,7 @@ static const struct accessor_class_hash classes[] =
|
|||
#line 87 "accessor_class_list.gperf"
|
||||
{"g1day_of_the_year_date", &grib_accessor_class_g1day_of_the_year_date},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
#line 164 "accessor_class_list.gperf"
|
||||
#line 165 "accessor_class_list.gperf"
|
||||
{"reference_value_error", &grib_accessor_class_reference_value_error},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
|
@ -621,11 +622,11 @@ static const struct accessor_class_hash classes[] =
|
|||
};
|
||||
|
||||
static const struct accessor_class_hash* grib_accessor_classes_hash(const char *str, size_t len)
|
||||
{
|
||||
unsigned int key = grib_accessor_classes_get_id (str, len);
|
||||
{
|
||||
unsigned int key = grib_accessor_classes_get_id (str, len);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
{
|
||||
const char *s;
|
||||
Assert( len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH );
|
||||
Assert( key <= MAX_HASH_VALUE );
|
||||
|
@ -634,5 +635,5 @@ static const struct accessor_class_hash* grib_accessor_classes_hash(const char *
|
|||
}
|
||||
#endif
|
||||
|
||||
return &classes[key];
|
||||
return &classes[key];
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
{ "md5", &grib_accessor_class_md5, },
|
||||
{ "message", &grib_accessor_class_message, },
|
||||
{ "message_copy", &grib_accessor_class_message_copy, },
|
||||
{ "multdouble", &grib_accessor_class_multdouble, },
|
||||
{ "nearest", &grib_accessor_class_nearest, },
|
||||
{ "non_alpha", &grib_accessor_class_non_alpha, },
|
||||
{ "number_of_coded_values", &grib_accessor_class_number_of_coded_values, },
|
||||
|
|
|
@ -131,6 +131,7 @@ mars_step, &grib_accessor_class_mars_step
|
|||
md5, &grib_accessor_class_md5
|
||||
message, &grib_accessor_class_message
|
||||
message_copy, &grib_accessor_class_message_copy
|
||||
multdouble, &grib_accessor_class_multdouble
|
||||
nearest, &grib_accessor_class_nearest
|
||||
non_alpha, &grib_accessor_class_non_alpha
|
||||
number_of_coded_values, &grib_accessor_class_number_of_coded_values
|
||||
|
|
|
@ -171,20 +171,6 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type);
|
|||
if (!(a)) codes_assertion_failed(#a, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#ifdef __gnu_hurd__
|
||||
#define COMPILE_TIME_ASSERT(condition) \
|
||||
extern int compile_time_assert[!!(condition)-1]
|
||||
#else
|
||||
/* Compile time assertion - Thanks to Ralf Holly */
|
||||
#define COMPILE_TIME_ASSERT(condition) \
|
||||
do { \
|
||||
enum \
|
||||
{ \
|
||||
assert_static__ = 1 / (condition) \
|
||||
}; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_ASSERT(a) Assert(a)
|
||||
#define DEBUG_ASSERT_ACCESS(array, index, size) \
|
||||
|
|
|
@ -408,11 +408,10 @@ static void dump_label(grib_dumper* d, grib_accessor* a, const char* comment)
|
|||
|
||||
static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accessors* block)
|
||||
{
|
||||
const char* secstr = "section";
|
||||
int len = 0;
|
||||
const char* secstr = "section";
|
||||
grib_dumper_serialize* self = (grib_dumper_serialize*)d;
|
||||
|
||||
len = strlen(secstr);
|
||||
size_t len = strlen(secstr);
|
||||
|
||||
if (a->name[0] == '_') {
|
||||
grib_dump_accessors_block(d, block);
|
||||
|
|
|
@ -19,8 +19,7 @@ int grib_expression_native_type(grib_handle* h, grib_expression* g)
|
|||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
if (g->cclass)
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "No native_type() in %s", g->cclass->name);
|
||||
Assert(1 == 0);
|
||||
grib_context_log(h->context, GRIB_LOG_FATAL, "%s: No native_type() in %s", __func__, g->cclass->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,7 @@ const char* grib_expression_evaluate_string(grib_handle* h, grib_expression* g,
|
|||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
if (g->cclass)
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "No evaluate_string() in %s", g->cclass->name);
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: No evaluate_string() in %s", __func__, g->cclass->name);
|
||||
*err = GRIB_INVALID_TYPE;
|
||||
|
||||
return 0;
|
||||
|
@ -69,8 +68,9 @@ const char* grib_expression_get_name(grib_expression* g)
|
|||
return c->get_name(g);
|
||||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
if (g->cclass) printf("No expression_get_name() in %s\n", g->cclass->name);
|
||||
Assert(1 == 0);
|
||||
if (g->cclass) {
|
||||
grib_context_log(grib_context_get_default(), GRIB_LOG_FATAL, "%s: No get_name() in %s", __func__, g->cclass->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,6 @@ void grib_expression_print(grib_context* ctx, grib_expression* g, grib_handle* f
|
|||
}
|
||||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
Assert(1 == 0);
|
||||
}
|
||||
|
||||
void grib_expression_free(grib_context* ctx, grib_expression* g)
|
||||
|
@ -110,43 +109,37 @@ void grib_expression_add_dependency(grib_expression* e, grib_accessor* observer)
|
|||
}
|
||||
c = c->super ? *(c->super) : NULL;
|
||||
}
|
||||
Assert(1 == 0);
|
||||
}
|
||||
|
||||
/*----------------------------------------*/
|
||||
int grib_expression_set_value(grib_handle* h, grib_expression* g, grib_values* v)
|
||||
{
|
||||
char buffer[1024];
|
||||
int ret = 0;
|
||||
size_t size = sizeof(buffer);
|
||||
|
||||
switch (v->type = grib_expression_native_type(h, g)) {
|
||||
case GRIB_TYPE_LONG:
|
||||
return grib_expression_evaluate_long(h, g, &v->long_value);
|
||||
break;
|
||||
|
||||
case GRIB_TYPE_DOUBLE:
|
||||
return grib_expression_evaluate_double(h, g, &v->double_value);
|
||||
break;
|
||||
|
||||
case GRIB_TYPE_STRING:
|
||||
v->string_value = grib_expression_evaluate_string(h, g, buffer, &size, &ret);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR,
|
||||
"grib_expression_set_value: unable to evaluate %s as string",
|
||||
grib_expression_get_name(g));
|
||||
return ret;
|
||||
}
|
||||
Assert(v->string_value != buffer);
|
||||
Assert(v->string_value);
|
||||
break;
|
||||
|
||||
default:
|
||||
Assert(1 == 0);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// int grib_expression_set_value(grib_handle* h, grib_expression* g, grib_values* v)
|
||||
// {
|
||||
// char buffer[1024];
|
||||
// int ret = 0;
|
||||
// size_t size = sizeof(buffer);
|
||||
// switch (v->type = grib_expression_native_type(h, g)) {
|
||||
// case GRIB_TYPE_LONG:
|
||||
// return grib_expression_evaluate_long(h, g, &v->long_value);
|
||||
// break;
|
||||
// case GRIB_TYPE_DOUBLE:
|
||||
// return grib_expression_evaluate_double(h, g, &v->double_value);
|
||||
// break;
|
||||
// case GRIB_TYPE_STRING:
|
||||
// v->string_value = grib_expression_evaluate_string(h, g, buffer, &size, &ret);
|
||||
// if (ret != GRIB_SUCCESS) {
|
||||
// grib_context_log(h->context, GRIB_LOG_ERROR,
|
||||
// "grib_expression_set_value: unable to evaluate %s as string",
|
||||
// grib_expression_get_name(g));
|
||||
// return ret;
|
||||
// }
|
||||
// Assert(v->string_value != buffer);
|
||||
// Assert(v->string_value);
|
||||
// break;
|
||||
// default:
|
||||
// Assert(!"grib_expression_set_value");
|
||||
// break;
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
/*----------------------------------------*/
|
||||
grib_arguments* grib_arguments_new(grib_context* c, grib_expression* g, grib_arguments* n)
|
||||
|
|
|
@ -375,7 +375,7 @@ grib_handle* grib_handle_clone_headers_only(const grib_handle* h)
|
|||
const int sections_to_copy = GRIB_SECTION_PRODUCT | GRIB_SECTION_LOCAL | GRIB_SECTION_GRID;
|
||||
result = grib_util_sections_copy((grib_handle*)h, h_sample, sections_to_copy, &err);
|
||||
if (!result || err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Failed to create headers_only clone: Unable to copy sections");
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s failed: Unable to copy sections (%s)", __func__, grib_get_error_message(err));
|
||||
grib_handle_delete(h_sample);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -85,21 +85,21 @@ static void init_class(grib_iterator_class* c)
|
|||
#define EPSILON 1.0e-10
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 /* Whole pie */
|
||||
#define M_PI 3.14159265358979323846 // Whole pie
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_2
|
||||
#define M_PI_2 1.57079632679489661923 /* Half a pie */
|
||||
#define M_PI_2 1.57079632679489661923 // Half a pie
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_4
|
||||
#define M_PI_4 0.78539816339744830962 /* Quarter of a pie */
|
||||
#define M_PI_4 0.78539816339744830962 // Quarter of a pie
|
||||
#endif
|
||||
|
||||
#define RAD2DEG 57.29577951308232087684 /* 180 over pi */
|
||||
#define DEG2RAD 0.01745329251994329576 /* pi over 180 */
|
||||
#define RAD2DEG 57.29577951308232087684 // 180 over pi
|
||||
#define DEG2RAD 0.01745329251994329576 // pi over 180
|
||||
|
||||
/* Adjust longitude (in radians) to range -180 to 180 */
|
||||
// Adjust longitude (in radians) to range -180 to 180
|
||||
static double adjust_lon_radians(double lon)
|
||||
{
|
||||
if (lon > M_PI) lon -= 2 * M_PI;
|
||||
|
@ -107,16 +107,15 @@ static double adjust_lon_radians(double lon)
|
|||
return lon;
|
||||
}
|
||||
|
||||
/* Function to compute the latitude angle, phi2, for the inverse
|
||||
* From the book "Map Projections-A Working Manual-John P. Snyder (1987)"
|
||||
* Equation (7-9) involves rapidly converging iteration: Calculate t from (15-11)
|
||||
* Then, assuming an initial trial phi equal to (pi/2 - 2*arctan t) in the right side of equation (7-9),
|
||||
* calculate phi on the left side. Substitute the calculated phi) into the right side,
|
||||
* calculate a new phi, etc., until phi does not change significantly from the preceding trial value of phi
|
||||
*/
|
||||
// Function to compute the latitude angle, phi2, for the inverse
|
||||
// From the book "Map Projections-A Working Manual-John P. Snyder (1987)"
|
||||
// Equation (7-9) involves rapidly converging iteration: Calculate t from (15-11)
|
||||
// Then, assuming an initial trial phi equal to (pi/2 - 2*arctan t) in the right side of equation (7-9),
|
||||
// calculate phi on the left side. Substitute the calculated phi) into the right side,
|
||||
// calculate a new phi, etc., until phi does not change significantly from the preceding trial value of phi
|
||||
static double compute_phi(
|
||||
double eccent, /* Spheroid eccentricity */
|
||||
double ts, /* Constant value t */
|
||||
double eccent, // Spheroid eccentricity
|
||||
double ts, // Constant value t
|
||||
int* error)
|
||||
{
|
||||
double eccnth, phi, con, dphi, sinpi;
|
||||
|
@ -136,19 +135,19 @@ static double compute_phi(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Compute the constant small m which is the radius of
|
||||
a parallel of latitude, phi, divided by the semimajor axis */
|
||||
// Compute the constant small m which is the radius of
|
||||
// a parallel of latitude, phi, divided by the semimajor axis
|
||||
static double compute_m(double eccent, double sinphi, double cosphi)
|
||||
{
|
||||
const double con = eccent * sinphi;
|
||||
return ((cosphi / (sqrt(1.0 - con * con))));
|
||||
}
|
||||
|
||||
/* Compute the constant small t for use in the forward computations */
|
||||
// Compute the constant small t for use in the forward computations
|
||||
static double compute_t(
|
||||
double eccent, /* Eccentricity of the spheroid */
|
||||
double phi, /* Latitude phi */
|
||||
double sinphi) /* Sine of the latitude */
|
||||
double eccent, // Eccentricity of the spheroid
|
||||
double phi, // Latitude phi
|
||||
double sinphi) // Sine of the latitude
|
||||
{
|
||||
double con = eccent * sinphi;
|
||||
double com = 0.5 * eccent;
|
||||
|
@ -162,7 +161,34 @@ static double calculate_eccentricity(double minor, double major)
|
|||
return sqrt(1.0 - temp * temp);
|
||||
}
|
||||
|
||||
static int init_sphere(grib_handle* h,
|
||||
static void xy2lonlat(double radius, double n, double f, double rho0_bare, double LoVInRadians,
|
||||
double x, double y,
|
||||
double* lonDeg, double* latDeg)
|
||||
{
|
||||
DEBUG_ASSERT(radius > 0);
|
||||
DEBUG_ASSERT(n != 0.0);
|
||||
x /= radius;
|
||||
y /= radius;
|
||||
y = rho0_bare - y;
|
||||
double rho = hypot(x, y);
|
||||
if (rho != 0.0) {
|
||||
if (n < 0.0) {
|
||||
rho = -rho;
|
||||
x = -x;
|
||||
y = -y;
|
||||
}
|
||||
double latRadians = 2. * atan(pow(f / rho, 1.0/n)) - M_PI_2;
|
||||
double lonRadians = atan2(x, y) / n;
|
||||
*lonDeg = (lonRadians + LoVInRadians) * RAD2DEG;
|
||||
*latDeg = latRadians * RAD2DEG;
|
||||
}
|
||||
else {
|
||||
*lonDeg = 0.0;
|
||||
*latDeg = (n > 0.0 ? M_PI_2 : -M_PI_2) * RAD2DEG;
|
||||
}
|
||||
}
|
||||
|
||||
static int init_sphere(const grib_handle* h,
|
||||
grib_iterator_lambert_conformal* self,
|
||||
size_t nv, long nx, long ny,
|
||||
double LoVInDegrees,
|
||||
|
@ -171,9 +197,7 @@ static int init_sphere(grib_handle* h,
|
|||
double LoVInRadians, double Latin1InRadians, double Latin2InRadians,
|
||||
double LaDInRadians)
|
||||
{
|
||||
int i, j;
|
||||
double f, n, rho, rho0, angle, x0, y0, x, y, tmp, tmp2;
|
||||
double latDeg, lonDeg, lonDiff;
|
||||
double n, x, y;
|
||||
|
||||
if (fabs(Latin1InRadians - Latin2InRadians) < 1E-09) {
|
||||
n = sin(Latin1InRadians);
|
||||
|
@ -182,26 +206,25 @@ static int init_sphere(grib_handle* h,
|
|||
log(tan(M_PI_4 + Latin2InRadians / 2.0) / tan(M_PI_4 + Latin1InRadians / 2.0));
|
||||
}
|
||||
|
||||
f = (cos(Latin1InRadians) * pow(tan(M_PI_4 + Latin1InRadians / 2.0), n)) / n;
|
||||
rho = radius * f * pow(tan(M_PI_4 + latFirstInRadians / 2.0), -n);
|
||||
rho0 = radius * f * pow(tan(M_PI_4 + LaDInRadians / 2.0), -n);
|
||||
if (n < 0) /* adjustment for southern hemisphere */
|
||||
rho0 = -rho0;
|
||||
lonDiff = lonFirstInRadians - LoVInRadians;
|
||||
double f = (cos(Latin1InRadians) * pow(tan(M_PI_4 + Latin1InRadians / 2.0), n)) / n;
|
||||
double rho = radius * f * pow(tan(M_PI_4 + latFirstInRadians / 2.0), -n);
|
||||
double rho0_bare = f * pow(tan(M_PI_4 + LaDInRadians / 2.0), -n);
|
||||
double rho0 = radius * rho0_bare; // scaled
|
||||
double lonDiff = lonFirstInRadians - LoVInRadians;
|
||||
|
||||
/* Adjust longitude to range -180 to 180 */
|
||||
// Adjust longitude to range -180 to 180
|
||||
if (lonDiff > M_PI)
|
||||
lonDiff -= 2 * M_PI;
|
||||
if (lonDiff < -M_PI)
|
||||
lonDiff += 2 * M_PI;
|
||||
angle = n * lonDiff;
|
||||
x0 = rho * sin(angle);
|
||||
y0 = rho0 - rho * cos(angle);
|
||||
/*Dx = iScansNegatively == 0 ? Dx : -Dx;*/
|
||||
/* GRIB-405: Don't change sign of Dy. Latitudes ALWAYS increase from latitudeOfFirstGridPoint */
|
||||
/*Dy = jScansPositively == 1 ? Dy : -Dy;*/
|
||||
double angle = n * lonDiff;
|
||||
double x0 = rho * sin(angle);
|
||||
double y0 = rho0 - rho * cos(angle);
|
||||
// Dx = iScansNegatively == 0 ? Dx : -Dx;
|
||||
// GRIB-405: Don't change sign of Dy. Latitudes ALWAYS increase from latitudeOfFirstGridPoint
|
||||
// Dy = jScansPositively == 1 ? Dy : -Dy;
|
||||
|
||||
/* Allocate latitude and longitude arrays */
|
||||
// Allocate latitude and longitude arrays
|
||||
self->lats = (double*)grib_context_malloc(h->context, nv * sizeof(double));
|
||||
if (!self->lats) {
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
|
||||
|
@ -213,20 +236,32 @@ static int init_sphere(grib_handle* h,
|
|||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Populate our arrays */
|
||||
double latDeg = 0, lonDeg = 0;
|
||||
for (long j = 0; j < ny; j++) {
|
||||
y = y0 + j * Dy;
|
||||
for (long i = 0; i < nx; i++) {
|
||||
const long index = i + j * nx;
|
||||
x = x0 + i * Dx;
|
||||
xy2lonlat(radius, n, f, rho0_bare, LoVInRadians, x, y, &lonDeg, &latDeg);
|
||||
self->lons[index] = lonDeg;
|
||||
self->lats[index] = latDeg;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (j = 0; j < ny; j++) {
|
||||
y = y0 + j * Dy;
|
||||
if (n < 0) { /* adjustment for southern hemisphere */
|
||||
y = -y;
|
||||
}
|
||||
//if (n < 0) { /* adjustment for southern hemisphere */
|
||||
// y = -y;
|
||||
//}
|
||||
tmp = rho0 - y;
|
||||
tmp2 = tmp * tmp;
|
||||
for (i = 0; i < nx; i++) {
|
||||
int index = i + j * nx;
|
||||
x = x0 + i * Dx;
|
||||
if (n < 0) { /* adjustment for southern hemisphere */
|
||||
x = -x;
|
||||
}
|
||||
x = x0 + i * Dx;
|
||||
//if (n < 0) { /* adjustment for southern hemisphere */
|
||||
// x = -x;
|
||||
//}
|
||||
angle = atan2(x, tmp); /* See ECC-524 */
|
||||
rho = sqrt(x * x + tmp2);
|
||||
if (n <= 0) rho = -rho;
|
||||
|
@ -237,12 +272,12 @@ static int init_sphere(grib_handle* h,
|
|||
self->lats[index] = latDeg;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
/* Oblate spheroid */
|
||||
static int init_oblate(grib_handle* h,
|
||||
// Oblate spheroid
|
||||
static int init_oblate(const grib_handle* h,
|
||||
grib_iterator_lambert_conformal* self,
|
||||
size_t nv, long nx, long ny,
|
||||
double LoVInDegrees,
|
||||
|
@ -254,20 +289,20 @@ static int init_oblate(grib_handle* h,
|
|||
{
|
||||
int i, j, err = 0;
|
||||
double x0, y0, x, y, latRad, lonRad, latDeg, lonDeg, sinphi, ts, rh1, theta;
|
||||
double false_easting; /* x offset in meters */
|
||||
double false_northing; /* y offset in meters */
|
||||
double false_easting; // x offset in meters
|
||||
double false_northing; // y offset in meters
|
||||
|
||||
double ns; /* ratio of angle between meridian */
|
||||
double F; /* flattening of ellipsoid */
|
||||
double rh; /* height above ellipsoid */
|
||||
double sin_po; /* sin value */
|
||||
double cos_po; /* cos value */
|
||||
double con; /* temporary variable */
|
||||
double ms1; /* small m 1 */
|
||||
double ms2; /* small m 2 */
|
||||
double ts0; /* small t 0 */
|
||||
double ts1; /* small t 1 */
|
||||
double ts2; /* small t 2 */
|
||||
double ns; // ratio of angle between meridian
|
||||
double F; // flattening of ellipsoid
|
||||
double rh; // height above ellipsoid
|
||||
double sin_po; // sin value
|
||||
double cos_po; // cos value
|
||||
double con; // temporary variable
|
||||
double ms1; // small m 1
|
||||
double ms2; // small m 2
|
||||
double ts0; // small t 0
|
||||
double ts1; // small t 1
|
||||
double ts2; // small t 2
|
||||
|
||||
double e = calculate_eccentricity(earthMinorAxisInMetres, earthMajorAxisInMetres);
|
||||
|
||||
|
@ -292,7 +327,7 @@ static int init_oblate(grib_handle* h,
|
|||
F = ms1 / (ns * pow(ts1, ns));
|
||||
rh = earthMajorAxisInMetres * F * pow(ts0, ns);
|
||||
|
||||
/* Forward projection: convert lat,lon to x,y */
|
||||
// Forward projection: convert lat,lon to x,y
|
||||
con = fabs(fabs(latFirstInRadians) - M_PI_2);
|
||||
if (con > EPSILON) {
|
||||
sinphi = sin(latFirstInRadians);
|
||||
|
@ -312,7 +347,7 @@ static int init_oblate(grib_handle* h,
|
|||
x0 = -x0;
|
||||
y0 = -y0;
|
||||
|
||||
/* Allocate latitude and longitude arrays */
|
||||
// Allocate latitude and longitude arrays
|
||||
self->lats = (double*)grib_context_malloc(h->context, nv * sizeof(double));
|
||||
if (!self->lats) {
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
|
||||
|
@ -324,7 +359,7 @@ static int init_oblate(grib_handle* h,
|
|||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Populate our arrays */
|
||||
// Populate our arrays
|
||||
false_easting = x0;
|
||||
false_northing = y0;
|
||||
for (j = 0; j < ny; j++) {
|
||||
|
@ -333,7 +368,7 @@ static int init_oblate(grib_handle* h,
|
|||
const int index = i + j * nx;
|
||||
double _x, _y;
|
||||
x = i * Dx;
|
||||
/* Inverse projection to convert from x,y to lat,lon */
|
||||
// Inverse projection to convert from x,y to lat,lon
|
||||
_x = x - false_easting;
|
||||
_y = rh - y + false_northing;
|
||||
rh1 = sqrt(_x * _x + _y * _y);
|
||||
|
@ -363,7 +398,7 @@ static int init_oblate(grib_handle* h,
|
|||
if (i == 0 && j == 0) {
|
||||
DEBUG_ASSERT(fabs(latFirstInRadians - latRad) <= EPSILON);
|
||||
}
|
||||
latDeg = latRad * RAD2DEG; /* Convert to degrees */
|
||||
latDeg = latRad * RAD2DEG; // Convert to degrees
|
||||
lonDeg = normalise_longitude_in_degrees(lonRad * RAD2DEG);
|
||||
self->lons[index] = lonDeg;
|
||||
self->lats[index] = latDeg;
|
||||
|
@ -393,7 +428,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
|
|||
const char* sLatin2InDegrees = grib_arguments_get_name(h, args, self->carg++);
|
||||
const char* slatFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
|
||||
const char* slonFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
|
||||
/* Dx and Dy are in Metres */
|
||||
// Dx and Dy are in Metres
|
||||
const char* sDx = grib_arguments_get_name(h, args, self->carg++);
|
||||
const char* sDy = grib_arguments_get_name(h, args, self->carg++);
|
||||
const char* siScansNegatively = grib_arguments_get_name(h, args, self->carg++);
|
||||
|
@ -443,16 +478,16 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
|
|||
if ((err = grib_get_long_internal(h, salternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
|
||||
/* Standard Parallels cannot be equal and on opposite sides of the equator */
|
||||
// Standard Parallels cannot be equal and on opposite sides of the equator
|
||||
if (fabs(Latin1InDegrees + Latin2InDegrees) < EPSILON) {
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR,
|
||||
"%s: Cannot have equal latitudes for standard parallels on opposite sides of equator", ITER);
|
||||
return GRIB_WRONG_GRID;
|
||||
}
|
||||
|
||||
/*
|
||||
* See Wolfram MathWorld: http://mathworld.wolfram.com/LambertConformalConicProjection.html
|
||||
*/
|
||||
//
|
||||
// See Wolfram MathWorld: http://mathworld.wolfram.com/LambertConformalConicProjection.html
|
||||
//
|
||||
latFirstInRadians = latFirstInDegrees * DEG2RAD;
|
||||
lonFirstInRadians = lonFirstInDegrees * DEG2RAD;
|
||||
Latin1InRadians = Latin1InDegrees * DEG2RAD;
|
||||
|
@ -478,7 +513,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
|
|||
|
||||
iter->e = -1;
|
||||
|
||||
/* Apply the scanning mode flags which may require data array to be transformed */
|
||||
// Apply the scanning mode flags which may require data array to be transformed
|
||||
err = transform_iterator_data(h->context, iter->data,
|
||||
iScansNegatively, jScansPositively, jPointsAreConsecutive, alternativeRowScanning,
|
||||
iter->nv, nx, ny);
|
||||
|
|
|
@ -341,8 +341,8 @@ int grib_nearest_find_generic(
|
|||
double lat1 = 0, lat2 = 0; /* inlat will be between these */
|
||||
const double LAT_DELTA = 10.0; /* in degrees */
|
||||
|
||||
*out_lons_count = nvalues; /* Maybe overestimate but safe */
|
||||
*out_lats_count = nvalues;
|
||||
*out_lons_count = (int)nvalues; /* Maybe overestimate but safe */
|
||||
*out_lats_count = (int)nvalues;
|
||||
|
||||
if (*out_lats)
|
||||
grib_context_free(nearest->context, *out_lats);
|
||||
|
|
|
@ -409,7 +409,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h,
|
|||
if (values) { /* ECC-499 */
|
||||
grib_get_double_element_internal(h, self->values_key, self->k[kk], &(values[kk]));
|
||||
}
|
||||
indexes[kk] = self->k[kk];
|
||||
indexes[kk] = (int)self->k[kk];
|
||||
kk++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -490,7 +490,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h,
|
|||
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_reduced: Unable to compute index. Value too large");
|
||||
return GRIB_OUT_OF_RANGE;
|
||||
} else {
|
||||
indexes[kk] = self->k[kk];
|
||||
indexes[kk] = (int)self->k[kk];
|
||||
}
|
||||
kk++;
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
|
|||
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_nearest_regular: Unable to compute index. Value too large");
|
||||
return GRIB_OUT_OF_RANGE;
|
||||
} else {
|
||||
indexes[kk] = self->k[kk];
|
||||
indexes[kk] = (int)self->k[kk];
|
||||
}
|
||||
kk++;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ int grib_trie_with_rank_insert(grib_trie_with_rank* t, const char* key, void* da
|
|||
grib_oarray_push(t->context, t->objs, data);
|
||||
/* grib_trie_with_rank_insert_in_list(t,data); */
|
||||
GRIB_MUTEX_UNLOCK(&mutex);
|
||||
return t->objs->n;
|
||||
return (int)t->objs->n;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -897,6 +897,9 @@ static int get_grib_sample_name(grib_handle* h, long editionNumber,
|
|||
case GRIB_UTIL_GRID_SPEC_HEALPIX:
|
||||
snprintf(sample_name, sample_name_len, "GRIB%ld", editionNumber);
|
||||
break;
|
||||
case GRIB_UTIL_GRID_SPEC_REDUCED_LL:
|
||||
snprintf(sample_name, sample_name_len, "%s_sfc_grib%ld", grid_type, editionNumber);
|
||||
break;
|
||||
default:
|
||||
snprintf(sample_name, sample_name_len, "%s_pl_grib%ld", grid_type, editionNumber);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ list(APPEND test_c_bins
|
|||
gauss_sub
|
||||
grib_nearest_test
|
||||
grib_util_set_spec
|
||||
grib_util_set_spec2
|
||||
grib_check_param_concepts
|
||||
grib_local_MeteoFrance
|
||||
grib_2nd_order_numValues
|
||||
|
@ -254,6 +255,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_ecc-1000
|
||||
grib_ecc-1001
|
||||
grib_ecc-1030
|
||||
grib_ecc-1364
|
||||
grib_ecc-1397
|
||||
grib_ecc-1425
|
||||
grib_ecc-1467
|
||||
|
@ -355,6 +357,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
endif()
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
list(APPEND tests_extra grib_util_set_spec)
|
||||
list(APPEND tests_extra grib_util_set_spec2)
|
||||
list(APPEND tests_extra grib_padding)
|
||||
list(APPEND tests_extra grib_tigge_conversions1)
|
||||
list(APPEND tests_extra grib_tigge_conversions2)
|
||||
|
@ -442,20 +445,20 @@ if( HAVE_BUILD_TOOLS )
|
|||
TYPE SCRIPT
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads.sh )
|
||||
|
||||
foreach( test grib_threads_ecc-604 grib_threads_ecc-604-encode bufr_threads_ecc-604 )
|
||||
foreach( test grib_encode_pthreads2 grib_threads_ecc-604-encode bufr_encode_pthreads )
|
||||
ecbuild_add_executable( TARGET ${test}
|
||||
NOINSTALL
|
||||
SOURCES ${test}.cc
|
||||
LIBS eccodes ${CMAKE_THREAD_LIBS_INIT} )
|
||||
endforeach()
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_threads_ecc-604
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads2
|
||||
TYPE SCRIPT
|
||||
TEST_DEPENDS eccodes_download_gribs
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_threads_ecc-604.sh )
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_threads_ecc-604
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads2.sh )
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_encode_pthreads
|
||||
TYPE SCRIPT
|
||||
TEST_DEPENDS eccodes_download_bufrs
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_threads_ecc-604.sh )
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_pthreads.sh )
|
||||
endif()
|
||||
|
||||
if( NOT ECCODES_ON_WINDOWS )
|
||||
|
|
|
@ -351,6 +351,31 @@ set -e
|
|||
[ $status -ne 0 ]
|
||||
grep -q "unreadable message" $fLog
|
||||
|
||||
###???
|
||||
f1="aaen_55.bufr"
|
||||
f2="aaen_55.bufr"
|
||||
set +e
|
||||
${tools_dir}/bufr_compare -H -c edition $f1 $f2 > $fLog 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "options are incompatible" $fLog
|
||||
|
||||
set +e
|
||||
${tools_dir}/bufr_compare -a edition $f1 $f2 > $fLog 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "a option requires -c option" $fLog
|
||||
|
||||
|
||||
set +e
|
||||
${tools_dir}/bufr_compare nosuchfile $f1 > $fLog 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
|
||||
|
||||
# Clean up
|
||||
# -------------
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
. ./include.ctest.sh
|
||||
|
||||
label="bufr_threads_ecc-604"
|
||||
label="bufr_encode_pthreads_test"
|
||||
temp_dir=tempdir.${label}
|
||||
|
||||
NUM_THREADS=3
|
||||
NUM_ITER=5
|
||||
OUTPUT=output
|
||||
PROG="${test_dir}/bufr_threads_ecc-604"
|
||||
PROG="${test_dir}/bufr_encode_pthreads"
|
||||
|
||||
validate()
|
||||
{
|
|
@ -35,8 +35,10 @@ int main(int argc, char* argv[])
|
|||
len = 1; // Cause it to fail
|
||||
|
||||
err = codes_get_string(h, key, kvalue, &len);
|
||||
printf("err=%d kvalue=|%s|\n", err, kvalue);
|
||||
//printf("err=%d kvalue=|%s|\n", err, kvalue);
|
||||
assert(err == CODES_BUFFER_TOO_SMALL);
|
||||
// The correct len should have been set
|
||||
assert(len > 1);
|
||||
|
||||
codes_handle_delete(h);
|
||||
fclose(in);
|
||||
|
|
|
@ -17,6 +17,8 @@ if [ ! -d "$ECCODES_DEFINITION_PATH" ]; then
|
|||
fi
|
||||
|
||||
temp=temp.$label.grib2
|
||||
tempFilt=temp.$label.filt
|
||||
tempText=temp.$label.txt
|
||||
sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
tables_dir="$ECCODES_DEFINITION_PATH/grib2/tables"
|
||||
|
@ -34,7 +36,6 @@ fi
|
|||
cd $test_dir
|
||||
# Check table 1.0
|
||||
# Check it has the latest with description matching "Version implemented on DD MM YYYY"
|
||||
tempText=temp.$label.txt
|
||||
${tools_dir}/grib_set -s tablesVersion=$latest $sample2 $temp
|
||||
${tools_dir}/grib_dump -O -p tablesVersion $temp > $tempText
|
||||
grep -q "Version implemented on" $tempText
|
||||
|
@ -50,4 +51,18 @@ if [ "$tablesVersion" != "$latestOfficial" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
rm -f $temp
|
||||
# Library and definitions versions
|
||||
cat >$tempFilt<<EOF
|
||||
transient _iv = 31;
|
||||
meta _checkit check_internal_version(_iv);
|
||||
print "checkit=[_checkit]";
|
||||
EOF
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $sample2 > $tempText 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
cat $tempText
|
||||
grep -q "Definition files version .* is greater than engine version" $tempText
|
||||
|
||||
rm -f $tempFilt $temp $tempText
|
||||
|
|
|
@ -45,6 +45,12 @@ grib_check_key_equals $temp scaleFactorOfLowerWavePeriodLimit,scaledValueOfLower
|
|||
${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=104 $sample2 $temp
|
||||
grib_check_key_equals $temp scaleFactorOfLowerWavePeriodLimit,scaledValueOfLowerWavePeriodLimit,perturbationNumber 'MISSING MISSING 0'
|
||||
|
||||
${tools_dir}/grib_set -s \
|
||||
tablesVersion=$latest,productDefinitionTemplateNumber=108,scaleFactorOfFirstWavelength=9,scaledValueOfFirstWavelength=12 \
|
||||
$sample2 $temp
|
||||
grib_check_key_equals $temp firstWavelengthInNanometres '12'
|
||||
grib_check_key_equals $temp firstWavelengthInMetres '1.2e-08'
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempSample $temp
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.ctest.sh
|
||||
|
||||
|
||||
# ECC-1364: GRIB: Geoiterator for Lambert Conformal in the southern hemisphere
|
||||
|
||||
label="grib_ecc-1364_test"
|
||||
tempGrib=temp.$label.grib
|
||||
tempFilt=temp.$label.filt
|
||||
tempLog=temp.$label.log
|
||||
tempRef=temp.$label.ref
|
||||
|
||||
sample_grib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
|
||||
# Create a GRIB with a similar grid to the one in the JIRA issue
|
||||
cat >$tempFilt<<EOF
|
||||
set dataRepresentationType = 3; # lambert conformal conic
|
||||
set resolutionAndComponentFlags = 136;
|
||||
set Nx = 999;
|
||||
set Ny = 1249;
|
||||
set latitudeOfFirstGridPoint = -54387;
|
||||
set longitudeOfFirstGridPoint = 265669;
|
||||
set LoV = 295000;
|
||||
set DxInMetres = 4000;
|
||||
set DyInMetres = 4000;
|
||||
set projectionCentreFlag = 128;
|
||||
set Latin1 = -35000;
|
||||
set Latin2 = -35000;
|
||||
set latitudeOfSouthernPole = -90000;
|
||||
set scanningMode = 64; # +i +j
|
||||
write;
|
||||
EOF
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample_grib1
|
||||
|
||||
${tools_dir}/grib_get_data $tempGrib > $tempLog
|
||||
|
||||
${tools_dir}/grib_ls -l -11.6277,-47.9583,1 $tempGrib > $tempLog
|
||||
grep -q "Grid Point chosen #1 index=1247750 " $tempLog
|
||||
grep -q "index=1247750 .* distance=0.01 " $tempLog
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGrib $tempFilt $tempLog $tempRef
|
|
@ -16,7 +16,7 @@ temp_dir=tempdir.${label}
|
|||
NUM_THREADS=3
|
||||
NUM_ITER=10
|
||||
OUTPUT=output
|
||||
PROG="${test_dir}/grib_threads_ecc-604"
|
||||
PROG="${test_dir}/grib_encode_pthreads2"
|
||||
|
||||
validate()
|
||||
{
|
|
@ -237,6 +237,19 @@ grib_check_key_equals $tempGrib scaleFactorOfFirstFixedSurface MISSING
|
|||
grib_check_key_equals $tempGrib scaledValueOfFirstFixedSurface MISSING
|
||||
|
||||
|
||||
echo "Test for the sum accessor"
|
||||
# -------------------------------
|
||||
input="${samp_dir}/reduced_gg_pl_32_grib2.tmpl"
|
||||
cat >$tempFilt <<EOF
|
||||
meta sum_of_pl_array sum(pl);
|
||||
# Default is double
|
||||
print "sum_of_pl_array =[sum_of_pl_array]";
|
||||
print "sum_of_pl_array as ints=[sum_of_pl_array:i]";
|
||||
print "sum_of_pl_array as strs=[sum_of_pl_array:s]";
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $input > $tempOut
|
||||
|
||||
|
||||
echo "Test from_scale_factor_scaled_value"
|
||||
# -----------------------------------------
|
||||
input="${samp_dir}/reduced_gg_pl_32_grib2.tmpl"
|
||||
|
@ -454,6 +467,18 @@ set -e
|
|||
[ $status -ne 0 ]
|
||||
grep -q "Unable to open file" $tempOut
|
||||
|
||||
# Signed bits
|
||||
# -----------
|
||||
cat >$tempFilt <<EOF
|
||||
meta _sb signed_bits(widthOfWidths, numberOfGroups);
|
||||
print "[_sb]";
|
||||
EOF
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $data_dir/boustrophedonic.grib1 > $tempOut 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
|
||||
# Setting step
|
||||
# -------------
|
||||
|
|
|
@ -164,6 +164,14 @@ if [ $HAVE_LIBJASPER -eq 0 ]; then
|
|||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "JasPer JPEG support not enabled" $tempDump
|
||||
|
||||
infile=$data_dir/sample.grib2
|
||||
set +e
|
||||
ECCODES_GRIB_JPEG=jasper ${tools_dir}/grib_set -rs packingType=grid_jpeg $infile $outfile1 > $tempDump 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "JasPer JPEG support not enabled" $tempDump
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -31,10 +31,9 @@ int main(int argc, char** argv)
|
|||
{
|
||||
int err = 0;
|
||||
long step = 0;
|
||||
size_t nfiles = 0;
|
||||
size_t i = 0, j = 0;
|
||||
codes_fieldset* set = NULL;
|
||||
const size_t max_numfiles = 100;
|
||||
int nfiles = 0, i = 0, j = 0;
|
||||
codes_fieldset* set = NULL;
|
||||
const int max_numfiles = 100;
|
||||
codes_handle* h = NULL;
|
||||
char param[20] = {0,};
|
||||
size_t len = 20;
|
||||
|
|
|
@ -33,4 +33,12 @@ if [ $HAVE_EXTRA_TESTS -eq 1 ]; then
|
|||
[ "$numlines" = "6599681" ] # 1 + numberOfDataPoints
|
||||
fi
|
||||
|
||||
# Regular Gaussian (no pl array)
|
||||
input=${data_dir}/regular_gaussian_model_level.grib2
|
||||
grib_check_key_equals $input isOctahedral 0
|
||||
|
||||
result=$( $tools_dir/grib_get -s Ni=missing -p isOctahedral $input )
|
||||
[ $result -eq 0 ]
|
||||
|
||||
# Clean up
|
||||
rm -f $temp
|
||||
|
|
|
@ -18,6 +18,7 @@ tempLog=temp.$label.log
|
|||
tempRef=temp.$label.ref
|
||||
|
||||
# Use a GRIB2 input with a bitmap
|
||||
# ----------------------------------
|
||||
input=$data_dir/reduced_latlon_surface.grib2
|
||||
grib_check_key_equals $input bitmapPresent 1
|
||||
${tools_dir}/grib_set -s packingType=grid_simple_matrix,NC=1,NR=1 $input $tempGribA
|
||||
|
@ -26,10 +27,23 @@ ${tools_dir}/grib_dump -O $tempGribB
|
|||
${tools_dir}/grib_dump -Dat $tempGribB
|
||||
|
||||
# Call pack_double and unpack_double
|
||||
# ----------------------------------
|
||||
cat >$tempFilt<<EOF
|
||||
set values = {0, 1, 9999};
|
||||
print "[bitmap]";
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $tempGribB
|
||||
|
||||
# data_g1secondary_bitmap
|
||||
# ----------------------------------
|
||||
cat >$tempFilt<<EOF
|
||||
transient expandBy = 1;
|
||||
meta _s data_g1secondary_bitmap(bitmap,secondaryBitmaps,missingValue,expandBy,octetAtWichPackedDataBegins);
|
||||
print "[_s]";
|
||||
set _s = {0, 9};
|
||||
EOF
|
||||
# The above filter is for testing only. Add -f as we know it will fail
|
||||
${tools_dir}/grib_filter -f $tempFilt $tempGribB
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGribA $tempGribB $tempFilt $tempLog $tempRef
|
||||
|
|
|
@ -520,6 +520,20 @@ cat $tempFilt
|
|||
${tools_dir}/grib_filter $tempFilt $data_dir/constant_field.grib2
|
||||
unset ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS
|
||||
|
||||
|
||||
# Changing the product definition template
|
||||
# ----------------------------------------
|
||||
# See ECC-1768
|
||||
${tools_dir}/grib_set -s step=62m $sample_g2 $temp
|
||||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8 $temp $temp2
|
||||
|
||||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8,stepUnits=s,step=0 $sample_g2 $temp
|
||||
grib_check_key_equals $temp '-p stepUnits:s,startStep,productDefinitionTemplateNumber' 's 0s 8'
|
||||
|
||||
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8,stepUnits=m,step=60 $sample_g2 $temp
|
||||
grib_check_key_equals $temp '-p stepUnits:s,productDefinitionTemplateNumber' 'h 8'
|
||||
|
||||
|
||||
# Bad stepUnits
|
||||
set +e
|
||||
${tools_dir}/grib_set -s stepUnits=190 $sample_g2 $temp > $tempText 2>&1
|
||||
|
|
|
@ -17,19 +17,6 @@ tempFilt=temp.${label}.filt
|
|||
tempRef=temp.${label}.ref
|
||||
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
|
||||
cat > $tempFilt <<EOF
|
||||
meta a_deprecated_key suppressed(typeOfOriginalFieldValues);
|
||||
print "[a_deprecated_key]";
|
||||
EOF
|
||||
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
cat $tempErr
|
||||
|
||||
cat > $tempRef <<EOF
|
||||
ECCODES ERROR : key 'a_deprecated_key' is unavailable in this version.
|
||||
ECCODES ERROR : Please use the following key(s):
|
||||
|
@ -37,7 +24,22 @@ ECCODES ERROR : - typeOfOriginalFieldValues
|
|||
ERROR: Key/value not found (message 1)
|
||||
EOF
|
||||
|
||||
diff $tempRef $tempErr
|
||||
do_tests()
|
||||
{
|
||||
qualifier=$1
|
||||
echo "meta a_deprecated_key suppressed(typeOfOriginalFieldValues); print \"[a_deprecated_key$qualifier]\";" > $tempFilt
|
||||
set +e
|
||||
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
cat $tempErr
|
||||
diff $tempRef $tempErr
|
||||
}
|
||||
|
||||
do_tests ""
|
||||
do_tests ":i"
|
||||
do_tests ":d"
|
||||
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#include "eccodes.h"
|
||||
|
||||
static void dump_it(grib_handle* h)
|
||||
{
|
||||
int dump_flags = GRIB_DUMP_FLAG_CODED | GRIB_DUMP_FLAG_OCTET | GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
|
||||
grib_dump_content(h, stdout, "wmo", dump_flags, NULL);
|
||||
}
|
||||
|
||||
// Lambert conformal
|
||||
static grib_handle* test0()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 4;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB1");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL;
|
||||
spec.Ni = 2;
|
||||
spec.Nj = 2;
|
||||
|
||||
// packing_spec.packing_type = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
|
||||
// packing_spec.bitsPerValue = 16;
|
||||
// packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
|
||||
// packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Lambert azimuthal
|
||||
static grib_handle* test1()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 4;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
grib_set_long(handle, "tablesVersion", 32);
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// HEALPix
|
||||
static grib_handle* test2()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 4;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_HEALPIX;
|
||||
spec.N = 2;
|
||||
|
||||
packing_spec.extra_settings_count = 1;
|
||||
packing_spec.extra_settings[0].type = GRIB_TYPE_LONG;
|
||||
packing_spec.extra_settings[0].name = "tablesVersion";
|
||||
packing_spec.extra_settings[0].long_value = 32;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Spherical harmonics
|
||||
static grib_handle* test3()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 0;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "sh_pl_grib2");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_SH;
|
||||
spec.truncation = 20;
|
||||
outlen = 2;
|
||||
|
||||
packing_spec.packing_type = GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE;
|
||||
packing_spec.bitsPerValue = 16;
|
||||
packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
|
||||
packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Polar stereo
|
||||
static grib_handle* test4()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 0;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
grib_set_long(handle, "tablesVersion", 32);
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC;
|
||||
outlen = 4;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Regular Gaussian
|
||||
static grib_handle* test5()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 0;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_REGULAR_GG;
|
||||
spec.Ni = spec.Nj = 2;
|
||||
outlen = 4;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Reduced LL
|
||||
static grib_handle* test6()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 0;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_REDUCED_LL;
|
||||
spec.Nj = 2;
|
||||
outlen = 4;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
// Unstructured
|
||||
static grib_handle* test7()
|
||||
{
|
||||
int err = 0;
|
||||
grib_util_grid_spec spec = {0,};
|
||||
grib_util_packing_spec packing_spec = {0,};
|
||||
double values[4] = {1.1, 2.2, 3.3, 0.4};
|
||||
int set_spec_flags = 0;
|
||||
size_t outlen = 4;
|
||||
|
||||
grib_handle* handle = grib_handle_new_from_samples(0, "GRIB2");
|
||||
spec.grid_type = GRIB_UTIL_GRID_SPEC_UNSTRUCTURED;
|
||||
|
||||
grib_handle* finalh = grib_util_set_spec(
|
||||
handle, &spec, &packing_spec, set_spec_flags,
|
||||
values, outlen, &err);
|
||||
Assert(err == 0);
|
||||
return finalh;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef grib_handle* (*test_func)(void);
|
||||
test_func funcs[] = {test0, test1, test2, test3, test4, test5, test6, test7};
|
||||
|
||||
//grib_handle* (*p[8]) (void) = {test0, test1, test2, test3, test4, test5, test6, test7};
|
||||
|
||||
const size_t num_tests = sizeof(funcs)/sizeof(funcs[0]);
|
||||
for (size_t i = 0; i < num_tests; i++) {
|
||||
grib_handle* result = funcs[i]();
|
||||
Assert(result);
|
||||
dump_it(result);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.ctest.sh
|
||||
|
||||
$EXEC ${test_dir}/grib_util_set_spec2
|
|
@ -20,7 +20,7 @@
|
|||
#include "grib_api_internal.h"
|
||||
#include <assert.h>
|
||||
|
||||
static int verbose = 0;
|
||||
static bool verbose = false;
|
||||
static const char* OUTPUT_FILENAME_FORMAT = "%s_%03d"; /* x_001, x_002 etc */
|
||||
static void usage(const char* prog)
|
||||
{
|
||||
|
@ -29,6 +29,11 @@ static void usage(const char* prog)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
static void print_num_messages_written(const char* output_filename, size_t n)
|
||||
{
|
||||
printf("Wrote output file %s (%zu message%s)\n", output_filename, n, n==1?"":"s");
|
||||
}
|
||||
|
||||
static int split_file(FILE* in, const char* filename, const int nchunks, unsigned long* count)
|
||||
{
|
||||
void* mesg = NULL;
|
||||
|
@ -76,8 +81,9 @@ static int split_file(FILE* in, const char* filename, const int nchunks, unsigne
|
|||
read_size += size;
|
||||
msg_size += size;
|
||||
if (read_size > chunk_size && msg_size < insize) {
|
||||
if (verbose)
|
||||
printf("Wrote output file %s (%zu msgs)\n", ofilename, num_msg);
|
||||
if (verbose) {
|
||||
print_num_messages_written(ofilename, num_msg);
|
||||
}
|
||||
fclose(out);
|
||||
i++;
|
||||
/* Start writing to the next file */
|
||||
|
@ -95,8 +101,9 @@ static int split_file(FILE* in, const char* filename, const int nchunks, unsigne
|
|||
(*count)++;
|
||||
}
|
||||
}
|
||||
if (verbose)
|
||||
printf("Wrote output file %s (%zu msgs)\n", ofilename, num_msg - 1);
|
||||
if (verbose) {
|
||||
print_num_messages_written(ofilename, num_msg - 1);
|
||||
}
|
||||
fclose(out);
|
||||
free(ofilename);
|
||||
|
||||
|
@ -118,7 +125,7 @@ int main(int argc, char* argv[])
|
|||
i = 1;
|
||||
if (strcmp(argv[i], "-v") == 0) {
|
||||
i++;
|
||||
verbose = 1;
|
||||
verbose = true;
|
||||
if (argc != 4)
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
|
|
@ -58,10 +58,11 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
*/
|
||||
int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||
{
|
||||
size_t i, j, err = 0;
|
||||
size_t i, j;
|
||||
size_t last_size = 0;
|
||||
long missingValuesPresent;
|
||||
double delta;
|
||||
int err = 0;
|
||||
|
||||
double* values = NULL;
|
||||
size_t size;
|
||||
|
|
|
@ -256,7 +256,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
|
||||
#ifndef ECCODES_ON_WINDOWS
|
||||
/* Check at compile time to ensure our file offset is at least 64 bits */
|
||||
COMPILE_TIME_ASSERT(sizeof(options->infile_offset) >= 8);
|
||||
static_assert(sizeof(options->infile_offset) >= 8);
|
||||
#endif
|
||||
|
||||
has_output = grib_options_on("U");
|
||||
|
|
|
@ -340,7 +340,7 @@ static int grib_tool_without_orderby(grib_runtime_options* options)
|
|||
if (options->infile_offset) {
|
||||
#ifndef ECCODES_ON_WINDOWS
|
||||
/* Check at compile time to ensure our file offset is at least 64 bits */
|
||||
COMPILE_TIME_ASSERT(sizeof(options->infile_offset) >= 8);
|
||||
static_assert(sizeof(options->infile_offset) >= 8);
|
||||
#endif
|
||||
err = fseeko(infile->file, options->infile_offset, SEEK_SET);
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue