diff --git a/machines/casper/config_machines.xml b/machines/casper/config_machines.xml
index afd46f0..799b9f3 100644
--- a/machines/casper/config_machines.xml
+++ b/machines/casper/config_machines.xml
@@ -3,7 +3,7 @@
LINUX
nvhpc,intel
openmpi
- /glade/scratch/$USER
+ /glade/derecho/scratch/$USER
$ENV{CESMDATAROOT}/inputdata
/glade/p/cgd/tss/CTSM_datm_forcing_data
$CIME_OUTPUT_ROOT/archive/$CASE
@@ -108,7 +108,7 @@
/glade/u/apps/dav/modulefiles/default/compilers:/glade/u/apps/dav/modulefiles/default/idep
256M
- /glade/scratch/$USER
+ /glade/derecho/scratch/$USER
/glade/p/cesmdata/cseg
$ENV{NETCDF}
diff --git a/machines/config_workflow.xml b/machines/config_workflow.xml
index fe10bbd..7f6f2fc 100644
--- a/machines/config_workflow.xml
+++ b/machines/config_workflow.xml
@@ -68,6 +68,20 @@
+
+
+ template.cupid
+ false
+ case.st_archive
+ 1
+
+ 1
+ 1
+ 0:20:00
+
+
+
+
diff --git a/machines/derecho/config_machines.xml b/machines/derecho/config_machines.xml
index 7bda638..fa02f15 100644
--- a/machines/derecho/config_machines.xml
+++ b/machines/derecho/config_machines.xml
@@ -38,6 +38,8 @@
cesmdev/1.0
ncarenv/23.09
+ conda/latest
+ nco
craype
diff --git a/machines/template.cupid b/machines/template.cupid
new file mode 100755
index 0000000..8b1b94e
--- /dev/null
+++ b/machines/template.cupid
@@ -0,0 +1,47 @@
+#!/bin/bash -e
+
+# Batch system directives
+{{ batchdirectives }}
+
+# Set environment for CESM
+source .env_mach_specific.sh
+
+# Use cupid-infrastructure environment for running these scripts
+# Note: on derecho, the cesmdev module creates a python conflict
+# by setting $PYTHONPATH; since this is conda-based we
+# want an empty PYTHONPATH environment variable
+MACH=`./xmlquery --value MACH`
+unset PYTHONPATH
+conda activate cupid-infrastructure
+
+# Set variables that should eventually come from environment file
+CUPID_EXAMPLE=key_metrics
+RUN_CUPID_ANALYSIS=TRUE
+RUN_CUPID_TIMESERIES=TRUE
+
+if [ "${RUN_CUPID_ANALYSIS}" == "TRUE" ]; then
+ # 1. Generate CUPiD config file
+ {{ srcroot }}/tools/CUPiD/helper_scripts/generate_cupid_config_for_cesm_case.py \
+ --cesm-root {{ SRCROOT }}
+
+ # 2. Generate ADF config file
+ {{ srcroot }}/tools/CUPiD/helper_scripts/generate_adf_config_file.py \
+ --cesm-root {{ SRCROOT }} \
+ --cupid-config-loc ${PWD} \
+ --adf-template {{ SRCROOT }}/tools/CUPiD/externals/ADF/config_amwg_default_plots.yaml \
+ --out-file adf_config.yml
+
+ # 3. Generate timeseries files and run ADF
+ if [ "${RUN_CUPID_TIMESERIES}" == "TRUE" ]; then
+ {{ srcroot }}/tools/CUPiD/cupid/run_timeseries.py
+ fi
+ conda deactivate
+ conda activate cupid-analysis
+ {{ SRCROOT }}/tools/CUPiD/externals/ADF/run_adf_diag adf_config.yml
+
+ # 4. Run CUPiD and build webpage
+ conda deactivate
+ conda activate cupid-infrastructure
+ {{ srcroot }}/tools/CUPiD/cupid/run_diagnostics.py
+ {{ srcroot }}/tools/CUPiD/cupid/cupid_webpage.py
+fi