home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 669595589

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
669595589 MDU6SXNzdWU2Njk1OTU1ODk= 4293 Plotting NEMO data with Multidimensional Coordinates breaks with ValueError 14315062 open 0     4 2020-07-31T09:08:15Z 2021-07-04T01:29:30Z   NONE      

I want to plot NEMO data on tripolar ORCA grid using the xarray plot functionality. Following @rabernat's tutorial at http://xarray.pydata.org/en/stable/examples/multidimensional-coords.html, I used the x='nav_lon', y='nav_lat' to specify the (two-dimensional) coordinates that contain the longitudes and latitudes. However, I'm getting a python ValueError: ('y', 'x') must be a permuted list of ('time_counter', 'y', 'x'), unless `...` is included

See below a simple code that breaks. The ORCA025-test.nc file is 6MB in size and can be downloaded from https://surfdrive.surf.nl/files/index.php/s/DYWAOzc3WmN7DcS

```python

import xarray as xr print(xr.version) 0.15.1 ```

```python

T = xr.open_dataset('ORCA025-test.nc').thetao.isel(deptht=0) T ```

```python

T.plot.pcolormesh(x='nav_lon', y='nav_lat')


ValueError Traceback (most recent call last) <ipython-input-3-ce97772e3e2b> in <module> ----> 1 T.plot.pcolormesh(x='nav_lon', y='nav_lat')

~/anaconda3/envs/py3_parcels/lib/python3.6/site-packages/xarray/plot/plot.py in plotmethod(_PlotMethods_obj, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, colors, center, robust, extend, levels, infer_intervals, subplot_kws, cbar_ax, cbar_kwargs, xscale, yscale, xticks, yticks, xlim, ylim, norm, kwargs) 814 for arg in ["_PlotMethods_obj", "newplotfunc", "kwargs"]: 815 del allargs[arg] --> 816 return newplotfunc(allargs) 817 818 # Add to class _PlotMethods

~/anaconda3/envs/py3_parcels/lib/python3.6/site-packages/xarray/plot/plot.py in newplotfunc(darray, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, center, robust, extend, levels, infer_intervals, colors, subplot_kws, cbar_ax, cbar_kwargs, xscale, yscale, xticks, yticks, xlim, ylim, norm, *kwargs) 681 682 if dims != darray.dims: --> 683 darray = darray.transpose(dims, transpose_coords=True) 684 685 # Pass the data as a masked ndarray too

~/anaconda3/envs/py3_parcels/lib/python3.6/site-packages/xarray/core/dataarray.py in transpose(self, transpose_coords, dims) 1900 """ 1901 if dims: -> 1902 dims = tuple(utils.infix_dims(dims, self.dims)) 1903 variable = self.variable.transpose(dims) 1904 if transpose_coords:

~/anaconda3/envs/py3_parcels/lib/python3.6/site-packages/xarray/core/utils.py in infix_dims(dims_supplied, dims_all) 687 if set(dims_supplied) ^ set(dims_all): 688 raise ValueError( --> 689 f"{dims_supplied} must be a permuted list of {dims_all}, unless ... is included" 690 ) 691 yield from dims_supplied

ValueError: ('y', 'x') must be a permuted list of ('time_counter', 'y', 'x'), unless ... is included ```

Also: if I add a cartopy transformation, as in @rabernat's tutorial, I get exactly the same error.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4293/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 1.039ms · About: xarray-datasette