-
Request: How much ice entered Scoresby Sund in 2018? |
Beta Was this translation helpful? Give feedback.
Answered by
mankoff
Jan 7, 2022
Replies: 1 comment
-
Open fileimport xarray as xr
ds = xr.open_dataset('gate.nc')
print(ds)
Extract ROI, compute annual average, sum discharge within ROIans = ds.where(ds['mean_x'] > 500000)\
.where(ds['mean_y'] > -2111111)\
.where(ds['mean_y'] < -1858906)\
.dropna(dim='gate')\
.resample({'time':'YS'})\
.mean()\
.sel({'time':'2018'})\
.squeeze()\
.to_dataframe()
# print gate indices and manually check that these are the 15 gates in the ROI in QGIS
print(df.index)
ans = df.agg({'discharge':sum, 'err':sum, 'coverage':mean,
'mean_x':mean, 'mean_y':mean, 'mean_lon':mean, 'mean_lat':mean,
'region':min, 'Zwally_2012':min})
print(ans)
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mankoff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open file