Download script for Argo data
1 #!/usr/bin/env python
2 import os,os.path
3 from ftplib import FTP
4
5 tmp_dir='/scratch/clisap/seaice/TMP/u242023/ARGO/'
6
7 ftp_adr='ftp.ifremer.fr'
8 ftp_dir='/ifremer/argo/geo/atlantic_ocean/2011/01/'
9
10 ftp = FTP(ftp_adr) # connect to host, default port
11 ftp.login() # user anonymous, passwd anonymous@
12 ftp.cwd(ftp_dir)
13
14 file_list=ftp.nlst()
15
16 for f in file_list:
17 urlfile='ftp://'+ftp_adr+ftp_dir+f
18 localfile=tmp_dir+f
19
20 if not(os.path.exists(localfile)):
21 print 'Getting file '+f
22 #We use curl instead of ftp.retrbinary for download
23 os.system("curl -s -k -o "+localfile+" "+urlfile)
24 else:
25 print 'file '+f+' exists'
26
27 ftp.close()