Skip to content

Commit

Permalink
renamed alt0 to hzero (ref. #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
brancomat committed Mar 31, 2022
1 parent 7f1e537 commit 384ef75
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
12 changes: 6 additions & 6 deletions doc/INPUTS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ Due to internal optimization, the second input value is not available in the

Example::

alt0:
hzero:
- model: ifs
type: groundtomsl
inputs: [z, alt0ground]
clip: "alt0[alt0 < z] = -999"
inputs: [z, hzeroground]
clip: "hzero[hzero <= z] = -999"
grib_set:
shortName: deg0l

Expand Down Expand Up @@ -306,11 +306,11 @@ postprocess it before writing it out.

Example::

alt0:
hzero:
- model: ifs
type: groundtomsl
inputs: [z, alt0ground]
clip: "alt0[alt0 < z] = -999"
inputs: [z, hzeroground]
clip: "hzero[hzero <= z] = -999"



Expand Down
10 changes: 5 additions & 5 deletions doc/recipes/alt0.md → doc/recipes/hzero.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# alt0: Altezza dello zero termico
# hzero: Height of zero degree level

Mixer: **default**

Expand All @@ -8,13 +8,13 @@ for IFS model it needs both "deg0l" and "z" variables

## Inputs

* **alt0**:
* **hzero**:
* Model **cosmo**:
* **Arkimet matcher**: `product:GRIB1,80,201,84;level:GRIB1,4`
* **grib_filter matcher**: `shortName is "hzerocl"`
* Model **ifs**:
* **Preprocessing**: groundtomsl
* **Inputs**: z, alt0ground
* **Inputs**: z, hzeroground

## Steps

Expand Down Expand Up @@ -44,7 +44,7 @@ Add a grib file
With arguments:
```
{
"grib": "alt0"
"grib": "hzero"
}
```

Expand Down Expand Up @@ -133,7 +133,7 @@ With arguments:
"legend": true,
"legend_display_type": "continuous",
"legend_title": true,
"legend_title_text": "Altezza dello zero termico (m)",
"legend_title_text": "Height of zero degree level (m)",
"legend_text_colour": "black",
"legend_text_font_size": 0.4,
"legend_title_font_size": 0.5,
Expand Down
14 changes: 7 additions & 7 deletions recipes/alt0.yaml → recipes/hzero.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
description: Altezza dello zero termico
description: Height of zero degree level
notes: for IFS model it needs both "deg0l" and "z" variables
inputs:
alt0ground:
hzeroground:
- model: ifs
arkimet: product:GRIB1,98,228,24;level:GRIB1,1
eccodes: shortName is "deg0l"
z:
- model: ifs
arkimet: product:GRIB1,98,128,129;level:GRIB1,1
eccodes: shortName is "z"
alt0:
hzero:
- model: cosmo
arkimet: product:GRIB1,80,201,84;level:GRIB1,4
eccodes: shortName is "hzerocl"
- model: ifs
type: groundtomsl
inputs: [z, alt0ground]
clip: "alt0[alt0 <= z] = -999"
inputs: [z, hzeroground]
clip: "hzero[hzero <= z] = -999"
grib_set:
shortName: deg0l
recipe:
- step: add_basemap
- step: add_coastlines_bg
- step: add_grib
grib: alt0
grib: hzero
- step: add_contour
params:
contour: off
Expand All @@ -47,7 +47,7 @@ recipe:
legend: on
legend_display_type: continuous
legend_title: on
legend_title_text: "Altezza dello zero termico (m)"
legend_title_text: "Height of zero degree level (m)"
legend_text_colour: black
legend_text_font_size: 0.4
legend_title_font_size: 0.5
Expand Down
16 changes: 8 additions & 8 deletions tests/test_alt0.py → tests/test_hzero.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from arkimapslib.unittest import add_recipe_test_cases


class ALT0CosmoMixin:
class HZEROCosmoMixin:
def test_process(self):
self.fill_pantry(expected=["cosmo_alt0_2021_1_10_0_0_0+12.grib"])
self.fill_pantry(expected=["cosmo_hzero_2021_1_10_0_0_0+12.grib"])

orders = self.make_orders()
self.assertEqual(len(orders), 1)
Expand All @@ -16,27 +16,27 @@ def test_process(self):
self.assertMgribArgsEqual(orders[0], cosmo={}, ifs={})


class ALT0IFSMixin:
class HZEROIFSMixin:
def test_process(self):
self.maxDiff = None
self.fill_pantry(expected=[
"ifs_alt0ground_2021_1_10_0_0_0+12.grib",
"ifs_hzeroground_2021_1_10_0_0_0+12.grib",
"ifs_z_2021_1_10_0_0_0+0.grib",
])

orders = self.make_orders()
self.assertEqual(len(orders), 1)

self.assertProcessLogEqual(
["alt0:GroundToMSL:groundtomsl"
["hzero:GroundToMSL:groundtomsl"
" ifs_z_2021_1_10_0_0_0+0.grib"
" ifs_alt0ground_2021_1_10_0_0_0+12.grib"
" ifs_alt0_2021_1_10_0_0_0+12.grib"]
" ifs_hzeroground_2021_1_10_0_0_0+12.grib"
" ifs_hzero_2021_1_10_0_0_0+12.grib"]
)

self.assertRenders(orders[0])

self.assertMgribArgsEqual(orders[0], cosmo={}, ifs={})


add_recipe_test_cases(__name__, "alt0")
add_recipe_test_cases(__name__, "hzero")
10 changes: 5 additions & 5 deletions tests/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def test_trim(self):
def test_apply_clip(self):
class Tester(arkimapslib.inputs.GribSetMixin):
def __init__(self, clip: str):
self.name = "alt0"
self.name = "hzero"
self.defined_in = __file__
super().__init__(clip=clip)

o = Tester(clip="alt0[alt0 < z] = -999")
alt0 = numpy.array([1, 2, 3, 4])
o = Tester(clip="hzero[hzero < z] = -999")
hzero = numpy.array([1, 2, 3, 4])
z = numpy.array([4, 3, 2, 1])
alt0 = o.apply_clip({"alt0": alt0, "z": z})
self.assertEqual(alt0.tolist(), [-999, -999, 3, 4])
hzero = o.apply_clip({"hzero": hzero, "z": z})
self.assertEqual(hzero.tolist(), [-999, -999, 3, 4])

0 comments on commit 384ef75

Please sign in to comment.