You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by go...@apache.org on 2013/06/25 23:13:20 UTC

svn commit: r1496638 - /incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py

Author: goodman
Date: Tue Jun 25 21:13:20 2013
New Revision: 1496638

URL: http://svn.apache.org/r1496638
Log:
CLIMATE-159: Fixed order of parameters for draw_cntr_map_single()

Modified:
    incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py

Modified: incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py?rev=1496638&r1=1496637&r2=1496638&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py (original)
+++ incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/plots.py Tue Jun 25 21:13:20 2013
@@ -96,15 +96,15 @@ def calc_nice_color_bar_values(mymin, my
     
     return newmin, newmax, new_nlevs
 
-def draw_cntr_map_single(pVar, lon, lat, mnLvl, mxLvl, pTitle, pName, pType = 'png', cMap = None):
+def draw_cntr_map_single(pVar, lats, lons, mnLvl, mxLvl, pTitle, pName, pType = 'png', cMap = None):
     '''
     Purpose::
         Plots a filled contour map.
        
     Input::
         pVar - 2d array of the field to be plotted with shape (nLon, nLat)
-        lon - 1d array of longitudes 
-        lat = latitude  (1-d)
+        lon - array of longitudes 
+        lat - array of latitudes
         mnLvl - an integer specifying the minimum contour level
         mxLvl - an integer specifying the maximum contour level
         pTitle - a string specifying plot title
@@ -124,10 +124,10 @@ def draw_cntr_map_single(pVar, lon, lat,
     ax = fig.gca()
 
     # Determine the map boundaries and construct a Basemap object
-    lonMin = lon.min()
-    lonMax = lon.max()
-    latMin = lat.min()
-    latMax = lat.max()
+    lonMin = lons.min()
+    lonMax = lons.max()
+    latMin = lats.min()
+    latMax = lats.max()
     m = Basemap(projection = 'cyl', llcrnrlat = latMin, urcrnrlat = latMax,
             llcrnrlon = lonMin, urcrnrlon = lonMax, resolution = 'l', ax = ax)
 
@@ -140,7 +140,8 @@ def draw_cntr_map_single(pVar, lon, lat,
     m.drawparallels(np.linspace(latMin, latMax, 5), labels = [1, 0, 0, 1])
 
     # Convert lats and lons to projection coordinates
-    lons, lats = np.meshgrid(lon, lat)
+    if lats.ndim == 1 and lons.ndim == 1:
+        lons, lats = np.meshgrid(lons, lats)
     x, y = m(lons, lats)
 
     # Plot data with filled contours