Skip to content

Commit

Permalink
Use numpy scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Dec 27, 2024
1 parent 40338fe commit aeb9fc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sarsen/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def upsample(data: xr.DataArray, dtype: str = None, **factors: int) -> xr.DataAr
coords = {}
for dim, factor in factors.items():
coord = data.coords[dim]
coord_delta = coord[1] - coord[0]
start = coord[0] - coord_delta / 2 + coord_delta / factor / 2
stop = coord[-1] + coord_delta / 2 - coord_delta / factor / 2
coord_delta = coord[1].values - coord[0].values
start = coord[0].values - coord_delta / 2 + coord_delta / factor / 2
stop = coord[-1].values + coord_delta / 2 - coord_delta / factor / 2
values = np.linspace(start, stop, num=coord.size * factor, dtype=dtype)
coords[dim] = values
return data.interp(coords, kwargs={"fill_value": "extrapolate"})
Expand Down

0 comments on commit aeb9fc2

Please sign in to comment.