SF.net SVN: matplotlib: [4430] trunk/toolkits/basemap

2007-11-24 Thread jswhit
Revision: 4430
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4430&view=rev
Author:   jswhit
Date: 2007-11-24 05:25:06 -0800 (Sat, 24 Nov 2007)

Log Message:
---
use drawmapboundary to fill map projection region
a specified color.  Useful for painting ocean areas
(instead of setting axis background color, which only
works for rectangular projections).

Modified Paths:
--
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/examples/customticks.py
trunk/toolkits/basemap/examples/hires.py
trunk/toolkits/basemap/examples/ortho_demo.py
trunk/toolkits/basemap/examples/randompoints.py
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py

Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2007-11-23 18:07:27 UTC (rev 4429)
+++ trunk/toolkits/basemap/Changelog2007-11-24 13:25:06 UTC (rev 4430)
@@ -1,3 +1,5 @@
+   * add 'fill_color' option to drawmapboundary, to optionally
+ fill the map projection background a certain color.
* added 'sstanom' colormap from
  http://www.ghrsst-pp.org/GHRSST-PP-Data-Tools.html
 version 0.9.7 (svn revision 4422)

Modified: trunk/toolkits/basemap/examples/customticks.py
===
--- trunk/toolkits/basemap/examples/customticks.py  2007-11-23 18:07:27 UTC 
(rev 4429)
+++ trunk/toolkits/basemap/examples/customticks.py  2007-11-24 13:25:06 UTC 
(rev 4430)
@@ -20,17 +20,17 @@
 
 # create figure.
 fig=pylab.figure()
-# background color will be used for 'wet' areas.
-fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
 # create Basemap instance (regular lat/lon projection).
 # suppress_ticks=False allows custom axes ticks to be used
 # Ticks are suppressed by default, so Basemap methods
 # drawparallels and drawmeridians used to draw labelled lat/lon grid.
 m = Basemap(llcrnrlon=-156.5,llcrnrlat=18.75,urcrnrlon=-154.5,urcrnrlat=20.5,
 resolution='h',projection='cyl',suppress_ticks=False)
-# draw coastlines, fill land areas.
+# draw coastlines, fill land and lake areas.
 m.drawcoastlines()
-m.fillcontinents(color="coral")
+m.fillcontinents(color='coral',lake_color='aqua')
+# background color will be used for oceans.
+m.drawmapboundary(fill_color='aqua')
 # get axes instance.
 ax = pylab.gca()
 # add custom ticks.

Modified: trunk/toolkits/basemap/examples/hires.py
===
--- trunk/toolkits/basemap/examples/hires.py2007-11-23 18:07:27 UTC (rev 
4429)
+++ trunk/toolkits/basemap/examples/hires.py2007-11-24 13:25:06 UTC (rev 
4430)
@@ -21,15 +21,18 @@
 
 # clear the figure
 clf()
-ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
 # read cPickle back in and plot it again (should be much faster).
 t1 = time.clock()
 m2 = cPickle.load(open('map.pickle','rb'))
 # draw coastlines and fill continents.
 m.drawcoastlines()
-m.fillcontinents(color='coral')
+# fill continents and lakes
+m.fillcontinents(color='coral',lake_color='aqua')
 # draw political boundaries.
 m.drawcountries(linewidth=1)
+# fill map projection region light blue (this will
+# paint ocean areas same color as lakes).
+m.drawmapboundary(fill_color='aqua')
 # draw major rivers.
 m.drawrivers(color='b')
 print time.clock()-t1,' secs to plot using using a pickled Basemap instance'

Modified: trunk/toolkits/basemap/examples/ortho_demo.py
===
--- trunk/toolkits/basemap/examples/ortho_demo.py   2007-11-23 18:07:27 UTC 
(rev 4429)
+++ trunk/toolkits/basemap/examples/ortho_demo.py   2007-11-24 13:25:06 UTC 
(rev 4430)
@@ -23,11 +23,11 @@
 fig = figure()
 m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l')
 m.drawcoastlines()
-m.fillcontinents(color='coral')
+m.fillcontinents(color='coral',lake_color='aqua')
 m.drawcountries()
 # draw parallels and meridians.
 m.drawparallels(arange(-90.,120.,30.))
 m.drawmeridians(arange(0.,420.,60.))
-m.drawmapboundary()
+m.drawmapboundary(fill_color='aqua')
 title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
 show()

