Setting up Environment for AGCM Sandbox

From GEOS-5
Revision as of 12:15, 29 November 2012 by Bmauer (talk | contribs) (split script back up)
Jump to navigation Jump to search

Given the large number of directories in the GEOS5 model it can be useful to set up your environment to make navigating your sandbox easier. This page will document one way of doing this through two shell scripts that must be sourced. This is especially useful if you have multiple copies of the GEOS5 model that you might have checked out (a stable release and your development sandbox for example). This assumes you have checked out a copy of the model previously and you are running c shell.


You need two files in your home directory or somewhere else. First is geosmodels. Here you will set the location of any GEOS sandboxes and names for them you will use from the command line to set the proper $ESMADIR variable.

 
#!/bin/csh -f

if ($?ESMADIR) then
   echo "ESMADIR is already set"
   exit
endif

if ($1 == MODEL1_NAME) then
   setenv ESMADIR PATH_TO_MODEL_SANDBOX1/GEOSagcm
else if ($1 == MODEL2_NAME) then
   setenv ESMADIR PATH_TO_MODEL_SANDBOX2/GEOSagcm
else
   echo "invalid tag for model"
   exit
endif

Next is g5env

#!/bin/csh -f

set arch = `uname`

echo ARCH: $arch
# Aliases for GEOS GCM Directories
# --------------------------------
if( $?prompt ) then
echo " "
echo "Creating GEOSGCM aliases ..."
echo "         ESMADIR: $ESMADIR"
set sources =     `find $ESMADIR -name src                     | grep -v $arch`
alias src     "cd $sources[1]"
alias gcm     "cd `find $ESMADIR -name GEOSgcm_GridComp        | grep -v $arch`"
alias iau     "cd `find $ESMADIR -name GEOSmkiau_GridComp      | grep -v $arch`"
alias shared  "cd `find $ESMADIR -name GEOS_Shared             | grep -v $arch`"
alias gfio    "cd `find $ESMADIR -name GMAO_gfio               | grep -v $arch`"
alias cshared "cd `find $ESMADIR -name Chem_Shared             | grep -v $arch`"
alias hermes  "cd `find $ESMADIR -name GMAO_hermes             | grep -v $arch`"
alias base    "cd `find $ESMADIR -name GEOS_Base               | grep -v $arch`"
alias cbase   "cd `find $ESMADIR -name Chem_Base               | grep -v $arch`"
alias util    "cd `find $ESMADIR -name GEOS_Util               | grep -v $arch`"
alias post    "cd `find $ESMADIR -name post                    | grep -v $arch`"
alias plots   "cd `find $ESMADIR -name plots                   | grep -v $arch`"
alias pilgrim "cd `find $ESMADIR -name GMAO_pilgrim            | grep -v $arch`"
alias agcm    "cd `find $ESMADIR -name GEOSagcm_GridComp       | grep -v $arch`"
alias ogcm    "cd `find $ESMADIR -name GEOSogcm_GridComp       | grep -v $arch`"
alias phys    "cd `find $ESMADIR -name GEOSphysics_GridComp    | grep -v $arch`"
alias dyn     "cd `find $ESMADIR -name GEOSsuperdyn_GridComp   | grep -v $arch`"
alias sdyn    "cd `find $ESMADIR -name GEOSsuperdyn_GridComp   | grep -v $arch`"
alias fv      "cd `find $ESMADIR -name FVdycore_GridComp       | grep -v $arch`"
alias fv3     "cd `find $ESMADIR -name FVdycoreCubed_GridComp  | grep -v $arch`"
alias aries   "cd `find $ESMADIR -name ARIESg3_GridComp        | grep -v $arch`"
alias gwd     "cd `find $ESMADIR -name GEOSgwd_GridComp        | grep -v $arch`"
alias surf    "cd `find $ESMADIR -name GEOSsurface_GridComp    | grep -v $arch`"
alias turb    "cd `find $ESMADIR -name GEOSturbulence_GridComp | grep -v $arch`"
alias rad     "cd `find $ESMADIR -name GEOSradiation_GridComp  | grep -v $arch`"
alias satsim  "cd `find $ESMADIR -name GEOSsatsim_GridComp     | grep -v $arch`"
alias solar   "cd `find $ESMADIR -name GEOSsolar_GridComp      | grep -v $arch`"
alias irrad   "cd `find $ESMADIR -name GEOSirrad_GridComp      | grep -v $arch`"
alias moist   "cd `find $ESMADIR -name GEOSmoist_GridComp      | grep -v $arch`"
alias gmi     "cd `find $ESMADIR -name GMIchem_GridComp        | grep -v $arch`"
alias chem    "cd `find $ESMADIR -name GEOSchem_GridComp       | grep -v $arch`"
alias gaas    "cd `find $ESMADIR -name GAAS_GridComp           | grep -v $arch`"
alias pchem   "cd `find $ESMADIR -name GEOSpchem_GridComp      | grep -v $arch`"
alias gocart  "cd `find $ESMADIR -name GOCART_GridComp         | grep -v $arch`"
alias carma   "cd `find $ESMADIR -name CARMAchem_GridComp      | grep -v $arch`"
alias land    "cd `find $ESMADIR -name GEOSland_GridComp       | grep -v $arch`"
alias lake    "cd `find $ESMADIR -name GEOSlake_GridComp       | grep -v $arch`"
alias landice "cd `find $ESMADIR -name GEOSlandice_GridComp    | grep -v $arch`"
alias salt    "cd `find $ESMADIR -name GEOSsaltwater_GridComp  | grep -v $arch`"
alias catch   "cd `find $ESMADIR -name GEOScatch_GridComp      | grep -v $arch`"
alias mapl    "cd `find $ESMADIR -name MAPL_Base               | grep -v $arch`"

alias appl    "cd `find_dir GEOSgcm_App     Application`"
endif

# Set ESMADIR and Module Environment
# ----------------------------------
echo ""
source $ESMADIR/src/g5_modules

setenv         GEOSUTIL $ESMADIR/src/GMAO_Shared/GEOS_Util
setenv GASCRP $GEOSUTIL/plots/grads_util
setenv GAUDFT $GEOSUTIL/plots/grads_util/udft_$arch.tools
setenv GADDIR /discover/nobackup/projects/gmao/share/dao_ops/opengrads/dat/

# Set alias for hdfdump
# ---------------------
if( -e $BASEDIR/$arch/bin/hdfdump ) then
        alias hdfdump '$BASEDIR/$arch/bin/hdfdump'
else
        alias hdfdump '$BASEDIR/$arch/bin/ncdump'
endif

set path = (~/bin/$arch $BASEDIR/$arch/bin $path)
unsetenv LD_LIBRARY_PATH
  setenv LD_LIBRARY_PATH ${LIBRARY_PATH}:${BASEDIR}/${arch}/lib

# Echo Results
# ------------
echo ""
echo " BASEDIR: $BASEDIR"
echo ""
echo " ESMADIR: $ESMADIR"
echo "GEOSUTIL: $GEOSUTIL"
echo ""
module list
echo ""

Set an alias in your login script to run these: alias geostag 'source ~/geosmodels \!:1 ; source ~/g5env'

Now run "geostag MODEL_NAME", where model name is one of the MODEL_NAMES in the geosmodel file. This will set $ESMADIR, source g5_modules in your sandbox and set aliases to the various model directories. To go to $ESMADIR/src/GMAO_Share/MAPL_Base you can now just type MAPL.