-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regridder hangs on input DataArray with length 0 dimension #244
Comments
Thanks for the report, do you want to submit a PR to fix this ? |
@huard I should have clarified, my quick "fix" was just to add an |
I just ran into this same sneaky bug on a different dataset. Was searching to see if anyone else had reported it and found my own comment. I've looked through the xESMF code a bit and still don't feel confident attempting a PR but I may have a hint in case someone else wants to try. I'd also be willing to provide a minimal working example. Here is my xESMF Regridder object:
It is expecting an input grid of shape (1, 72670). But then if we inspect my input data:
Shape is (0, 145141). So maybe this mismatch is leading to the regridder step getting hung up? |
Hi @kevinrosa. I sadly wasn't able to reproduce the issue. Here's my code generating a "locstream" dataset as input, with a time dimension of size 0. import xarray as xr
import numpy as np
import xesmf as xe
ds_in = xr.Dataset(data_vars={'data': (('time', 'site'), np.zeros((0, 100)))})
ds_in = ds_in.assign_coords(lat=(('site',), np.linspace(-80, 80, 100)), lon=(('site',), np.linspace(-180, 180, 100)))
lon_new = np.arange(-60, -47.9, 0.1)
lat_new = np.arange(-36, -24.9, 0.1)
reg = xe.Regridder(ds_in, {'lat': lat_new, 'lon': lon_new}, locstream_in=True, method='nearest_s2d')
reg(ds_in) What version of xESMF are you using ? We made major changes in the latest releases, maybe this was fixed in 0.8.2 ? |
I recently discovered that
xesmf.Regridder
gets stuck in some sort of infinite process without returning an error if I pass in a DataSet with an empty DataArray (time dimension of length 0 this my case).My personal fix has been to add a check of the time dimension before regridding, but I thought I'd share this experience in case this is not the intended behavior.
The source dataset:
The destination grid:
The regridding step:
The text was updated successfully, but these errors were encountered: