def reproject_raster( src_fname:str, # Path to the source GeoTIFF dst_fname:str, # Path of the reprojected GeoTIFF to write dst_crs:str='EPSG:4326', # Target coordinate reference system)->None:
Reproject every band of src_fname to dst_crs and write the result to dst_fname.
Resampling uses the nearest neighbour. Each output cell copies the value of the closest input cell, and no values are interpolated.
def gridder( fname_raster:str, # Path to the raster file band:int=1, # Band to read. Unused: the grid depends only on the raster's bounds and CRS nrows:int=10, # Number of grid rows ncols:int=10, # Number of grid columns)->geopandas.geodataframe.GeoDataFrame: # One polygon per grid cell, indexed by `loc_id`, in the raster's CRS
Split the extent of fname_raster into an nrows by ncols grid of polygons.
gridder simulates administrative units when real boundaries are not available. The default grid has 10 rows and 10 columns:
def anonymize_raster( fname_raster:str, # Path to the raster file new_lon_origin:float, # Longitude of the new upper-left corner new_lat_origin:float, # Latitude of the new upper-left corner band:int=1, # Band to anonymize)->None:
Move a raster to a new origin and rescale its values to [0, 1].