Skip to content
Snippets Groups Projects
Commit 3d7e7b12 authored by Siddhant Tibrewal's avatar Siddhant Tibrewal
Browse files

hiopy-configure: changed add_height() to accept array of values instead of...

hiopy-configure: changed add_height() to accept array of values instead of incrementing from 0 to n always
parent 67668c15
No related branches found
No related tags found
No related merge requests found
Pipeline #102258 waiting for manual action
......@@ -111,7 +111,7 @@ hiopy-levante:
z = zarr.open("${DATASET}")
hc.add_healpix_hierarchy(z, order=4)
hc.add_time(z, "1979-01-01T00:00:00", "1979-01-01T06:00:00", 900)
hc.add_height(z, "full_level", 47)
hc.add_height(z, "full_level", "up", list(range(47)))
hc.add_variable(z, "temp", "atmo_output", "icon_atmos_grid",
zaxis="full_level", chunk_shape=(8, 16, 200))
hc.add_variable(z, "pres", "atmo_output", "icon_atmos_grid",
......
......@@ -29,14 +29,14 @@ def _collect_groups(dataset):
yield from _collect_groups(g)
def add_height(dataset, name, n):
def add_height(dataset, name, positive_direction: str, values: list[int]):
for g in _collect_groups(dataset):
height = g.create_array(name, fill_value=None, dtype=np.int64, shape=np.arange(n).shape)
height[:] = np.arange(n)
height = g.create_array(name, fill_value=None, dtype=np.int64, shape=(len(values),))
height[:] = np.asarray(values, dtype=np.int64)
height.attrs["_ARRAY_DIMENSIONS"] = [name]
height.attrs["axis"] = "Z"
height.attrs["long_name"] = "generalized_height"
height.attrs["positive"] = "down"
height.attrs["positive"] = positive_direction
height.attrs["standard_name"] = "height"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment