home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1282651087

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
1282651087 I_kwDOAMm_X85Mc7PP 6718 Losing CRS when interpolating 26328973 closed 0     2 2022-06-23T16:17:21Z 2022-07-08T08:22:53Z 2022-07-08T08:22:52Z NONE      

What happened?

Hi, I'm not very sure if this issue belongs here, but I found a little bug/feature although it may be intentional.

Having a Dataset with geographic information, calling ds.rio.set_crs() sets de CRS. Everything is okay. But then, when manipulating again that object (doing some interpolation for example), it loses the CRS information previously attached.

May be I missunderstood CRS or interp, just to let you know.

Also, I don't know if this behaviour is repeated with other transformations.

What did you expect to happen?

I expect to mantain the same CRS as the original one.

Minimal Complete Verifiable Example

```Python import xarray as xr
import rioxarray
import numpy as np

ds = xr.tutorial.load_dataset("air_temperature")

Check CRS

assert ds.rio.crs == None

Set CRS

ds.rio.set_crs("EPSG:4326", inplace=True)
print(ds.rio.crs) # EPSG:4326
assert ds.rio.crs == "EPSG:4326"

ds_ = ds.interp(lat=np.linspace(30, 20, 10), lon=np.linspace(200, 210, 10))

assert ds_.rio.crs == "EPSG:4326" # <---- Shouldn't it be EPSG:4326? ```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [X] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [X] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

>>> xr.show_versions() /usr/lib/python3.10/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONS ------------------ commit: None python: 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0] python-bits: 64 OS: Linux OS-release: 5.18.5-arch1-1 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: es_ES.UTF-8 LOCALE: ('es_ES', 'UTF-8') libhdf5: 1.12.2 libnetcdf: None xarray: 2022.3.0 pandas: 1.4.2 numpy: 1.22.4 scipy: 1.8.1 netCDF4: None pydap: None h5netcdf: None h5py: 3.7.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: 1.3a3 cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.5.2 cartopy: 0.20.2 seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 61.3.1 pip: 21.0 conda: None pytest: 7.1.2 IPython: 8.4.0 sphinx: None rioxarray-0.11.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6718/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

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