satellitetools.common.raster ============================ .. py:module:: satellitetools.common.raster .. autoapi-nested-parse:: Functions for raster data handling. @author: Olli Nevalainen (Finnish Meteorological Institute) Functions --------- .. autoapisummary:: satellitetools.common.raster.mask_raster satellitetools.common.raster.resample_raster satellitetools.common.raster.reproject_data_to_profile Module Contents --------------- .. py:function:: mask_raster(raster: Union[rasterio.io.MemoryFile, os.PathLike], aoi_geometry: Union[shapely.geometry.Polygon, shapely.geometry.MultiPolygon], no_data: Union[float, int]) -> Tuple[numpy.ndarray, dict] Mask raster data with area of interest geometry. Parameters: ---------------- raster: Union[MemoryFile, os.PathLike] Raster data. aoi_geometry: Polygon Area of interest geometry. no_data: Union[float, int] No data value. Returns: ---------------- Tuple[np.ndarray, dict] Tuple of masked data and metadata. .. py:function:: resample_raster(raster: Union[rasterio.io.MemoryFile, os.PathLike], target_gsd: float, resampling_method: rasterio.enums.Resampling, target_height: Optional[int] = None, target_width: Optional[int] = None) -> Tuple[numpy.ndarray, dict] Resample raster data to target ground sample distance. Parameters: ---------------- raster: Union[MemoryFile, os.PathLike] Raster data. target_gsd: float Target ground sample distance. resampling_method: Resampling Resampling method. target_height: Optional[int] Target height. target_width: Optional[int] Target width. Returns: ---------------- Tuple[np.ndarray, dict] Tuple of resampled data and metadata. .. py:function:: reproject_data_to_profile(src_data: numpy.ndarray, src_profile: dict, target_profile: dict, resampling: rasterio.enums.Resampling) -> numpy.ndarray Reproject raster data to target profile. Parameters: ---------------- src_data: np.ndarray Source data. src_profile: dict Source profile. target_profile: dict Target profile. resampling: Resampling Resampling method. Returns: ---------------- np.ndarray Reprojected data.