From 886460db9b15cb26630033d38f3ff8e94c230103 Mon Sep 17 00:00:00 2001 From: rdosinski <126468241+rdosinski@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:16:24 +0200 Subject: [PATCH] Feature/mars namespace quantiles (#250) * initial commit * quantile mars namespace - GRIB2 and GRIB3 same -> if else * ECC-1935: include mars.quantile.def instead of repeating same definitions several times * Update grib.efhs.cd.def Fix error * ECC-1935: remove GRIB2 from if clause --------- Co-authored-by: shahramn --- definitions/mars/grib.dacl.pb.def | 5 ++--- definitions/mars/grib.dacw.pb.def | 6 +++--- definitions/mars/grib.eefo.pb.def | 5 ++--- definitions/mars/grib.eefo.pd.def | 6 +++--- definitions/mars/grib.eehs.cd.def | 4 ++-- definitions/mars/grib.efhs.cd.def | 4 ++-- definitions/mars/grib.enfo.pb.def | 5 ++--- definitions/mars/grib.enfo.pd.def | 6 +++--- definitions/mars/grib.mfam.pb.def | 3 +-- definitions/mars/grib.mfam.pd.def | 3 +-- definitions/mars/grib.wees.cd.def | 4 ++-- definitions/mars/grib.wehs.cd.def | 4 ++-- definitions/mars/mars.quantile.def | 17 +++++++++++++++++ 13 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 definitions/mars/mars.quantile.def diff --git a/definitions/mars/grib.dacl.pb.def b/definitions/mars/grib.dacl.pb.def index 5ecc47b04..db9763909 100644 --- a/definitions/mars/grib.dacl.pb.def +++ b/definitions/mars/grib.dacl.pb.def @@ -1,4 +1,3 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.dacw.pb.def b/definitions/mars/grib.dacw.pb.def index 5ecc47b04..4144f1bc3 100644 --- a/definitions/mars/grib.dacw.pb.def +++ b/definitions/mars/grib.dacw.pb.def @@ -1,4 +1,4 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; + +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.eefo.pb.def b/definitions/mars/grib.eefo.pb.def index 5ecc47b04..db9763909 100644 --- a/definitions/mars/grib.eefo.pb.def +++ b/definitions/mars/grib.eefo.pb.def @@ -1,4 +1,3 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.eefo.pd.def b/definitions/mars/grib.eefo.pd.def index a53d82ca0..db9763909 100644 --- a/definitions/mars/grib.eefo.pd.def +++ b/definitions/mars/grib.eefo.pd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; + +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.eehs.cd.def b/definitions/mars/grib.eehs.cd.def index 05e94a6f1..db9763909 100644 --- a/definitions/mars/grib.eehs.cd.def +++ b/definitions/mars/grib.eehs.cd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -alias mars.quantile = quantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.efhs.cd.def b/definitions/mars/grib.efhs.cd.def index 05e94a6f1..db9763909 100644 --- a/definitions/mars/grib.efhs.cd.def +++ b/definitions/mars/grib.efhs.cd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -alias mars.quantile = quantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.enfo.pb.def b/definitions/mars/grib.enfo.pb.def index 5ecc47b04..db9763909 100644 --- a/definitions/mars/grib.enfo.pb.def +++ b/definitions/mars/grib.enfo.pb.def @@ -1,4 +1,3 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.enfo.pd.def b/definitions/mars/grib.enfo.pd.def index a53d82ca0..db9763909 100644 --- a/definitions/mars/grib.enfo.pd.def +++ b/definitions/mars/grib.enfo.pd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +alias mars.step = stepRange; + +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.mfam.pb.def b/definitions/mars/grib.mfam.pb.def index 27df3cc1b..72b841ecc 100644 --- a/definitions/mars/grib.mfam.pb.def +++ b/definitions/mars/grib.mfam.pb.def @@ -3,8 +3,7 @@ alias mars.origin = centre; meta forecastperiod g1fcperiod(P1,P2,timeRangeIndicator,indicatorOfUnitOfTimeRange) : no_copy; alias mars.fcperiod = forecastperiod; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +include "mars/mars.quantile.def" # TODO: Check why they are set in the first place unalias mars.step; diff --git a/definitions/mars/grib.mfam.pd.def b/definitions/mars/grib.mfam.pd.def index 96f272f62..cd37d34f6 100644 --- a/definitions/mars/grib.mfam.pd.def +++ b/definitions/mars/grib.mfam.pd.def @@ -3,8 +3,7 @@ alias mars.origin = centre; meta forecastperiod g1fcperiod(P1,P2,timeRangeIndicator,indicatorOfUnitOfTimeRange) : no_copy; alias mars.fcperiod = forecastperiod; -meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); -alias mars.quantile = marsQuantile; +include "mars/mars.quantile.def" # TODO: Check why they are set in the first place unalias mars.step; diff --git a/definitions/mars/grib.wees.cd.def b/definitions/mars/grib.wees.cd.def index 05e94a6f1..db9763909 100644 --- a/definitions/mars/grib.wees.cd.def +++ b/definitions/mars/grib.wees.cd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -alias mars.quantile = quantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/grib.wehs.cd.def b/definitions/mars/grib.wehs.cd.def index 05e94a6f1..db9763909 100644 --- a/definitions/mars/grib.wehs.cd.def +++ b/definitions/mars/grib.wehs.cd.def @@ -1,3 +1,3 @@ -alias mars.step = stepRange; -alias mars.quantile = quantile; +alias mars.step = stepRange; +include "mars/mars.quantile.def" diff --git a/definitions/mars/mars.quantile.def b/definitions/mars/mars.quantile.def new file mode 100644 index 000000000..60431fc38 --- /dev/null +++ b/definitions/mars/mars.quantile.def @@ -0,0 +1,17 @@ +if ((stream is "eehs" or stream is "efhs" or stream is "wees" or stream is "wehs") and (type is "cd")){ + if (edition == 1){ + # defined in local section 19 + alias mars.quantile = quantile; + } else { + meta marsQuantile sprintf("%d:%d",quantileValue,totalNumberOfQuantiles); + alias mars.quantile = marsQuantile; + } + } else { +if (edition == 1){ + meta marsQuantile sprintf("%d:%d",perturbationNumber,numberOfForecastsInEnsemble); + alias mars.quantile = marsQuantile; + } else { + meta marsQuantile sprintf("%d:%d",quantileValue,totalNumberOfQuantiles); + alias mars.quantile = marsQuantile; + } +}