sand package

Subpackages


sand.base

class sand.base.BaseDownload(collection: str = None, level: int = 1)[source]

Bases: object

check_name(name, check_funcs)[source]
download(product: dict, dir: Path | str, uncompress: bool = True) Path[source]

Download a product from API server

download_all(products, dir: Path | str, if_exists: str = 'skip', uncompress: bool = True) list[Path][source]

Download all products from API server resulting from a query

get_available_collection() dict[source]

Every downloadable collections

metadata(product: dict)[source]

Returns the product metadata including attributes and assets

query(dtstart=None, dtend=None, geo=None) dict[source]

Product query on the API server

quicklook(product: dict, dir: Path | str)[source]

Download a quicklook to dir

exception sand.base.RequestsError[source]

Bases: Exception

sand.base.get_ssl_context() SSLContext[source]

Returns an SSL context based on ssl_verify argument.

Parameters:

ssl_verifyssl_verify parameter

Returns:

An SSL context object.

sand.base.raise_api_error(response: dict)[source]
sand.base.request_get(session, url, nb_loop=5, **kwargs)[source]

sand.copernicus_dataspace

class sand.copernicus_dataspace.DownloadCDSE(collection: str = None, level: int = 1)[source]

Bases: BaseDownload

change_api(**kwargs)
download(**kwargs)

Download a product from API server

download_file(product_id: str, dir: Path | str) Path[source]

Download product knowing is product id (ex: S2A_MSIL1C_20190305T050701_N0207_R019_T44QLH_20190305T103028)

metadata(**kwargs)

Returns the product metadata including attributes and assets

name = 'DownloadCDSE'
query(**kwargs)

Product query on the API server

quicklook(**kwargs)

Download a quicklook to dir

sand.eumdac

class sand.eumdac.DownloadEumDAC(collection: str = None, level: int = 1)[source]

Bases: BaseDownload

download(**kwargs)

Download a product from API server

download_file(product_id, dir)[source]
metadata(**kwargs)

Returns the product metadata including attributes and assets

name = 'DownloadEumDAC'
query(**kwargs)

Product query on the API server

quicklook(**kwargs)

Download a quicklook to dir

sand.geodes

class sand.geodes.DownloadCNES(collection: str = None, level: int = 1)[source]

Bases: BaseDownload

download(**kwargs)

Download a product from API server

download_file(**kwargs)
metadata(**kwargs)

Returns the product metadata including attributes and assets

name = 'DownloadCNES'
query(**kwargs)

Product query on the API server

quicklook(**kwargs)

Download a quicklook to dir

sand.nasa

class sand.nasa.DownloadNASA(collection: str = None, level: int = 1)[source]

Bases: BaseDownload

download(**kwargs)

Download a product from API server

download_file(product_id, dir)[source]
metadata(**kwargs)

Returns the product metadata including attributes and assets

name = 'DownloadNASA'
query(**kwargs)

Product query on the API server

quicklook(**kwargs)

Download a quicklook to dir

sand.nextcloud

sand.patterns

sand.results

sand.results.Collection(selection: list, collec_table: DataFrame) DataFrame[source]

Function to extract a selection of collection from a reference table as pandas DataFrame

Parameters:
  • selection (list) – List of selected collections

  • collec_table (pd.DataFrame) – Reference table

Returns:

Filtered table containing selected collections

Return type:

pd.DataFrame

sand.results.Query(json_value: dict) DataFrame[source]

sand.sample_product

sand.tinyfunc

sand.tinyfunc.change_lon_convention(geo)[source]

Change longitude convention to (-180,180), assuming geo has coords as (lon,lat)

sand.tinyfunc.check_name_contains(name: str, elements: list[str])[source]
sand.tinyfunc.check_name_endswith(name: str, suffix: str)[source]
sand.tinyfunc.check_name_glob(name: str, regexp: str)[source]
sand.tinyfunc.check_name_startswith(name: str, prefix: str)[source]
sand.tinyfunc.end_of_day(date)[source]
sand.tinyfunc.flip_coords(geo)[source]

Flips the x and y coordinate values

sand.usgs

class sand.usgs.DownloadUSGS(collection: str = None, level: int = 1)[source]

Bases: BaseDownload

download(**kwargs)

Download a product from API server

download_file(product_id, dir)[source]
metadata(**kwargs)

Returns the product metadata including attributes and assets

name = 'DownloadUSGS'
query(**kwargs)

Product query on the API server

quicklook(**kwargs)

Download a quicklook to dir