Hi,
Is there any wget shell script available for downloading HYCOM output?
Thanks
Venkat
Venkat S. Kolluru
Technical Director, Surfacewater Modeling Group
ERM
350 Eagleview Boulevard, Suite 200
Exton, PA 19341-1180
Tel: 610 524 3654
Mob: 610 764 0579
class download_netcdf:
def __init__(self, date, data):
HYCOM_date = netcdftime.DateFromJulianDay(date+2415384.5)
year_of_date = HYCOM_date.timetuple().tm_year
day_of_year = HYCOM_date.timetuple().tm_yday
file = ('archv.' + str(year_of_date) + '_' +
str(day_of_year).zfill(3) + '_00_3z' + data + '.nc')
if os.path.isfile(file):
print 'File exists!'
else:
ftp = ftplib.FTP('ftp.hycom.org')
ftp.login('anonymous', 'youremailaddress')
if data == 't':
directory = ('/datasets/GOMl0.04/expt_20.1/' +
str(year_of_date) + '/' + data + 'emp')
else:
directory = ('/datasets/GOMl0.04/expt_20.1/' +
str(year_of_date) + '/' + data + 'vel')
ftp.cwd(directory)
print 'Retrieving ' + file + '...'
ftp.retrbinary('RETR ' + file, open(file, 'wb').write)
date = netcdftime.JulianDayFromDate(end_date) - 2415384.5
Then it is simply called as:
download_netcdf(date, 'u')
if you want the u data (also accepts 't', 'v', and 'w'...sorry no salinity in there). Let me know if I left anything important out. You'll need to import ftplib, os, and netcdftime at least.