Module: util

cesium.util.extract_time_series(data_path[, …]) Extract zip- or tarfile of time series file and return file paths.
cesium.util.remove_files(paths) Remove specified file(s) from disk.
cesium.util.shorten_fname(file_path) Extract the name of a file (omitting directory names and extensions).

extract_time_series

cesium.util.extract_time_series(data_path, cleanup_archive=True, cleanup_files=False, extract_dir=None)

Extract zip- or tarfile of time series file and return file paths.

If the given file is not a tar- or zipfile then it is treated as a single time series filepath.

Parameters:

data_path : str

Path to data archive or single data file.

cleanup_archive : bool, optional

Boolean specifying whether to delete the original archive (if applicable). Defaults to True.

cleanup_files : bool, optional

Boolean specifying whether to delete the extracted files when exiting the given context. Defaults to False.

extract_dir : str, optional

Directory into which files are to be extracted (if applicable). If None, a temporary directory is created.

Yields:

list of str

List of full paths to time series files.

remove_files

cesium.util.remove_files(paths)

Remove specified file(s) from disk.

Parameters:

paths : str or list of str

Path(s) to file(s) to be removed from disk.

shorten_fname

cesium.util.shorten_fname(file_path)

Extract the name of a file (omitting directory names and extensions).

Parameters:

file_path : str

Absolute or relative path to a file.

Returns:

str

The name of the file with directory names and extensions removed.