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 – Stacked image dataset location
  • folder_pattern – Filename pattern for stack image folders located within location (default: ‘L*’)
  • image_pattern – Filename pattern for stacked images located within each folder (default: ‘L*stack’)
  • date_index_start – Starting index of image date string within folder name (default: 9)
  • date_index_end – Ending index of image date string within folder name (default: 16)
  • date_format – String format of date within folder names (default: ‘%Y%j’)
  • ignore – 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 – directory path to create
Raises:OSError – Raise OSError if cannot create directory for reasons other than it existing already (errno 13 “EEXIST”)