Skip to content

Commit

Permalink
Fixed issue #1520, by adding a if-else that checks for None (#1526)
Browse files Browse the repository at this point in the history
* Fixed issue #1520, by adding a if-else that checks for None

* Changed the read_rasterio to skip CRS entirely if it is None

* Added whats new comment on fix of issue #1520

* Resolved a conflict with master branch.

* Deleted a line change from whats new
  • Loading branch information
leeviannala authored and Joe Hamman committed Sep 1, 2017
1 parent 4a15cfa commit 78ca20a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Bug fixes
objects with data stored as ``dask`` arrays (:issue:`1529`).
By `Joe Hamman <https://github.com/jhamman>`_.

- :py:func:`~xarray.open_rasterio` method now skips rasterio.crs -attribute if
it is none.
By `Leevi Annala <https://github.com/leevei>`_.

.. _whats-new.0.9.6:

v0.9.6 (8 June 2017)
Expand Down Expand Up @@ -2028,4 +2032,4 @@ Miles.
v0.1 (2 May 2014)
-----------------

Initial release.
Initial release.
5 changes: 3 additions & 2 deletions xarray/backends/rasterio_.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ def open_rasterio(filename, chunks=None, cache=None, lock=None):

# Attributes
attrs = {}
if hasattr(riods, 'crs'):
if hasattr(riods, 'crs') and riods.crs:
# CRS is a dict-like object specific to rasterio
# We convert it back to a PROJ4 string using rasterio itself
# If CRS is not None, we convert it back to a PROJ4 string using
# rasterio itself
attrs['crs'] = riods.crs.to_string()
if hasattr(riods, 'res'):
# (width, height) tuple of pixels in units of CRS
Expand Down

0 comments on commit 78ca20a

Please sign in to comment.