Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
perturbations
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Mar 13, 2024
1 parent 183134d commit e9cfc9f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 31 deletions.
13 changes: 2 additions & 11 deletions ecml_tools/create/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}]"
)
Expand Down
28 changes: 14 additions & 14 deletions tests/create/join.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
46 changes: 40 additions & 6 deletions tests/create/perturbations.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,6 +31,17 @@ common:
center: &center
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
Expand All @@ -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:
Expand Down

0 comments on commit e9cfc9f

Please sign in to comment.