Ejemplo n.º 1
0
    def output(self):
        ''' 
        Generate data wrapper
        
        @return data wrapper of MODIS data
        '''

        # Determine latitude and longitude for
        # output
        lat = self.ap_paramList[0]()
        lon = self.ap_paramList[1]()

        start_date = self.start_date
        end_date = self.end_date
        time = self.daynightboth

        file_ids = getFileIDs(self.modis_identifier, start_date, end_date, lat,
                              lon, time)
        file_urls = getFileURLs(file_ids)

        # For streaming, need to use opendap urls
        url_header = 'http://ladsweb.modaps.eosdis.nasa.gov/opendap/'
        opendap_urls = [
            url_header + re.search('allData.*$', url).group(0)
            for url in file_urls
        ]

        # This function reads data and returns a wrapper
        return readMODISData(opendap_urls,
                             self.variable_list,
                             grid=self.grid,
                             grid_fill=self.grid_fill,
                             use_long_name=self.use_long_name,
                             platform=self.modis_platform,
                             product_id=self.modis_id)
Ejemplo n.º 2
0
    def output(self):
        ''' 
        Generate data wrapper
        
        @return data wrapper of MODIS data
        '''

        # Determine latitude and longitude for
        # output
        lat = self.ap_paramList[0]()
        lon = self.ap_paramList[1]()


        start_date = self.start_date
        end_date = self.end_date
        time = self.daynightboth

        file_ids = getFileIDs(self.modis_identifier, start_date, end_date, lat, lon, time)
        file_urls = getFileURLs(file_ids)

        # For streaming, need to use opendap urls
        url_header = 'http://ladsweb.modaps.eosdis.nasa.gov/opendap/'
        opendap_urls = [ url_header + re.search('allData.*$',url).group(0) for url in file_urls ]
        
        # This function reads data and returns a wrapper
        return readMODISData(opendap_urls, self.variable_list, grid=self.grid, grid_fill = self.grid_fill,
                             use_long_name = self.use_long_name, platform = self.modis_platform,
                             product_id = self.modis_id)
Ejemplo n.º 3
0
    def output(self):
        ''' 
        Generate data wrapper
        
        @return data wrapper of MODIS data
        '''

        # Determine latitude and longitude for
        # output
        lat = self.ap_paramList[0]()
        lon = self.ap_paramList[1]()


        start_date = self.start_date
        end_date = self.end_date
        time = self.daynightboth

        file_ids = getFileIDs(self.modis_identifier, start_date, end_date, lat, lon, time)
        
        self.cacheData(file_ids)

        data_location = DataFetcher.getDataLocation('modis')
        with open(os.path.join(data_location,'metadata.csv'), 'a+') as file_object:
            fcntl.lockf(file_object, fcntl.LOCK_SH)
            file_object.seek(0)
            file_list = self.find_data(file_ids, file_object)

        # Location of data files
        data_location = DataFetcher.getDataLocation('modis')

        # Generate list containing full paths to data files
        file_locations = []
        for filename in file_list:
            file_locations.append(os.path.join(data_location, filename))

        # This function reads data and returns a wrapper
        return readMODISData(file_locations, self.variable_list, grid=self.grid, grid_fill = self.grid_fill,
                             use_long_name = self.use_long_name, platform = self.modis_platform,
                             product_id = self.modis_id)