chemId/paramId split: Fix case when mars class is changed but datasetForLocal does not

This commit is contained in:
shahramn 2024-07-31 17:27:13 +01:00
parent 97a01c3df0
commit 2f9cc4803d
3 changed files with 57 additions and 1 deletions

View File

@ -51,7 +51,14 @@ concept datasetForLocal(unknown) {
"unknown" = { dummy=1; }
}
if (datasetForLocal isnot "unknown") {
# If the keys marsClass or productionStatusOfProcessedData change in memory,
# need to trigger the change of conceptsDirs
transient redo_concept_dirs = 0;
when( changed(marsClass) || changed(productionStatusOfProcessedData) ) {
set redo_concept_dirs = 1;
}
if ( redo_concept_dirs || datasetForLocal isnot "unknown") {
constant conceptsDir2 = "grib2/localConcepts/[datasetForLocal]": hidden;
constant conceptsDir1 = "grib2": hidden;
}

View File

@ -195,6 +195,7 @@ if( HAVE_BUILD_TOOLS )
grib_count
grib_clone_headers_only
grib2_paramType
grib2_datasetForLocal
wmo_read_bufr_from_file
wmo_read_gts_from_file
wmo_read_any_from_file

48
tests/grib2_datasetForLocal.sh Executable file
View File

@ -0,0 +1,48 @@
#!/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
REDIRECT=/dev/null
label="grib2_datasetforlocal_test"
tempGribA=temp.$label.A.grib
tempGribB=temp.$label.B.grib
tempGribC=temp.$label.C.grib
tempFilt=temp.$label.filt
tempLog=temp.$label.log
tempOut=temp.$label.txt
tempRef=temp.$label.ref
# ERA6
# -----
sample=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl
# Make changes in stages
${tools_dir}/grib_set -s marsClass=e6,productDefinitionTemplateNumber=42 $sample $tempGribA
${tools_dir}/grib_set -s paramId=233033 $tempGribA $tempGribB
# Now all in one go
${tools_dir}/grib_set -s marsClass=e6,productDefinitionTemplateNumber=42,paramId=233033 $sample $tempGribC
cmp $tempGribB $tempGribC
# DestinE
# --------
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -s centre=0,productionStatusOfProcessedData=12 $sample $tempGribA
${tools_dir}/grib_set -s paramId=210061 $tempGribA $tempGribB
${tools_dir}/grib_set -s centre=0,productionStatusOfProcessedData=12,paramId=210061 $sample $tempGribC
cmp $tempGribB $tempGribC
#grib_check_key_equals $temp k1,k2 "v1 v2"
# Clean up
rm -f $tempGribA $tempGribB $tempGribC $tempFilt $tempLog $tempOut $tempRef