Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ftplib import FTP
- import datetime, os
- ftpUrl = "safmil.ipma.pt"
- ftp = FTP(ftpUrl)
- user = 'rggb'
- passwd = 'rgTuBgb8'
- ftp.login(user, passwd)
- FRP_PIXEL_dir = '/home/rggb/OperationalChain/LSASAF_Products/FRP-PIXEL'
- ftp.cwd(FRP_PIXEL_dir)
- dateTimeList = list()
- ftpList = ftp.nlst()
- for i in range(0,len(ftpList)):
- dateTimeList.append(datetime.datetime(int(ftpList[i][-16:-12]), int(ftpList[i][-12:-10]), int(ftpList[i][-10:-8]), int(ftpList[i][-8:-6]), int(ftpList[i][-6:-4])))
- dateTimeList.sort()
- #print dateTimeList
- #print dateTimeList[-1]
- #dateTimeString = str(dateTimeList[-1].year).zfill(4) + str(dateTimeList[-1].month).zfill(2) + str(dateTimeList[-1].day).zfill(2) + str(dateTimeList[-1].hour).zfill(2) + str(dateTimeList[-1].minute).zfill(2)
- #print str(dateTimeList[-1].year).zfill(5)
- dateTimeArray = [str(dateTimeList[-1].year).zfill(4),str(dateTimeList[-1].month).zfill(2),str(dateTimeList[-1].day).zfill(2),str(dateTimeList[-1].hour).zfill(2),str(dateTimeList[-1].minute).zfill(2)]
- #print ''.join(dateTimeArray)
- seviriLsaFTPUrl = "ftp://" + user + ":" + passwd + "@" + ftpUrl + "/OperationalChain/LSASAF_Products/FRP-PIXEL/HDF5_LSASAF_MSG_FRP-PIXEL-ListProduct_MSG-Disk_" + ''.join(dateTimeArray) + ".bz2"
- #print seviriLsaFTPUrl
- os.system("wget " + seviriLsaFTPUrl + " -O /var/www/html/maps/firemap/realdata-geojson/seviri_lsa/HDF5_LSASAF_MSG_FRP-PIXEL-ListProduct_MSG-Disk.bz2")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement