[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, PointStat, EnsembleStat(es_grid_refc), EnsembleStat(es_point_tmp)


###
# 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(0,36,1)


###
# 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 = {OUTPUT_BASE}/RegridDataPlane/mrms
OBS_GRID_STAT_INPUT_TEMPLATE = {valid?fmt=%Y%m%d}/MergedReflectivityQCComposite_00.50_{valid?fmt=%Y%m%d}-{valid?fmt=%H%M%S}.nc

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

# PointStat
FCST_POINT_STAT_INPUT_DIR = {FCST_GRID_STAT_INPUT_DIR}
FCST_POINT_STAT_INPUT_TEMPLATE = {FCST_GRID_STAT_INPUT_TEMPLATE}

OBS_POINT_STAT_INPUT_DIR = {INPUT_BASE}/MET_output/pb2nc
OBS_POINT_STAT_INPUT_TEMPLATE = {valid?fmt=%Y%m%d}/ndas_{valid?fmt=%Y%m%d%H}.nc

POINT_STAT_OUTPUT_DIR = {OUTPUT_BASE}/PointStat/HREF_TMP
POINT_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 = MRMS

# GridStat
FCST_GRID_STAT_IS_PROB = true

FCST_GRID_STAT_VAR1_NAME = REFC_L0_ENS_FREQ_ge35.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 = MergedReflectivityQCComposite
OBS_GRID_STAT_VAR1_LEVELS = "(*,*)"
OBS_GRID_STAT_VAR1_THRESH = ge35.0
OBS_GRID_STAT_VAR1_OPTIONS = censor_thresh = [eq-999, lt0&&ge-99]; censor_val = [-9999, 0];


# PointStat
FCST_POINT_STAT_IS_PROB = true
FCST_POINT_STAT_VAR1_NAME = TMP_Z2_ENS_FREQ_ge291
FCST_POINT_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_POINT_STAT_VAR1_NAME = TMP
OBS_POINT_STAT_VAR1_LEVELS = Z2
OBS_POINT_STAT_VAR1_THRESH = ge291

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

GRID_STAT_REGRID_TO_GRID = NONE
#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}_REFC


###
# PointStat Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#pointstat
###

POINT_STAT_MESSAGE_TYPE = ADPSFC

POINT_STAT_INTERP_TYPE_METHOD = BILIN
POINT_STAT_INTERP_TYPE_WIDTH = 2

POINT_STAT_OUTPUT_FLAG_PCT = STAT
POINT_STAT_OUTPUT_FLAG_PSTD = STAT
POINT_STAT_OUTPUT_FLAG_PJC = STAT
POINT_STAT_OUTPUT_FLAG_PRC = STAT

POINT_STAT_OUTPUT_PREFIX = PROB_{MODEL}_vs_NDAS_TMP

###
# EnsembleStat Common Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#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

ENSEMBLE_STAT_N_MEMBERS = 10

ENSEMBLE_STAT_ENS_THRESH = 1.0

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


###
# EnsembleStat settings for Gridded Reflectivty
###

[es_grid_refc]

# File I/O
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_REFC
ENSEMBLE_STAT_OUTPUT_TEMPLATE = {init?fmt=%Y%m%d%H}

ENSEMBLE_STAT_OUTPUT_PREFIX = {MODEL}_vs_{OBTYPE}_REFC

# Variables
FCST_ENSEMBLE_STAT_VAR1_NAME = REFC
FCST_ENSEMBLE_STAT_VAR1_LEVELS = L0
FCST_ENSEMBLE_STAT_VAR1_THRESH = ge35.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}
OBS_ENSEMBLE_STAT_VAR1_OPTIONS = {OBS_GRID_STAT_VAR1_OPTIONS}

ENSEMBLE_STAT_MESSAGE_TYPE =

# Regridding
ENSEMBLE_STAT_REGRID_TO_GRID = NONE
#ENSEMBLE_STAT_REGRID_METHOD = BUDGET
#ENSEMBLE_STAT_REGRID_WIDTH = 2
#ENSEMBLE_STAT_REGRID_VLD_THRESH = 1.0

# Output netCDF data
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


###
# EnsembleStat settings for Point Temperature
###

[es_point_tmp]

# File I/O
OBS_ENSEMBLE_STAT_POINT_INPUT_DIR = {OBS_POINT_STAT_INPUT_DIR}
OBS_ENSEMBLE_STAT_POINT_INPUT_TEMPLATE = {OBS_POINT_STAT_INPUT_TEMPLATE}

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

ENSEMBLE_STAT_OUTPUT_PREFIX = {MODEL}_vs_NDAS_TMP

# Variables
FCST_ENSEMBLE_STAT_VAR1_NAME = TMP
FCST_ENSEMBLE_STAT_VAR1_LEVELS = Z2
FCST_ENSEMBLE_STAT_VAR1_THRESH = ge291

OBS_ENSEMBLE_STAT_VAR1_NAME = TMP
OBS_ENSEMBLE_STAT_VAR1_LEVELS = Z2
OBS_ENSEMBLE_STAT_VAR1_THRESH = ge291

ENSEMBLE_STAT_MESSAGE_TYPE = ADPSFC
