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

updated add_height to accept an array of values instead of a number

parent b2836116
No related branches found
No related tags found
1 merge request!43Draft: Resolve "Migrate to Zarr3 and add example for a dataset using sharding"
Pipeline #100322 waiting for manual action
......@@ -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 = "up", 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