Module: util
|
Extract zip- or tarfile of time series file and return file paths. |
|
Remove specified file(s) from disk. |
|
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_pathstr
Path to data archive or single data file.
- cleanup_archivebool, optional
Boolean specifying whether to delete the original archive (if applicable). Defaults to True.
- cleanup_filesbool, optional
Boolean specifying whether to delete the extracted files when exiting the given context. Defaults to False.
- extract_dirstr, 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:
- pathsstr 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_pathstr
Absolute or relative path to a file.
- Returns:
- str
The name of the file with directory names and extensions removed.