From: <js...@us...> - 2008-10-07 03:23:54
|
Revision: 6161 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6161&view=rev Author: jswhit Date: 2008-10-07 00:46:26 +0000 (Tue, 07 Oct 2008) Log Message: ----------- fix url Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2008-10-07 00:38:35 UTC (rev 6160) +++ trunk/toolkits/basemap/examples/plotsst.py 2008-10-07 00:46:26 UTC (rev 6161) @@ -10,9 +10,9 @@ else: date = sys.argv[1] if date[0:4] > '2005': - ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') + ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') else: - ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc') + ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc') # read sst. Will automatically create a masked array using # missing_value variable attribute. sst = ncfile.variables['sst'][:] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-01-26 19:48:53
|
Revision: 6831 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6831&view=rev Author: jswhit Date: 2009-01-26 19:48:47 +0000 (Mon, 26 Jan 2009) Log Message: ----------- update URL, use new date2index function. Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2009-01-26 19:48:04 UTC (rev 6830) +++ trunk/toolkits/basemap/examples/plotsst.py 2009-01-26 19:48:47 UTC (rev 6831) @@ -1,26 +1,30 @@ -from mpl_toolkits.basemap import Basemap, NetCDFFile +from mpl_toolkits.basemap import Basemap, NetCDFFile, date2index, num2date import numpy as np import matplotlib.pyplot as plt -import sys +import sys, datetime # read in sea-surface temperature and ice data # can be a local file, a URL for a remote opendap dataset, -# or (if PyNIO is installed) a GRIB or HDF file. if len(sys.argv) == 1: date = '20071215' else: date = sys.argv[1] -if date[0:4] > '2005': - ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') -else: - ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc') +# convert datestring to datetime object. +date = datetime.datetime(int(date[0:4]),int(date[4:6]),int(date[6:8])) +print date +# open dataset. +dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAagg') +# find index of desired time. +time = dataset.variables['time'] +nt = date2index(date, time) +print num2date(time[nt],time.units) # read sst. Will automatically create a masked array using # missing_value variable attribute. -sst = ncfile.variables['sst'][:] +sst = dataset.variables['sst'][nt] # read ice. -ice = ncfile.variables['ice'][:] +ice = dataset.variables['ice'][nt] # read lats and lons (representing centers of grid boxes). -lats = ncfile.variables['lat'][:] -lons = ncfile.variables['lon'][:] +lats = dataset.variables['lat'][:] +lons = dataset.variables['lon'][:] # shift lats, lons so values represent edges of grid boxes # (as pcolor expects). delon = lons[1]-lons[0] @@ -34,7 +38,6 @@ # create Basemap instance for mollweide projection. # coastlines not used, so resolution set to None to skip # continent processing (this speeds things up a bit) -#m = Basemap(projection='ortho',lon_0=-110,lat_0=20,resolution=None) m = Basemap(projection='moll',lon_0=lons.mean(),lat_0=0,resolution=None) # compute map projection coordinates of grid. x, y = m(*np.meshgrid(lons, lats)) @@ -42,7 +45,7 @@ # color background of map projection region. # missing values over land will show up this color. m.drawmapboundary(fill_color='0.3') -# plot ice, then with pcolor +# plot sst, then ice with pcolor im1 = m.pcolor(x,y,sst,shading='flat',cmap=plt.cm.jet) im2 = m.pcolor(x,y,ice,shading='flat',cmap=plt.cm.gist_gray) # draw parallels and meridians, but don't bother labelling them. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-26 18:12:34
|
Revision: 7242 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7242&view=rev Author: jswhit Date: 2009-06-26 18:11:32 +0000 (Fri, 26 Jun 2009) Log Message: ----------- fix url Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2009-06-25 05:17:10 UTC (rev 7241) +++ trunk/toolkits/basemap/examples/plotsst.py 2009-06-26 18:11:32 UTC (rev 7242) @@ -12,7 +12,7 @@ date = datetime.datetime(int(date[0:4]),int(date[4:6]),int(date[6:8])) print date # open dataset. -dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAagg') +dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAgg') # find index of desired time. time = dataset.variables['time'] nt = date2index(date, time, calendar='standard') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2010-07-07 13:53:28
|
Revision: 8527 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8527&view=rev Author: jswhit Date: 2010-07-07 13:53:19 +0000 (Wed, 07 Jul 2010) Log Message: ----------- fix URL Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2010-07-07 13:19:29 UTC (rev 8526) +++ trunk/toolkits/basemap/examples/plotsst.py 2010-07-07 13:53:19 UTC (rev 8527) @@ -12,7 +12,8 @@ date = datetime.datetime(int(date[0:4]),int(date[4:6]),int(date[6:8])) print date # open dataset. -dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAgg') +dataset =\ +NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst2/totalAmsrAgg') # find index of desired time. time = dataset.variables['time'] nt = date2index(date, time, calendar='standard') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2011-01-18 22:10:16
|
Revision: 8928 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8928&view=rev Author: jswhit Date: 2011-01-18 22:10:10 +0000 (Tue, 18 Jan 2011) Log Message: ----------- use netcdf4-python if installed to read opendap data. Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2011-01-18 19:00:20 UTC (rev 8927) +++ trunk/toolkits/basemap/examples/plotsst.py 2011-01-18 22:10:10 UTC (rev 8928) @@ -1,4 +1,8 @@ -from mpl_toolkits.basemap import Basemap, NetCDFFile, date2index, num2date +from mpl_toolkits.basemap import Basemap, date2index, num2date +try: + from netCDF4 import Dataset as NetCDFFile +except: + from mpl_toolkits.basemap import NetCDFFile import numpy as np import matplotlib.pyplot as plt import sys, datetime This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |