Skip to content

Commit

Permalink
Timeseries (CICE-Consortium#264)
Browse files Browse the repository at this point in the history
* generalize timeseries.csh

* remove conflict
  • Loading branch information
eclare108213 authored Dec 3, 2018
1 parent 78c129b commit 04441c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
20 changes: 17 additions & 3 deletions configuration/scripts/tests/timeseries.csh
Original file line number Diff line number Diff line change
@@ -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/^\.\///'`
Expand All @@ -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
Expand All @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions doc/source/user_guide/ug_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 04441c3

Please sign in to comment.