Recipe: pbs script
Jump to navigation
Jump to search
#!/bin/csh -f
#SBATCH --job-name=12km_CS_to_LatLon
#SBATCH --time=12:00:00
#SBATCH --nodes=1
#SBATCH --tasks-per-node=28
#SBATCH --partition=geosgms
# Get the working directory
set workDir = `pwd`
set numProcs = 1
if ($?PBS_NODEFILE) set numProcs = 28
echo $numProcs
set hostName = `hostname`
echo $hostName
# Choose which plot routine to use
# cube_to_latlon -> general for any variable
# winds_cube_to_latlong -> specific to compute wind speed at 10m
#
#set PLOT = "cube_to_latlon"
set PLOT = "winds_cube_to_latlon"
echo $PLOT
# Set the variable:
# TBISCCP -> IR
# T2M -> Temperature at 2m
# PRECTOT -> Total precipitation
# DBZ_MAX -> Simulated radar
# U10M -> Eastward wind at 10m
# V10M -> Westward wind at 10m
# winds -> windspeed at 10m; only use with winds_cube_to_latlon
set myvar = "winds"
set varname = $myvar
echo $myvar
# Set the data directory; could find a way of getting the latest directory
#set dataDir = "/discover/nobackup/projects/gmao/osse2/Ops6KM_R/forecast2-11218526-e20160929_21z"
set dataDir = "/discover/nobackup/projects/gmao/osse2/Ops12KM_R/forecasts_1M/20161004_00z"
# Sort by the most recent forecast dates
cd $dataDir
set files = `ls -d G5GMAO.inst1_2d_asm_Mx* | sed 's/-/ /g' | sort -r -k 3`
foreach file ($files)
echo $file
end
cd $workDir
# Use this as a counter for the number of running processes
@ n = 0
foreach file ($files)
set fullFileName = "$dataDir/$file"
echo $fullFileName
set outputFileName = "$varname.latlon.$file"
echo $outputFileName
echo idl -e "${PLOT}, '$fullFileName', '$outputFileName', '$myvar', '$varname'"
if ($numProcs == 1) then
echo "Single file"
idl -e "${PLOT}, '$fullFileName', '$outputFileName', '$myvar', '$varname'"
else
echo $n
idl -e "${PLOT}, '$fullFileName', '$outputFileName', '$myvar', '$varname'" >& /dev/null &
endif
@ n++
if ($n == $numProcs) then
wait
@ n = 0
endif
if ($numProcs == 1) then
wait
exit
endif
end