#! /bin/csh -f
#SBATCH -p singlepe
#SBATCH -t 24:00:00
#SBATCH -n 1
#SBATCH -c 1
#SBATCH --gid=romo
#SBATCH --account=romo



 setenv compiler intel
 setenv compilerVrsn 17.0
 source /work/ROMO/users/kpc/merps/hr2day/config_cmaq.csh


 setenv GRID 12US1
 setenv SCEN baseline2018_r1_SERAemis+isam

setenv YEAR 2018
foreach month (  06 07 08 )

#> define species (format: "Name, units, From_species, Operation")
#>  operations : {SUM, AVG, MIN, MAX, @MAXT, MAXDIF, 8HRMAX, SUM06}
 setenv OZONE "O3" #variable from which the @8HRMAXO3 bases the 8hr max
 setenv SPECIES_1 "O3,ppb,O3,8HRMAX"
 setenv SPECIES_2 "O3_ANTH,ppb,O3_ANTH,@8HRMAXO3"
 setenv SPECIES_3 "O3_BIO,ppb,O3_BIO,@8HRMAXO3"
 setenv SPECIES_4 "O3_ICBC,ppb,O3_ICBC,@8HRMAXO3"
 setenv SPECIES_5 "USFLAG,unk,USFLAG,@8HRMAXO3"
 setenv SPECIES_6 "USFLAG2,unk,USFLAG2,@8HRMAXO3"
 setenv SPECIES_7 "USFLAG3,unk,USFLAG3,@8HRMAXO3"
 setenv SPECIES_8 "XUS,unk,XUS,@8HRMAXO3"
 setenv SPECIES_9 "O3_FIRE,ppb,O3_FIRE,@8HRMAXO3"


 setenv BINDIR /work/ROMO/users/kpc/ssvis/hr2day/BLD_hr2day_v52_intel17.0
 setenv EXEC hr2day_v52.exe
#> location of time zone data file, tz.csv (this is a required input file
#> when using OLAYTYPE HOURLY since hourly observations need to be shifted
#> from local time to GMT)
 setenv TZFILE /work/ROMO/users/kpc/o3ipt/hr2day/tz.csv
#> set input and output files
 setenv INFILE /work/ROMO/lrt/cmaq/$GRID/postp/combine_2D_firemetric.${YEAR}${month}.$GRID.35.$SCEN.ncf
          #[Add location of input file, e.g. COMBINE_ACONC file.]
 setenv OUTFILE /work/ROMO/lrt/cmaq/$GRID/postp/combine_MDA8_firemetric.${YEAR}${month}.$GRID.35.$SCEN.ncf
 rm -f $OUTFILE

#> Projection sphere type used by I/OAPI (use type #20 to match WRF/CMAQ)
 setenv IOAPI_ISPH 20
#> set to use local time (default is GMT)
 setenv USELOCAL Y
#> set to use daylight savings time (default is N)
 setenv USEDST N
#> partial day calculation (computes value for last day)
 setenv PARTIAL_DAY Y
#> constant hour offset between desired time zone and GMT (default is 0)
 setenv HROFFSET 0
#> starting hour for daily metrics (default is 0)
 setenv START_HOUR 0
#> ending hour for daily metrics (default is 23)
 setenv END_HOUR 23
#> Number of 8hr values to use when computing daily maximum 8hr ozone.
#> Allowed values are 24 (use all 8-hr averages with starting hours 
#> from 0 - 23 hr local time) and 17 (use only the 17 8-hr averages
#> with starting hours from 7 - 23 hr local time)
 setenv HOURS_8HRMAX 24
# setenv HOURS_8HRMAX 17

#> Executable call:
 ${BINDIR}/${EXEC}

 end #loop over months

 exit()


