def open_file (file_path) : """ given a file path that is a modis file, open it """ file_object = None guidebook = dry('guidebooks', 'is_my_file', file_path) file_object = guidebook.open_file(file_path) return file_object
def get_variable_names (file_path, user_requested_names=[ ]) : """get a list of variable names we expect to process from the file """ var_names = set ( ) guidebook = dry('guidebooks', 'is_my_file', file_path) var_names.update(guidebook.get_variable_names(user_requested_names)) return var_names
def parse_datetime_from_filename (file_path) : """parse the given file_name_string and create an appropriate datetime object that represents the datetime indicated by the file name; if the file name does not represent a pattern that is understood, None will be returned """ datetime_to_return = None guidebook = dry('guidebooks', 'is_my_file', file_path) datetime_to_return = guidebook.parse_datetime_from_filename(file_path) return datetime_to_return
def load_aux_data (file_path, minimum_scan_angle, file_object=None) : """ load the auxillary data for a given file """ temp_aux_data = None guidebook = dry('guidebooks', 'is_my_file', file_path) file_object, temp_aux_data = guidebook.load_aux_data(file_path, minimum_scan_angle, file_object=file_object) return file_object, temp_aux_data
def get_satellite_from_filename (file_path) : """given a file name, figure out which satellite it's from if the file does not represent a known satellite name configuration None will be returned """ satellite_to_return = None instrument_to_return = None guidebook = dry('guidebooks', 'is_my_file', file_path) satellite_to_return, instrument_to_return = guidebook.get_satellite_from_filename(file_path) return satellite_to_return, instrument_to_return
def load_variable_from_file (variable_name, file_path=None, file_object=None, data_type_for_output=numpy.float32) : """ load a given variable from a file path or file object """ temp_data = None guidebook = dry('guidebooks', 'is_my_file', file_path) file_object, temp_data = guidebook.load_variable_from_file (variable_name, file_path=file_path, file_object=file_object, data_type_for_output=data_type_for_output) return file_object, temp_data
def close_file (file_path, file_object) : """ given a file object, close it """ guidebook = dry('guidebooks', 'is_my_file', file_path) guidebook.close_file(file_object)