#!/bin/csh
# Submits batch job to make standard spectrum files for each orbit and SRM files for each flare for RHESSI archive

# Modified 1/29/2019 to use yyyy/mm/dd in call and to name log files yyyymmdd for easier ordering by date.
# Modified 2/21/2024 to run from directory /home/softw/spectrum_archive
#
# To run this from the command line for a specific time period, do this:
#   cd to /home/softw/spectrum_archive
#  ./run_sp 2005/01/01 2005/01/05 &
#  or to specify times too:
#  ./run_sp 2005/01/01+02:00 2005/01/05+04:00 &

setenv SSW /data/ssw
setenv SSW_INSTR 'hessi xray spex ontology'
source $SSW/gen/setup/setup.ssw
cd /home/softw/spectrum_archive

setenv tstart $1
setenv tend $2

# remove slash in times for use in log file name
setenv tstartnoslash `echo $tstart | sed 's/\///g'`
setenv tendnoslash `echo $2 | sed 's/\///g'`


# Log file name will be, e.g. run_sp_20050101_20050105.log
# Use backslash so it's clear env var name is $tstartnoslash, not $tstartnoslash_ 
$SSW/gen/bin/ssw_batch run_sp run_sp_$tstartnoslash\_$tendnoslash.log

