Skip to content

Commit

Permalink
Fix for the previous change
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Feb 28, 2024
1 parent 9868337 commit a2ccf6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pygmtsar/pygmtsar/Stack_phasediff.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ def block_phasediff(date1, date2, prm1, prm2, ylim, xlim):
block_data1 = block_data1.assign_coords(y=ys, x=xs)
block_data2 = block_data2.assign_coords(y=ys, x=xs)

if isinstance(topo, xr.DataArray):
dy, dx = topo.y.diff('y').item(0), topo.x.diff('x').item(0)

# use outer variables topo, data1, data2, prm1, prm2
# build topo block
if not isinstance(topo, xr.DataArray):
Expand All @@ -507,7 +510,6 @@ def block_phasediff(date1, date2, prm1, prm2, ylim, xlim):
.assign_coords(y=ys, x=xs)
else:
# topography resolution is different, interpolation with extrapolation required
dy, dx = topo.y.diff('y').item(0), topo.x.diff('x').item(0)
# convert indices 0.5, 1.5,... to 0,1,... for easy calculations
# fill NaNs by zero because typically DEM is missed outside of land areas
block_topo = topo.sel(y=slice(ys[0]-2*dy, ys[-1]+2*dy), x=slice(xs[0]-2*dx, xs[-1]+2*dx))\
Expand Down

0 comments on commit a2ccf6c

Please sign in to comment.