eumap.gapfiller.ImageGapfill

class ImageGapfill(fn_files=None, data=None, outlier_remover=None, std_win=3, std_env=2, perc_env=[2, 98], n_jobs_io=4, verbose=True)[source]

Bases: abc.ABC

Abstract class responsible for read/write the raster files in all implemented gapfilling methods.

Parameters
  • fn_files (Optional[List]) – Raster file paths to be read and gapfilled. The filename alphabetic order is used to infer the temporal order for the read data.

  • data (Optional[array]) – 3D array where the last dimension is the time.

  • outlier_remover (Optional[OutlierRemover]) – Strategy to remove outliers.

  • std_win (int) – Temporal window size used to calculate a local median and std.

  • std_env (int) – Number of std used to define a local envelope around the median. Values outside of this envelope are removed.

  • perc_env (list) – A list containing the lower and upper percentiles used to defined a global envelope for the time series. Values outside of this envelope are removed.

  • n_jobs_io – Number of parallel jobs to read/write raster files.

  • verbose (bool) – Use True to print the progress of the gapfilled.

Methods

run

Execute the gapfilling approach.

save_rasters

Save the result in raster files maintaining the same filenames of the read rasters.

run()[source]

Execute the gapfilling approach.

save_rasters(out_dir, dtype=None, out_mantain_subdirs=True, root_dir_name='eumap_data', fn_files=None, nodata=None, spatial_win=None, save_flag=True)[source]

Save the result in raster files maintaining the same filenames of the read rasters.

Parameters
  • out_dir – Folder path to save the files.

  • dtype (Optional[str]) – Convert the rasters for the specified Numpy dtype before save. This argument overwrite the values retrieved of fn_files

  • out_mantain_subdirs (bool) – Keep the full folder hierarchy of the read raster in the out_dir.

  • root_dir_name (str) – Keep the relative folder hierarchy of the read raster in the out_dir considering of the sub folders of root_dir_name.

  • fn_files (Optional[List]) – Raster file paths to retrieve the filenames and folders. Use this parameter in situations where the data parameter is informed in the class constructor. The pixel size, crs, extent, image size and nodata for the gapfilled rasters are retrieved from the first valid raster of fn_files

  • nodataNodata value used for the the gapfilled rasters. This argument overwrite the values retrieved of fn_files. This argument doesn’t affect the flag rasters (gapfill summary), which have nodata=0.

  • spatial_win (Optional[Window]) – Save the gapfilled rasters considering the specified spatial window.

  • save_flag – Save the flag rasters (gapfill summary).