Modified: trunk/toolkits/basemap/examples/randompoints.py
===
--- trunk/toolkits/basemap/examples/randompoints.py 2007-11-23 18:07:27 UTC 
(rev 4429)
+++ trunk/toolkits/basemap/examples/randompoints.py 2007-11-24 13:25:06 UTC 
(rev 4430)
@@ -24,8 +24,6 @@
 # plot them as filled circles on the map.
 # first, create a figure.
 fig=figure()
-# background color will be used for 'wet' areas.
-fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
 # draw colored markers.
 # use zorder=10 to make sure markers are drawn last.
 # (otherwise they are covered up when continents are filled)
@@ -39,9 +37,11 @@
 if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt <

SF.net SVN: matplotlib: [4431] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/pupynere.py

2007-11-24 Thread jswhit
Revision: 4431
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4431&view=rev
Author:   jswhit
Date: 2007-11-24 11:43:37 -0800 (Sat, 24 Nov 2007)

Log Message:
---
modify pupynere to create masked array when missing_value
and/or _FillValue attribute is defined, and apply scale_factor
and add_offset.

Modified Paths:
--
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py

Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-11-24 13:25:06 UTC (rev 4430)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-11-24 19:43:37 UTC (rev 4431)
@@ -31,7 +31,7 @@
 import itertools
 import mmap
 
-from numpy import ndarray, zeros, array
+from numpy import ndarray, zeros, array, ma, squeeze
 
 
 ABSENT   = '\x00' * 8
@@ -257,7 +257,23 @@
}
 
 def __getitem__(self, index):
-return self.__array_data__.__getitem__(index)
+# modified by jsw to automatically
+# - remove singleton dimensions
+# - create a masked array using missing_value or _FillValue attribute
+# - apply scale_factor and add_offset to packed integer data
+datout = squeeze(self.__array_data__.__getitem__(index))
+try:
+datout = ma.masked_values(datout, self.missing_value)
+except:
+try:
+datout = ma.masked_values(datout, self._FillValue)
+except:
+pass
+try:
+datout = self.scale_factor*datout + self.add_offset
+except:
+pass
+return datout
 
 def getValue(self):
 """For scalars."""


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4432] trunk/toolkits/basemap/examples/ccsm_popgrid .py

2007-11-24 Thread jswhit
Revision: 4432
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4432&view=rev
Author:   jswhit
Date: 2007-11-24 11:57:45 -0800 (Sat, 24 Nov 2007)

Log Message:
---
no longer need to manually create masked array

Modified Paths:
--
trunk/toolkits/basemap/examples/ccsm_popgrid.py

Modified: trunk/toolkits/basemap/examples/ccsm_popgrid.py
===
--- trunk/toolkits/basemap/examples/ccsm_popgrid.py 2007-11-24 19:43:37 UTC 
(rev 4431)
+++ trunk/toolkits/basemap/examples/ccsm_popgrid.py 2007-11-24 19:57:45 UTC 
(rev 4432)
@@ -36,16 +36,13 @@
 fpin  = NetCDFFile(infile)
 tlat  = fpin.variables['TLAT'][:]
 tlon  = fpin.variables['TLONG'][:]
+# masked array returned, masked where data == _FillValue
 temp  = fpin.variables['TEMP'][:]
-fillvalue = fpin.variables['TEMP'].attributes['_FillValue']
 fpin.close()
 
 # make longitudes monotonically increasing.
 tlon = N.where(N.greater_equal(tlon,min(tlon[:,0])),tlon-360,tlon)
 
-# create a masked array with temperature data (continents masked).
-temp = MA.masked_values(temp,fillvalue)
-
 # stack grids side-by-side (in longitiudinal direction), so
 # any range of longitudes may be plotted on a world map.
 tlon = N.concatenate((tlon,tlon+360),1)


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4433] trunk/toolkits/basemap/Changelog

2007-11-24 Thread jswhit
Revision: 4433
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4433&view=rev
Author:   jswhit
Date: 2007-11-24 19:52:28 -0800 (Sat, 24 Nov 2007)

Log Message:
---
modify NetCDFFile

Modified Paths:
--
trunk/toolkits/basemap/Changelog

Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2007-11-24 19:57:45 UTC (rev 4432)
+++ trunk/toolkits/basemap/Changelog2007-11-25 03:52:28 UTC (rev 4433)
@@ -1,3 +1,6 @@
+   * modify NetCDFFile to automatically apply scale_factor
+ and add_offset, and return masked arrays masked where
+ data == missing_value or _FillValue.
* add 'fill_color' option to drawmapboundary, to optionally
  fill the map projection background a certain color.
* added 'sstanom' colormap from


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins