示例#1
0
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
示例#2
0
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
示例#3
0
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
示例#4
0
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
示例#5
0
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
示例#6
0
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
示例#7
0
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)