From 71be88aca3d5b6e73d263e7bab11d2d7071d3c8a Mon Sep 17 00:00:00 2001 From: Matthew Griffith Date: Fri, 30 Aug 2024 10:36:07 +0000 Subject: [PATCH] ECC-1903: Attempting with MTG2SwitchConcept. Not sure the if defined statement in parameters.def is working as expected. --- .../grib2/local/ecmf/section2_extras.def | 13 ++++ .../localConcepts/ecmf/MTG2SwitchConcept.def | 25 +++++++ .../ecmf/modelVersionConcept_IFS.def | 8 ++- .../grib2/{name.36.def => name.33.def} | 0 .../grib2/{paramId.36.def => paramId.33.def} | 0 definitions/grib2/parameters.def | 68 +++++++------------ definitions/grib2/section.2.def | 3 + .../{shortName.36.def => shortName.33.def} | 0 .../grib2/{units.36.def => units.33.def} | 0 9 files changed, 72 insertions(+), 45 deletions(-) create mode 100644 definitions/grib2/local/ecmf/section2_extras.def create mode 100644 definitions/grib2/localConcepts/ecmf/MTG2SwitchConcept.def rename definitions/grib2/{name.36.def => name.33.def} (100%) rename definitions/grib2/{paramId.36.def => paramId.33.def} (100%) rename definitions/grib2/{shortName.36.def => shortName.33.def} (100%) rename definitions/grib2/{units.36.def => units.33.def} (100%) diff --git a/definitions/grib2/local/ecmf/section2_extras.def b/definitions/grib2/local/ecmf/section2_extras.def new file mode 100644 index 000000000..69c57b2ee --- /dev/null +++ b/definitions/grib2/local/ecmf/section2_extras.def @@ -0,0 +1,13 @@ +# (C) Copyright 2005- ECMWF. +# ECMWF specific section 2 extras + +transient tablesVersionMTG2Switch=33: hidden; + +# MTG2 +if (tablesVersion <= [tablesVersionMTG2Switch]) { + transient MTG2SwitchDefault = 0; +} else { + transient MTG2SwitchDefault = 1; +} + +concept MTG2Switch(MTG2SwitchDefault, "MTG2SwitchConcept.def", conceptsDir2,conceptsDir1): no_copy; \ No newline at end of file diff --git a/definitions/grib2/localConcepts/ecmf/MTG2SwitchConcept.def b/definitions/grib2/localConcepts/ecmf/MTG2SwitchConcept.def new file mode 100644 index 000000000..6ba593e02 --- /dev/null +++ b/definitions/grib2/localConcepts/ecmf/MTG2SwitchConcept.def @@ -0,0 +1,25 @@ +# Concept MTG2Switch +# 0 = pre-MTG2 encoding used +# 1 = post-MTG2 encoding used +# 2 = post-MTG2 encoding with paramId + chemId used +# OD +0 = {tablesVersion=35; productionStatusOfProcessedData=0; modelVersion='cy50r1';} +1 = {tablesVersion=35; productionStatusOfProcessedData=1; modelVersion='cy50r1';} +1 = {tablesVersion=35; productionStatusOfProcessedData=0; modelVersion='cy50r2';} +# MC +2 = {tablesVersion=35; productionStatusOfProcessedData=1; modelVersion='cy50r1'; class=mc;} +2 = {tablesVersion=35; productionStatusOfProcessedData=0; modelVersion='cy50r2'; class=mc;} +# RD +0 = {tablesVersion=35; productionStatusOfProcessedData=2; modelVersion='cy50r1';} +1 = {tablesVersion=35; productionStatusOfProcessedData=2; modelVersion='cy50r1'; typeOfProcessedData=9;} +1 = {tablesVersion=35; productionStatusOfProcessedData=2; modelVersion='cy50r2';} + +# SEAS6 +1 = {tablesVersion=34; productionStatusOfProcessedData=0; modelVersion='cy49r2';} + +# ERA6 +1 = {tablesVersion=34; productionStatusOfProcessedData=3; modelVersion='cy49r2'; marsClass=e6;} + +# EAC5 +2 = {tablesVersion=34; productionStatusOfProcessedData=3; modelVersion='cy49r2'; marsClass=mc;} +2 = {tablesVersion=34; productionStatusOfProcessedData=3; modelVersion='cy49r2'; marsClass=cr;} diff --git a/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def index 8445b7489..27985a80d 100644 --- a/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def +++ b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def @@ -1,4 +1,10 @@ -'cy49r1' = { generatingProcessIdentifier = 155; } +'cy50r2' = { generatingProcessIdentifier = 161; } +'cy50r1' = { generatingProcessIdentifier = 160; } +'cy49r2' = { generatingProcessIdentifier = 159; } +'cy49r1' = { generatingProcessIdentifier = 158; } +'cy48r3' = { generatingProcessIdentifier = 157; } +'climatedt' = { generatingProcessIdentifier = 156; } +'cy48r2' = { generatingProcessIdentifier = 155; } 'cy48r1' = { generatingProcessIdentifier = 154; } 'cy47r3' = { generatingProcessIdentifier = 153; } 'cy47r2' = { generatingProcessIdentifier = 152; } diff --git a/definitions/grib2/name.36.def b/definitions/grib2/name.33.def similarity index 100% rename from definitions/grib2/name.36.def rename to definitions/grib2/name.33.def diff --git a/definitions/grib2/paramId.36.def b/definitions/grib2/paramId.33.def similarity index 100% rename from definitions/grib2/paramId.36.def rename to definitions/grib2/paramId.33.def diff --git a/definitions/grib2/parameters.def b/definitions/grib2/parameters.def index 1084516cf..254da2ef4 100644 --- a/definitions/grib2/parameters.def +++ b/definitions/grib2/parameters.def @@ -2,66 +2,46 @@ transient dummyc=0: hidden; -# MTG2 switch at tablesVersion 36 +# If MTG2Switch is defined we may need to look at pre-MTG2 definitions. Otherwise look at new definitions -transient tablesVersionMTG2Switch=36: hidden; +if ( defined(MTG2Switch) ) { -concept paramIdLegacyECMF(defaultParameter,"paramId.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy,hidden; + # pre-MTG2 + if ( MTG2Switch == 0) { -# pre-MTG2 -if ( tablesVersion <= tablesVersionMTG2Switch ) { + concept paramIdLegacyECMF(defaultParameter,"paramId.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy,hidden; + concept paramIdECMF (paramIdLegacyECMF,"paramId.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy; + concept paramId (paramIdECMF,"paramId.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): long_type; - concept paramIdECMF (paramIdLegacyECMF,"paramId.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy; - concept paramId (paramIdECMF,"paramId.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): long_type; + concept shortNameLegacyECMF(defaultShortName,"shortName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; + concept shortNameECMF (shortNameLegacyECMF,"shortName.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; + concept ls.shortName (shortNameECMF,"shortName.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy,dump; -# post-MTG2 + concept unitsLegacyECMF(defaultName,"units.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden,read_only; + concept unitsECMF (unitsLegacyECMF,"units.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy, read_only; + concept units (unitsECMF,"units.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy, read_only; + + concept nameLegacyECMF(defaultName,"name.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; + concept nameECMF(nameLegacyECMF,"name.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; + concept name(nameECMF,"name.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy,dump; + + } +# All other cases other than pre-MTG2 fall here } else { + concept paramIdLegacyECMF(defaultParameter,"paramId.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy,hidden; concept paramIdECMF (paramIdLegacyECMF,"paramId.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy; concept paramId (paramIdECMF,"paramId.def",conceptsDir2,conceptsDir1): long_type; -} - -concept shortNameLegacyECMF(defaultShortName,"shortName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; - -# pre-MTG2 -if ( tablesVersion <= tablesVersionMTG2Switch ) { - - concept shortNameECMF (shortNameLegacyECMF,"shortName.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; - concept ls.shortName (shortNameECMF,"shortName.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy,dump; - -} else { - + concept shortNameLegacyECMF(defaultShortName,"shortName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; concept shortNameECMF (shortNameLegacyECMF,"shortName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; concept ls.shortName (shortNameECMF,"shortName.def",conceptsDir2,conceptsDir1): no_copy,dump; -} - -concept unitsLegacyECMF(defaultName,"units.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden,read_only; - - -# pre-MTG2 -if ( tablesVersion <= tablesVersionMTG2Switch ) { - - concept unitsECMF (unitsLegacyECMF,"units.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy, read_only; - concept units (unitsECMF,"units.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy, read_only; - -} else { - + concept unitsLegacyECMF(defaultName,"units.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden,read_only; concept unitsECMF (unitsLegacyECMF,"units.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy, read_only; concept units (unitsECMF,"units.def",conceptsDir2,conceptsDir1): no_copy, read_only; -} -concept nameLegacyECMF(defaultName,"name.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; - -# pre-MTG2 -if ( tablesVersion <= tablesVersionMTG2Switch ) { - - concept nameECMF(nameLegacyECMF,"name.[tablesVersionMTG2Switch].def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; - concept name(nameECMF,"name.[tablesVersionMTG2Switch].def",conceptsDir2,conceptsDir1): no_copy,dump; - -} else { - + concept nameLegacyECMF(defaultName,"name.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden; concept nameECMF(nameLegacyECMF,"name.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; concept name(nameECMF,"name.def",conceptsDir2,conceptsDir1): no_copy,dump; diff --git a/definitions/grib2/section.2.def b/definitions/grib2/section.2.def index cc7601295..492adafa8 100644 --- a/definitions/grib2/section.2.def +++ b/definitions/grib2/section.2.def @@ -51,5 +51,8 @@ if ( addEmptySection2 == 0 ) { } } +# Hook for local extras +template_nofail extras "grib2/local/[centre]/section2_extras.def"; + section_padding section2Padding : read_only; diff --git a/definitions/grib2/shortName.36.def b/definitions/grib2/shortName.33.def similarity index 100% rename from definitions/grib2/shortName.36.def rename to definitions/grib2/shortName.33.def diff --git a/definitions/grib2/units.36.def b/definitions/grib2/units.33.def similarity index 100% rename from definitions/grib2/units.36.def rename to definitions/grib2/units.33.def