From 04441c3661027e224a2b0935259e89f552d2df76 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunke Date: Mon, 3 Dec 2018 12:35:40 -0700 Subject: [PATCH] Timeseries (#264) * generalize timeseries.csh * remove conflict --- configuration/scripts/tests/timeseries.csh | 20 +++++++++++++++++--- doc/source/user_guide/ug_testing.rst | 7 ++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/configuration/scripts/tests/timeseries.csh b/configuration/scripts/tests/timeseries.csh index f0a75e2e5..0dd4f7bc2 100755 --- a/configuration/scripts/tests/timeseries.csh +++ b/configuration/scripts/tests/timeseries.csh @@ -1,10 +1,13 @@ #!/bin/csh # Check to see if test case directory was passed -if ( $1 == "" ) then - echo "To generate timeseries plots, this script must be passed a directory." - echo "It will pull the diagnostic data from the most recently modified log file." +if ( $1 == "-h" ) then + echo "To generate timeseries plots, this script can be passed a directory" + echo "containing a logs/ subdirectory, or it can be run in the directory with" + echo "the log files, without being passed a directory." echo "Example: ./timeseries.csh ./annual_gx3_conrad_4x1.t00" + echo "Example: ./timeseries.csh" + echo "It will pull the diagnostic data from the most recently modified log file." exit -1 endif set basename = `echo $1 | sed -e 's#/$##' | sed -e 's/^\.\///'` @@ -16,8 +19,13 @@ set basename = `echo $1 | sed -e 's#/$##' | sed -e 's/^\.\///'` set xrange = '' # Determine if BASELINE dataset exists +if ( $1 == "" ) then +set basefile_dir = "IGNORE" +else source $1/cice.settings set basefile_dir = "$ICE_BASELINE/$ICE_BASECOM/$ICE_TESTNAME" +endif + if ( -d $basefile_dir ) then set num_basefile = `ls $basefile_dir | grep cice.runlog | wc -l` if ( $num_basefile > 0 ) then @@ -39,9 +47,15 @@ set fieldlist=("total ice area (km^2)" \ "rms ice speed (m/s)" ) # Get the filename for the latest log +if ( $1 == "" ) then +foreach file (./cice.runlog.*) + set logfile = $file +end +else foreach file ($1/logs/cice.runlog.*) set logfile = $file end +endif # Loop through each field and create the plot foreach field ($fieldlist:q) diff --git a/doc/source/user_guide/ug_testing.rst b/doc/source/user_guide/ug_testing.rst index 84308c2c2..aa6804701 100644 --- a/doc/source/user_guide/ug_testing.rst +++ b/doc/source/user_guide/ug_testing.rst @@ -913,9 +913,10 @@ figures from a diagnostic output file. When running a test suite, the ``timeseries.csh`` script is automatically copied to the suite directory. If the ``timeseries.csh`` script is to be used on a test or case that is not a part of a test suite, users will need to run the ``timeseries.csh`` script from the tests directory -(``./configuration/scripts/tests/timeseries.csh ./path/``), or copy it to a local directory and run it -locally. Because the script is designed for use in our test suites, it needs to be run in the directory -above the particular case being plotted. +(``./configuration/scripts/tests/timeseries.csh ./path/``), or copy it to a local directory. +When used with the test suites or given a path, it needs to be run in the directory +above the particular case being plotted, but it can also be run on isolated log files in the same directory, +without a path. For example: