Skip to content

Commit

Permalink
Merge branch 'master' into update-op-w-avg-xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Nov 6, 2023
2 parents 053869f + b4aeb14 commit e18cdeb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions rook/utils/concat_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .decadal_fixes import apply_decadal_fixes

coord_by_standard_name = {
"realization": "realization_index",
"realization": "realization",
}


Expand Down Expand Up @@ -80,9 +80,8 @@ def _calculate(self):
dims = dimension_parameter.DimensionParameter(
self.params.get("dims", None)
).value
# standard_name = dims[0]
# dim = coord_by_standard_name.get(standard_name, None)
dim = dims[0]
standard_name = dims[0]
dim = coord_by_standard_name.get(standard_name, None)

processed_ds = xr.concat(
datasets,
Expand All @@ -91,10 +90,10 @@ def _calculate(self):
processed_ds = processed_ds.assign_coords(
{dim: (dim, np.array(processed_ds[dim].values, dtype="int32"))}
)
# processed_ds.coords[dim].attrs = {"standard_name": standard_name}
processed_ds.coords[dim].attrs = {"standard_name": standard_name}
# optional: average
if self.params.get("apply_average", False):
processed_ds = average(processed_ds, dims=["realization"])
processed_ds = average(processed_ds, dims=[dim])
# subset
outputs = subset(
processed_ds,
Expand Down

0 comments on commit e18cdeb

Please sign in to comment.