yatsm.io.helpers module

Collection of helper functions that ease common filesystem operations

yatsm.io.helpers.find_stack_images(location, folder_pattern='L*', image_pattern='L*stack', date_index_start=9, date_index_end=16, date_format='%Y%j', ignore=['YATSM'])[source]

Find and identify dates and filenames of Landsat image stacks

Parameters:
  • location (str) – Stacked image dataset location
  • folder_pattern (str, optional) – Filename pattern for stack image folders located within location (default: ‘L*’)
  • image_pattern (str, optional) – Filename pattern for stacked images located within each folder (default: ‘L*stack’)
  • date_index_start (int, optional) – Starting index of image date string within folder name (default: 9)
  • date_index_end (int, optional) – Ending index of image date string within folder name (default: 16)
  • date_format (str, optional) – String format of date within folder names (default: ‘%Y%j’)
  • ignore (list, optional) – List of folder names within location to ignore from search (default: [‘YATSM’])
Returns:

Tuple of lists containing the dates and filenames of all stacked

images located

Return type:

tuple

yatsm.io.helpers.mkdir_p(d)[source]

Make a directory, ignoring error if it exists (i.e., mkdir -p)

Parameters:d (str) – directory path to create
Raises:OSError – Raise OSError if cannot create directory for reasons other than it existing already (errno 13 “EEXIST”)