Skip to content

Commit

Permalink
Fix dropping attrs in format_lat
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Nov 14, 2024
1 parent d7775a7 commit 7a60214
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xarray_regrid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ def format_lat(
if dy - polar_lat >= obj.coords[lat_coord].values[0] > -polar_lat:
south_pole = obj.isel({lat_coord: 0})
if lon_coord is not None:
south_pole = south_pole.mean(lon_coord)
south_pole = south_pole.mean(lon_coord, keep_attrs=True)
obj = xr.concat([south_pole, obj], dim=lat_coord) # type: ignore
lat_vals = np.concatenate([[-polar_lat], lat_vals])

# North pole
if polar_lat - dy <= obj.coords[lat_coord].values[-1] < polar_lat:
north_pole = obj.isel({lat_coord: -1})
if lon_coord is not None:
north_pole = north_pole.mean(lon_coord)
north_pole = north_pole.mean(lon_coord, keep_attrs=True)
obj = xr.concat([obj, north_pole], dim=lat_coord) # type: ignore
lat_vals = np.concatenate([lat_vals, [polar_lat]])

Expand Down

0 comments on commit 7a60214

Please sign in to comment.