Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
recalc: bool, optional
Will force the bounds to be recalculated instead of using the transform
attribute.
Returns
-------
left, bottom, right, top: float
Outermost coordinates in target coordinate reference system.
"""
return rasterio.warp.transform_bounds(
self.crs, dst_crs, *self.bounds(recalc=recalc), densify_pts=densify_pts
)
@xarray.register_dataarray_accessor("rio")
class RasterArray(XRasterBase):
"""This is the GIS extension for :obj:`xarray.DataArray`"""
def __init__(self, xarray_obj):
super(RasterArray, self).__init__(xarray_obj)
# properties
self._nodata = None
def set_nodata(self, input_nodata, inplace=True):
"""
Set the nodata value for the DataArray without modifying
the data array.
Parameters
----------
input_nodata: object
Valid nodata for dtype.
for _, window in window_iter:
if window is not None:
out_data = self.isel_window(window)
else:
out_data = self._obj
if self.encoded_nodata is not None:
out_data = out_data.fillna(self.encoded_nodata)
data = out_data.astype(dtype).load().data
if data.ndim == 2:
dst.write(data, 1, window=window)
else:
dst.write(data, window=window)
@xarray.register_dataset_accessor("rio")
class RasterDataset(XRasterBase):
"""This is the GIS extension for :class:`xarray.Dataset`"""
@property
def vars(self):
"""list: Returns non-coordinate varibles"""
return list(self._obj.data_vars)
@property
def crs(self):
""":obj:`rasterio.crs.CRS`:
Retrieve projection from `xarray.Dataset`
"""
if self._crs is not None:
return None if self._crs is False else self._crs
self._crs = super().crs
if self._crs is not None: