stems.io.utils module¶
IO utilities
-
stems.io.utils.
parse_filename_attrs
(paths, index=None, sep=None)[source]¶ Parse filenames into an array of dates
- Parameters
paths (str or Sequence) – Glob style search pattern, or a list of filenames
index (slice or int) – Either a
slice
used to index on the stem of the filenames in paths, or together with sep an int used to index on the filename stem split by sep (e.g.,filename.split(sep)[index]
)sep (str, optional) – String field seperator
- Returns
Attribute extracted from each filename path
- Return type
-
stems.io.utils.
parse_filename_dates
(paths, index=None, sep=None, date_format='%Y%m%d')[source]¶ Parse filenames into an array of dates
- Parameters
paths (str or Sequence) – Glob style search pattern, or a list of filenames
index (slice or int) – Either a
slice
used to index on the stem of the filenames in paths, or together with sep an int used to index on the filename stem split by sep (e.g.,filename.split(sep)[index]
)sep (str, optional) – String field seperator
date_format (str) – Date format used by
datetime.datetime.strptime()
- Returns
Array of datetime64
- Return type
np.ndarray