[config]

# Documentation for this use case can be found at
# https://metplus.readthedocs.io/en/latest/generated/model_applications/precipitation/GridStat_fcstHRRR-TLE_obsStgIV_GRIB.html

# For additional information, please see the METplus Users Guide.
# https://metplus.readthedocs.io/en/latest/Users_Guide

###
# Processes to run
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#process-list
###

PROCESS_LIST = GridStat, EnsembleStat


###
# Time Info
# LOOP_BY options are INIT, VALID, RETRO, and REALTIME
# If set to INIT or RETRO:
#   INIT_TIME_FMT, INIT_BEG, INIT_END, and INIT_INCREMENT must also be set
# If set to VALID or REALTIME:
#   VALID_TIME_FMT, VALID_BEG, VALID_END, and VALID_INCREMENT must also be set
# LEAD_SEQ is the list of forecast leads to process
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#timing-control
###

LOOP_BY = INIT

INIT_TIME_FMT = %Y%m%d%H
INIT_BEG=2022051100
INIT_END=2022051200
INIT_INCREMENT=86400

#LEAD_SEQ = begin_end_incr(1,36,1)
LEAD_SEQ = 23, 24


###
# File I/O
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#directory-and-filename-template-info
###

# GridStat
FCST_GRID_STAT_INPUT_DIR = {INPUT_BASE}/MET_output/GenEnsProd/HREF/
FCST_GRID_STAT_INPUT_TEMPLATE= {init?fmt=%Y%m%d%H}/gen_ens_prod_{valid?fmt=%Y%m%d}_{valid?fmt=%H%M%S}V_ens.nc

OBS_GRID_STAT_INPUT_DIR = {INPUT_BASE}/obs/ccpa/proc
OBS_GRID_STAT_INPUT_TEMPLATE = {valid?fmt=%Y%m%d}/ccpa.t{valid?fmt=%H}z.01h.hrap.conus.gb2

GRID_STAT_OUTPUT_DIR = {OUTPUT_BASE}/GridStat/HREF_APCP
GRID_STAT_OUTPUT_TEMPLATE = {init?fmt=%Y%m%d%H}

# EnsembleStat
FCST_ENSEMBLE_STAT_INPUT_DIR = {INPUT_BASE}/HREFv3_byMem
FCST_ENSEMBLE_STAT_INPUT_TEMPLATE = {init?fmt=%Y%m%d%H}/mem01/postprd/HREF.t{init?fmt=%H}z.bgdawpf{lead?fmt=%3H}.tm00.grib2,
  {init?fmt=%Y%m%d%H}/mem02/postprd/HREF.t{init?fmt=%H}z.bgdawpf{lead?fmt=%3H}.tm00.grib2,
  {init?fmt=%Y%m%d%H}/mem03/postprd/HREF.t{init?fmt=%H}z.bgdawpf{lead?fmt=%3H}.tm00.grib2,
  {init?fmt=%Y%m%d%H}/mem04/postprd/HREF.t{init?fmt=%H}z.bgdawpf{lead?fmt=%3H}.tm00.grib2,
  {init?fmt=%Y%m%d%H}/mem05/postprd/HREF.t{init?fmt=%H}z.bgdawpf{lead?fmt=%3H}.tm00.grib2,
  {init?fmt=%Y%m%d%H?shift=-43200}/mem06/postprd/HREF.t{init?fmt=%H?shift=-43200}z.bgdawpf{lead?fmt=%3H?shift=43200}.tm00.grib2,
  {init?fmt=%Y%m%d%H?shift=-43200}/mem07/postprd/HREF.t{init?fmt=%H?shift=-43200}z.bgdawpf{lead?fmt=%3H?shift=43200}.tm00.grib2,
  {init?fmt=%Y%m%d%H?shift=-43200}/mem08/postprd/HREF.t{init?fmt=%H?shift=-43200}z.bgdawpf{lead?fmt=%3H?shift=43200}.tm00.grib2,
  {init?fmt=%Y%m%d%H?shift=-43200}/mem10/postprd/HREF.t{init?fmt=%H?shift=-43200}z.bgdawpf{lead?fmt=%3H?shift=43200}.tm00.grib2,
  {init?fmt=%Y%m%d%H?shift=-21600}/mem09/postprd/HREF.t{init?fmt=%H?shift=-21600}z.bgdawpf{lead?fmt=%3H?shift=21600}.tm00.grib2

OBS_ENSEMBLE_STAT_GRID_INPUT_DIR = {OBS_GRID_STAT_INPUT_DIR}
OBS_ENSEMBLE_STAT_GRID_INPUT_TEMPLATE = {OBS_GRID_STAT_INPUT_TEMPLATE}

ENSEMBLE_STAT_OUTPUT_DIR = {OUTPUT_BASE}/EnsembleStat/HREF_APCP
ENSEMBLE_STAT_OUTPUT_TEMPLATE = {init?fmt=%Y%m%d%H}


###
# Field Info
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#field-info
###

MODEL = HREF
OBTYPE = CCPA

# GridStat
FCST_GRID_STAT_IS_PROB = true

FCST_GRID_STAT_VAR1_NAME = APCP_01_A01_ENS_FREQ_gt0.0
FCST_GRID_STAT_VAR1_LEVELS = "(*,*)"
FCST_GRID_STAT_PROB_THRESH = ge0.0, ge0.1, ge0.2, ge0.3, ge0.4, ge0.5, ge0.6, ge0.7, ge0.8, ge0.9, ge1.0

OBS_GRID_STAT_VAR1_NAME = APCP
OBS_GRID_STAT_VAR1_LEVELS = A01 
OBS_GRID_STAT_VAR1_THRESH = gt0.0

# EnsembleStat
FCST_ENSEMBLE_STAT_VAR1_NAME = APCP
FCST_ENSEMBLE_STAT_VAR1_LEVELS = A01
FCST_ENSEMBLE_STAT_VAR1_THRESH = gt0.0

OBS_ENSEMBLE_STAT_VAR1_NAME = {OBS_GRID_STAT_VAR1_NAME}
OBS_ENSEMBLE_STAT_VAR1_LEVELS = {OBS_GRID_STAT_VAR1_LEVELS}
OBS_ENSEMBLE_STAT_VAR1_THRESH = {OBS_GRID_STAT_VAR1_THRESH}


###
# GridStat Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#gridstat
###

GRID_STAT_REGRID_TO_GRID = FCST
GRID_STAT_REGRID_METHOD = NEAREST
GRID_STAT_REGRID_WIDTH = 1
#GRID_STAT_REGRID_VLD_THRESH =
#GRID_STAT_REGRID_SHAPE =
#GRID_STAT_REGRID_CONVERT =
#GRID_STAT_REGRID_CENSOR_THRESH =
#GRID_STAT_REGRID_CENSOR_VAL =

#GRID_STAT_MASK_GRID = FULL
#GRID_STAT_MASK_POLY = 

GRID_STAT_OUTPUT_FLAG_PCT = STAT
GRID_STAT_OUTPUT_FLAG_PSTD = STAT
GRID_STAT_OUTPUT_FLAG_PJC = STAT
GRID_STAT_OUTPUT_FLAG_PRC = STAT

GRID_STAT_NC_PAIRS_FLAG_LATLON = FALSE
GRID_STAT_NC_PAIRS_FLAG_RAW = FALSE
GRID_STAT_NC_PAIRS_FLAG_DIFF = FALSE
GRID_STAT_NC_PAIRS_FLAG_CLIMO = FALSE
GRID_STAT_NC_PAIRS_FLAG_APPLY_MASK = FALSE

GRID_STAT_OUTPUT_PREFIX = PROB_{MODEL}_vs_{OBTYPE}_APCP_01


###
# EnsembleStat Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#ensemblestat
###

ENSEMBLE_STAT_N_MEMBERS = 10

ENSEMBLE_STAT_ENS_THRESH = 0.8

ENSEMBLE_STAT_OUTPUT_FLAG_ECNT = STAT
ENSEMBLE_STAT_OUTPUT_FLAG_RPS = NONE
ENSEMBLE_STAT_OUTPUT_FLAG_RHIST = STAT
ENSEMBLE_STAT_OUTPUT_FLAG_PHIST = STAT
ENSEMBLE_STAT_OUTPUT_FLAG_ORANK = STAT
ENSEMBLE_STAT_OUTPUT_FLAG_SSVAR = STAT
ENSEMBLE_STAT_OUTPUT_FLAG_RELP = STAT

ENSEMBLE_STAT_OUTPUT_PREFIX = {MODEL}_vs_{OBTYPE}_APCP_01

ENSEMBLE_STAT_MESSAGE_TYPE =

ENSEMBLE_STAT_REGRID_TO_GRID = FCST
ENSEMBLE_STAT_REGRID_METHOD = BUDGET
ENSEMBLE_STAT_REGRID_WIDTH = 2
ENSEMBLE_STAT_REGRID_VLD_THRESH = 1.0

ENSEMBLE_STAT_NC_ORANK_FLAG_LATLON = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_MEAN = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_RAW = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_RANK = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_PIT = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_VLD_COUNT = TRUE
ENSEMBLE_STAT_NC_ORANK_FLAG_WEIGHT = FALSE
