def getFileIDs(modis_identifier, start_date, end_date, lat, lon, daynightboth):
'''
Retrieve file IDs for images matching search parameters
@param modis_identifier: Product identifier (e.g. MOD09)
@param start_date: Starting date
@param end_date: Ending date
@param lat: Latitude
@param lon: Longitude
@param daynightboth: Get daytime images ('D'), nightime images ('N') or both ('B')
@return list of file IDs
'''
lat_str = str(lat)
lon_str = str(lon)
info_url = ('http://modwebsrv.modaps.eosdis.nasa.gov/axis2/services/MODAPSservices/searchForFiles'
+ '?product=' + modis_identifier + '&collection=6&start=' + start_date
+ '&stop=' + end_date + '&north=' + lat_str + '&south=' + lat_str + '&west='
+ lon_str + '&east=' + lon_str + '&coordsOrTiles=coords&dayNightBoth=' + daynightboth)
url = urlopen(info_url)
tree = ET.fromstring(url.read().decode())
url.close()
return [ int(child.text) for child in tree ]
评论列表
文章目录