![]() ![]() |
![]() |
File: [Development] / JSOC / proj / globalhs / scripts / doinvert
(download)
Revision: 1.1, Sat May 24 15:47:42 2014 UTC (9 years ago) by tplarson Branch: MAIN CVS Tags: Ver_8-6, Ver_8-5 script for performing inversions, runs inv2d.x |
#! /bin/tcsh -f setenv PATH $JSOCROOT/bin/$JSOC_MACHINE':'$JSOCROOT/proj/globalhs/scripts':'$JSOCROOT/proj/globalhs/scripts/pkbgn':'$PATH set pbdir=$JSOCROOT/proj/globalhs/scripts/pkbgn @ i = 1 while ($i <= $#argv ) set $argv[$i] @ i++ end if (! $?starttime) then echo must specify parameter starttime exit 1 endif if (! $?totaltime) then echo must specify parameter totaltime exit 1 endif set totalsecs = `durcon $totaltime` if ($status) then echo incorrect format for parameter totaltime exit 1 endif set timecheck = `echo "$totalsecs % 86400" | bc` if ($timecheck) then echo totaltime must be an integer number of days exit 1 endif set ndays = `echo "$totalsecs / 86400" | bc` if (! $?lmin) set lmin = 0 if (! $?lmax) set lmax = 300 date echo $PWD echo $0 $argv if (! -es inv.parms.blank) then echo parameter file blank missing: inv.parms.blank is required exit 1 endif grep -v '^[[:space:]]*$' inv.parms.blank | grep "^[[:space:]]*##" | awk -F '##' '{print $2}' | sed s@"[[:space:]]"@"\n"@g | grep -v '^[[:space:]]*$' > script.parms set nonomatch set vars = `cat script.parms` @ i = 1 while ($i <= $#vars ) set $vars[$i] @ i++ end # TAG may have been defined in script.parms if ($?TAG) then set tagclause = "TAG=$TAG" else set tagclause = `cat inv.parms.blank | grep '^[[:space:]]*##' | awk -F '##' '{print $2}' | sed s@"[[:space:]]"@"\n"@g | grep ^input= | cut -d= -f2- | sed s@"\["@"\n"@g | sed s@]@"\n"@g | grep TAG` endif set in = `echo $input | sed s/\'//g | sed s/\"//g | cut -d[ -f1` set epoch = `show_info -j $in | grep -i '^keyword:t_start_epoch' | cut -d, -f5` set epochsecs = `time_convert o=jsoc time=$epoch` set tstartstep = `show_info -j $in | grep -i '^keyword:t_start_step' | cut -d, -f5` set cadence = `show_info -j $in | grep -i '^keyword:t_step' | cut -d, -f5` set ndt = `echo "$totalsecs / $cadence" | bc` durcon $starttime >& /dev/null if ($status) then set startsecs = `time_convert o=jsoc time=$starttime` set firstday = `echo "($startsecs - $epochsecs)/86400" | bc` else set startsecs = `durcon $starttime` set firstday = `echo "$startsecs / 86400" | bc` set startsecs = `echo "$startsecs + $epochsecs" | bc` endif set in = `echo $input | sed s/\'//g | sed s/\"//g | sed s/XXXX/$starttime/g | sed s/NNNN/$lmin/g | sed s/MMMM/$lmax/g | sed s/TTTT/$ndt/g` set versionin = `show_info -q "$in" key=version` # VERSION may have been (re)defined in script.parms if ($?VERSION) then set verclause = "VERSION=$VERSION" else if ($versionin != InvalidKeyname) then set verclause = "VERSION=$versionin" else set verclause = "" endif set quality = `show_info -q "$in" key=quality` set calver = `show_info -q "$in" key=calver64` if ($calver == InvalidKeyname) set calver=0 set efuncfile = `show_info -q "$efuncs" -AP` cat $pbdir/efunc.in.blank | sed s@FFFF@$efuncfile@g > efunc.in cat inv.parms.blank | sed s/XXXX/$firstday/g > inv2d.in inv2d.x < inv2d.in > inv2d.out if ($?) then echo failure of inv2d.x, nonzero return status exit 1 endif if (! -es splittings.out || ! -es rot.2d) then echo error in output, one of splittings.out or rot.2d file either does not exist or is empty exit 1 endif echo inversion done, rotation profiles made # invseries should be defined in script.parms above set tstart = `time_convert s=$startsecs zone=TAI` set stopsecs = `echo "$startsecs + $totalsecs" | bc` set tstop = `time_convert s=$stopsecs zone=TAI` set midsecs = `echo "$startsecs + ($totalsecs / 2)" | bc` set tobs = `time_convert s=$midsecs zone=TAI` set now = `date -u +%Y.%m.%d_%T` set_info -c ds=$invseries $tagclause $verclause NDT=$ndt LMIN=$lmin LMAX=$lmax T_START=$tstart T_STOP=$tstop T_OBS=$tobs QUALITY=$quality CALVER64=$calver DATE=$now split=splittings.out rot=rot.2d err=err.2d mesh=rmesh.orig if ($?) then echo failure to ingest inversion results for starttime = $starttime, totaltime = $totaltime exit 1 endif rm script.parms echo successful completion exit 0
Karen Tian |
Powered by ViewCVS 0.9.4 |