downmodis module
It is useful to download MODIS data from NASA server
-
class pymodis.downmodis.downModis(destinationFolder, password=None, user='anonymous', url='http://e4ftl01.cr.usgs.gov', tiles=None, path='MOLT', product='MOD11A1.005', today=None, enddate=None, delta=10, jpg=False, debug=False, timeout=30)[source]
A class to download MODIS data from NASA FTP repository
-
checkDataExist(listNewFile, move=0)[source]
Check if a file already exists in the directory of download
listNewFile = list of all files, returned by getFilesList function
- move = it is useful to know if a function is called from download
- or move function
-
checkFile(filHdf)[source]
Check using GDAL to be sure that download was fine
filHdf = name of the HDF file to check
-
closeFTP()[source]
Close ftp connection
-
closeFilelist()[source]
Function to close the file where write the downloaded files
-
connect(ncon=20)[source]
Connect to the server and fill the dirData variable
ncon = number maximum of test to connection at the server
-
dayDownload(day, listFilesDown)[source]
Downloads tiles are in files_hdf_consider
- listFilesDown = list of the files to download, returned by
- checkDataExist function
-
debugDays()[source]
This function is useful to debug the number of days
-
debugLog()[source]
Function to create the debug file
-
debugMaps()[source]
This function is useful to debug the number of maps to download for
each day
-
downloadFile(filDown, filHdf, day)[source]
Download the single file
filDown = name of the file to download
filHdf = name of the file to write
day = the day in format YYYY.MM.DD
-
downloadsAllDay(clean=False, allDays=False)[source]
Download the single file
filDown = name of the file to download
filSave = name of the file to write
-
getAllDays()[source]
Return a list of all days
-
getFilesList(day=None)[source]
Create a list of files to download, it is possible choose to
download also the jpeg files or only the hdf files
day = the date of data
-
getListDays()[source]
Return a list of all selected days
-
removeEmptyFiles()[source]
Check if some file has size ugual 0
-
setDirectoryIn(day)[source]
Enter in the directory of the day
-
setDirectoryOver()[source]
Come back to old path
-
pymodis.downmodis.getNewerVersion(oldFile, newFile)[source]
Return newer version of a file
oldFile = one of the two similar file
newFile = one of the two similar file
-
class pymodis.downmodis.modisHtmlParser(fh)[source]
Bases: HTMLParser.HTMLParser
A class to parse HTML
-
get_all()[source]
Return everything
-
get_dates()[source]
Return a list of directories with date
-
get_tiles(prod, tiles, jpeg=False)[source]
Return a list of file to download
-
handle_starttag(tag, attrs)[source]
-
pymodis.downmodis.str2date(strin)[source]
Return a date object from a string
string = text string to return date (2012-10-04)
-
pymodis.downmodis.urljoin(*args)[source]
Joins given arguments into a url. Trailing but not leading slashes are
stripped for each argument.
http://stackoverflow.com/a/11326230