Merge branch 'develop' into feature/mtg2

This commit is contained in:
Matthew Griffith 2024-09-25 13:02:26 +00:00
commit 57b9fe549f
75 changed files with 1676 additions and 1336 deletions

View File

@ -18,7 +18,16 @@
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
find_package( ecbuild 3.7 HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
if(NOT ecbuild_FOUND)
message(STATUS "Fetching ecbuild...")
include(FetchContent)
FetchContent_Populate(ecbuild
GIT_REPOSITORY https://github.com/ecmwf/ecbuild.git
GIT_TAG 3.8.5
)
find_package( ecbuild 3.7 REQUIRED HINTS ${ecbuild_SOURCE_DIR})
endif()
# Initialise project
project( eccodes LANGUAGES CXX )
@ -508,11 +517,8 @@ ecbuild_info(" | ecCodes version ${eccodes_VERSION} |")
ecbuild_info(" +--------------------------+")
ecbuild_info("")
ecbuild_info(" +--------------------------------------+")
ecbuild_info(" | Please note: |")
ecbuild_info(" | For Python3 support, first install |")
ecbuild_info(" | ecCodes and then install the Python |")
ecbuild_info(" | bindings from PyPI with: |")
ecbuild_info(" | $ pip3 install eccodes |")
ecbuild_info(" +--------------------------------------+")
ecbuild_info("Please note:")
ecbuild_info(" For Python3 support, you must install the Python bindings.")
ecbuild_info(" See:")
ecbuild_info(" https://confluence.ecmwf.int/display/ECC/ecCodes+installation")
ecbuild_info("")

View File

@ -1,4 +1,5 @@
# RDB stands for REPORT DATA BASE
# See https://confluence.ecmwf.int/pages/viewpage.action?pageId=24316441
unsigned[1] rdbType : dump;
unsigned[1] oldSubtype: dump;

View File

@ -50,7 +50,7 @@ unsigned[1] reservedSection3 = 0;
unsigned[2] numberOfSubsets : dump;
alias ls.numberOfSubsets=numberOfSubsets;
if (section2Present && bufrHeaderCentre==98 && section2Length==52) {
if (section2Present && bufrHeaderCentre == 98 && section2Length == 52) {
if ( rdbType == 2 || rdbType == 3 || rdbType == 8 || rdbType == 12 || rdbType == 30 ) {
transient isSatelliteType=1;
} else {
@ -69,10 +69,11 @@ if (section2Present && bufrHeaderCentre==98 && section2Length==52) {
meta localLatitude2 bits(keyMore,32,25,-9000000,100000) : dump,no_copy;
# This rule is taken from BUFRDC. See bufrdc_wmo/buukey.F
# Also see ECC-686
if (oldSubtype == 255 || numberOfSubsets>255 ||
( oldSubtype>=121 && oldSubtype <=130 ) ||
oldSubtype==31) {
# See ECC-686
# and https://confluence.ecmwf.int/pages/viewpage.action?pageId=24316441
if (oldSubtype == 255 || numberOfSubsets > 255 ||
( oldSubtype >= 121 && oldSubtype <= 130 ) ||
oldSubtype == 31) {
meta ls.localNumberOfObservations bits(keySat,0,16) : dump,long_type,no_copy;
meta ls.satelliteID bits(keySat,16,16) : dump,long_type,no_copy;
} else {
@ -114,16 +115,16 @@ meta bufrdcExpandedDescriptors bufrdc_expanded_descriptors(expandedCodes) : no_c
#smart_table NAME (VALUES,FILE_NAME,MASTER_DIRECTORY,LOCAL_DIRECTORY,WIDTH_OF_CODE_IN_BITS,EXTRA_DIRECTORY,EXTRA_FILE_NAME);
#Note: The WIDTH_OF_CODE_IN_BITS has to be big enough so 2^width > the highest BUFR descriptor code
smart_table expandedOriginalCodes (expandedCodes,"element.table",tablesMasterDir,tablesLocalDir,18,rootTablesDir,"operators.table") :no_copy;
meta expandedAbbreviations smart_table_column(expandedOriginalCodes,0,1) : string_type,no_copy;
meta expandedTypes smart_table_column(expandedOriginalCodes,1,0) : string_type,no_copy;
meta expandedNames smart_table_column(expandedOriginalCodes,2,0) : string_type,no_copy;
meta expandedUnits smart_table_column(expandedOriginalCodes,3,0) : string_type,no_copy;
meta expandedOriginalScales smart_table_column(expandedOriginalCodes,4,0) : long_type,no_copy;
meta expandedOriginalReferences smart_table_column(expandedOriginalCodes,5,0) : long_type,no_copy;
meta expandedOriginalWidths smart_table_column(expandedOriginalCodes,6,0) : long_type,no_copy;
meta expandedCrex_units smart_table_column(expandedOriginalCodes,7,0) : long_type,no_copy;
meta expandedCrex_scales smart_table_column(expandedOriginalCodes,8,0) : long_type,no_copy;
meta expandedCrex_widths smart_table_column(expandedOriginalCodes,9,0) : long_type,no_copy;
meta expandedAbbreviations smart_table_column(expandedOriginalCodes,0,1) : string_type,no_copy;
meta expandedTypes smart_table_column(expandedOriginalCodes,1,0) : string_type,no_copy;
meta expandedNames smart_table_column(expandedOriginalCodes,2,0) : string_type,no_copy;
meta expandedUnits smart_table_column(expandedOriginalCodes,3,0) : string_type,no_copy;
meta expandedOriginalScales smart_table_column(expandedOriginalCodes,4,0) : long_type,no_copy;
meta expandedOriginalReferences smart_table_column(expandedOriginalCodes,5,0) : long_type,no_copy;
meta expandedOriginalWidths smart_table_column(expandedOriginalCodes,6,0) : long_type,no_copy;
meta expandedCrex_units smart_table_column(expandedOriginalCodes,7,0) : long_type,no_copy;
meta expandedCrex_scales smart_table_column(expandedOriginalCodes,8,0) : long_type,no_copy;
meta expandedCrex_widths smart_table_column(expandedOriginalCodes,9,0) : long_type,no_copy;
position endDescriptors;
section_padding section3Padding;

View File

@ -114,7 +114,6 @@ if(matrixOfValues == 0)
# From GRIBEX:
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! !
# ! This is the WMO definition, but it is entirely !
# ! inadequate when secondary bit maps are present !
# ! eg 3x3 global grid with a matrix of values !
@ -129,7 +128,6 @@ if(matrixOfValues == 0)
# ! missing'). !
# ! This definition will accommodate a 1x1 !
# ! degree global grid. !
# ! !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
constant datumSize = NC*NR;

View File

@ -10,10 +10,11 @@ transient numberOfUnusedBitsAtEndOfSection3 = 0 : read_only;
transient tableReference = 0;
#position offsetBeforeBitmap;
meta bitmap gds_not_present_bitmap( missingValue,numberOfValues,
numberOfPoints,
latitudeOfFirstGridPoint,
Ni,numberOfUnusedBitsAtEndOfSection3) : read_only;
meta bitmap gds_not_present_bitmap(
missingValue,numberOfValues,
numberOfPoints,
latitudeOfFirstGridPoint,
Ni,numberOfUnusedBitsAtEndOfSection3) : read_only;
#position offsetAfterBitmap;
#padtoeven padding_sec3_1(offsetSection3,section3Length);

View File

@ -40,6 +40,6 @@ transient numberOfPoints= nd *(Ni + 1) * (Ni + 1);
alias numberOfDataPoints=numberOfPoints;
meta numberOfValues
number_of_values(values,bitsPerValue,numberOfDataPoints,
bitmapPresent,bitmap,numberOfCodedValues) : dump;
number_of_values(
values,bitsPerValue,numberOfDataPoints,
bitmapPresent,bitmap,numberOfCodedValues) : dump;

View File

@ -79,11 +79,11 @@ if(missing(Ni)){
nearest latlon_reduced(values,radius,Nj,pl);
} else {
transient iteratorDisableUnrotate = 0 : hidden; # ECC-808
iterator latlon(numberOfPoints,missingValue,values,longitudeFirstInDegrees,iInc ,
Ni,Nj,iScansNegatively ,
latitudeFirstInDegrees,DjInDegrees,jScansPositively,jPointsAreConsecutive,
isRotatedGrid, angleOfRotation,
latitudeOfSouthernPoleInDegrees,longitudeOfSouthernPoleInDegrees);
iterator latlon(numberOfPoints,missingValue,values,longitudeFirstInDegrees,iInc,
Ni,Nj,iScansNegatively,
latitudeFirstInDegrees,DjInDegrees,jScansPositively,jPointsAreConsecutive,
isRotatedGrid, angleOfRotation,
latitudeOfSouthernPoleInDegrees,longitudeOfSouthernPoleInDegrees);
nearest regular(values,radius,Ni,Nj);
}
meta latLonValues latlonvalues(values);

View File

@ -24,9 +24,9 @@ constant dataRepresentationType = 0;
# (according to data representation type - octet 6 above)
# grib 1 -> 2
constant gridDefinitionTemplateNumber = 0;
constant gridDefinitionTemplateNumber = 0;
# START 1/grid_definition.latitude_longitude_grid ----------------------------------------------------------------------
# START 1/grid_definition.latitude_longitude_grid
# GRID DEFINITION latitude/longitude grid (or equidistant cylindrical)
alias numberOfPointsAlongAParallel=Ni;
@ -122,6 +122,6 @@ constant tableReference = 0;
#position offsetBeforeBitmap;
# meta bitmap gds_not_present_bitmap( missingValue,numberOfValues,
# numberOfPoints,
# latitudeOfFirstGridPoint,
# Ni,numberOfUnusedBitsAtEndOfSection3) : read_only;
# numberOfPoints,
# latitudeOfFirstGridPoint,
# Ni,numberOfUnusedBitsAtEndOfSection3) : read_only;

View File

@ -1,70 +1,70 @@
# Concept marsLevtype
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=8;}
'o2d' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=9;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=162;}
'sfc' = {typeOfFirstFixedSurface=2; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=20; scaleFactorOfFirstFixedSurface=-2;
scaledValueOfFirstFixedSurface=29315; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=100;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=100;
scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=80000;}
'sfc' = {typeOfFirstFixedSurface=100; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=80000;
typeOfSecondFixedSurface=100; scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=45000;}
'sfc' = {typeOfFirstFixedSurface=100; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=45000; typeOfSecondFixedSurface=8;}
'sfc' = {typeOfFirstFixedSurface=101; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=103;}
'ml' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=255;}
'ml' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=105;}
'sfc' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=106;typeOfSecondFixedSurface=106;}
'pt' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=255;}
'pt' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=107;}
'pv' = {typeOfFirstFixedSurface=109; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=114;}
'hhl' = {typeOfFirstFixedSurface=118; typeOfSecondFixedSurface=255;}
'hpl' = {typeOfFirstFixedSurface=119; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=151;}
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=152;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=9;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=20;
scaledValueOfFirstFixedSurface=0; scaleFactorOfFirstFixedSurface=0;}
'sfc' = {typeOfFirstFixedSurface=162; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=166; typeOfSecondFixedSurface=255;}
'o3d' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=255;}
'o3d' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=168;}
'o2d' = {typeOfFirstFixedSurface=169; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=170; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=171; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=173; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=173; typeOfSecondFixedSurface=175;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=176; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=160;
scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=0;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=177; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=188; typeOfSecondFixedSurface=189;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=8;}
'o2d' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=9;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=162;}
'sfc' = {typeOfFirstFixedSurface=2; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=19; typeOfSecondFixedSurface=255;}
'o2d' = {discipline=10; typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=100;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=100;
scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=80000;}
'sfc' = {typeOfFirstFixedSurface=100; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=80000;
typeOfSecondFixedSurface=100; scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=45000;}
'sfc' = {typeOfFirstFixedSurface=100; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=45000; typeOfSecondFixedSurface=8;}
'sfc' = {typeOfFirstFixedSurface=101; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=103;}
'ml' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=255;}
'ml' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=105;}
'sfc' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=106;typeOfSecondFixedSurface=106;}
'pt' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=255;}
'pt' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=107;}
'pv' = {typeOfFirstFixedSurface=109; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=114;}
'hhl' = {typeOfFirstFixedSurface=118; typeOfSecondFixedSurface=255;}
'hpl' = {typeOfFirstFixedSurface=119; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=151;}
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=152;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=9;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=20;
scaledValueOfFirstFixedSurface=0; scaleFactorOfFirstFixedSurface=0;}
'sfc' = {typeOfFirstFixedSurface=162; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=166; typeOfSecondFixedSurface=255;}
'o3d' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=255;}
'o3d' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=168;}
'o2d' = {typeOfFirstFixedSurface=169; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=170; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=171; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=173; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=173; typeOfSecondFixedSurface=175;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=176; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=160;
scaleFactorOfSecondFixedSurface=0; scaledValueOfSecondFixedSurface=0;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=177; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=188; typeOfSecondFixedSurface=189;}
'sfc' = {typeOfFirstFixedSurface=5; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=14; typeOfSecondFixedSurface=255;}

View File

@ -1,39 +1,42 @@
# (C) Copyright 2005- ECMWF.
codetable[2] marsClass "mars/class.table" = "od" : dump,string_type,lowercase;
codetable[2] marsClass "mars/class.table" = "od" : dump,string_type,lowercase;
codetable[2] marsType "mars/type.table" = "an" : dump,string_type,no_fail,lowercase;
codetable[2] marsStream "mars/stream.table" = "oper" : dump,string_type,lowercase ;
codetable[2] marsStream "mars/stream.table" = "oper" : dump,string_type,lowercase;
ksec1expver[4] experimentVersionNumber = "0001" : dump;
meta class g2_mars_labeling(0,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
meta class g2_mars_labeling(
0,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
meta type g2_mars_labeling(1,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
meta type g2_mars_labeling(
1,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
meta stream g2_mars_labeling(2,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
meta stream g2_mars_labeling(
2,marsClass,
marsType,
marsStream,
experimentVersionNumber,
typeOfProcessedData,
productDefinitionTemplateNumber,
stepType,
derivedForecast,
typeOfGeneratingProcess);
alias ls.dataType = marsType;
@ -41,5 +44,4 @@ alias mars.class = class;
alias mars.type = type;
alias mars.stream = stream;
alias mars.expver = experimentVersionNumber;
alias mars.domain = globalDomain; # For now...
alias mars.domain = globalDomain; # For now...

View File

@ -4114,6 +4114,27 @@
parameterNumber = 148 ;
typeOfFirstFixedSurface = 1 ;
}
#Radar reflectivity
'Radar reflectivity' = {
discipline = 0 ;
parameterCategory = 16 ;
parameterNumber = 4 ;
}
#Pressure at cloud ceiling
'Pressure at cloud ceiling' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 19 ;
scaledValueOfFirstFixedSurface = 50 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Visibility through precipitation
'Visibility through precipitation' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
}
#Burned area
'Burned area' = {
discipline = 2 ;
@ -5601,6 +5622,13 @@
parameterNumber = 23 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean visibility through precipitation
'Time-mean visibility through precipitation' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-maximum volumetric soil moisture
'Time-maximum volumetric soil moisture' = {
discipline = 2 ;
@ -5637,6 +5665,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-maximum visibility through precipitation
'Time-maximum visibility through precipitation' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-minimum volumetric soil moisture
'Time-minimum volumetric soil moisture' = {
discipline = 2 ;
@ -5680,6 +5715,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-minimum visibility through precipitation
'Time-minimum visibility through precipitation' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-standard-deviation volumetric soil moisture
'Time-standard-deviation volumetric soil moisture' = {
discipline = 2 ;

View File

@ -4114,6 +4114,27 @@
parameterNumber = 148 ;
typeOfFirstFixedSurface = 1 ;
}
#Radar reflectivity
'231066' = {
discipline = 0 ;
parameterCategory = 16 ;
parameterNumber = 4 ;
}
#Pressure at cloud ceiling
'231067' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 19 ;
scaledValueOfFirstFixedSurface = 50 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Visibility through precipitation
'231068' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
}
#Burned area
'232000' = {
discipline = 2 ;
@ -5601,6 +5622,13 @@
parameterNumber = 23 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean visibility through precipitation
'235382' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-maximum volumetric soil moisture
'237077' = {
discipline = 2 ;
@ -5637,6 +5665,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-maximum visibility through precipitation
'237382' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-minimum volumetric soil moisture
'238077' = {
discipline = 2 ;
@ -5680,6 +5715,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-minimum visibility through precipitation
'238382' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-standard-deviation volumetric soil moisture
'239077' = {
discipline = 2 ;

View File

@ -4114,6 +4114,27 @@
parameterNumber = 148 ;
typeOfFirstFixedSurface = 1 ;
}
#Radar reflectivity
'rare' = {
discipline = 0 ;
parameterCategory = 16 ;
parameterNumber = 4 ;
}
#Pressure at cloud ceiling
'pcdc' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 19 ;
scaledValueOfFirstFixedSurface = 50 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Visibility through precipitation
'visp' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
}
#Burned area
'fba' = {
discipline = 2 ;
@ -5601,6 +5622,13 @@
parameterNumber = 23 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean visibility through precipitation
'avg_visp' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-maximum volumetric soil moisture
'max_vsw' = {
discipline = 2 ;
@ -5637,6 +5665,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-maximum visibility through precipitation
'max_visp' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-minimum volumetric soil moisture
'min_vsw' = {
discipline = 2 ;
@ -5680,6 +5715,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-minimum visibility through precipitation
'min_visp' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-standard-deviation volumetric soil moisture
'std_vsw' = {
discipline = 2 ;

View File

@ -20,6 +20,7 @@
'neutralBuoyancy' = {typeOfFirstFixedSurface=16; typeOfSecondFixedSurface=255;}
'mostUnstableParcel' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'mixedLayerParcel' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'lowestLevelOfCloudCoverExceedance' = {typeOfFirstFixedSurface=19; typeOfSecondFixedSurface=255;}
'isothermal' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'isobaricInPa' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255; pressureUnits='Pa';}
'isobaricInhPa' = {typeOfFirstFixedSurface=100; pressureUnits='hPa'; typeOfSecondFixedSurface=255;}

View File

@ -4114,6 +4114,27 @@
parameterNumber = 148 ;
typeOfFirstFixedSurface = 1 ;
}
#Radar reflectivity
'dB' = {
discipline = 0 ;
parameterCategory = 16 ;
parameterNumber = 4 ;
}
#Pressure at cloud ceiling
'Pa' = {
discipline = 0 ;
parameterCategory = 3 ;
parameterNumber = 0 ;
typeOfFirstFixedSurface = 19 ;
scaledValueOfFirstFixedSurface = 50 ;
scaleFactorOfFirstFixedSurface = 0 ;
}
#Visibility through precipitation
'm' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
}
#Burned area
'%' = {
discipline = 2 ;
@ -5601,6 +5622,13 @@
parameterNumber = 23 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-mean visibility through precipitation
'm' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 0 ;
}
#Time-maximum volumetric soil moisture
'm**3 m**-3' = {
discipline = 2 ;
@ -5637,6 +5665,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-maximum visibility through precipitation
'm' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 2 ;
}
#Time-minimum volumetric soil moisture
'm**3 m**-3' = {
discipline = 2 ;
@ -5680,6 +5715,13 @@
typeOfSecondFixedSurface = 8 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-minimum visibility through precipitation
'm' = {
discipline = 0 ;
parameterCategory = 19 ;
parameterNumber = 51 ;
typeOfStatisticalProcessing = 3 ;
}
#Time-standard-deviation volumetric soil moisture
'm**3 m**-3' = {
discipline = 2 ;

View File

@ -4,5 +4,6 @@ alias mars.fcmonth = marsForecastMonth;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -6,7 +6,10 @@ if (class is "od") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -8,7 +8,10 @@ if (class is "od") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -15,7 +15,7 @@ if (class isnot "gw") { # ECC-1448
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -18,7 +18,7 @@ if (class isnot "gw") { # ECC-1448
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -5,13 +5,15 @@ unalias mars.step;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -6,13 +6,15 @@ alias mars.number = perturbationNumber;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -6,14 +6,12 @@ alias mars.method = methodNumber;
unalias mars.step;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "ci") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3" || class is "ci") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -5,14 +5,14 @@ alias mars.number = perturbationNumber;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -7,13 +7,14 @@ unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -1 +0,0 @@
grib.msmm.em.def

View File

@ -0,0 +1,18 @@
# assert(16);
alias mars.fcmonth = marsForecastMonth;
unalias mars.step;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -1,5 +1,6 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -31,8 +31,10 @@ program codes_dump_test
if (iret == CODES_END_OF_FILE) exit
call codes_set_debug(0)
call codes_set_data_quality_checks(1)
call codes_dump(msgid)
call codes_set_debug(1)
call codes_set_data_quality_checks(0)
call codes_release(msgid)

View File

@ -2786,6 +2786,12 @@
call grib_set_debug(dmode)
end subroutine codes_set_debug
!> Set data quality check value (0, 1 or 2)
subroutine codes_set_data_quality_checks(val)
integer(kind=kindOfInt), intent(in) :: val
call grib_set_data_quality_checks(val)
end subroutine codes_set_data_quality_checks
!> Set the definition path

View File

@ -79,7 +79,7 @@ integer, external :: grib_f_set_int, grib_f_set_int_array, &
integer, external :: grib_f_get_message_size, grib_f_copy_message, grib_f_count_in_file
integer, external :: grib_f_write, grib_f_multi_write, grib_f_multi_append
integer, external :: grib_f_clone, grib_f_copy_namespace
external :: grib_f_check , grib_f_set_debug
external :: grib_f_check , grib_f_set_debug, grib_f_set_data_quality_checks
integer, external :: grib_f_util_sections_copy
integer, external :: grib_f_set_definitions_path, grib_f_set_samples_path
integer, external :: grib_f_julian_to_datetime, grib_f_datetime_to_julian, grib_f_copy_key

View File

@ -3211,6 +3211,12 @@
call grib_f_set_debug(dmode)
end subroutine grib_set_debug
!> Set data quality check value (0, 1 or 2)
subroutine grib_set_data_quality_checks(val)
integer(kind=kindOfInt), intent(in) :: val
call grib_f_set_data_quality_checks(val)
end subroutine grib_set_data_quality_checks
!> Set the definition path
!>

View File

@ -2875,6 +2875,13 @@ void grib_f_set_debug_(int* dmode)
grib_context* c = grib_context_get_default();
grib_context_set_debug(c, *dmode);
}
/*****************************************************************************/
void grib_f_set_data_quality_checks_(int* val)
{
Assert(val);
grib_context* c = grib_context_get_default();
grib_context_set_data_quality_checks(c, *val);
}
/*****************************************************************************/
int grib_f_set_definitions_path_(char* path, int len)

View File

@ -310,6 +310,7 @@ int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid);
int grib_f_read_file_(int* fid, void* buffer, size_t* nbytes);
int codes_f_bufr_keys_iterator_delete_(int* iterid);
void grib_f_set_debug_(int* mode);
void grib_f_set_data_quality_checks_(int* val);
int grib_f_set_definitions_path_(char* path, int len);
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes);
int any_f_new_from_file_(int* fid, int* gid);

View File

@ -357,7 +357,6 @@ list( APPEND eccodes_src_files
eccodes_prototypes.h
grib_dumper_class.h
grib_dumper_factory.h
grib_emoslib.h
grib_iterator_class.h
grib_iterator_factory.h
grib_nearest_class.h

View File

@ -835,8 +835,7 @@ static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bu
return err;
}
static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd,
grib_accessor_bufr_data_array_t* self, char* sval)
static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd, char* sval)
{
int err = 0;
int len;
@ -845,7 +844,7 @@ static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bu
grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + bd->width);
err = grib_encode_string(buff->data, pos, len, sval);
if (err) {
grib_context_log(c, GRIB_LOG_ERROR, "encode_string_value: %s. Failed to encode '%s'", bd->shortName, sval);
grib_context_log(c, GRIB_LOG_ERROR, "%s: %s. Failed to encode '%s'", __func__, bd->shortName, sval);
}
return err;
@ -1151,7 +1150,7 @@ static int encode_new_element(grib_context* c, grib_accessor_bufr_data_array_t*
grib_sarray_delete(c, stringValues);
}
else {
err = encode_string_value(c, buff, pos, bd, self, csval);
err = encode_string_value(c, buff, pos, bd, csval);
grib_context_free(c, csval);
}
}
@ -1273,7 +1272,7 @@ static int encode_element(grib_context* c, grib_accessor_bufr_data_array_t* self
grib_context_log(c, GRIB_LOG_ERROR, "encode_element '%s': Invalid index %d", bd->shortName, idx);
return GRIB_INVALID_ARGUMENT;
}
err = encode_string_value(c, buff, pos, bd, self, self->stringValues->v[idx]->v[0]);
err = encode_string_value(c, buff, pos, bd, self->stringValues->v[idx]->v[0]);
}
}
else {

View File

@ -77,7 +77,7 @@ int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count)
int grib_accessor_class_g1bitmap_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len)
{
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
const unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a;
long tlen;
int err;

View File

@ -18,7 +18,7 @@ void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, con
{
grib_accessor_class_abstract_vector_t::init(a, l, c);
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
int n = 0;
int n = 0;
self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
@ -26,7 +26,7 @@ void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, con
a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN;
self->number_of_elements = 6;
self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements);
self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements);
a->length = 0;
a->dirty = 1;
@ -90,8 +90,8 @@ int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor
int grib_accessor_class_g1end_of_interval_monthly_t::value_count(grib_accessor* a, long* count)
{
grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
*count = self->number_of_elements;
const grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a;
*count = self->number_of_elements;
return 0;
}
@ -111,9 +111,8 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g
long count = 0;
size_t alen = 0;
size_t blen = 0;
int err = 0;
err = a->value_count(&count);
int err = a->value_count(&count);
if (err)
return err;
alen = count;
@ -133,7 +132,10 @@ int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, g
a->dirty = 1;
err = a->unpack_double(aval, &alen);
if (err) return err;
err = b->unpack_double(bval, &blen);
if (err) return err;
for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) {
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
}

View File

@ -310,7 +310,7 @@ long grib_accessor_class_gen_t::byte_offset(grib_accessor* a)
int grib_accessor_class_gen_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len)
{
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
const unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
const long length = a->byte_count();
const long offset = a->byte_offset();

View File

@ -18,10 +18,11 @@ void grib_accessor_class_getenv_t::init(grib_accessor* a, const long l, grib_arg
{
grib_accessor_class_ascii_t::init(a, l, args);
grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a;
static char undefined[] = "undefined";
static char undefined[] = "undefined";
grib_handle* hand = grib_handle_of_accessor(a);
self->name = grib_arguments_get_string(grib_handle_of_accessor(a), args, 0);
self->default_value = grib_arguments_get_string(grib_handle_of_accessor(a), args, 1);
self->envvar = grib_arguments_get_string(hand, args, 0);
self->default_value = grib_arguments_get_string(hand, args, 1);
if (!self->default_value)
self->default_value = undefined;
self->value = 0;
@ -39,7 +40,7 @@ int grib_accessor_class_getenv_t::unpack_string(grib_accessor* a, char* val, siz
size_t l = 0;
if (!self->value) {
v = getenv(self->name);
v = getenv(self->envvar);
if (!v)
v = (char*)self->default_value;
self->value = v;

View File

@ -15,7 +15,7 @@
class grib_accessor_getenv_t : public grib_accessor_ascii_t
{
public:
const char* name;
const char* envvar;
char* value;
const char* default_value;
};
@ -23,7 +23,7 @@ public:
class grib_accessor_class_getenv_t : public grib_accessor_class_ascii_t
{
public:
grib_accessor_class_getenv_t(const char* name) : grib_accessor_class_ascii_t(name) {}
grib_accessor_class_getenv_t(const char* envvar) : grib_accessor_class_ascii_t(envvar) {}
grib_accessor* create_empty_accessor() override { return new grib_accessor_getenv_t{}; }
int pack_string(grib_accessor*, const char*, size_t* len) override;
int unpack_string(grib_accessor*, char*, size_t* len) override;
@ -31,4 +31,3 @@ public:
int value_count(grib_accessor*, long*) override;
void init(grib_accessor*, const long, grib_arguments*) override;
};

View File

@ -17,7 +17,7 @@ grib_accessor_class* grib_accessor_class_group = &_grib_accessor_class_group;
void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
const grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
grib_accessor_group_t* self = (grib_accessor_group_t*)a;
size_t i = 0;

View File

@ -59,6 +59,6 @@ int grib_accessor_class_gts_header_t::value_count(grib_accessor* a, long* count)
size_t grib_accessor_class_gts_header_t::string_length(grib_accessor* a)
{
grib_handle* h = grib_handle_of_accessor(a);
const grib_handle* h = grib_handle_of_accessor(a);
return h->gts_header_len;
}

View File

@ -25,9 +25,9 @@ void grib_accessor_class_md5_t::init(grib_accessor* a, const long len, grib_argu
grib_string_list* current = 0;
grib_context* context = a->context;
self->offset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++);
self->length = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, n++);
self->blocklist = NULL;
self->offset_key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++);
self->length_key = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, n++);
self->blocklist = NULL;
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++)) != NULL) {
if (!self->blocklist) {
self->blocklist = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
@ -99,9 +99,9 @@ int grib_accessor_class_md5_t::unpack_string(grib_accessor* a, char* v, size_t*
return GRIB_BUFFER_TOO_SMALL;
}
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offset, &offset)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offset_key, &offset)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(a), self->length, &length)) != GRIB_SUCCESS)
if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(a), self->length_key, &length)) != GRIB_SUCCESS)
return ret;
mess = (unsigned char*)grib_context_malloc(a->context, length);
memcpy(mess, grib_handle_of_accessor(a)->buffer->data + offset, length);

View File

@ -17,8 +17,8 @@ class grib_accessor_md5_t : public grib_accessor_gen_t
{
public:
/* Members defined in md5 */
const char* offset;
grib_expression* length;
const char* offset_key;
grib_expression* length_key;
grib_string_list* blocklist;
};

View File

@ -17,12 +17,10 @@ grib_accessor_class* grib_accessor_class_non_alpha = &_grib_accessor_class_non_a
void grib_accessor_class_non_alpha_t::init(grib_accessor* a, const long len, grib_arguments* arg)
{
grib_accessor_class_gen_t::init(a, len, arg);
grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
size_t i = 0;
unsigned char* v;
v = buffer->data + a->offset;
i = 0;
const grib_buffer* buffer = grib_handle_of_accessor(a)->buffer;
unsigned char* v = buffer->data + a->offset;
size_t i = 0;
while ((*v < 33 || *v > 126) && i <= buffer->ulength) {
v++;
i++;

View File

@ -199,17 +199,16 @@ long grib_accessor_class_signed_t::next_offset(grib_accessor* a)
int grib_accessor_class_signed_t::is_missing(grib_accessor* a)
{
int i = 0;
unsigned char ff = 0xff;
unsigned char ff = 0xff;
unsigned long offset = a->offset;
grib_handle* hand = grib_handle_of_accessor(a);
const grib_handle* hand = grib_handle_of_accessor(a);
if (a->length == 0) {
Assert(a->vvalue != NULL);
return a->vvalue->missing;
}
for (i = 0; i < a->length; i++) {
for (long i = 0; i < a->length; i++) {
if (hand->buffer->data[offset] != ff)
return 0;
offset++;

View File

@ -16,9 +16,9 @@ grib_accessor_class* grib_accessor_class_uint64 = &_grib_accessor_class_uint64;
int grib_accessor_class_uint64_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
long value = 0;
long pos = a->offset;
unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
long value = 0;
long pos = a->offset;
const unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
unsigned long long result = 0, tmp;
int i;

View File

@ -16,17 +16,16 @@ grib_accessor_class* grib_accessor_class_uint64_little_endian = &_grib_accessor_
int grib_accessor_class_uint64_little_endian_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
long value = 0;
long pos = a->offset;
unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
long value = 0;
long pos = a->offset;
const unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
unsigned long long result = 0, tmp;
int i;
if (*len < 1) {
return GRIB_ARRAY_TOO_SMALL;
}
for (i = 7; i >= 0; i--) {
for (int i = 7; i >= 0; i--) {
result <<= 8;
result |= data[pos + i];
}

View File

@ -18,7 +18,7 @@ int grib_accessor_class_uint8_t::unpack_long(grib_accessor* a, long* val, size_t
{
long value = 0;
long pos = a->offset;
unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
const unsigned char* data = grib_handle_of_accessor(a)->buffer->data;
if (*len < 1) {
return GRIB_ARRAY_TOO_SMALL;

View File

@ -162,7 +162,7 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in
int grib_accessor_class_unsigned_t::unpack_long(grib_accessor* a, long* val, size_t* len)
{
grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a;
const grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a;
long rlen = 0;
unsigned long i = 0;
@ -245,7 +245,7 @@ int grib_accessor_class_unsigned_t::is_missing(grib_accessor* a)
{
const unsigned char ff = 0xff;
unsigned long offset = a->offset;
grib_handle* hand = grib_handle_of_accessor(a);
const grib_handle* hand = grib_handle_of_accessor(a);
if (a->length == 0) {
Assert(a->vvalue != NULL);

View File

@ -218,10 +218,9 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
char master[1024] = {0,};
char local[1024] = {0,};
char masterDir[1024] = {0,};
size_t lenMasterDir = 1024;
size_t lenMasterDir = sizeof(masterDir);
char key[4096] = {0,};
char* full = 0;
int id;
const size_t bufLen = sizeof(buf);
const size_t keyLen = sizeof(key);
@ -234,7 +233,15 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
Assert(self->masterDir);
grib_get_string(h, self->masterDir, masterDir, &lenMasterDir);
snprintf(buf, bufLen, "%s/%s", masterDir, self->basename);
// See ECC-1920: The basename could be a key or a string
char* basename = self->basename; // default is a string
Assert(basename);
char baseNameValue[1024] = {0,}; // its value if a key
size_t lenBaseName = sizeof(baseNameValue);
if (grib_get_string(h, self->basename, baseNameValue, &lenBaseName) == GRIB_SUCCESS) {
basename = baseNameValue; // self->basename was a key whose value is baseNameValue
}
snprintf(buf, bufLen, "%s/%s", masterDir, basename);
grib_recompose_name(h, NULL, buf, master, 1);
@ -242,13 +249,13 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
char localDir[1024] = {0,};
size_t lenLocalDir = 1024;
grib_get_string(h, self->localDir, localDir, &lenLocalDir);
snprintf(buf, bufLen, "%s/%s", localDir, self->basename);
snprintf(buf, bufLen, "%s/%s", localDir, basename);
grib_recompose_name(h, NULL, buf, local, 1);
}
snprintf(key, keyLen, "%s%s", master, local);
id = grib_itrie_get_id(h->context->concepts_index, key);
int id = grib_itrie_get_id(h->context->concepts_index, key);
if ((c = h->context->concepts[id]) != NULL)
return c;
@ -274,7 +281,7 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
else {
grib_context_log(context, GRIB_LOG_FATAL,
"unable to find definition file %s in %s:%s\nDefinition files path=\"%s\"",
self->basename, master, local, context->grib_definition_files_path);
basename, master, local, context->grib_definition_files_path);
return NULL;
}

View File

@ -12,11 +12,11 @@
/* Generic functions */
/******************************************************************************/
char* codes_samples_path(const grib_context* c)
char* codes_samples_path(const codes_context* c)
{
return grib_samples_path(c);
}
char* codes_definition_path(const grib_context* c)
char* codes_definition_path(const codes_context* c)
{
return grib_definition_path(c);
}
@ -41,16 +41,16 @@ void codes_print_api_version(FILE* out)
{
grib_print_api_version(out);
}
int codes_count_in_file(grib_context* c, FILE* f, int* n)
int codes_count_in_file(codes_context* c, FILE* f, int* n)
{
return grib_count_in_file(c, f, n);
}
int codes_count_in_filename(grib_context* c, const char* filename, int* n)
int codes_count_in_filename(codes_context* c, const char* filename, int* n)
{
return grib_count_in_filename(c, filename, n);
}
grib_context* codes_context_get_default(void)
codes_context* codes_context_get_default(void)
{
return grib_context_get_default();
}
@ -74,7 +74,7 @@ void codes_check(const char* call, const char* file, int line, int e, const char
/* Fieldsets */
/******************************************************************************/
grib_fieldset* codes_fieldset_new_from_files(grib_context* c, const char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err)
grib_fieldset* codes_fieldset_new_from_files(codes_context* c, const char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err)
{
return grib_fieldset_new_from_files(c, filenames, nfiles, keys, nkeys, where_string, order_by_string, err);
}
@ -101,11 +101,11 @@ int codes_fieldset_count(const grib_fieldset* set)
/* Indexing */
/******************************************************************************/
grib_index* codes_index_new_from_file(grib_context* c, const char* filename, const char* keys, int* err)
grib_index* codes_index_new_from_file(codes_context* c, const char* filename, const char* keys, int* err)
{
return grib_index_new_from_file(c, filename, keys, err);
}
grib_index* codes_index_new(grib_context* c, const char* keys, int* err)
grib_index* codes_index_new(codes_context* c, const char* keys, int* err)
{
return grib_index_new(c, keys, err);
}
@ -117,7 +117,7 @@ int codes_index_write(grib_index* index, const char* filename)
{
return grib_index_write(index, filename);
}
grib_index* codes_index_read(grib_context* c, const char* filename, int* err)
grib_index* codes_index_read(codes_context* c, const char* filename, int* err)
{
return grib_index_read(c, filename, err);
}
@ -164,15 +164,15 @@ int codes_write_message(const grib_handle* h, const char* file, const char* mode
{
return grib_write_message(h, file, mode);
}
grib_handle* codes_handle_new_from_message(grib_context* c, const void* data, size_t data_len)
grib_handle* codes_handle_new_from_message(codes_context* c, const void* data, size_t data_len)
{
return grib_handle_new_from_message(c, data, data_len);
}
grib_handle* codes_handle_new_from_message_copy(grib_context* c, const void* data, size_t data_len)
grib_handle* codes_handle_new_from_message_copy(codes_context* c, const void* data, size_t data_len)
{
return grib_handle_new_from_message_copy(c, data, data_len);
}
grib_handle* codes_grib_handle_new_from_samples(grib_context* c, const char* sample_name)
grib_handle* codes_grib_handle_new_from_samples(codes_context* c, const char* sample_name)
{
return grib_handle_new_from_samples(c, sample_name);
}
@ -189,11 +189,11 @@ int codes_handle_delete(grib_handle* h)
{
return grib_handle_delete(h);
}
grib_handle* codes_handle_new_from_partial_message_copy(grib_context* c, const void* data, size_t size)
grib_handle* codes_handle_new_from_partial_message_copy(codes_context* c, const void* data, size_t size)
{
return grib_handle_new_from_partial_message_copy(c, data, size);
}
grib_handle* codes_handle_new_from_partial_message(grib_context* c, const void* data, size_t buflen)
grib_handle* codes_handle_new_from_partial_message(codes_context* c, const void* data, size_t buflen)
{
return grib_handle_new_from_partial_message(c, data, buflen);
}
@ -230,23 +230,23 @@ grib_string_list* codes_grib_util_get_mars_param(const char* param_id)
{
return grib_util_get_mars_param(param_id);
}
void codes_grib_multi_support_on(grib_context* c)
void codes_grib_multi_support_on(codes_context* c)
{
grib_multi_support_on(c);
}
void codes_grib_multi_support_off(grib_context* c)
void codes_grib_multi_support_off(codes_context* c)
{
grib_multi_support_off(c);
}
void codes_grib_multi_support_reset_file(grib_context* c, FILE* f)
void codes_grib_multi_support_reset_file(codes_context* c, FILE* f)
{
grib_multi_support_reset_file(c, f);
}
grib_handle* codes_grib_handle_new_from_multi_message(grib_context* c, void** data, size_t* data_len, int* error)
grib_handle* codes_grib_handle_new_from_multi_message(codes_context* c, void** data, size_t* data_len, int* error)
{
return grib_handle_new_from_multi_message(c, data, data_len, error);
}
grib_multi_handle* codes_grib_multi_handle_new(grib_context* c)
grib_multi_handle* codes_grib_multi_handle_new(codes_context* c)
{
return grib_multi_handle_new(c);
}
@ -467,24 +467,24 @@ void codes_dump_action_tree(codes_context* c, FILE* f)
}
/* GTS, GRIBEX */
/******************************************************************************/
void codes_gts_header_off(grib_context* c)
void codes_gts_header_off(codes_context* c)
{
grib_gts_header_off(c);
}
void codes_gts_header_on(grib_context* c)
void codes_gts_header_on(codes_context* c)
{
grib_gts_header_on(c);
}
void codes_gribex_mode_on(grib_context* c)
void codes_gribex_mode_on(codes_context* c)
{
grib_gribex_mode_on(c);
}
int codes_get_gribex_mode(const grib_context* c)
int codes_get_gribex_mode(const codes_context* c)
{
return grib_get_gribex_mode(c);
}
void codes_gribex_mode_off(grib_context* c)
void codes_gribex_mode_off(codes_context* c)
{
grib_gribex_mode_off(c);
}
@ -577,41 +577,45 @@ void codes_get_reduced_row_p(long pl, double lon_first, double lon_last, long* n
grib_get_reduced_row_p(pl, lon_first, lon_last, npoints, olon_first, olon_last);
}
void codes_context_delete(grib_context* c)
void codes_context_delete(codes_context* c)
{
grib_context_delete(c);
}
void codes_context_set_definitions_path(grib_context* c, const char* path)
void codes_context_set_definitions_path(codes_context* c, const char* path)
{
grib_context_set_definitions_path(c, path);
}
void codes_context_set_samples_path(grib_context* c, const char* path)
void codes_context_set_samples_path(codes_context* c, const char* path)
{
grib_context_set_samples_path(c, path);
}
void codes_context_set_debug(grib_context* c, int mode)
void codes_context_set_debug(codes_context* c, int mode)
{
grib_context_set_debug(c, mode);
}
void codes_context_set_data_quality_checks(codes_context* c, int val)
{
grib_context_set_data_quality_checks(c, val);
}
void codes_context_set_memory_proc(grib_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
void codes_context_set_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
{
grib_context_set_memory_proc(c, p_malloc, p_free, p_realloc);
}
void codes_context_set_persistent_memory_proc(grib_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free)
void codes_context_set_persistent_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free)
{
grib_context_set_persistent_memory_proc(c, p_malloc, p_free);
}
void codes_context_set_buffer_memory_proc(grib_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
void codes_context_set_buffer_memory_proc(codes_context* c, grib_malloc_proc p_malloc, grib_free_proc p_free, grib_realloc_proc p_realloc)
{
grib_context_set_buffer_memory_proc(c, p_malloc, p_free, p_realloc);
}
void codes_context_set_print_proc(grib_context* c, grib_print_proc p_print)
void codes_context_set_print_proc(codes_context* c, grib_print_proc p_print)
{
grib_context_set_print_proc(c, p_print);
}
void codes_context_set_logging_proc(grib_context* c, grib_log_proc p_log)
void codes_context_set_logging_proc(codes_context* c, grib_log_proc p_log)
{
grib_context_set_logging_proc(c, p_log);
}

View File

@ -1174,7 +1174,8 @@ void codes_context_set_definitions_path(codes_context* c, const char* path);
*/
void codes_context_set_samples_path(codes_context* c, const char* path);
void codes_context_set_debug(grib_context* c, int mode);
void codes_context_set_debug(codes_context* c, int mode);
void codes_context_set_data_quality_checks(codes_context* c, int val);
/**
* Sets memory procedures of the context

View File

@ -1172,6 +1172,7 @@ void grib_context_set_definitions_path(grib_context* c, const char* path);
void grib_context_set_samples_path(grib_context* c, const char* path);
void grib_context_set_debug(grib_context* c, int mode);
void grib_context_set_data_quality_checks(grib_context* c, int val);
/**
* Sets memory procedures of the context

View File

@ -241,6 +241,17 @@ void grib_context_set_print_proc(grib_context* c, grib_print_proc p)
c->print = (p ? p : &default_print);
}
void grib_context_set_data_quality_checks(grib_context* c, int val)
{
c = c ? c : grib_context_get_default();
// If val == 0, disable data quality checks
// If val == 1, failure results in an error
// If val == 2, failure results in a warning
Assert(val == 0 || val == 1 || val == 2);
c->grib_data_quality_checks = val;
}
void grib_context_set_debug(grib_context* c, int mode)
{
c = c ? c : grib_context_get_default();

View File

@ -84,7 +84,6 @@ void grib_dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
@ -97,7 +96,6 @@ void grib_dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
@ -110,7 +108,6 @@ void grib_dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment)
@ -123,7 +120,6 @@ void grib_dump_string_array(grib_dumper* d, grib_accessor* a, const char* commen
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_label(grib_dumper* d, grib_accessor* a, const char* comment)
@ -136,7 +132,6 @@ void grib_dump_label(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment)
@ -149,7 +144,6 @@ void grib_dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
@ -162,7 +156,6 @@ void grib_dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accessors* block)
@ -175,7 +168,6 @@ void grib_dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accessors
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_values(grib_dumper* d, grib_accessor* a)
@ -188,7 +180,6 @@ void grib_dump_values(grib_dumper* d, grib_accessor* a)
}
c = c->super ? *(c->super) : NULL;
}
Assert(0);
}
void grib_dump_header(grib_dumper* d, const grib_handle* ch)

View File

@ -16,7 +16,7 @@
START_CLASS_DEF
CLASS = dumper
IMPLEMENTS = dump_long;dump_bits
IMPLEMENTS = dump_double;dump_string
IMPLEMENTS = dump_double;dump_string;dump_string_array
IMPLEMENTS = dump_bytes;dump_values
IMPLEMENTS = dump_label;dump_section
IMPLEMENTS = init;destroy
@ -45,6 +45,7 @@ static void dump_long (grib_dumper* d, grib_accessor* a,const char* commen
static void dump_bits (grib_dumper* d, grib_accessor* a,const char* comment);
static void dump_double (grib_dumper* d, grib_accessor* a,const char* comment);
static void dump_string (grib_dumper* d, grib_accessor* a,const char* comment);
static void dump_string_array (grib_dumper* d, grib_accessor* a,const char* comment);
static void dump_bytes (grib_dumper* d, grib_accessor* a,const char* comment);
static void dump_values (grib_dumper* d, grib_accessor* a);
static void dump_label (grib_dumper* d, grib_accessor* a,const char* comment);
@ -70,7 +71,7 @@ static grib_dumper_class _grib_dumper_class_debug = {
&dump_long, /* dump long */
&dump_double, /* dump double */
&dump_string, /* dump string */
0, /* dump string array */
&dump_string_array, /* dump string array */
&dump_label, /* dump labels */
&dump_bytes, /* dump bytes */
&dump_bits, /* dump bits */
@ -381,6 +382,76 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
grib_context_free(a->context, value);
}
static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment)
{
grib_dumper_debug* self = (grib_dumper_debug*)d;
char** values;
size_t size = 0, i = 0;
grib_context* c = NULL;
int err = 0;
int tab = 0;
long count = 0;
if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
return;
c = a->context;
a->value_count(&count);
if (count == 0)
return;
size = count;
if (size == 1) {
dump_string(d, a, comment);
return;
}
values = (char**)grib_context_malloc_clear(c, size * sizeof(char*));
if (!values) {
grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size);
return;
}
err = a->unpack_string_array(values, &size);
// print_offset(self->dumper.out,d,a);
//print_offset(self->dumper.out, self->begin, self->theEnd);
if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) {
fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "# type %s (str) \n", a->creator->op);
}
aliases(d, a);
if (comment) {
fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "# %s \n", comment);
}
if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) {
fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "#-READ ONLY- ");
tab = 13;
}
else
fprintf(self->dumper.out, " ");
tab++;
fprintf(self->dumper.out, "%s = {\n", a->name);
for (i = 0; i < size; i++) {
fprintf(self->dumper.out, "%-*s\"%s\",\n", (int)(tab + strlen(a->name) + 4), " ", values[i]);
}
fprintf(self->dumper.out, " }");
if (err) {
fprintf(self->dumper.out, " ");
fprintf(self->dumper.out, "# *** ERR=%d (%s)", err, grib_get_error_message(err));
}
fprintf(self->dumper.out, "\n");
for (i=0; i<size; ++i) grib_context_free(c, values[i]);
grib_context_free(c, values);
}
static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment)
{
grib_dumper_debug* self = (grib_dumper_debug*)d;

View File

@ -1,13 +0,0 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
int igglat_(long* KLAT, float* PGAUSS, long* KPR, long* KERR);
void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double* PSEC2, long* KSEC3, double* PSEC3, long* KSEC4,
double* PSEC4, long* KLENP, void* KGRIB, long* KLENG, long* KWORD, char* HOPER, long* KRET);

View File

@ -108,7 +108,7 @@ int transform_iterator_data(grib_context* context, double* data,
{
double* data2;
double *pData0, *pData1, *pData2;
unsigned long ix, iy;
long ix, iy;
if (!iScansNegatively && jScansPositively && !jPointsAreConsecutive && !alternativeRowScanning) {
/* Already +i and +j. No need to change */

View File

@ -211,7 +211,7 @@ static std::vector<double> HEALPix_longitudes(size_t N, size_t i)
return longitudes;
}
static int iterate_healpix(grib_iterator_healpix* self, long N)
static int iterate_healpix(grib_iterator_healpix* self, long N, bool nested)
{
size_t Ny = 4 * static_cast<size_t>(N) - 1;
auto Nd = static_cast<double>(N);
@ -241,7 +241,7 @@ static int iterate_healpix(grib_iterator_healpix* self, long N)
// Equator
latitudes[2 * N - 1] = 0.0;
if (self->nested) {
if (nested) {
if (!is_power_of_2(N)) {
grib_context* c = grib_context_get_default();
grib_context_log(c, GRIB_LOG_ERROR, "%s: For nested ordering, Nside must be a power of 2", ITER);
@ -389,7 +389,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
}
try {
err = iterate_healpix(self, N);
err = iterate_healpix(self, N, self->nested);
}
catch (...) {
return GRIB_INTERNAL_ERROR;

View File

@ -875,6 +875,20 @@ static int write_out_error_data_file(const double* data_values, size_t data_valu
return GRIB_SUCCESS;
}
static long get_bitsPerValue_for_packingType(const int specPackingType, const long specBitsPerValue)
{
if (specPackingType == GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE) {
if (specBitsPerValue > 60) return 60;
}
else if (specPackingType == GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER) {
if (specBitsPerValue > 60) return 32;
}
else if (specPackingType == GRIB_UTIL_PACKING_TYPE_CCSDS) {
if (specBitsPerValue > 32) return 32;
}
return specBitsPerValue; //original
}
static int get_grib_sample_name(grib_handle* h, long editionNumber,
const grib_util_grid_spec* spec, const char* grid_type, char* sample_name)
{
@ -1341,17 +1355,26 @@ grib_handle* grib_util_set_spec(grib_handle* h,
Assert(grib_get_long(h, "bitsPerValue", &bitsPerValue) == 0);
SET_LONG_VALUE("bitsPerValue", bitsPerValue);
}
} break;
}
break;
case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES:
SET_LONG_VALUE("bitsPerValue", packing_spec->bitsPerValue);
break;
case GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES: {
// See ECC-1921
const long bitsPerValue = get_bitsPerValue_for_packingType(packing_spec->packing_type, packing_spec->bitsPerValue);
if (bitsPerValue != packing_spec->bitsPerValue) {
fprintf(stderr, "ECCODES WARNING : Cannot pack with requested bitsPerValue (%ld). Using %ld\n",
packing_spec->bitsPerValue, bitsPerValue);
}
SET_LONG_VALUE("bitsPerValue", bitsPerValue);
}
break;
case GRIB_UTIL_ACCURACY_SAME_DECIMAL_SCALE_FACTOR_AS_INPUT: {
long decimalScaleFactor = 0;
Assert(grib_get_long(h, "decimalScaleFactor", &decimalScaleFactor) == 0);
SET_LONG_VALUE("decimalScaleFactor", decimalScaleFactor);
} break;
}
break;
case GRIB_UTIL_ACCURACY_USE_PROVIDED_DECIMAL_SCALE_FACTOR:
SET_LONG_VALUE("decimalScaleFactor", packing_spec->decimalScaleFactor);

File diff suppressed because it is too large Load Diff

View File

@ -703,13 +703,17 @@ trigger_block: TRIGGER '(' argument_list ')' '{' instructions '}' { $$ = grib_ac
concept_block: CONCEPT IDENT '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$2,$4,0,0,0,0,0,0,$6,0); free($2); }
| CONCEPT IDENT '(' IDENT ')' '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$2,$7,0,0,$4,0,0,0,$9,0); free($2);free($4); }
| CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,$10,0,$12,0); free($2);free($6);free($4);free($8);free($10); }
| CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,$10,0,$12,0); free($2);free($6);free($4);free($8);free($10); }
| CONCEPT IDENT '(' IDENT ',' IDENT ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,$10,0,$12,0); free($2);free($6);free($4);free($8);free($10); }
| CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,$10,$12,$14,0); free($2);free($6);free($4);free($8);free($10);free($12); }
| CONCEPT IDENT '(' IDENT ',' STRING ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,0,0,$10,0); free($2);free($6);free($4);free($8); }
| CONCEPT IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$4,0,$8,$2,$6,$10,$12,0,$14,0); free($4);free($8);free($6);free($10); free($12); free($2);}
| CONCEPT IDENT '.' IDENT '(' IDENT ',' IDENT ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$4,0,$8,$2,$6,$10,$12,0,$14,0); free($4);free($8);free($6);free($10); free($12); free($2);}
| CONCEPT IDENT '.' IDENT '(' IDENT ',' STRING ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$4,0,$8,$2,$6,$10,0,0,$12,0); free($4);free($8);free($6);free($10); free($2);}
| CONCEPT IDENT '.' IDENT '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$4,$6,0,$2,0,0,0,0,$8,0); free($2);free($4); }
| CONCEPT IDENT '.' IDENT '(' IDENT ')' '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$4,$9,0,$2,$6,0,0,0,$11,0); free($2);free($4);free($6); }
| CONCEPT_NOFAIL IDENT '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$2,$4,0,0,0,0,0,0,$6,1); free($2); }
| CONCEPT_NOFAIL IDENT '(' IDENT ')' '{' concept_list '}' flags { $$ = grib_action_create_concept(grib_parser_context,$2,$7,0,0,$4,0,0,0,$9,1); free($2);free($4); }
| CONCEPT_NOFAIL IDENT '(' IDENT ',' STRING ',' IDENT ',' IDENT ')' flags { $$ = grib_action_create_concept(grib_parser_context,$2,0,$6,0,$4,$8,$10,0,$12,1); free($2);free($6);free($4);free($8);free($10); }

