<p><b>mhoffman@lanl.gov</b> 2012-05-07 10:54:18 -0600 (Mon, 07 May 2012)</p><p>BRANCH COMMIT<br>
Updating the CISM-to-MPAS grid script to support scaling factors used in CISM grids.<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-07 16:43:03 UTC (rev 1867)
+++ branches/land_ice_projects/grid_tools/copy_CISM_grid_to_MPAS_grid.py        2012-05-07 16:54:18 UTC (rev 1868)
@@ -122,9 +122,13 @@
try:
thk = infile.variables['thk']
+ try:
+ sf = thk.scale_factor
+ except:
+ sf = 1.0
thickness = outfile.variables['thickness']
- print '</font>
<font color="red">thk min/max', thk[:].min(), thk[:].max()
- thickness[timelevout,:] = BilinearInterp(x1, y1, thk[timelev,:,:], xCell, yCell)
+ print '</font>
<font color="gray">thk min/max', thk[:].min()*sf, thk[:].max()*sf
+ thickness[timelevout,:] = BilinearInterp(x1, y1, thk[timelev,:,:] * sf, xCell, yCell)
print 'new thickness min/max', thickness[:].min(), thickness[:].max()
del thk, thickness
except:
@@ -133,9 +137,13 @@
try:
topg = infile.variables['topg']
+ try:
+ sf = topg.scale_factor
+ except:
+ sf = 1.0
bedTopography = outfile.variables['bedTopography']
- print '</font>
<font color="red">topg min/max', topg[:].min(), topg[:].max()
- bedTopography[timelevout,:] = BilinearInterp(x1, y1, topg[timelev,:,:], xCell, yCell)
+ print '</font>
<font color="gray">topg min/max', topg[:].min()*sf, topg[:].max()*sf
+ bedTopography[timelevout,:] = BilinearInterp(x1, y1, topg[timelev,:,:]*sf, xCell, yCell)
print 'new bedTopography min/max', bedTopography[:].min(), bedTopography[timelevout,:].max()
del topg, bedTopography
except:
@@ -144,9 +152,13 @@
try:
inbeta = infile.variables['beta']
+ try:
+ sf = inbeta.scale_factor
+ except:
+ sf = 1.0
beta = outfile.variables['beta']
- print '</font>
<font color="red">input beta min/max', inbeta[:].min(), inbeta[:].max()
- beta[timelevout,:] = BilinearInterp(x0, y0, inbeta[timelev,:,:], xCell, yCell)
+ print '</font>
<font color="gray">input beta min/max', inbeta[:].min()*sf, inbeta[:].max()*sf
+ beta[timelevout,:] = BilinearInterp(x0, y0, inbeta[timelev,:,:]*sf, xCell, yCell)
print 'new beta min/max', beta[:].min(), beta[:].max()
del inbeta, beta
except:
@@ -155,13 +167,17 @@
try:
temp = infile.variables['temp']
+ try:
+ sf = temp.scale_factor
+ except:
+ sf = 1.0
temperature = outfile.variables['temperature']
- print '</font>
<font color="blue">input temp min/max', temp[:].min(), temp[:].max()
+ print '</font>
<font color="red">input temp min/max', temp[:].min()*sf, temp[:].max()*sf
if level == nVertLevels + 2: # CISM includes the upper and lower boundaries as levels, MPAS does not.
#print range(1,level-1)
for i in range(1,level-1):
print 'Copying level ', i+1, ' of ', level , 'CISM levels (ignoring CISM b.c. temp levels)'
- temperature[timelevout,:,i-1] = BilinearInterp(x1, y1, temp[timelev,i,:,:], xCell, yCell)
+ temperature[timelevout,:,i-1] = BilinearInterp(x1, y1, temp[timelev,i,:,:]*sf, xCell, yCell)
print 'new temperature min/max', temperature[:].min(), temperature[:].max()
else:
raise Exception
</font>
</pre>