I have a dataset ds which looks like this:

Dimensions:      (time: 42, long: 1383, lat: 586)
  * time         (time) datetime64[ns] 1979-01-01 1980-01-01 ... 2020-01-01
  * long         (long) float64 -1.732e+07 -1.73e+07 ... 1.73e+07 1.732e+07
  * lat          (lat) float64 7.332e+06 7.307e+06 ... -7.307e+06 -7.332e+06
    spatial_ref  int32 0
Data variables:
    tmean        (time, lat, long) float32 nan nan nan nan ... nan nan nan nan

The spatial reference of the dataset are in epsg:3408, https://epsg.io/3408.

I am trying to assign the reference like this:

ds.rio.write_crs('epsg:3408', inplace = True)

but when I check it is not assigned and the spatial_ref is still int32 0.

2 Answers 2


Click over the paper here: Then you can see the crs.

enter image description here

enter image description here

it's something like this

Use this code:

data.rio.crs or data.rio.estimate_utm_crs()
  • There is no 'paper' in my editor. How can I see it programmatically? I tried ds.crs but it says Dataset has no attribute 'crs' Commented Feb 10, 2022 at 19:55
  • which IDE are you using? Install miniconda or anaconda that includes Jupyter Notebook in your browser.
    – Helios
    Commented Feb 10, 2022 at 20:03
  • I checked in Jupyter Notebook, those icons are not there. Is there not a way to return it programmatically? I guess I can rephrase my question. Commented Feb 10, 2022 at 20:06
  • Use this: data.rio.estimate_utm_crs()
    – Helios
    Commented Feb 10, 2022 at 20:10
  • I think you meant ds.rio.crs
    – snowman2
    Commented Feb 10, 2022 at 20:44

See: https://corteva.github.io/rioxarray/stable/getting_started/crs_management.html

This should give you the correct CRS object:

  • This fails with Dataset has no attribute 'crs' Commented Feb 10, 2022 at 20:45
  • Did you use .rio before .crs?
    – snowman2
    Commented Feb 10, 2022 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.