Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update timeseries plots to resolve issue with some fields #539

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions configuration/scripts/timeseries.csh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ endif
set basename = `echo $1 | sed -e 's#/$##' | sed -e 's/^\.\///'`

# Set x-axis limits
# Manuallyl set x-axis limits
# Manually set x-axis limits
#set xrange = 'set xrange ["19980101":"19981231"]'
# Let gnuplot determine x-alis limits
# Let gnuplot determine x-axis limits
set xrange = ''

# Determine if BASELINE dataset exists
Expand Down Expand Up @@ -59,8 +59,10 @@ endif

# Loop through each field and create the plot
foreach field ($fieldlist:q)
# Add backslashes before (, ), and ^ for grep searches
set search_name = "`echo '$field' | sed 's/(/\\(/' | sed 's/)/\\)/' | sed 's/\^/\\^/'`"
set fieldname = `echo "$field" | sed -e 's/([^()]*)//g'`
set search = "'$fieldname'\|istep1"
set search = "'$search_name'\|istep1"
rm -f data.txt
foreach line ("`egrep $search $logfile`")
if ("$line" =~ *"istep1"*) then
Expand Down
7 changes: 4 additions & 3 deletions configuration/scripts/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_data(logfile,field):
# Build the regular expression to extract the data
field_regex = field.replace('(','\(').replace('^','\^').replace(')','\)')
number_regex = '[-+]?\d+\.?\d+([eE][-+]?\d+)?'
my_regex = '{}\s+=\s+({})\s+({})'.format(field_regex,number_regex,number_regex)
my_regex = '^{}\s+=\s+({})\s+({})'.format(field_regex,number_regex,number_regex)

dtg = []
arctic = []
Expand Down Expand Up @@ -95,9 +95,10 @@ def plot_timeseries(log, field, dtg, arctic, antarctic, expon, dtg_base=None, ar
Plot the timeseries data from the CICE log file
'''

casename = os.path.abspath(log).rstrip('/').rstrip('/logs').split('/')[-1]
import re
casename = re.sub(r"/logs", "", os.path.abspath(log).rstrip('/')).split('/')[-1]
if base_dir:
base_casename = os.path.abspath(base_dir).rstrip('/').rstrip('/logs').split('/')[-1]
base_casename = re.sub(r"/logs", "", os.path.abspath(base_dir).rstrip('/')).split('/')[-1]

# Load the plotting libraries, but set the logging level for matplotlib
# to WARNING so that matplotlib debugging info is not printed when running
Expand Down