home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1052918815

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
1052918815 I_kwDOAMm_X84-wkQf 5987 Plotting interpolated data causes artefacts 33153877 closed 1     8 2021-11-14T11:50:13Z 2021-11-19T22:35:09Z 2021-11-19T22:35:09Z NONE      

What happened:

I'm trying to do some analysis of CMIP6 model data, and I want to plot multi-model ensembles. In order to do that I need to regrid all of the models to a common grid. Whenever I try to plot data from a regridded model there's a white line along the central longitude and the poles. I use the PlateCarree projection and it doesn't matter what I choose as the central longitude; there's always a white line there.

The code I've included below produces 4 plots. The first one is of data that hasn't been interpolated and there's no white line:

The next three are with interpolated data and with different central longitudes. They all have a white line at the central longitude.

central_longitude=0

central_longitude=33

central_longitude=164

What you expected to happen:

No plot artefacts.

Minimal Complete Verifiable Example:

```python import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs

cesm2_waccm = xr.open_dataset('pr_day_CESM2-WACCM_ssp245_r2i1p1f1_gn_20750101-20841231.nc') mpi = xr.open_dataset('pr_day_MPI-ESM1-2-LR_ssp245_r1i1p1f1_gn_20750101-20941231.nc')

cesm2_waccm_subset = cesm2_waccm.sel(time=slice('2075-01-01', '2075-12-31')).mean(dim='time') mpi_subset = mpi.sel(time=slice('2075-01-01', '2075-12-31')).mean(dim='time')

map_proj = ccrs.PlateCarree()

This works.

plot = mpi_subset.pr.plot(subplot_kws={'projection': map_proj}) plot.axes.coastlines() plt.show()

mpi_interp = mpi_subset.interp(lat=cesm2_waccm_subset['lat'], lon=cesm2_waccm_subset['lon'])

A randomly chosen set of central longitudes for plots.

longitudes = [0, 33, 164]

for lon in longitudes: map_proj = ccrs.PlateCarree(central_longitude=lon)

# Has a white line at the central longitude. plot = mpi_interp.pr.plot(subplot_kws={'projection': map_proj}) plot.axes.coastlines() plt.show()

```

Anything else we need to know?:

Here's the data I used for plotting:

https://climate.uiogeo-apps.sigma2.no/ESGF/CMIP6/ScenarioMIP/NCAR/CESM2-WACCM/ssp245/r2i1p1f1/day/pr/gn/v20200224/pr_day_CESM2-WACCM_ssp245_r2i1p1f1_gn_20750101-20841231.nc

https://climate.uiogeo-apps.sigma2.no/ESGF/CMIP6/ScenarioMIP/MPI-M/MPI-ESM1-2-LR/ssp245/r1i1p1f1/day/pr/gn/v20190710/pr_day_MPI-ESM1-2-LR_ssp245_r1i1p1f1_gn_20750101-20941231.nc

Environment:

Output of <tt>xr.show_versions()</tt> ``` In [3]: xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:23:11) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.14.16-301.fc35.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: ('en_GB', 'UTF-8') libhdf5: 1.12.1 libnetcdf: None xarray: 0.20.1 pandas: 1.3.4 numpy: 1.21.4 scipy: 1.7.2 netCDF4: None pydap: None h5netcdf: 0.11.0 h5py: 3.4.0 Nio: None zarr: None cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.3.2 cartopy: 0.20.1 seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 58.5.3 pip: 21.3.1 conda: None pytest: None IPython: 7.29.0 sphinx: None ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5987/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 8 rows from issue in issue_comments
Powered by Datasette · Queries took 0.519ms · About: xarray-datasette