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




 setenv YEAR 2023
 setenv GRID 36US3

foreach SCEN  ( base2023_rxeqemis+isam    ) 
foreach MON ( 01 02 03 04 05 06 07 08 09 10 11 12)

#> 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,@8HRMAXO3"
 setenv SPECIES_2 "O3_ICBC,ppb,O3_ICBC,@8HRMAXO3"
 setenv SPECIES_3 "O3_ANTH,ppb,O3_ANTH,@8HRMAXO3"
 setenv SPECIES_4 "O3_NAT,ppb,O3_NAT,@8HRMAXO3"
 setenv SPECIES_5 "O3_NONUS,ppb,O3_NONUS,@8HRMAXO3"
 setenv SPECIES_6 "O3_WF,ppb,O3_WF,@8HRMAXO3"
 setenv SPECIES_7 "O3_AG,ppb,O3_AG,@8HRMAXO3"
 setenv SPECIES_8 "O3_OB,ppb,O3_OB,@8HRMAXO3"
 setenv SPECIES_9 "O3_RX,ppb,O3_RX,@8HRMAXO3"

 setenv SPECIES_10 "PM_OCEC,,PM_OCEC,AVG"
 setenv SPECIES_11 "PM_ICBC,,PM_ICBC,AVG"
 setenv SPECIES_12 "PM_ANTH,,PM_ANTH,AVG"
 setenv SPECIES_13 "PM_NAT,,PM_NAT,AVG"
 setenv SPECIES_14 "PM_NONUS,,PM_NONUS,AVG"
 setenv SPECIES_15 "PM_WF,,PM_WF,AVG"
 setenv SPECIES_16 "PM_AG,,PM_AG,AVG"
 setenv SPECIES_17 "PM_OB,,PM_OB,AVG"
 setenv SPECIES_18 "PM_RX,,PM_RX,AVG"


#> 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/MOD3EVAL/kbaker/projects/wfsens/hr2day/tz.csv
#> set input and output files
 setenv INFILE /work/ROMO/lrt/cmaq/$GRID/postp/$SCEN/combine.${YEAR}${MON}.$GRID.$SCEN.ncf
          #[Add location of input file, e.g. COMBINE_ACONC file.]
 setenv OUTFILE /work/ROMO/lrt/cmaq/$GRID/postp/$SCEN/dailyavg.${YEAR}${MON}.$GRID.$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:
 setenv BINDIR /work/MOD3EVAL/kbaker/projects/cmaq/v5.5public/POST/hr2day/scripts/BLD_hr2day_v55_intel21.4
 setenv EXEC hr2day_v55.exe

 ${BINDIR}/${EXEC}

 end #loop over months
 end


 exit()


