<p><b>dwj07@fsu.edu</b> 2012-02-28 11:17:07 -0700 (Tue, 28 Feb 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding error output for incorrect calls to script.<br>
        Adding inputs for min and max on colorbar, which can be used in plotting different variables.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/visualize_channel.py
===================================================================
--- branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/visualize_channel.py        2012-02-28 18:04:29 UTC (rev 1545)
+++ branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/visualize_channel.py        2012-02-28 18:17:07 UTC (rev 1546)
@@ -13,9 +13,27 @@
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename", help="file to visualize", metavar="FILE")
parser.add_option("-v", "--var", dest="variable", help="variable to visualize", metavar="VAR")
+parser.add_option("--max", dest="maximum", help="maximum for color bar", metavar="MAX")
+parser.add_option("--min", dest="minimum", help="minimum for color bar", metavar="MIN")
options, args = parser.parse_args()
+if not options.filename:
+        parser.error("Filename is a required input.")
+
+if not options.variable:
+        parser.error("Variable is a required input.")
+
+if not options.maximum:
+        color_max = 13.0
+else:
+        color_max = float(options.maximum)
+
+if not options.minimum:
+        color_min = 11.0
+else:
+        color_min = float(options.minimum)
+
x_length = 160000
y_length = 500000
@@ -51,39 +69,33 @@
del junk
-global_max = maxval
-global_min = minval
+junk = temperature[:,:,:]
+global_max = junk.max()
+global_min = junk.min()
-for lev in range(1, vert_levs):
-        junk = temperature[:,:,lev]
-        global_max = max(junk.max(), global_max)
-        global_min = min(junk.min(), global_min)
+del junk
-        del junk
-
print "Global max = ", global_max, " Global min = ", global_min
print "Surface max = ", maxval, " Surface min = ", minval
-step = (maxval - minval) / steps
-color_bar_levels = arange(minval-step, maxval+2*step, step)
+step = (color_max - color_min) / steps
+color_bar_levels = arange(color_min-step, color_max+step, step)
-temp_slice = temperature[0, :, 0]
-temp_slice = temp_slice.reshape(ny, nx)
+temp_slice = temperature[:, :, 0]
+temp_slice = temp_slice.reshape(time_length, ny, nx)
plt.ion()
fig = plt.figure(1)
ax = fig.add_subplot(111)
-C = plt.contourf(temp_slice[:,:], levels=color_bar_levels)
+C = plt.contourf(temp_slice[0, :,:], levels=color_bar_levels)
plt.colorbar()
plt.draw()
for t in range( 1, time_length):
        ax.cla()
-         temp_slice = temperature[t, :, 0]
-         temp_slice = temp_slice.reshape(ny, nx)
-        C = plt.contourf(temp_slice[:,:], levels=color_bar_levels)
+        C = plt.contourf(temp_slice[t, :,:], levels=color_bar_levels)
        plt.draw()
        time.sleep(0.05)
</font>
</pre>