eogrow.core.storage

Implementation of the StorageManager class for handling project storage.

class eogrow.core.storage.StorageManager(config)[source]

Bases: EOGrowObject

Parameters:

config (Schema) –

PRESET_FOLDERS: ClassVar[dict[str, str]] = {'cache': 'cache', 'input_data': 'input-data', 'logs': 'logs'}
pydantic settings Schema[source]

Bases: ManagerSchema, BaseSettings

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
  • aws_profile (str | None)

  • filesystem_kwargs (Dict[str, Any])

  • geopandas_backend (Literal['fiona', 'pyogrio'])

  • project_folder (str)

  • structure (Dict[str, str])

  • use_zarr (bool)

field aws_profile: str | None = None

The AWS profile with credentials needed to access the S3 buckets. In case the profile isn’t specified with a parameter it can be read from an environmental variable.

field filesystem_kwargs: Dict[str, Any] [Optional]

Optional kwargs to be passed on to FS specs.

field geopandas_backend: Literal['fiona', 'pyogrio'] = 'fiona'

Which backend is used for IO operations when using geopandas.

field project_folder: str [Required]

The root project folder. Can be either local or on AWS S3 Bucket.If on AWS, the path must be prefixed with s3://.

field structure: Dict[str, str] [Optional]

A flat key: value store mapping each key to a path in the project.

field use_zarr: bool = False

Use the Zarr backend for EOPatch IO.

config: Schema
get_folder(key, full_path=False)[source]

Returns the path associated with the given key in the structure config.

Parameters:
  • key (str) –

  • full_path (bool) –

Return type:

str

get_logs_folder(full_path=False)[source]

Method for obtaining the logs folder.

Parameters:

full_path (bool) –

Return type:

str

get_cache_folder(full_path=False)[source]

Returns the path associated with the cache key.

Parameters:

full_path (bool) –

Return type:

str

get_input_data_folder(full_path=False)[source]

Returns the path associated with the input_data key.

Parameters:

full_path (bool) –

Return type:

str

is_on_s3()[source]

Returns True if the project_folder is on S3, False otherwise.

Return type:

bool