darts_acquisition.s2.raw_data_store
¶
Raw Data Store for Sentinel 2 data.
StoreManager
¶
Bases: abc.ABC, typing.Generic[darts_acquisition.s2.raw_data_store.SceneItem]
Manager for storing raw sentinel 2 data.
This class is an abstract base class and should be extended to implement the respective downloading methods.
Usage:
1. "Normal" usage:
```python
store_manager = StoreManager(store_path)
ds_s2 = store_manager.load(identifier, bands)
```
2. Force download:
```python
store_manager = StoreManager(store_path)
ds_s2 = store_manager.load(identifier, force=True)
```
3. Download only (and only if missing) and store the scene:
```python
store_manager = StoreManager(store_path)
store_manager.download(identifier) # store_path must be not None
```
4. Offline mode:
```python
store_manager = StoreManager(store_path)
store_manager.open(identifier) # store_path must be not None, bands must be complete
```
Initialize the store manager.
Parameters:
-
bands(list[str]) –List of bands to manage
-
store(str | pathlib.Path | None, default:None) –Directory path for storing raw sentinel 2 data
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
store
instance-attribute
¶
store = (
pathlib.Path(
darts_acquisition.s2.raw_data_store.StoreManager(
store
)
)
if isinstance(
darts_acquisition.s2.raw_data_store.StoreManager(
store
),
str,
)
else darts_acquisition.s2.raw_data_store.StoreManager(
store
)
)
complete
¶
download_and_store
¶
download_and_store(
item: str
| darts_acquisition.s2.raw_data_store.SceneItem,
)
Download a scene from the source and store it in the local store.
Store must be provided! Will do nothing if all required bands are already present.
Parameters:
-
item(str | darts_acquisition.s2.raw_data_store.SceneItem) –Item or scene-id to open.
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
download_scene_from_source
abstractmethod
¶
download_scene_from_source(
item: str
| darts_acquisition.s2.raw_data_store.SceneItem,
bands: list[str],
) -> xarray.Dataset
encodings
abstractmethod
¶
exists
¶
Check if a scene already exists in the local raw data store.
Parameters:
-
identifier(str) –Unique identifier for the scene
Returns:
-
bool(bool) –True if the scene exists in the store, False otherwise
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
identifier
abstractmethod
¶
identifier(
item: str
| darts_acquisition.s2.raw_data_store.SceneItem,
) -> str
load
¶
load(
item: str
| darts_acquisition.s2.raw_data_store.SceneItem,
force: bool = False,
) -> xarray.Dataset
Load a scene.
If force==True will download the scene from source even if present in store.
Else, will try to open the scene from store first and only download missing bands.
Will always store the downloaded scene in local store if store is provided, potentially overwriting existing.
Parameters:
-
item(str | darts_acquisition.s2.raw_data_store.SceneItem) –Item or scene-id to open.
-
force(bool, default:False) –If True, will download the scene even if present. Defaults to False.
Returns:
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
missing_bands
¶
Get the list of missing bands for a scene in the store.
Parameters:
-
identifier(str) –Unique identifier for the scene
Returns:
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
open
¶
open(
item: str
| darts_acquisition.s2.raw_data_store.SceneItem,
) -> xarray.Dataset
Open a scene from local store.
Store must be provided and the scene must be present in store!
Parameters:
-
item(str | darts_acquisition.s2.raw_data_store.SceneItem) –Item or scene-id to open
Returns:
Source code in darts-acquisition/src/darts_acquisition/s2/raw_data_store.py
save_to_store
¶
Save a scene dataset to the local raw data store.
Will append new bands to existing store if scene already exists. Will overwrite existing bands in an existing store if scene already exists.
Parameters: