def download(self):
"""
Download images for specified tiles and time period.
:param filelist: lists all of the HDF files downloaded
:param observations: lists the total number of days worth of data downloaded
(e.g. 1 year of data = 23 observations).
(e.g. 1 year of data = 23 observations).
"""
if not os.path.exists(self.directory):
os.mkdir(self.directory)
if not os.path.exists(self.fullPath):
os.mkdir(self.fullPath)
dm = pymodis.downmodis.downModis(self.fullPath, self.password, self.username, self.url, self.tiles, self.path, self.dataset,
self.today, self.enddate, jpg = False, debug = True, timeout = 30)
dm.connect()
self.filelist = dm.getListDays()
self.observations = len(dm.getListDays())
if self.dataset != 'MOD13Q1.005':
if self.observations % 2 != 0:
raise IOError("The total number of observations through time must be an even number. Please add or remove an observation before or after %s" % str(self.filelist[0]))
dm.downloadsAllDay()
logger.log('SUCCESS', 'Downloading is complete! %d HDF files of %s data for tiles %s were downloaded for the following days: %s' % (self.observations*len(self.tiles), str(self.dataset), str(self.tiles), str(self.filelist)))
评论列表
文章目录