dep_tools.namers module
Base class and implementation of Namer objects, which are used to
define paths for output data and accompanying files, such as STAC Items.
- class dep_tools.namers.GenericItemPath(sensor, dataset_id, version, time, prefix='dep', zero_pad_numbers=True, full_path_prefix=None)[source]
Bases:
ItemPathA GenericItemPath represents a path on a network or local drive.
- Parameters:
sensor (
str) – The satellite sensor, typically “ls” for Landsat or “s2” for Sentinel-2.dataset_id (
str) – The identifier for this product, such as “geomad”.version (
str) – A version identified.time (
str) – A time, such as “2012”.prefix (
str) – The prefix for the product, typically representing the data producer, such as “dep” for Digital Earth Pacific.zero_pad_numbers (
bool) – Whether to pad numbers in the item id (see below) to three digits.full_path_prefix (
Union[str,Path,None]) – Something to put at the beginning of the full path representation of the path, such as “/home/”.
- basename(item_id)[source]
The stem of the file name, without any parent folders.
- Parameters:
item_id (
list[str|int] |tuple[str|int] |str) – The item id. If a list, items are converted to string, optionally zero-padded (according to the class parameter zero_pad_numbers), and joined using an underscore. Otherwise, the value is used directly.- Return type:
str- Returns:
A string.
- path(item_id, asset_name=None, ext='.tif', absolute=False)[source]
- Parameters:
item_id (
list[str|int] |tuple[str|int] |str) – The item id.asset_name (
Optional[str]) – If the thing we are naming has multiple assets / bands, this is the name of the asset.ext (
str) – The extension for the path.absolute (
bool) – Whether to return the absolute path.
- Return type:
str- Returns:
The path as a string.
- stac_path(item_id, **kwargs)[source]
The path to the STAC item.
- Parameters:
item_id (
list[str|int] |tuple[str|int] |str) – The item id.**kwargs – Additional arguments to
GenericItemPath.path().
- Return type:
str- Returns:
The path as a string.
- class dep_tools.namers.DepItemPath(sensor, dataset_id, version, time, prefix='dep', zero_pad_numbers=True, full_path_prefix=None)[source]
Bases:
GenericItemPathA DepItemPath is just a renamed GenericItemPath, for backwards compatibility.
- Parameters:
sensor (
str) – The satellite sensor, typically “ls” for Landsat or “s2” for Sentinel-2.dataset_id (
str) – The identifier for this product, such as “geomad”.version (
str) – A version identified.time (
str) – A time, such as “2012”.prefix (
str) – The prefix for the product, typically representing the data producer, such as “dep” for Digital Earth Pacific.zero_pad_numbers (
bool) – Whether to pad numbers in the item id (see below) to three digits.full_path_prefix (
Union[str,Path,None]) – Something to put at the beginning of the full path representation of the path, such as “/home/”.
- class dep_tools.namers.S3ItemPath(bucket, sensor, dataset_id, version, time, prefix='dep', zero_pad_numbers=True, full_path_prefix=None, make_hrefs_https=True)[source]
Bases:
GenericItemPathAn ItemPath for something on Amazon S3 storage.
- bucket
The name of the bucket.
- Parameters:
sensor (
str) – The satellite sensor, typically “ls” for Landsat or “s2” for Sentinel-2.dataset_id (
str) – The identifier for this product, such as “geomad”.version (
str) – A version identified.time (
str) – A time, such as “2012”.prefix (
str) – The prefix for the product, typically representing the data producer, such as “dep” for Digital Earth Pacific.zero_pad_numbers (
bool) – Whether to pad numbers in the item id (see below) to three digits.full_path_prefix (
Optional[str]) – Something to put at the beginning of the full path representation of the path, such as “/home/”.
- class dep_tools.namers.DailyItemPath(time, **kwargs)[source]
Bases:
S3ItemPathAn S3ItemPath which produces approprate paths for “daily” items where the time is a datetime parseable by datetime.datetime.fromisoformat. Folders will have format YYYY/mm/dd, and stems will have dates in the format YYYY-mm-dd. Example: a time value of “2025-06-13 15:56:54.012509” would produce dep_ls_wofl/99/77/2025/06/13/dep_ls_wofl_99_77_2025-06-13.tif
- Parameters:
sensor – The satellite sensor, typically “ls” for Landsat or “s2” for Sentinel-2.
dataset_id – The identifier for this product, such as “geomad”.
version – A version identified.
time (
str|datetime) – A time, such as “2012”.prefix – The prefix for the product, typically representing the data producer, such as “dep” for Digital Earth Pacific.
zero_pad_numbers – Whether to pad numbers in the item id (see below) to three digits.
full_path_prefix – Something to put at the beginning of the full path representation of the path, such as “/home/”.
- basename(item_id)[source]
The stem of the file name, without any parent folders.
- Parameters:
item_id – The item id. If a list, items are converted to string, optionally zero-padded (according to the class parameter zero_pad_numbers), and joined using an underscore. Otherwise, the value is used directly.
- Return type:
str- Returns:
A string.
- class dep_tools.namers.LocalPath(local_folder, prefix='dep', **kwargs)[source]
Bases:
DepItemPath- Parameters:
sensor – The satellite sensor, typically “ls” for Landsat or “s2” for Sentinel-2.
dataset_id – The identifier for this product, such as “geomad”.
version – A version identified.
time – A time, such as “2012”.
prefix (
str) – The prefix for the product, typically representing the data producer, such as “dep” for Digital Earth Pacific.zero_pad_numbers – Whether to pad numbers in the item id (see below) to three digits.
full_path_prefix – Something to put at the beginning of the full path representation of the path, such as “/home/”.
- path(item_id, asset_name=None, ext='.tif')[source]
- Parameters:
item_id – The item id.
asset_name – If the thing we are naming has multiple assets / bands, this is the name of the asset.
ext – The extension for the path.
absolute – Whether to return the absolute path.
- Return type:
str- Returns:
The path as a string.