Open ThomasHaine opened 6 months ago
Hey @ThomasHaine thanks for the detailed error. I gave it a very quick glance. It is possible that the error is because there is so little data (perhaps 1 grid point) that is being retained from the arctic face, or face 2, and that sometime causes errors in cutout...
One thing that you can play with is remove the add_hbdr
option from your cutout_kwargs
. add_hbdr
adds a buffer layer around the limits of your cutout, effectively making if larger. I believe for ECCO its like 1 deg or 2 in each direction, which equals about one grid point or two...
Another is to manually increase the your domain of interest by more that 1 or 2 degrees. I tried it and it worked fine. This is what I did:
## case 1 ) same domain w/o buffer layer
cutout_kwargs1 = {
'varList': ['U','V', 'T'],
'timeRange': ["1992-01-16T12:00:00.000000000"],
'XRange': [np.min(lons), np.max(lons)],
'YRange': [np.min(lats), np.max(lats)],
}
## case 2) Manually increase domain in north direction
cutout_kwargs2 = {
'varList': ['U','V', 'T'],
'timeRange': ["1992-01-16T12:00:00.000000000"],
'XRange': [np.min(lons), np.max(lons)],
'YRange': [np.min(lats), np.max(lats)+6],
}
cut_od1 = ECCOod.subsample.cutout(**cutout_kwargs1)
cut_od2 = ECCOod.subsample.cutout(**cutout_kwargs2)
# on a separate cell:
fig, axes = plt.subplots(1, 2, figsize=(14, 4))
cut_od1._ds['T'].isel(time=0, Z=0).plot(ax=axes[0])
cut_od2._ds['T'].isel(time=0, Z=0).plot(ax=axes[1])
Runs fine... the plots are:
Incut_od1
, which contains your domain of interest unexpanded, the data all lies within face=10. Which points to the original error likely being about 1 gridpoint or so retain from face 6, and potentially another point retained from face 2, when the buffer layer is added. The faces involved in your original cutout were [2, 6, 10].
Thanks @Mikejmnez ! I agree with your analysis. It's interesting.
Can we trap the condition in cutout
and give an informative error message?
Sure!
llc_rearrange.py
is long due for a refactor. In particular cutout
could use some of the functions I wrote for computing mooring arrays "serially" that determine the index location at the edges between faces. That would make cutout
less error prune and more exact.
The new
cutout
code (see #408) fails when an Arctic face is included, but works OK without an Arctic face.Run the following code on SciServer with/without the Arctic face (Gulf Stream cutout/Labrador Sea cutout). OceanSpy must be updated to the most recent version.
The error traceback for the Labrador Sea cutout is: