Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. fixes for newer versions of Xarray #182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions weatherbench2/derived_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ def interpolate_spectral_frequencies(

def interp_at_one_lat(da: xr.DataArray) -> xr.DataArray:
da = (
da.swap_dims({wavenumber_dim: 'frequency'}) # pytype: disable=wrong-arg-types
da.squeeze('latitude')
.swap_dims({wavenumber_dim: 'frequency'}) # pytype: disable=wrong-arg-types
.drop_vars(wavenumber_dim)
.interp(frequency=frequencies, method=method, **interp_kwargs)
)
Expand All @@ -673,7 +674,7 @@ def interp_at_one_lat(da: xr.DataArray) -> xr.DataArray:
da['wavelength'] = da['wavelength'].assign_attrs(units='m')
return da

return spectrum.groupby('latitude').apply(interp_at_one_lat)
return spectrum.groupby('latitude', squeeze=False).apply(interp_at_one_lat)


@dataclasses.dataclass
Expand Down
Loading