Skip to content

Commit

Permalink
map doesn't behave with to_gcm_domain
Browse files Browse the repository at this point in the history
  • Loading branch information
henryaddison committed Dec 1, 2023
1 parent dd9d3f7 commit c57cfc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ml_downscaling_emulator/bin/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def gcmify(
ensemble_member: str = typer.Option(...),
):
def process_samples(ds):
return ds.groupby("ensemble_member").map(to_gcm_domain)
ds = to_gcm_domain(ds.sel(ensemble_member=ensemble_member).map(to_gcm_domain))
ds["pred_pr"] = ds["pred_pr"].expand_dims({"ensemble_member": ensemble_member})
return ds

process_each_sample(
workdir,
Expand Down
1 change: 1 addition & 0 deletions src/ml_downscaling_emulator/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ def to_gcm_domain(ds: xr.Dataset):
ds = Remapcon(target_grid_filepath).run(ds)
ds = ShiftLonBreak().run(ds)
ds = SelectGCMDomain(subdomain="birmingham", size=9).run(ds)
ds = ds.drop_vars(["rotated_latitude_longitude"], errors="ignore")
return ds

0 comments on commit c57cfc9

Please sign in to comment.