Skip to content

Commit d35527d

Browse files
author
Jeff Whitaker
committed
Merge pull request #121 from jswhit/master
retrieve data with urllib
2 parents 7d6a57a + 5a26093 commit d35527d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

doc/users/figures/plotargo.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
import time, calendar, datetime, numpy
33
from mpl_toolkits.basemap import Basemap
44
import matplotlib.pyplot as plt
5-
# data downloaded from
6-
# http://coastwatch.pfeg.noaa.gov/erddap/tabledap/apdrcArgoAll.html via
7-
# http://coastwatch.pfeg.noaa.gov/erddap/tabledap/apdrcArgoAll.nc?longitude,latitude,time&longitude>=0&longitude<=360&latitude>=-90&latitude<=90&time>=2010-01-01&time<=2010-01-08&distinct()
8-
dset = Dataset('apdrcArgoAll_af28_ee2b_1d10.nc')
5+
import urllib, os
6+
# data downloaded from the form at
7+
# http://coastwatch.pfeg.noaa.gov/erddap/tabledap/apdrcArgoAll.html
8+
filename, headers = urllib.urlretrieve('http://coastwatch.pfeg.noaa.gov/erddap/tabledap/apdrcArgoAll.nc?longitude,latitude,time&longitude>=0&longitude<=360&latitude>=-90&latitude<=90&time>=2010-01-01&time<=2010-01-08&distinct()')
9+
dset = Dataset(filename)
910
lats = dset.variables['latitude'][:]
1011
lons = dset.variables['longitude'][:]
1112
time = dset.variables['time']
1213
times = time[:]
1314
t1 = times.min(); t2 = times.max()
1415
date1 = num2date(t1, units=time.units)
1516
date2 = num2date(t2, units=time.units)
17+
dset.close()
18+
os.remove(filename)
1619
# draw map with markers for float locations
1720
m = Basemap(projection='hammer',lon_0=180)
1821
x, y = m(lons,lats)

0 commit comments

Comments
 (0)