Skip to content
Snippets Groups Projects
Commit c21e5208 authored by Nils-Arne Dreier's avatar Nils-Arne Dreier
Browse files

feat: add hiopy::var_group attribute to split up variable groups into

multipole components
parent c809feb0
No related branches found
No related tags found
1 merge request!47[hiopy] refactor variable handling and distribution
......@@ -10,9 +10,11 @@ def grid_id(var, zgroup):
assert "grid_mapping" in var.attrs
crs = zgroup[var.attrs["grid_mapping"]]
var_group = var.attrs.get("hiopy::var_group", "")
# healpix
if "grid_mapping_name" in crs.attrs and crs.attrs["grid_mapping_name"] == "healpix":
s = "healpix_"
s = var_group + "healpix_"
s += str(crs.attrs["healpix_nside"])
s += str(crs.attrs["healpix_order"])
if "_ARRAY_DIMENSIONS" in var.attrs and var.attrs["_ARRAY_DIMENSIONS"][-1] in zgroup:
......@@ -23,7 +25,7 @@ def grid_id(var, zgroup):
if "coordinates" in crs.attrs:
try:
lon, lat = crs.attrs["coordinates"].split(" ")
s = hash(hash(str(zgroup[lat][:])) + hash(str(zgroup[lon][:])))
s = hash(hash(str(zgroup[lat][:])) + hash(str(zgroup[lon][:])) + var_group)
return s
except Exception as e:
raise RuntimeError("Cannot parse coordinates") from e
......
......@@ -95,6 +95,7 @@ hiopy specific parameters are added in the attributes and are usually prefixed b
"hiopy::nnn", "Array", "Number of nearest neighbors to use. Default is 1."
"hiopy::frac_mask", "Array", "Array name of the fractional mask that is used when forwarding the data. (see `yac_cput_frac`)"
"hiopy::enable", "Boolean", "Enable or disable the variable to be handled by the worker"
"hiopy::var_group", "Array", "Can be used to split-up variables into multiple groups, if not enough chunks are available to distribute the work (optional)."
`hiopy.configure` can also be used as a python
module. The following example creates a dataset with healpix grid
......
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