Base class
- class terragon.base.Base
Bases:
ABCAbstract base class for all EO data providers.
- Parameters:
ABC – abstract base class
- Raises:
ValueError – when there are missing parameters
- create(*args, **kwargs)
Execute search and download within one command. For explanation of parameters see the ‘search’ function.
- abstract download(items)
Download the given items.
- Parameters:
items (
typing.List[object]) – list of items to download, the item type is specific to the backend- Returns:
xarray.Dataset or list of filenames
- search(shp, collection, bands=None, start_date=None, end_date=None, resolution=None, filter=None, clip_to_shp=True, download_folder='./eo_download/', num_workers=1, create_minicube=True, save_metadata=[])
Search for items in the backend (This abstract function only takes all arguments and stores them, the search is done in the child/data provider class). The listed arguments are the same for all data providers, the parameter list may be completed by special parameters of the child class.
- Parameters:
shp (
geopandas.GeoDataFrame) – the shape of the area of interest, the output will be reprojected to the shape crscollection (
str) – collection namebands (
typing.List[str]) – band names to download, defaults to Nonestart_date (
str) – the first date of the time series of interest, defaults to Noneend_date (
str) – the last date of the time series of interest (if there is no time in the date it defaults to include the end_date), defaults to Noneresolution (
float) – resolution of the output in meters, defaults to Nonefilter (
dict) – filters applied to the meta data in format: {‘<meta-var-name>’: {<filter-matching>:<value>}, …}, defaults to Noneclip_to_shp (
bool) – if True set pixels outside of the shape to nan (using rio.clip), else clip to bounding box, defaults to Truedownload_folder (
str) – the folder to download files (also temporary files), defaults to “./eo_download/”num_workers (
int) – the number of workers in parallel to use for downloading, defaults to 1create_minicube (
bool) – if True return a xarray.Dataset, otherwise return the downloaded filenames, defaults to Truesave_metadata (
list[str]) – list of metadata fields from each image to save as coordinates in the minicube, defaults to []