Deterministic verification
Andrew Singleton
17/02/2022
Introduction
- The next 2 sessions are the most important if you are only interested in point verification
- The entire workflow will be demonstrated
- You can get away with ignoring everything that came before and will come after these 2 sessions
Another new package
Today we will be using another new package - patchwork for controlling plot layouts. You can install it with install.packages("patchwork")
Outputing interpolated data
read_forecast() and read_obs() have an output_file_opts argument
- All you need to do is to pass something to to that argument
sqlite_opts() for read_forecast() (will probably become fctable_opts())
obstable_opts() for read_obs()
- Generally you just need to set the path to the output in
sqlite_opts() / obstable_opts()
Read in interpolated forecast data
read_point_forecast() is used
- NOTE it takes
start_date and end_date as the first arguments. This will change to date_times soon
- You need to tell it if it is ensemble or deterministic forecast data. This will be removed soon
- Must include
fcst_model and parameter - only one parameter can be read at a time
- Can also choose
lead_time, stations
- Precipitation accumulation is done at read time
Preparing data for verification
- If verifying more than one model, you should only choose the common cases
- This is done with the
common_cases() function
Reading in point observations
- This is done with the
read_point_obs() function
- NOTE it takes
start_date and end_date as the first arguments. This will change to date_times soon
- It can get the dates it needs from the forecast data
- … as well as the stations
Join
- Once you have the forecast and observations you join them together with
join_to_fcst()
- The function will check that the forecasts and observations have same units
Scatter plot
- Before running the verification you make scatter plots of forecasts vs observations using
plot_scatter()
- It can only plot one forecast model at a time (faceting coming soon!)
- However the
patchwork package can be used to arrange the scatter plots
Verify
- Verify with
det_verify() giving it the joined data and the name of the observations column
- The observations column (
parameter) argument is unquoted - if you use a variable it must be wrapped in {{ }}
- Categorical scores are computed by adding thresholds
Plot scores
plot_point_verif() is used
- It takes the output of
det_verify() and the name of the score
- The name of the score is unquoted so if using a variable it must be wrapped in
{{ }}
- Line colours can be changed by passing a data frame with the
colour_table argument
- For categorical scores the plot must be filtered or faceted with the
filter_by or facet_by arguments
- The contents of
filter_by and facet_by must be wrapped inside vars()
- Categorical scores can be plotted as a function of lead time or threshold
The point verification web app
- You can save your verification data using
save_point_verif()
- You can then open an app to display your scores using
shiny_plot_point_verif()
- (Shiny is the R package that powers the app)
The workflow
- The verification workflow can be summarized as:
- Read
- Join
- (scatter plots)
- Verify
- (Plot)
- Save
- Open app