<p><b>mhoffman@lanl.gov</b> 2012-03-07 15:24:20 -0700 (Wed, 07 Mar 2012)</p><p>BRANCH COMMIT -- land_ice<br>
Added python script for quick visualization of dome test case output.<br>
</p><hr noshade><pre><font color="gray">Added: branches/land_ice_projects/test_cases/dome/visualize_dome.py
===================================================================
--- branches/land_ice_projects/test_cases/dome/visualize_dome.py                                (rev 0)
+++ branches/land_ice_projects/test_cases/dome/visualize_dome.py        2012-03-07 22:24:20 UTC (rev 1602)
@@ -0,0 +1,106 @@
+#!/usr/bin/python
+import sys, os, glob, shutil, numpy
+from netCDF import *
+from pylab import *
+
+from optparse import OptionParser
+
+import time
+import matplotlib
+import matplotlib.pyplot as plt
+from matplotlib.contour import QuadContourSet
+
+
+parser = OptionParser()
+parser.add_option(&quot;-f&quot;, &quot;--file&quot;, dest=&quot;filename&quot;, help=&quot;file to visualize&quot;, metavar=&quot;FILE&quot;)
+parser.add_option(&quot;-t&quot;, &quot;--time&quot;, dest=&quot;time&quot;, help=&quot;time step to visualize (0 based)&quot;, metavar=&quot;TIME&quot;)
+# parser.add_option(&quot;-v&quot;, &quot;--var&quot;, dest=&quot;variable&quot;, help=&quot;variable to visualize&quot;, metavar=&quot;VAR&quot;)
+# parser.add_option(&quot;--max&quot;, dest=&quot;maximum&quot;, help=&quot;maximum for color bar&quot;, metavar=&quot;MAX&quot;)
+# parser.add_option(&quot;--min&quot;, dest=&quot;minimum&quot;, help=&quot;minimum for color bar&quot;, metavar=&quot;MIN&quot;)
+
+options, args = parser.parse_args()
+
+if not options.filename:
+        print &quot;No filename provided. Using output.nc.&quot;
+        options.filename = &quot;output.nc&quot;
+
+if not options.time:
+        print &quot;No time provided. Using time 0.&quot;
+        time_slice = 0
+else:
+        time_slice = int(options.time)
+
+#if not options.variable:
+#        parser.error(&quot;Variable is a required input.&quot;)
+
+# if not options.maximum:
+#              color_max = 0.0
+# else:
+#         color_max = float(options.maximum)
+
+# if not options.minimum:
+#         color_min = 0.0
+# else:
+#         color_min = float(options.minimum)
+
+nx = 30
+ny = 35
+
+f = NetCDFFile(options.filename,'r')
+
+times = f.variables['xtime']
+thickness = f.variables['thickness']
+dcedge = f.variables['dcEdge']
+bedTopography = f.variables['bedTopography']
+xCell = f.variables['xCell']
+yCell = f.variables['yCell']
+temperature = f.variables['temperature']
+
+vert_levs = f.dimensions['nVertLevels']
+
+time_length = times.shape[0]
+
+# print &quot;nx = &quot;, nx, &quot; ny = &quot;, ny
+print &quot;vert_levs = &quot;, vert_levs, &quot; time_length = &quot;, time_length
+
+
+# print &quot;Computing global max and min&quot;
+# junk = thickness[:,:,0]
+# maxval = junk.max()
+# minval = junk.min()
+# 
+# del junk
+# 
+# junk = thickness[:,:]
+# global_max = junk.max()
+# global_min = junk.min()
+
+
+var_slice = thickness[time_slice,:]
+# var_slice = var_slice.reshape(time_length, ny, nx)
+
+
+# print &quot;Global max = &quot;, global_max, &quot; Global min = &quot;, global_min
+# print &quot;Surface max = &quot;, maxval, &quot; Surface min = &quot;, minval
+
+fig = plt.figure(1)
+ax = fig.add_subplot(111, aspect='equal')
+# C = plt.contourf(xCell, yCell, var_slice )
+plt.scatter(xCell[:], yCell[:], 80, var_slice, marker='h', edgecolors='none')
+plt.colorbar()
+plt.title('thickness at time ' + str(time_slice) )
+plt.draw()
+
+fig = plt.figure(2)
+for templevel in xrange(0,vert_levs+2):
+    ax = fig.add_subplot(3,4,templevel+1, aspect='equal')
+    var_slice = temperature[time_slice,:,templevel]
+    # C = plt.contourf(xCell, yCell, var_slice )
+    plt.scatter(xCell[:], yCell[:], 40, var_slice, marker='h', edgecolors='none')
+    plt.colorbar()
+    plt.title('temperature at level '+ str(templevel) + ' at time ' + str(time_slice) )
+    plt.draw()
+
+
+plt.show()
+f.close()


Property changes on: branches/land_ice_projects/test_cases/dome/visualize_dome.py
___________________________________________________________________
Added: svn:executable
   + *

</font>
</pre>