Skip to content

Commit a0322e9

Browse files
authored
DEP: pin rasterio>=1.1.1 (#471)
1 parent 7abc888 commit a0322e9

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

rioxarray/_io.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -497,36 +497,34 @@ def _get_rasterio_attrs(riods):
497497
# pylint: disable=too-many-branches
498498
# Add rasterio attributes
499499
attrs = _parse_tags(riods.tags(1))
500-
if hasattr(riods, "nodata") and riods.nodata is not None:
500+
if riods.nodata is not None:
501501
# The nodata values for the raster bands
502502
attrs["_FillValue"] = riods.nodata
503-
if hasattr(riods, "scales"):
504-
# The scale values for the raster bands
505-
if len(set(riods.scales)) > 1:
506-
attrs["scales"] = riods.scales
507-
warnings.warn(
508-
"Offsets differ across bands. The 'scale_factor' attribute will "
509-
"not be added. See the 'scales' attribute."
510-
)
511-
else:
512-
attrs["scale_factor"] = riods.scales[0]
513-
if hasattr(riods, "offsets"):
514-
# The offset values for the raster bands
515-
if len(set(riods.offsets)) > 1:
516-
attrs["offsets"] = riods.offsets
517-
warnings.warn(
518-
"Offsets differ across bands. The 'add_offset' attribute will "
519-
"not be added. See the 'offsets' attribute."
520-
)
521-
else:
522-
attrs["add_offset"] = riods.offsets[0]
523-
if hasattr(riods, "descriptions") and any(riods.descriptions):
503+
# The scale values for the raster bands
504+
if len(set(riods.scales)) > 1:
505+
attrs["scales"] = riods.scales
506+
warnings.warn(
507+
"Offsets differ across bands. The 'scale_factor' attribute will "
508+
"not be added. See the 'scales' attribute."
509+
)
510+
else:
511+
attrs["scale_factor"] = riods.scales[0]
512+
# The offset values for the raster bands
513+
if len(set(riods.offsets)) > 1:
514+
attrs["offsets"] = riods.offsets
515+
warnings.warn(
516+
"Offsets differ across bands. The 'add_offset' attribute will "
517+
"not be added. See the 'offsets' attribute."
518+
)
519+
else:
520+
attrs["add_offset"] = riods.offsets[0]
521+
if any(riods.descriptions):
524522
if len(set(riods.descriptions)) == 1:
525523
attrs["long_name"] = riods.descriptions[0]
526524
else:
527525
# Descriptions for each dataset band
528526
attrs["long_name"] = riods.descriptions
529-
if hasattr(riods, "units") and any(riods.units):
527+
if any(riods.units):
530528
# A list of units string for each dataset band
531529
if len(riods.units) == 1:
532530
attrs["units"] = riods.units[0]
@@ -880,7 +878,7 @@ def open_rasterio(
880878
coord_name = "band"
881879
coords[coord_name] = np.asarray(riods.indexes)
882880

883-
has_gcps = hasattr(riods, "gcps") and riods.gcps[0]
881+
has_gcps = riods.gcps[0]
884882
if has_gcps:
885883
parse_coordinates = False
886884

@@ -939,7 +937,7 @@ def open_rasterio(
939937
# always (0, 0, 1) per definition (see
940938
# https://github.com/sgillies/affine)
941939
result.rio.write_transform(_rio_transform(riods), inplace=True)
942-
if hasattr(riods, "crs") and riods.crs:
940+
if riods.crs:
943941
result.rio.write_crs(riods.crs, inplace=True)
944942
if has_gcps:
945943
result.rio.write_gcps(*riods.gcps, inplace=True)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_version():
2323
with open("README.rst") as readme_file:
2424
readme = readme_file.read()
2525

26-
requirements = ["packaging", "rasterio", "xarray>=0.17", "pyproj>=2.2"]
26+
requirements = ["packaging", "rasterio>=1.1.1", "xarray>=0.17", "pyproj>=2.2"]
2727

2828
test_requirements = ["pytest>=3.6", "pytest-cov", "pytest-timeout", "dask", "netcdf4"]
2929
doc_requirements = ["sphinx-click", "nbsphinx", "sphinx_rtd_theme"]

0 commit comments

Comments
 (0)