issues: 436311057
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
436311057 | MDU6SXNzdWU0MzYzMTEwNTc= | 2915 | Plotting tripolar dataset in xarray | 42008691 | closed | 0 | 4 | 2019-04-23T17:44:33Z | 2019-04-23T20:16:56Z | 2019-04-23T20:16:56Z | NONE | I am trying to plot a tripolar grid dataset using xarray/cartopy. I can plot it fine using matplotlib/cartopy ds = xr.open_dataset('ocean_hgrid.nc') xcntr = ds['x'][1::2,1::2] ycntr = ds['y'][1::2,1::2] test=xr.open_dataset('xarray_test.nc') ax = plt.axes(projection=proj) cs=plt.contourf(xcntr,ycntr,test['nh4_stf'],transform=data_crs,cmap='coolwarm',vmin=-4.5e-9,vmax=4.5e-9) plt.colorbar(cs) I would like to achieve the same result in xarray. I have tried the following proj=ccrs.PlateCarree() data_crs=ccrs.PlateCarree() ax = plt.axes(projection=proj) test['nh4_stf'].plot.contourf(ax=ax, transform=ccrs.PlateCarree()) and test['nh4_stf'].plot.pcolormesh(x=xcntr,y=ycntr,ax=ax,transform=ccrs.PlateCarree()) but this does not work (the second option crashes). Is there a way to pass xcntr,ycntr? datasets can be found on ftp://ftp.gfdl.noaa.gov/pub/Fabien.Paulot/xarray/ Thank you very much and congratulations to the developers for this amazing tool xarray.show_versions() INSTALLED VERSIONScommit: None python: 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 2.6.32-696.30.1.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US LOCALE: en_US.ISO8859-1 libhdf5: 1.10.3 libnetcdf: 4.6.1 xarray: 0.11.3 pandas: 0.24.2 numpy: 1.16.2 scipy: 1.2.1 netCDF4: 1.4.2 pydap: None h5netcdf: None h5py: 2.8.0 Nio: None zarr: None cftime: 1.0.3.4 PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None cyordereddict: None dask: 1.1.5 distributed: 1.27.0 matplotlib: 3.0.3 cartopy: 0.16.0 seaborn: 0.9.0 setuptools: 41.0.0 pip: 19.0.3 conda: None pytest: None IPython: 7.4.0 sphinx: 2.0.1 |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2915/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |