Skip to content

Commit 658f9e6

Browse files
committed
fix topographical features retrieval (#176)
1 parent 8a425aa commit 658f9e6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

massbalancemachine/data_processing/get_topo_data.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,19 @@ def _retrieve_topo_features(
195195
"""Find the nearest recorded point with topographical features on the glacier for each stake."""
196196

197197
for gdir, gdir_grid in zip(glacier_directories, gdirs_gridded):
198-
lat = grouped_stakes.get_group(gdir.rgi_id)[["POINT_LAT"]].values.flatten()
199-
lon = grouped_stakes.get_group(gdir.rgi_id)[["POINT_LON"]].values.flatten()
198+
lat = xr.DataArray(
199+
grouped_stakes.get_group(gdir.rgi_id)[["POINT_LAT"]].values.flatten(),
200+
dims="points",
201+
)
202+
lon = xr.DataArray(
203+
grouped_stakes.get_group(gdir.rgi_id)[["POINT_LON"]].values.flatten(),
204+
dims="points",
205+
)
200206

201207
topo_data = (
202208
gdir_grid.sel(x=lon, y=lat, method="nearest")[voi]
203209
.to_dataframe()
204210
.reset_index(drop=True)
205211
)
206212

207-
df.loc[df["RGIId"] == gdir.rgi_id, voi] = topo_data[voi]
213+
df.loc[df["RGIId"] == gdir.rgi_id, voi] = topo_data[voi].values

0 commit comments

Comments
 (0)