|
From: <js...@us...> - 2009-03-07 21:56:10
|
Revision: 6963
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6963&view=rev
Author: jswhit
Date: 2009-03-07 21:55:59 +0000 (Sat, 07 Mar 2009)
Log Message:
-----------
add comment
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-07 21:52:21 UTC (rev 6962)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-07 21:55:59 UTC (rev 6963)
@@ -1,5 +1,6 @@
"""
plot H's and L's on a sea-level pressure map
+(uses scipy.ndimage.filters)
"""
import numpy as np
import matplotlib.pyplot as plt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-07 22:44:21
|
Revision: 6964
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6964&view=rev
Author: jswhit
Date: 2009-03-07 22:44:16 +0000 (Sat, 07 Mar 2009)
Log Message:
-----------
fix URL
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-07 21:55:59 UTC (rev 6963)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-07 22:44:16 UTC (rev 6964)
@@ -27,7 +27,10 @@
YYYYMMDDHH = sys.argv[1]
# open OpenDAP dataset.
-data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH)
+try:
+ data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH)
+except:
+ data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/"+YYYYMMDDHH[0:6]+"/gdas"+YYYYMMDDHH)
# read lats,lons.
lats = data.variables['lat'][:]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-08 13:05:19
|
Revision: 6967
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6967&view=rev
Author: jswhit
Date: 2009-03-08 13:05:11 +0000 (Sun, 08 Mar 2009)
Log Message:
-----------
cosmetic changes.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 06:37:06 UTC (rev 6966)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 13:05:11 UTC (rev 6967)
@@ -43,7 +43,8 @@
# (higher value, fewer highs and lows)
local_min, local_max = extrema(prmsl, mode='wrap', window=25)
# create Basemap instance.
-m = Basemap(llcrnrlon=0,llcrnrlat=-65,urcrnrlon=360,urcrnrlat=65,projection='merc')
+m =\
+Basemap(llcrnrlon=0,llcrnrlat=-80,urcrnrlon=360,urcrnrlat=80,projection='mill')
# add wrap-around point in longitude.
prmsl, lons = addcyclic(prmsl, lons1)
# contour levels
@@ -56,8 +57,8 @@
cs = m.contour(x,y,prmsl,clevs,colors='k',linewidths=1.)
m.drawcoastlines(linewidth=1.25)
m.fillcontinents(color='0.8')
-m.drawparallels(np.arange(-80,81,20))
-m.drawmeridians(np.arange(0,360,60))
+m.drawparallels(np.arange(-80,81,20),labels=[1,1,0,0])
+m.drawmeridians(np.arange(0,360,60),labels=[0,0,0,1])
xlows = x[local_min]; xhighs = x[local_max]
ylows = y[local_min]; yhighs = y[local_max]
lowvals = prmsl[local_min]; highvals = prmsl[local_max]
@@ -65,6 +66,7 @@
xyplotted = []
# don't plot if there is already a L or H within dmin meters.
dmin = 500000
+yoffset = 0.022*(m.ymax-m.ymin)
for x,y,p in zip(xlows, ylows, lowvals):
if x < m.xmax and x > m.xmin and y < m.ymax and y > m.ymin:
dist = [np.sqrt((x-x0)**2+(y-y0)**2) for x0,y0 in xyplotted]
@@ -72,7 +74,7 @@
plt.text(x,y,'L',fontsize=14,fontweight='bold',
horizontalalignment='center',
verticalalignment='center',color='blue')
- plt.text(x,y-400000,repr(int(p)),fontsize=9,
+ plt.text(x,y-yoffset,repr(int(p)),fontsize=9,
horizontalalignment='center',
verticalalignment='top',color='blue')
xyplotted.append((x,y))
@@ -85,7 +87,7 @@
plt.text(x,y,'H',fontsize=14,fontweight='bold',
horizontalalignment='center',
verticalalignment='center',color='red')
- plt.text(x,y-400000,repr(int(p)),fontsize=9,
+ plt.text(x,y-yoffset,repr(int(p)),fontsize=9,
horizontalalignment='center',
verticalalignment='top',color='red')
xyplotted.append((x,y))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-08 13:18:49
|
Revision: 6968
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6968&view=rev
Author: jswhit
Date: 2009-03-08 13:18:34 +0000 (Sun, 08 Mar 2009)
Log Message:
-----------
make central pressures more readable by making text boxes semi-transparent
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 13:05:11 UTC (rev 6967)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 13:18:34 UTC (rev 6968)
@@ -72,11 +72,10 @@
dist = [np.sqrt((x-x0)**2+(y-y0)**2) for x0,y0 in xyplotted]
if not dist or min(dist) > dmin:
plt.text(x,y,'L',fontsize=14,fontweight='bold',
- horizontalalignment='center',
- verticalalignment='center',color='blue')
+ ha='center',va='center',color='b')
plt.text(x,y-yoffset,repr(int(p)),fontsize=9,
- horizontalalignment='center',
- verticalalignment='top',color='blue')
+ ha='center',va='top',color='b',
+ bbox = dict(boxstyle="square",ec='None',fc=(1,1,1,0.5)))
xyplotted.append((x,y))
# plot highs as red H's, with max pressure value underneath.
xyplotted = []
@@ -85,11 +84,10 @@
dist = [np.sqrt((x-x0)**2+(y-y0)**2) for x0,y0 in xyplotted]
if not dist or min(dist) > dmin:
plt.text(x,y,'H',fontsize=14,fontweight='bold',
- horizontalalignment='center',
- verticalalignment='center',color='red')
+ ha='center',va='center',color='r')
plt.text(x,y-yoffset,repr(int(p)),fontsize=9,
- horizontalalignment='center',
- verticalalignment='top',color='red')
+ ha='center',va='top',color='r',
+ bbox = dict(boxstyle="square",ec='None',fc=(1,1,1,0.5)))
xyplotted.append((x,y))
plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % YYYYMMDDHH)
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-08 13:29:04
|
Revision: 6969
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6969&view=rev
Author: jswhit
Date: 2009-03-08 13:29:00 +0000 (Sun, 08 Mar 2009)
Log Message:
-----------
streamline extrema function
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 13:18:34 UTC (rev 6968)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2009-03-08 13:29:00 UTC (rev 6969)
@@ -9,15 +9,14 @@
from scipy.ndimage.filters import minimum_filter, maximum_filter
def extrema(mat,mode='wrap',window=10):
+ """find the indices of local extrema (min and max)
+ in the input array."""
mn = minimum_filter(mat, size=window, mode=mode)
mx = maximum_filter(mat, size=window, mode=mode)
# (mat == mx) true if pixel is equal to the local max
- # The next computation suppresses responses where
- # the function is flat.
- local_maxima = ((mat == mx) & (mat != mn))
- local_minima = ((mat == mn) & (mat != mx))
- # Get the indices of the maxima, minima
- return np.nonzero(local_minima), np.nonzero(local_maxima)
+ # (mat == mn) true if pixel is equal to the local in
+ # Return the indices of the maxima, minima
+ return np.nonzero(mat == mn), np.nonzero(mat == mx)
if len(sys.argv) < 2:
print 'enter date to plot (YYYYMMDDHH) on command line'
@@ -65,8 +64,8 @@
# plot lows as blue L's, with min pressure value underneath.
xyplotted = []
# don't plot if there is already a L or H within dmin meters.
-dmin = 500000
yoffset = 0.022*(m.ymax-m.ymin)
+dmin = yoffset
for x,y,p in zip(xlows, ylows, lowvals):
if x < m.xmax and x > m.xmin and y < m.ymax and y > m.ymin:
dist = [np.sqrt((x-x0)**2+(y-y0)**2) for x0,y0 in xyplotted]
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:59:35
|
Revision: 8528
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8528&view=rev
Author: jswhit
Date: 2010-07-07 13:59:29 +0000 (Wed, 07 Jul 2010)
Log Message:
-----------
update URL
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plothighsandlows.py
Modified: trunk/toolkits/basemap/examples/plothighsandlows.py
===================================================================
--- trunk/toolkits/basemap/examples/plothighsandlows.py 2010-07-07 13:53:19 UTC (rev 8527)
+++ trunk/toolkits/basemap/examples/plothighsandlows.py 2010-07-07 13:59:29 UTC (rev 8528)
@@ -27,9 +27,9 @@
# open OpenDAP dataset.
try:
- data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH)
+ data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH+".grib2")
except:
- data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/"+YYYYMMDDHH[0:6]+"/gdas"+YYYYMMDDHH)
+ data=NetCDFFile("http://nomad2.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH+".grib2")
# read lats,lons.
lats = data.variables['lat'][:]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|