eumap.datasets.eo.s2mosaic.mosaic_maker.MosaicMaker¶
- class MosaicMaker(nworkers=1, dst_crs='+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs', dxy=30, align_xy=(900000, 5460010), tmp_folder=None, bucket=None, debug=False, tiles=None)[source]¶
Bases:
object
Methods
align_transform
Checks if file exists
get_all_orbits
Finds bounding box, transform, width and height of tile in destination crs.
Finds bounding box, transform, width and height of tile in destination crs.
Finds extent, transform and size of output mosaic
Finds all orbits and files for making final mosaic
get_input_file
get_output_folder
Makes final mosaic using tiled multiprocessing.
Worker procedure for final mosaic.
Makes mosaic of one relative orbit using multiprocessing.
Worker procedure to make one subtile
Makes final mosaic from all orbit files
Main procedure for making mosaic of all relative orbits
Reads data and mask of one tile into memory
save_tif
save_tif_finish
save_tif_init
save_tif_update
Attributes
landmask
max_distance_from_orbit
- get_bbox(filename)[source]¶
Finds bounding box, transform, width and height of tile in destination crs. Depends on real data values, i.e. ignores nodata value for calculating bounding box. Slow.
param: filename: Filename of tile image
returns: dst_bbox: bounding box returns: dst_transform: transform returns: dst_height returns: dst_width
- get_bbox_nodata(filename)[source]¶
Finds bounding box, transform, width and height of tile in destination crs. Not depending on real data values.
param: filename: Filename of tile image
returns: dst_bbox: bounding box returns: dst_transform: transform returns: dst_height returns: dst_width
- get_extent(input_file_list)[source]¶
Finds extent, transform and size of output mosaic
params: input_file_list: List of input files
returns: df: DataFrame with all files and their transforms returns: dst_left: left boundary of mosaic returns: dst_top: top boundary of mosaic returns: dst_right: right boundary of transform returns: dst_bottom: bottom boundary of mosdsaic
- get_final_orbits(input_folder)[source]¶
Finds all orbits and files for making final mosaic
param: input_folder: Folder with orbits
returns: Dict of names and files of orbits
- make_mosaic_final_tiled_mp(out_file_name, preklop, orbits, extent, output_profile, tile_size=10240)[source]¶
Makes final mosaic using tiled multiprocessing.
param: out_file_name: Output file name param: preklop: Method for overlap calculating param: orbits: List of all orbits and files param: extent: Extent of final mosaic param: output_profile: Profile of output image
- make_mosaic_final_tiled_worker(j, args)[source]¶
Worker procedure for final mosaic. Calculates one subtile.
- make_mosaic_tiled_mp(input_file_list, out_file_name, dst_type, dst_nodata, resampling_method, output_profile, dst_bounds=None, max_cols=10240, max_rows=10240, landmask=False)[source]¶
Makes mosaic of one relative orbit using multiprocessing.
param: input_file_list: List of all input tile images param: out_file_name: Name of output file param: dst_type: Type of data in output file param: dst_nodata: Nodata value in output file param: resampling_method: Method of resampling param: output_profile: Profile of output file param: dst_bounds: Not used, default is None param: max_cols: Maximum number of columns in one subtile, default is 10240 param: max_rows: Maximum number of rows in one subtile, default is 10240 param: landmask: If True then output data is masked with landmask, default is False
- mosaic_final_tiled(orbits_folder, out_filename, extent=[900000, 900010, 6540000, 5460010], preklop='weight')[source]¶
Makes final mosaic from all orbit files
param: orbits_folder: Folder with all input orbit files param: out_filename: Output folder for final mosaic param: extent: Extent of output mosaic param: preklop: Method to use for overlap, default is ‘weight’
- mosaic_orbits_tiled(input_folder, output_folder, dst_nodata=32767, dst_dtype='int16', resampling_method='nearest', landmask=False)[source]¶
Main procedure for making mosaic of all relative orbits
param: input_folder: Folder with all tiles param: outpout_folder: Folder where to write output orbits param: dst_nodata: nodata value for output files, default 2**15-1 param: dst_dtype: type of data in output orbit mosaics, default is ‘int16’ param: resampling_methos: method of resampling, default is ‘nearest’ param: landmask: If true then output is masked with landmask, default is False