SF.net SVN: matplotlib:[6824] trunk/toolkits/basemap/setup.cfg
Revision: 6824 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6824&view=rev Author: jswhit Date: 2009-01-25 12:56:39 + (Sun, 25 Jan 2009) Log Message: --- fix typo Modified Paths: -- trunk/toolkits/basemap/setup.cfg Modified: trunk/toolkits/basemap/setup.cfg === --- trunk/toolkits/basemap/setup.cfg2009-01-24 18:07:31 UTC (rev 6823) +++ trunk/toolkits/basemap/setup.cfg2009-01-25 12:56:39 UTC (rev 6824) @@ -2,7 +2,7 @@ # By default, basemap checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines. Acceptible values are: -# auto: install, overwrite an existing installation +# True: install, overwrite an existing installation # False: do not install # auto: install only if the package is unavailable. This # is the default behavior This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6825] trunk/toolkits/basemap
Revision: 6825
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6825&view=rev
Author: jswhit
Date: 2009-01-25 14:29:31 + (Sun, 25 Jan 2009)
Log Message:
---
added maskoceans function and example.
Modified Paths:
--
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/MANIFEST.in
trunk/toolkits/basemap/examples/README
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Added Paths:
---
trunk/toolkits/basemap/examples/maskoceans.py
Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2009-01-25 12:56:39 UTC (rev 6824)
+++ trunk/toolkits/basemap/Changelog2009-01-25 14:29:31 UTC (rev 6825)
@@ -1,4 +1,5 @@
version 0.99.4 (not yet released)
+ * added 'maskoceans' function.
* update pupynere to version 1.0.8 (supports writing large files).
* added more informative error message in readshapefile when
one of the shapefile components can't be found.
Modified: trunk/toolkits/basemap/MANIFEST.in
===
--- trunk/toolkits/basemap/MANIFEST.in 2009-01-25 12:56:39 UTC (rev 6824)
+++ trunk/toolkits/basemap/MANIFEST.in 2009-01-25 14:29:31 UTC (rev 6825)
@@ -70,6 +70,7 @@
include examples/plotprecip.py
include examples/nws_precip_conus_20061222.nc
include examples/NetCDFFile_tst.py
+include examples/maskoceans.py
include examples/README
include lib/mpl_toolkits/__init__.py
include lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/examples/README
===
--- trunk/toolkits/basemap/examples/README 2009-01-25 12:56:39 UTC (rev
6824)
+++ trunk/toolkits/basemap/examples/README 2009-01-25 14:29:31 UTC (rev
6825)
@@ -123,3 +123,5 @@
save_background.py shows how to save a map background and reuse it in another
figure (without having to redraw coastlines).
+
+maskoceans.py shows how to mask 'wet' areas on a plot.
Added: trunk/toolkits/basemap/examples/maskoceans.py
===
--- trunk/toolkits/basemap/examples/maskoceans.py
(rev 0)
+++ trunk/toolkits/basemap/examples/maskoceans.py 2009-01-25 14:29:31 UTC
(rev 6825)
@@ -0,0 +1,46 @@
+from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
+
+topodatin = mlab.load('etopo20data.gz')
+lonsin = mlab.load('etopo20lons.gz')
+latsin = mlab.load('etopo20lats.gz')
+
+# shift data so lons go from -180 to 180 instead of 20 to 380.
+topoin,lons1 = shiftgrid(180.,topodatin,lonsin,start=False)
+lats1 = latsin
+
+fig=plt.figure()
+# setup basemap
+m=Basemap(resolution='l',projection='lcc',lon_0=-100,lat_0=40,width=8.e6,height=6.e6)
+lons, lats = np.meshgrid(lons1,lats1)
+x, y = m(lons, lats)
+# interpolate land/sea mask to topo grid, mask ocean values.
+topo = maskoceans(lons, lats, topoin, inlands=False)
+# make contour plot (ocean values will be masked)
+#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+# draw coastlines.
+m.drawcoastlines()
+plt.title('ETOPO data with marine areas masked (original grid)')
+
+fig=plt.figure()
+# interpolate topo data to higher resolution grid (to better match
+# the land/sea mask).
+nlats = 3*topoin.shape[0]
+nlons = 3*topoin.shape[1]
+lons = np.linspace(-180,180,nlons)
+lats = np.linspace(-90,90,nlats)
+lons, lats = np.meshgrid(lons, lats)
+topo = interp(topoin,lons1,lats1,lons,lats,order=1)
+x, y = m(lons, lats)
+# interpolate land/sea mask to topo grid, mask ocean values.
+topo = maskoceans(lons, lats, topo, inlands=False)
+# make contour plot (ocean values will be masked)
+#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+# draw coastlines.
+m.drawcoastlines()
+plt.title('ETOPO data with marine areas masked (data on finer grid)')
+plt.show()
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-25
12:56:39 UTC (rev 6824)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-25
14:29:31 UTC (rev 6825)
@@ -8,6 +8,8 @@
:func:`interp`: bilinear interpolation between rectilinear grids.
+:func:`maskoceans`: mask 'wet' points of an input array.
+
:func:`shiftgrid`: shifts global lat/lon grids east or west.
:func:`addcyclic`: Add cyclic (wraparound) point in longitude.
@@ -3113,20 +3115,8 @@
# read in.
if self.lsmask is None:
# read in land/sea mask.
-
SF.net SVN: matplotlib:[6826] trunk/toolkits/basemap/examples/maskoceans.py
Revision: 6826
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6826&view=rev
Author: jswhit
Date: 2009-01-25 14:38:48 + (Sun, 25 Jan 2009)
Log Message:
---
add comments.
Modified Paths:
--
trunk/toolkits/basemap/examples/maskoceans.py
Modified: trunk/toolkits/basemap/examples/maskoceans.py
===
--- trunk/toolkits/basemap/examples/maskoceans.py 2009-01-25 14:29:31 UTC
(rev 6825)
+++ trunk/toolkits/basemap/examples/maskoceans.py 2009-01-25 14:38:48 UTC
(rev 6826)
@@ -3,6 +3,8 @@
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
+# example showing how to mask out 'wet' areas on a contour or pcolor plot.
+
topodatin = mlab.load('etopo20data.gz')
lonsin = mlab.load('etopo20lons.gz')
latsin = mlab.load('etopo20lats.gz')
@@ -17,29 +19,31 @@
lons, lats = np.meshgrid(lons1,lats1)
x, y = m(lons, lats)
# interpolate land/sea mask to topo grid, mask ocean values.
+# output may look 'blocky' near coastlines, since data is at much
+# lower resolution than land/sea mask.
topo = maskoceans(lons, lats, topoin, inlands=False)
# make contour plot (ocean values will be masked)
-#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
-im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+#im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
# draw coastlines.
m.drawcoastlines()
plt.title('ETOPO data with marine areas masked (original grid)')
fig=plt.figure()
# interpolate topo data to higher resolution grid (to better match
-# the land/sea mask).
+# the land/sea mask). Output looks less 'blocky' near coastlines.
nlats = 3*topoin.shape[0]
nlons = 3*topoin.shape[1]
lons = np.linspace(-180,180,nlons)
lats = np.linspace(-90,90,nlats)
lons, lats = np.meshgrid(lons, lats)
+x, y = m(lons, lats)
topo = interp(topoin,lons1,lats1,lons,lats,order=1)
-x, y = m(lons, lats)
# interpolate land/sea mask to topo grid, mask ocean values.
topo = maskoceans(lons, lats, topo, inlands=False)
# make contour plot (ocean values will be masked)
-#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
-im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+#im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
# draw coastlines.
m.drawcoastlines()
plt.title('ETOPO data with marine areas masked (data on finer grid)')
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
