align_to_mask.py
def warp_raster(base_raster_path, mask_raster_path, resample_mode, target_raster_path):
    """Warp raster to exemplar's bounding box, cell size, and projection."""
    base_projection_wkt = geoprocessing.get_raster_info(
        base_raster_path)['projection_wkt']
    if base_projection_wkt is None:
        # assume its wgs84 if not defined
        LOGGER.warn(
            f'{base_raster_path} has undefined projection, assuming WGS84')
        base_projection_wkt = osr.SRS_WKT_WGS84_LAT_LONG
    mask_raster_info = geoprocessing.get_raster_info(mask_raster_path)
    geoprocessing.warp_raster(
        base_raster_path, mask_raster_info['pixel_size'],
        target_raster_path, resample_mode,
        base_projection_wkt=base_projection_wkt,
        target_bb=mask_raster_info['bounding_box'],
        target_projection_wkt=mask_raster_info['projection_wkt'])
Warp raster to exemplar's bounding box, cell size, and projection.
Warp raster to exemplar's bounding box, cell size, and projection.
Warp raster to exemplar ' s bounding box cell size and projection .
def warp_raster(base_raster_path, mask_raster_path, resample_mode, target_raster_path):
    base_projection_wkt = geoprocessing.get_raster_info(
        base_raster_path)['projection_wkt']
    if base_projection_wkt is None:
        LOGGER.warn(
            f'{base_raster_path} has undefined projection, assuming WGS84')
        base_projection_wkt = osr.SRS_WKT_WGS84_LAT_LONG
    mask_raster_info = geoprocessing.get_raster_info(mask_raster_path)
    geoprocessing.warp_raster(
        base_raster_path, mask_raster_info['pixel_size'],
        target_raster_path, resample_mode,
        base_projection_wkt=base_projection_wkt,
        target_bb=mask_raster_info['bounding_box'],
        target_projection_wkt=mask_raster_info['projection_wkt'])
def warp_raster ( base_raster_path , mask_raster_path , resample_mode , target_raster_path ) : base_projection_wkt = geoprocessing . get_raster_info ( base_raster_path ) [ 'projection_wkt' ] if base_projection_wkt is None : LOGGER . warn ( f'{base_raster_path} has undefined projection, assuming WGS84' ) base_projection_wkt = osr . SRS_WKT_WGS84_LAT_LONG mask_raster_info = geoprocessing . get_raster_info ( mask_raster_path ) geoprocessing . warp_raster ( base_raster_path , mask_raster_info [ 'pixel_size' ] , target_raster_path , resample_mode , base_projection_wkt = base_projection_wkt , target_bb = mask_raster_info [ 'bounding_box' ] , target_projection_wkt = mask_raster_info [ 'projection_wkt' ] )
Warp raster to exemplar's bounding box, cell size, and projection.
Warp raster to exemplar ' s bounding box cell size and projection .
"""Warp raster to exemplar's bounding box, cell size, and projection.""" # assume its wgs84 if not defined
base_raster_path
mask_raster_path
resample_mode
target_raster_path