From e9cfc9f46f05da7d67c287edb04dec2f41f07ac7 Mon Sep 17 00:00:00 2001 From: Florian Pinault Date: Wed, 13 Mar 2024 16:05:43 +0000 Subject: [PATCH] perturbations --- ecml_tools/create/check.py | 13 ++-------- tests/create/join.yaml | 28 ++++++++++---------- tests/create/perturbations.yaml | 46 ++++++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 31 deletions(-) diff --git a/ecml_tools/create/check.py b/ecml_tools/create/check.py index c2e47c1..de06551 100644 --- a/ecml_tools/create/check.py +++ b/ecml_tools/create/check.py @@ -165,31 +165,22 @@ def check_data_values(arr, *, name: str, log=[], allow_nan=False): if max == 9999.0: warnings.warn(f"Max value 9999 for {name}") - in_0_1 = dict(minimum=0, maximum=1) in_minus_1_plus_1 = dict(minimum=-1, maximum=1) - is_temperature = dict(minimum=173.15, maximum=373.15) # -100 celsius to +200 celsius - # is_wind = dict(minimum=-500., maximum=500.) limits = { - "lsm": in_0_1, "cos_latitude": in_minus_1_plus_1, "sin_latitude": in_minus_1_plus_1, "cos_longitude": in_minus_1_plus_1, "sin_longitude": in_minus_1_plus_1, - "insolation": in_0_1, - "2t": is_temperature, - "sst": is_temperature, - # "10u": is_wind, - # "10v": is_wind, } if name in limits: if min < limits[name]["minimum"]: - raise StatisticsValueError( + warnings.warn( f"For {name}: minimum value in the data is {min}. " "Not in acceptable range [{limits[name]['minimum']} ; {limits[name]['maximum']}]" ) if max > limits[name]["maximum"]: - raise StatisticsValueError( + warnings.warn( f"For {name}: maximum value in the data is {max}. " "Not in acceptable range [{limits[name]['minimum']} ; {limits[name]['maximum']}]" ) diff --git a/tests/create/join.yaml b/tests/create/join.yaml index ab09d4c..ea6dafa 100644 --- a/tests/create/join.yaml +++ b/tests/create/join.yaml @@ -17,20 +17,20 @@ input: levtype: sfc stream: oper type: an - - - mars: - <<: *mars_request - param: [q, t] - levtype: pl - level: [50, 100] - stream: oper - type: an - - - accumulations: - <<: *mars_request - levtype: sfc - param: [cp, tp] - # accumulation_period: 6h +# +# - mars: +# <<: *mars_request +# param: [q, t] +# levtype: pl +# level: [50, 100] +# stream: oper +# type: an +# +# - accumulations: +# <<: *mars_request +# levtype: sfc +# param: [cp, tp] +# # accumulation_period: 6h - constants: template: ${input.join.0.mars} diff --git a/tests/create/perturbations.yaml b/tests/create/perturbations.yaml index 476da9e..16bea59 100644 --- a/tests/create/perturbations.yaml +++ b/tests/create/perturbations.yaml @@ -1,11 +1,22 @@ common: - mars_request: &common + sfc: &sfc class: ea expver: "0001" grid: 20.0/20.0 levtype: sfc param: [2t] - mars_request_acc: &common_acc + #levtype: sfc + #param: [10u, 10v, 2d, 2t, lsm, msl, sdor, skt, slor, sp, tcw, z, cp, tp] + pl: &pl + class: ea + expver: "0001" + grid: 20.0/20.0 + levtype: pl + param: [q] + level: [50] + #param: [q, t, u, v, w, z] + #level: [50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 850, 925, 1000] + acc: &acc class: ea expver: "0001" grid: 20.0/20.0 @@ -20,6 +31,17 @@ common: center: ¢er stream: oper type: an + constants: &constants + param: + - cos_latitude + - cos_longitude + - sin_latitude + - sin_longitude + - cos_julian_day + - cos_local_time + - sin_julian_day + - sin_local_time + - insolation dates: start: 2020-12-30 00:00:00 @@ -34,18 +56,30 @@ data_sources: join: - mars: <<: *ensembles - <<: *common + <<: *sfc + - mars: + <<: *ensembles + <<: *pl - accumulations: <<: *ensembles - <<: *common_acc + <<: *acc + # - constants: + # <<: *constants + # template: ${data_sources.ensembles.join.0.mars} center: join: - mars: <<: *center - <<: *common + <<: *sfc + - mars: + <<: *center + <<: *pl - accumulations: <<: *center - <<: *common_acc + <<: *acc + # - constants: + # <<: *constants + # template: ${data_sources.center.join.0.mars} input: ensemble_perturbations: