get_patch_names

function of dascore.utils.patch source

get_patch_names(
    patch_data: pandas.core.frame.DataFrame | dascore.core.patch.Patch | dascore.core.spool.BaseSpool[DataFrame, Patch, BaseSpool] ,
    prefix = DAS,
    attrs = (‘network’, ‘station’, ‘tag’),
    coords = (‘time’,),
    sep = __,
    strip_extension = True,
)-> ‘pd.Series’

Generates the default name of patch data.

Parameters

Parameter Description
patch_data A container with patch data.
prefix A string to prefix the names.
attrs The Patch attrs to include in the name.
coords The coordinate ranges to use in the names.
sep The separator for each value.
strip_extension If True, remove extensions when getting name from a file path.
See the notes section for more details.
Note

There are two special cases where the default logic is overwritten. The first one, is when a column called “name” already exists. This will simply be returned.

The second is when a column called “path” exists. In this case, the output will be the file name with the extension removed (if strip_extension). The path must use ‘/’ as a delinater.

See Also

Examples

import dascore as dc
from dascore.utils.patch import get_patch_names

# Get a series of names from a patch or spool
patch = dc.get_example_patch()
spool = dc.get_example_spool()
patch_name = get_patch_names(patch)
spool_name = get_patch_names(patch)

# Use the Patch/Spool methods
spool_series = spool.get_patch_names()
patch_name = patch.get_patch_name() # a str w/ name.