question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

regrid_dataset broken with xarray=0.16.1

See original GitHub issue

First off, thanks everyone for keeping this great package going!

Unfortunately, regridding of chunked/dask datasets seems to have broken with the latest 0.16.1 xarray release, maybe related to #4060?

Minimal Example

import xarray as xr
import xesmf as xe

ds = xr.tutorial.open_dataset('air_temperature').chunk({'time':1})
ds['foo'] = ds.air # adding a second field breaks regridder call
grid = xr.Dataset({'lat': (['lat'], ds.lat[::4]), 'lon': (['lon'], ds.lon[::4])})
regridder = xe.Regridder(ds, grid, 'bilinear')
ds_out = regridder(ds)

Fails with:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    ds_out = regridder(ds)
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xesmf/frontend.py", line 397, in __call__
    return self.regrid_dataset(indata, keep_attrs=keep_attrs)
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xesmf/frontend.py", line 515, in regrid_dataset
    ds_out = xr.apply_ufunc(
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xarray/core/computation.py", line 1092, in apply_ufunc
    return apply_dataset_vfunc(
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xarray/core/computation.py", line 410, in apply_dataset_vfunc
    result_vars = apply_dict_of_variables_vfunc(
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xarray/core/computation.py", line 356, in apply_dict_of_variables_vfunc
    result_vars[name] = func(*variable_args)
  File "/home/slevang/miniconda3/envs/salient/lib/python3.8/site-packages/xarray/core/computation.py", line 653, in apply_variable_ufunc
    raise ValueError(
ValueError: dimension 'dim1' in 'output_sizes' must correspond to output_core_dims

Regridding the tutorial dataset with single field air works fine, but adding a second variable raises this error with dimension names.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dcheriancommented, Nov 11, 2020

@kmuehlbauer probably knows whats going wrong.

1reaction
rabernatcommented, Nov 11, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found