<p><b>mhoffman@lanl.gov</b> 2012-05-25 11:14:17 -0600 (Fri, 25 May 2012)</p><p>BRANCH COMMIT<br>
More updates to the script for copying CISM data to an MPAS grid - more fixes to copying temperature plus a bit of checking for valid ranges.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice_projects/grid_tools/copy_CISM_grid_to_MPAS_grid.py
===================================================================
--- branches/land_ice_projects/grid_tools/copy_CISM_grid_to_MPAS_grid.py        2012-05-25 15:08:00 UTC (rev 1940)
+++ branches/land_ice_projects/grid_tools/copy_CISM_grid_to_MPAS_grid.py        2012-05-25 17:14:17 UTC (rev 1941)
@@ -78,9 +78,9 @@
 
     try:
       if netCDF_module == 'Scientific.IO.NetCDF':
-        level = infile.dimensions['stagwbndlevel']
+        stagwbndlevel = infile.dimensions['stagwbndlevel']
       else:
-        level = len(infile.dimensions['stagwbndlevel'])
+        stagwbndlevel = len(infile.dimensions['stagwbndlevel'])
     except:
       print 'Input file is missing the dimension stagwbndlevel.  Might not be a problem.'
 
@@ -160,6 +160,8 @@
     thickness = outfile.variables['thickness']
     print '</font>
<font color="gray">thk min/max', thk[:].min()*sf, thk[:].max()*sf
     thickness[timelevout,:] = BilinearInterp(x1, y1, thk[timelev,:,:] * sf, xCell, yCell)
+    # Don't let there be negative thickness
+    thickness[:] = thickness[:] * (thickness[:]&gt;=0.0)
     print 'new thickness min/max', thickness[:].min(), thickness[:].max()
     del thk, thickness
 except:
@@ -195,8 +197,12 @@
     print '</font>
<font color="red">input beta min/max', inbeta[:].min()*sf, inbeta[:].max()*sf
     #beta[timelevout,:] = BilinearInterp(x0, y0, inbeta[timelev,:,:]*sf, xCell, yCell)
     beta[:] = BilinearInterp(x0, y0, inbeta[timelev,:,:]*sf, xCell, yCell)
+    # Make all beta be positive values
+    b = beta[:]
+    b[b&lt;=0.0] = 1.0
+    beta[:] = b
     print 'new beta min/max', beta[:].min(), beta[:].max()
-    del inbeta, beta
+    del inbeta, beta, b
 except:
     print '</font>
<font color="black">problem with beta field (e.g. not found in input file), skipping...</font>
<font color="gray">'
 
@@ -204,7 +210,7 @@
 try: 
     tempstag = infile.variables['tempstag']
     try:
-      sf = temp.scale_factor
+      sf = tempstag.scale_factor
     except:
       sf = 1.0
     if netCDF_module == 'netCDF4':
@@ -219,9 +225,9 @@
       print 'new temperature min/max', temperature[:].min(), temperature[:].max()
     else: 
       raise Exception
-    del temp, temperature
+    del tempstag, temperature
 except:
-    print '</font>
<font color="black">problem with temp field (e.g. not found in input file, differing number of layers), skipping...</font>
<font color="blue">'
+    print '</font>
<font color="black">problem with tempstag field (e.g. not found in input file, differing number of layers), skipping...</font>
<font color="black">'
 
 
 

</font>
</pre>