From 193cad6db42d102fbcb38169887fafdd40bd8b93 Mon Sep 17 00:00:00 2001 From: Joe Stassi Date: Fri, 23 Jul 2021 09:32:16 -0400 Subject: [PATCH 1/2] Updates for integrating RADMON processing into the ADAS --- src/Applications/GEOSdas_App/GEOSdas.csm | 1 + src/Applications/GEOSdas_App/fvsetup | 62 +++++++++++--- src/Applications/GEOSdas_App/gen_silo_arc.pl | 2 +- .../GEOSdas_App/monthly.yyyymm.pl.tmpl | 81 ++++++++++++++++--- src/Applications/GEOSdas_App/monthly_setup.pl | 4 + .../GEOSdas_App/write_FVDAS_Run_Config.pl | 6 +- 6 files changed, 129 insertions(+), 27 deletions(-) diff --git a/src/Applications/GEOSdas_App/GEOSdas.csm b/src/Applications/GEOSdas_App/GEOSdas.csm index 54f71fbd..f2bdd02e 100755 --- a/src/Applications/GEOSdas_App/GEOSdas.csm +++ b/src/Applications/GEOSdas_App/GEOSdas.csm @@ -140,6 +140,7 @@ if ( !($?LOCAL_ACQUIRE) ) setenv LOCAL_ACQUIRE 0 if ( !($?MAP05RST) ) setenv MAP05RST 0 if ( !($?MKRESRST ) ) setenv MKRESRST 0 + if ( !($?MONTHLY_RADMON) ) setenv MONTHLY_RADMON 0 if ( !($?MPIRUN_IDF) ) setenv MPIRUN_IDF 0 if ( !($?MPIRUN_UPRST) ) setenv MPIRUN_UPRST /dev/null if ( !($?NEWRADBC) ) setenv NEWRADBC 0 diff --git a/src/Applications/GEOSdas_App/fvsetup b/src/Applications/GEOSdas_App/fvsetup index adaf5a68..f94f1131 100755 --- a/src/Applications/GEOSdas_App/fvsetup +++ b/src/Applications/GEOSdas_App/fvsetup @@ -514,6 +514,7 @@ $ENV{"PATH"} = $FindBin::Bin .":$ENV{PATH}"; if ($DAO == 0) { while3 ( \&get_mhost ) } while3 ( \&get_output ); while3 ( \&get_history ); + while3 ( \&get_pyradmon ); while3 ( \&get_rstype ); while3 ( \&get_GID ); @@ -4556,6 +4557,29 @@ sub get_GID { return 0; } +#======================================================================= +sub get_pyradmon { + + #=========================================================# + # FOR NOW, TAKE DEFAULT RATHER THAN QUERYING FOR LOCATION # + #=========================================================# + $pyradmon = "/discover/nobackup/jstassi/GEOSadas/pyradmon"; + return; + #=========================================================# + + print "\n------------------------\n" + . "Pyradmon Source Location\n" + . "------------------------\n"; + + $pyradmon_dflt = "/discover/nobackup/jstassi/GEOSadas/pyradmon"; + $pyradmon = query("\n Pyradmon code location?", $pyradmon_dflt); + if (-d $pyradmon) { + $ENV{"PYRADMON"} = $pyradmon; + return; + } + return 1; +} + #======================================================================= sub get_dimsg5gcm { @@ -5184,9 +5208,11 @@ sub secs2hhmmss { sub mkdir_fvhome { # create directories on FVHOME print "\nSetting up FVHOME directory for $expid experiment ...\n"; - foreach $dir (qw(ana diag daotovs etc obs prog rs run recycle fcst asens anasa)) { - mkpath("$fvhome/$dir") - or die ">>> ERROR <<< creating directory $fvhome/$dir;"; + foreach $dir (qw(ana diag daotovs etc obs prog radmon)) { + mkpath("$fvhome/$dir") or die ">>> ERROR <<< creating directory $fvhome/$dir;"; + } + foreach $dir (qw(rs run recycle fcst asens anasa)) { + mkpath("$fvhome/$dir") or die ">>> ERROR <<< creating directory $fvhome/$dir;"; } foreach $subdir (qw( gaas gocart )) { mkpath("$fvhome/run/$subdir") @@ -7313,9 +7339,10 @@ if ((\$arch_type == "ADAS") && (\$\?yyyymm) && (\$\?dd)) then # defaults #--------- - if (! \$\?MONTHLY_MEANS ) set MONTHLY_MEANS = 1 - if (! \$\?MONTHLY_TAR ) set MONTHLY_TAR = 1 - if (! \$\?MONTHLY_PLOTS ) set MONTHLY_PLOTS = 0 + if (! \$\?MONTHLY_MEANS ) set MONTHLY_MEANS = 1 + if (! \$\?MONTHLY_TAR ) set MONTHLY_TAR = 1 + if (! \$\?MONTHLY_PLOTS ) set MONTHLY_PLOTS = 0 + if (! \$\?MONTHLY_RADMON ) set MONTHLY_RADMON = 0 # create job script for monthly post processing #---------------------------------------------- @@ -7335,14 +7362,12 @@ if ((\$arch_type == "ADAS") && (\$\?yyyymm) && (\$\?dd)) then # execute job script for monthly means processing #------------------------------------------------ set flags = "" - if (\$MONTHLY_MEANS) set flags = "\$flags -means" - if (\$MONTHLY_TAR) set flags = "\$flags -tar" - if (\$MONTHLY_PLOTS) set flags = "\$flags -plots" - - if (\$MONTHLY_MEANS || \$MONTHLY_TAR || \$MONTHLY_PLOTS) then - \$monthlyPost \$flags - endif + if (\$MONTHLY_MEANS) set flags = "\$flags -means" + if (\$MONTHLY_TAR) set flags = "\$flags -tar" + if (\$MONTHLY_PLOTS) set flags = "\$flags -plots" + if (\$MONTHLY_RADMON) set flags = "\$flags -radmon \$MONTHLY_RADMON" + if (\$flags != "") \$monthlyPost \$flags endif endif endif @@ -7631,6 +7656,7 @@ print SCRIPT <<"EOF"; setenv MONTHLY_MEANS $monthly_means # 1 = submit monthly means at end of month; 0 = don't setenv MONTHLY_TAR $monthly_tar # 1 = submit monthly tar job at end of month; 0 = don't setenv MONTHLY_PLOTS $monthly_plots # 1 = submit monthly plots job at end of month; 0 = don't + setenv MONTHLY_RADMON 0 # 1 = submit monthly radmon job; 2 = 2 jobs/month; 3 = 3 jobs/month; 0 = don't setenv NCSUFFIX $ncsuffix setenv STAGE4FSENS /dev/null setenv GAAS_ANA $gaas_ana # 1 = aerosol analysis, 0 = disables it @@ -8412,6 +8438,10 @@ EOF set vars = "\$vars,MONTHLY_PLOTS=\$MONTHLY_PLOTS" endif + if (\$\?MONTHLY_RADMON) then + set vars = "\$vars,MONTHLY_RADMON=\$MONTHLY_RADMON" + endif + # submit archive job # ------------------ if ( \$BATCH_SUBCMD == "sbatch" ) then @@ -9965,6 +9995,12 @@ sub copy_resources { $fname = "fvsavecf"; # config saving script $rc = system("/bin/cp $fvbin/$fname $fvhome/run/$fname"); die "Cannot write file $fvhome/run/$fname: $!" if ( $rc ); + + # Copy radmon.defaults.rc file to FVHOME/radmon + #---------------------------------------------- + if (-e "$pyradmon/scripts/radmon.defaults.rc") { + cp("$pyradmon/scripts/radmon.defaults.rc", "$fvhome/radmon"); + } } #======================================================================= diff --git a/src/Applications/GEOSdas_App/gen_silo_arc.pl b/src/Applications/GEOSdas_App/gen_silo_arc.pl index 9607767f..63d87329 100755 --- a/src/Applications/GEOSdas_App/gen_silo_arc.pl +++ b/src/Applications/GEOSdas_App/gen_silo_arc.pl @@ -86,7 +86,7 @@ sub init { # check for needed executables and rc #------------------------------------ $edhist_pl = "$fvroot/bin/edhist.pl"; - $echorc_x = "$fvroot/bin/echorc.x"; + $echorc_x = "$fvroot/bin/echorc.pl"; $gsidiags_rc = "$fvroot/etc/gsidiags.rc"; die "Error. Cannot find $edhist_pl;" unless -x $edhist_pl; diff --git a/src/Applications/GEOSdas_App/monthly.yyyymm.pl.tmpl b/src/Applications/GEOSdas_App/monthly.yyyymm.pl.tmpl index 1792ac4d..c3dba664 100644 --- a/src/Applications/GEOSdas_App/monthly.yyyymm.pl.tmpl +++ b/src/Applications/GEOSdas_App/monthly.yyyymm.pl.tmpl @@ -6,6 +6,7 @@ # > compute monthly means # > tar and clean monthly means inputs # > create monthly plots +# > run monthly radmon plots # Notes: # 1. To use this script, # - copy to experiment run directory @@ -53,12 +54,12 @@ use WriteLog qw(chdir_ mkpath_ unlink_ system_); # global variables #----------------- -my ($meansFLG, $plotsFLG, $tarFLG, $finish, $nopush, %doMeans); -my ($EXPID, $FVHOME, $PBS_BIN, $account, $listdir, $mnthlyRC); +my ($meansFLG, $plotsFLG, $radmonFLG, $tarFLG, $finish, $nopush, %doMeans); +my ($EXPID, $FVHOME, $PBS_BIN, $PYRADMON, $account, $listdir, $mnthlyRC); my ($numnodes_mm, $numnodes_mp, $plotHISTrc, $qcmd, $rundir); my ($script, $siteID, $workdir, $yyyymm, %newrc, %JOBID); my ($walltime_cl, $walltime_mm, $walltime_mp, $walltime_pf); -my ($partition, $qos); +my ($partition, $qos, $runlocal); #$partition = "preops"; #$qos = "dastest"; @@ -88,6 +89,7 @@ my %valid = ( "fetch" => 1, archive_monthly_keep_files(); } monthly_plots() if $plotsFLG; + radmon() if $radmonFLG; } #======================================================================= @@ -111,10 +113,14 @@ sub init { #----------------------- GetOptions( "means" => \$meansFLG, "tar" => \$tarFLG, + "plots" => \$plotsFLG, "finish_plots" => \$finish, "nopush" => \$nopush, + "radmon:i" => \$radmonFLG, + "runlocal" => \$runlocal, + "partition=s" => \$partition, "qos=s" => \$qos, @@ -125,6 +131,10 @@ sub init { "h|help" => \$help ); usage() if $help; + if (defined($radmonFLG)) { + $radmonFLG = 1 if $radmonFLG < 1 or $radmonFLG > 3; + } + # flags indicating whether to create new resource files #------------------------------------------------------ if ($#newrc == 0 and $newrc[0] eq "") { $newrc[0] = "1,2" } @@ -134,7 +144,8 @@ sub init { next unless m/^1$/ or m/^2$/; $newrc{$_} = 1; } - usage() unless $meansFLG or $tarFLG or $plotsFLG or $finish or %newrc; + usage() unless $meansFLG or $tarFLG or $plotsFLG or $finish + or $radmonFLG or %newrc; # process options #---------------- @@ -153,10 +164,11 @@ sub init { $opts{"debug"} = $debug if $debug; perl_config(%opts); - $EXPID = $ENV{"EXPID"}; - $FVHOME = $ENV{"FVHOME"}; - $PBS_BIN = $ENV{"PBS_BIN"}; - $GID = $ENV{"GID"}; + $EXPID = $ENV{"EXPID"}; + $FVHOME = $ENV{"FVHOME"}; + $PBS_BIN = $ENV{"PBS_BIN"}; + $PYRADMON = $ENV{"PYRADMON"}; + $GID = $ENV{"GID"}; $ENV{"PATH"} = "$rundir:$fvroot/bin:$ENV{PATH}"; @@ -870,6 +882,43 @@ sub finish_monthly_plots { } } +#======================================================================= +# name - radmon +# purpose - run pyradmon code +#======================================================================= +sub radmon { + my ($qFLG, $flags, $pyflags, $radmonRC); + + $qFLG = ""; + $qFLG = "-qjobs" unless $runlocal; + $flags = "-expid $EXPID -fvhome $FVHOME -np $qFLG"; + + $radmonRC = "$FVHOME/radmon/radmon.defaults.rc"; + $radmonRC = "" unless -e $radmonRC; + + if ($radmonFLG == 1) { + $pyflags = $flags ." -startdate ${yyyymm}01"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + } + elsif ($radmonFLG == 2) { + $pyflags = $flags ." -startdate ${yyyymm}01 -enddate ${yyyymm}15"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + + $pyflags = $flags ." -startdate ${yyyymm}16"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + } + elsif ($radmonFLG == 3) { + $pyflags = $flags ." -startdate ${yyyymm}01 -enddate ${yyyymm}10"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + + $pyflags = $flags ." -startdate ${yyyymm}11 -enddate ${yyyymm}20"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + + $pyflags = $flags ." -startdate ${yyyymm}21"; + system("$PYRADMON/scripts/pyradmon_driver.pl $radmonRC $pyflags"); + } +} + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # UTILITY subroutines #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1043,11 +1092,21 @@ usage: $script [process options] [plot option] [other options] process options (see Notes below) -means calculate monthly means -tar tar input files + -plots produce monthly plots from monthly means -finish_plots finish monthly plots job which stopped before completion - -plot option (only valid when used with -plots or -finish_plots) - -nopush do not transfer gif files to Web server after plotting + -nopush do not transfer gif files to Web server after plotting; + only valid when used with -plots or -finish_plots flag + + -radmon [val] produce radmon plots (see -qjobs option) + if val == 1 ... produce plots for entire month + if val == 2 ... split month into 2 sets + if val == 3 ... split month into 3 sets + if no val is given, then set val to 1 + -runlocal run radmon jobs locally if archive is visible; otherwise, + jobs will automatically be sent to slurm queue; they will + be sent there regardless if archive is not visible; + only valid when used with -radmon flag slurm directive options -partition partition send monthly means jobs to specified partition diff --git a/src/Applications/GEOSdas_App/monthly_setup.pl b/src/Applications/GEOSdas_App/monthly_setup.pl index 647546c7..b5b6eb10 100755 --- a/src/Applications/GEOSdas_App/monthly_setup.pl +++ b/src/Applications/GEOSdas_App/monthly_setup.pl @@ -180,6 +180,10 @@ sub write_plotfiles { $values{"\@GEOSBIN"} = "$FVROOT/bin"; $values{"\@GEOSSRC"} = $ENV{"GEOSUTIL"}; + $values{"\@BATCH_TIME"} = "SBATCH --time="; + $values{"\@BATCH_JOBNAME"} = "SBATCH --jobname="; + $values{"\@BATCH_OUTPUTNAMEOUTPUT"} = "SBATCH --output=OUTPUT"; + replaceLabels($infile, $outfil, \%values,\@setenvs); # write gcm_moveplot.j; copy gcm_quickplot.csh diff --git a/src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl b/src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl index 5951cc18..0ebb4315 100755 --- a/src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl +++ b/src/Applications/GEOSdas_App/write_FVDAS_Run_Config.pl @@ -15,8 +15,8 @@ my ($FVHOME, $FVROOT, $RUNDIR); my ($AOD_OBSCLASS, $BERROR, $DO_ECS_OUT, $DO_REM_SYNC, $EXPID, $FVARCH, $FVBCS, $GID, $MONTHLY_MEANS, $MP_SET_NUMTHREADS, $NCEPINPUT, $NOBACKUP, - $OBSCLASS, $OBSCLASS_NOAIRS, $OMP_NUM_THREADS, $RUN_QUADS, $VTRACK, - $VTXLEVS, $VTXRELOC); + $OBSCLASS, $OBSCLASS_NOAIRS, $OMP_NUM_THREADS, $RUN_QUADS, $PYRADMON, + $VTRACK, $VTXLEVS, $VTXRELOC); my ($BASEDIR, $FCSTID, $FVDMGET, $G5MODULES, $PLOTS_LOC, $GEOSUTIL, $GTAG); my ($qalter, $PBS_BIN, $DISCOVERSHARE); my ($FVSHARE, $SHARE, $REM_GRADS_CONFIG, $G5MGRAM, $LATS4DLOC, $FVBIN, @@ -97,6 +97,7 @@ sub init { $OBSCLASS = $ENV{"OBSCLASS"}; $OBSCLASS_NOAIRS = $ENV{"OBSCLASS_NOAIRS"}; $OMP_NUM_THREADS = $ENV{"OMP_NUM_THREADS"}; + $PYRADMON = $ENV{"PYRADMON"}; $RUN_QUADS = $ENV{"RUN_QUADS"}; $VTRACK = $ENV{"VTRACK"}; $VTXLEVS = $ENV{"VTXLEVS"}; @@ -278,6 +279,7 @@ sub writefile { print RUNCONF "setenv FVARCH $FVARCH\n" if $FVARCH; print RUNCONF "setenv FVSPOOL $FVSPOOL\n" if $FVSPOOL; print RUNCONF "setenv BASEDIR $BASEDIR\n" if $BASEDIR; + print RUNCONF "setenv PYRADMON $PYRADMON\n" if $PYRADMON; print RUNCONF "#------------------------------\n"; print RUNCONF "setenv G5MODULES \"$G5MODULES\"\n" if $G5MODULES; print RUNCONF "source \$FVROOT/bin/g5_modules\n"; From 61a011c510c5fda7c13735d704d95c50fa539b30 Mon Sep 17 00:00:00 2001 From: Joe Stassi Date: Mon, 26 Jul 2021 11:39:39 -0400 Subject: [PATCH 2/2] Correct prompts in input file --- src/Applications/GEOSdas_App/testsuites/C48f.input | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Applications/GEOSdas_App/testsuites/C48f.input b/src/Applications/GEOSdas_App/testsuites/C48f.input index 2cbc6376..fbc4a60a 100644 --- a/src/Applications/GEOSdas_App/testsuites/C48f.input +++ b/src/Applications/GEOSdas_App/testsuites/C48f.input @@ -221,6 +221,9 @@ Output Restart TYPE (bin or nc4) [nc4] Select group: [g0613] > +Continue without missing resource files? [y] +> + Edit COLLECTIONS list in run/HISTORY.rc.tmpl (y/n)? [n] > y