View File

@ -106,5 +106,11 @@ grep -q "unsigned iDirectionIncrement = 2000000 (can be missing)" $temp
grep -q "constant zero = 0 (read-only)" $temp
grep -q "unsigned reserved = MISSING (can be missing) (read-only)" $temp
# Debug dump a BUFR using -TB switch
infile=${data_dir}/bufr/pgps_110.bufr
${tools_dir}/grib_dump -Da -TB $infile > $temp
# ${tools_dir}/grib_dump -Da -TB -s unpack=1 $infile > $temp
# Clean up
rm -f $temp

View File

@ -422,6 +422,16 @@ static void test_gts_header_mode()
Assert(c->gts_header_on == 0);
}
static void test_data_quality_checks()
{
grib_context* c = grib_context_get_default();
printf("Running %s ...\n", __func__);
grib_context_set_data_quality_checks(c, 1);//warning
grib_context_set_data_quality_checks(c, 2);//error
grib_context_set_data_quality_checks(c, 0);//no checks
}
static void test_bufr_multi_element_constant_arrays()
{
grib_context* c = grib_context_get_default();
@ -859,6 +869,7 @@ int main(int argc, char** argv)
test_gribex_mode();
test_gts_header_mode();
test_bufr_multi_element_constant_arrays();
test_data_quality_checks();
test_concept_condition_strings();

View File

@ -36,7 +36,7 @@ print_feature()
build_type="@CMAKE_BUILD_TYPE@"
info()
{
echo "ecCodes version (${ECCODES_VERSION_STR}), git-sha1 ${ECCODES_GIT_SHA1}"
echo "ecCodes version ${ECCODES_VERSION_STR}, git-sha1 ${ECCODES_GIT_SHA1}"
echo ""
echo "Build:"
echo " build type : @CMAKE_BUILD_TYPE@"
@ -55,6 +55,7 @@ info()
# echo " flags : @ECCODES_Fortran_FLAGS@"
echo ""
echo "Features:"
echo " FORTRAN : $(print_feature @HAVE_FORTRAN@)"
echo " AEC : $(print_feature @HAVE_AEC@)"
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
echo " ECCODES_THREADS : $(print_feature @GRIB_PTHREADS@)"

View File

@ -371,10 +371,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
}
if (!json_latlon && options->json_output) {
if (options->current_infile && options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}
if (!first_handle && options->handle_count > 1) {
fprintf(stdout, ",\n");
}
@ -383,6 +379,12 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
first_handle = 0;
}
}
if (options->current_infile && options->current_infile->name) {
size = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &size);
}
new_handle = "\n,";
return 0;
}