eumap.gapfiller.TLI¶
- class TLI(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:
eumap.gapfiller.ImageGapfill
Temporal Linear Interpolation able to gapfill the missing pixels using a linear regression [1] over the time using all valid pixels.
- Parameters
fn_files (
Optional
[List
]) – Raster file paths to be read and gapfilled.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 – Use
True
to print the progress of the gapfilled.
References
[1] Scikit-learn linear regression
Examples
>>> from eumap import gapfiller >>> >>> tli = gapfiller.TLI(fn_files=fn_rasters) >>> data_tli = tli.run() >>> >>> fn_rasters_tli = tli.save_rasters('./gapfilled_tli')
Methods
Execute the gapfilling approach.
Save the result in raster files maintaining the same filenames of the read rasters.
- run()¶
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)¶
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 Numpydtype
before save. This argument overwrite the values retrieved offn_files
out_mantain_subdirs (
bool
) – Keep the full folder hierarchy of the read raster in theout_dir
.root_dir_name (
str
) – Keep the relative folder hierarchy of the read raster in theout_dir
considering of the sub folders ofroot_dir_name
.fn_files (
Optional
[List
]) – Raster file paths to retrieve the filenames and folders. Use this parameter in situations where thedata
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 offn_files
nodata –
Nodata
value used for the the gapfilled rasters. This argument overwrite the values retrieved offn_files
. This argument doesn’t affect the flag rasters (gapfill summary), which havenodata=0
.spatial_win (
Optional
[Window
]) – Save the gapfilled rasters considering the specified spatial window.save_flag – Save the flag rasters (gapfill summary).