eodal.core.utils.raster module¶
Raster utilities to extract raster band attributes
Copyright (C) 2022 Lukas Valentin Graf
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- eodal.core.utils.raster.bounds_window(bounds: Tuple[float, float, float, float], affine: Affine) Tuple[Tuple[int, int], Tuple[int, int]][source]¶
Create a full cover rasterio-style window
New in version 0.1.1.
- taken from:
rasterstats package under BSD 3-Clause “New” or “Revised” License Copyright (c) 2013 Matthew Perry https://github.com/perrygeo/python-rasterstats/blob/d05f0dbda82c7a54fbb99d893af6e3182c225005/src/rasterstats/io.py#L145
- eodal.core.utils.raster.get_raster_attributes(riods: DatasetReader) Dict[str, Any][source]¶
extracts immutable raster attributes (not changed by reprojections, resampling) and returns them as a dictionary.
Code taken from https://github.com/pydata/xarray/blob/960010b00119367ff6b82e548f2b54ca25c7a59c/xarray/backends/rasterio_.py#L359
- Parameters:
riods – opened
rasteriodata set reader- Returns:
dictionary with extracted raster attributes (attrs)
- eodal.core.utils.raster.spatial_to_image_coordinates(x: float, y: float, affine: ~affine.Affine, op=<built-in function floor>) Tuple[int, int][source]¶
Convert spatial x and y coordinat to image coordinates (row + column)
New in version 0.1.1.
- taken from:
rasterstats package under BSD 3-Clause “New” or “Revised” License Copyright (c) 2013 Matthew Perry https://github.com/perrygeo/python-rasterstats/blob/d05f0dbda82c7a54fbb99d893af6e3182c225005/src/rasterstats/io.py#L137