wolfhece.Coordinates_operations
Module Contents
- wolfhece.Coordinates_operations.transform_chunk_coordinates(inputEPSG: str, outputEPSG: str, chunk: numpy.ndarray)[source]
Transforms a chunk of coordinates
- Parameters:
inputEPSG (str) – input EPSG code (e.g. “EPSG:3812”)
outputEPSG (str) – output EPSG code (e.g. “EPSG:31370”)
chunk (np.ndarray) – list of points to be transformed
- wolfhece.Coordinates_operations.transform_coordinates(points: numpy.ndarray, inputEPSG: str = 'EPSG:3812', outputEPSG: str = 'EPSG:31370', chunk_size: int = 1000)[source]
Transforms coordinates in batches using multiprocessing. If more than chunk_size points are provided, the function will split the points into chunks and transform them in parallel => requiring in the main script to use the statement if __name__ == ‘__main__’:.
- Parameters:
points (numpy.ndarray) – Array of coordinates to be transformed
inputEPSG (str) – (optional) Input EPSG code. Defaults to “EPSG:3812”
outputEPSG (str) – (optional) Output EPSG code. Defaults to “EPSG:31370”
chunk_size (int) – (optional) Size of each batch for transformation. Defaults to 100000
- Return numpy.ndarray:
Transformed coordinates
- wolfhece.Coordinates_operations.reproject_and_resample_raster(input_raster_path: str, output_raster_path: str, input_srs: str = 'EPSG:3812', output_srs: str = 'EPSG:31370', resampling_method: str | int = gdal.GRA_Bilinear, xRes: float = 0.5, yRes: float = 0.5, debug: bool = False)[source]
Use gdal to open a tiff raster in a given input EPSG ‘inputEPSG’ and transforms the raster into another EPSG system ‘outputEPSG’. The resolution can be forced through xRes and yRes (the origin will be rounded to the nearest multiple of the resolution). The resampling method can be chosen among the gdal GRA_* constants (gdal.GRA_Average; gdal.GRA_Bilinear; gdal.GRA_Cubic; gdal.GRA_CubicSpline; gdal.GRA_Lanczos; gdal.GRA_Mode; gdal.GRA_NearestNeighbor).
- Parameters:
input_raster_path (str) – the path to the input raster file (.tif or .tiff)
output_raster_path (str) – the path to the output raster file (.tif or .tiff) that will be created
input_srs (str) – Input EPSG code. Defaults to Lambert 2008 “EPSG:3812”
output_srs (str) – Output EPSG code. Defaults to Lambert 72 “EPSG:31370”
resampling_method (int, str) – Resampling method. Defaults to gdal.GRA_Bilinear
xRes (float) – Resolution along X. Defaults to 0.5
yRes (float) – Resolution along Y. Defaults to 0.5
debug (bool) – If True, print debug information. Defaults to False