#!/bin/bash if test $1 = '-h'; then echo "****************************" echo "*** Shell script to make ***" echo "*** an aqua-planet ***" echo "****************************" echo "make_aquaplanet.bash [geofile](domain file to transform)" else rootsh=`pwd` export PATH=/u/lflmd/bin/gcc_Python-2.7.5/bin:${PATH} geofile=$1 ofile='zero_dom.nc' rm ${ofile} > /dev/null zerovars='LANDMASK:HGT_M:HGT_U:HGT_V:SLPX:SLPY:CON:VAR:OA1:OA2:OA3:OA4:OL1:OL2:OL3:OL4:' keepvars='XLAT_M:XLONG_M:XLAT_U:XLONG_U:XLAT_V:XLONG_V:CLAT:CLONG:MAPFAC_M:MAPFAC_V:MAPFAC_U:MAPFAC_MX:MAPFAC_VX:MAPFAC_UX:MAPFAC_MY:MAPFAC_VY:MAPFAC_UY:E:F:SINALPHA:COSALPHA' specificvars='LANDUSEF|1:LU_INDEX|1:SOILTEMP|0:SOILCTOP|0:SCT_DOM|14:SOILCBOT|0:SCB_DOM|14:ALBEDO12M|8:GREENFRAC|0:SNOALB|0:SLOPECAT|0' cp ${geofile} ${ofile} # zerovars ## ivar=1 echo "zeroing..." zerov=`echo ${zerovars} | tr ':' ' '` for var in ${zerov}; do echo " "${var}"..." python ${HOME}/climatescripts/python/nc_var.py -f ${ofile} -v ${var} -o valmod -S mulc,0. ivar=`expr ${ivar} + 1` ## exit done # end of zeroingvars # giving values ## echo "giving values..." givv=`echo ${specificvars} | tr ':' ' '` for var in ${givv}; do varn=`echo ${var} | tr '|' ' ' | awk '{print $1}'` varv=`echo ${var} | tr '|' ' ' | awk '{print $2}'` echo " "${varn}"..." python ${HOME}/climatescripts/python/nc_var.py -f ${ofile} -v ${varn} -o valmod -S mulc,0. python ${HOME}/climatescripts/python/nc_var.py -f ${ofile} -v ${varn} -o valmod -S sumc,${varv} ivar=`expr ${ivar} + 1` ## exit done # end of zeroingvars fi