eo_forge.utils

Helper utilities to download, calibrate, and extract patches from raw data.

Downloader module

bucket_downloader([logger])

Downloader Sentinel or Landasat data from a Google Cloud bucket.

gcSatImg([spacecraft, boto_config, logger])

Google cloud definitions and path generators.

ThreadUrlDownload(queue_[, logger])

Threaded Url download.

bucket_images_downloader([spacecraft, ...])

Base class to download images.

Landsat helper functions

get_clouds_landsat(file)

purpouse: to read cloud image level from landsat metadata file

calibrate_landsat_bqa(raster, filter_values)

Calibrate Landsat BQA band.

calibrate_landsat5(raster, band, metadata[, ...])

Calibrate landsat5 l1 images to top of atmosphere radiance (default) or reflectance (if reflectance=True).

calibrate_landsat8(raster, band, metadata[, ...])

Calibrate landsat8 l1 images to top of atmosphere radiance (default) or reflectance (if reflectance=True).

Sentinel2 helper functions

calibrate_sentinel2(raster, band, metadata)

Calibrate Sentinel 2.

get_granule_from_meta_sentinel(base_dir)

Get granule id and image base for a sentinel2 L1C image.

get_sentinel_granule_img(metadata_file)

Get granule id and image id from sentinel2 l1c products.

get_clouds_msil1c(file)

Get clouds from metadata file "MTD_MSIL1C.xml".

Helper functions for raster datasets

clip_raster(raster, bbox[, ...])

Clip raster to provided BBox.

reproject_raster_to_bbox(raster, roi_bbox[, ...])

Reproject raster to a new bbox.

reproject_raster_north_south(raster[, close])

Reproject raster north-south if needed.

check_resample(raster, target_resolution)

Check if resampling is required.

get_raster_polygon(raster[, ccw])

Return a the raster's bounding box polygon.

resample_raster(raster, scale[, close])

Resample a raster dataset by multiplying the pixel size by the scale factor, and update the dataset shape.

write_mem_raster(data, **profile)

Create a rasterio.MemoryFile instance.

write_raster(file_path, data, **profile)

check_raster_clip_crs(raster_dataset, roi_bbox)

Check band crs match to provided bbox

check_raster_shape_match(raster, roi_shape)

Check raster shape match.

get_nodata_mask(raster_dataset[, nodata, ...])

Get nodata_mask from raster by filtering values.

apply_nodata_mask(raster_dataset, raster_mask)

Apply nodata_mask to raster.

apply_isvalid_mask(raster_dataset, raster_mask)

Apply_isvalid_mask to raster

get_is_valid_mask(raster_dataset[, ...])

Get is_valid_mask from raster by filtering values.

get_raster_data_and_profile(raster)

get raster data and profile Parameters ---------- raster: raster instance (rasterio open)

shapes2array(shapes, raster)

Set shapes to raster.

Helper functions for Bounding boxs

set_buffer_on_gdf(gdf[, buffer, ...])

Set buffer and simplify (convexhull) geometry.

General helper functions

rem_trail_os_sep(scene_path_dir)

walk_dir_files(target_base_path_[, cases])

Get dir and files from a target_path.