validate_sim: Run diagnostics on model results vs observations

View source: R/validate_sim.R

validate_simR Documentation

Run diagnostics on model results vs observations

Description

Run diagnostics on model results vs observations

Usage

validate_sim(
  nc_file,
  field_file,
  nml_file,
  metrics,
  fig_path = NULL,
  report = FALSE,
  ...
)

Arguments

nc_file

a string with the path to the netcdf output from GLM

field_file

a string with the path to the field observation file

nml_file

a string with the path to the glm3.nml file

metrics

a string or vector of strings representing physical metrics. Should be a rLakeAnalyzer function or other valid function.

fig_path

Default is NULL (only plots to screen). Enter string path to save as output file. File type can be anything supported by ggplot2:ggsave. See examples.

report

default as FALSE, so no stats are returned. If TRUE, return summary stats for each metric used.

...

additional arguments passed to ggplot2:ggsave

Value

A report or figures comparing modeled results to observations.

Author(s)

Jordan S. Read, Hilary A. Dugan

See Also

compare_to_field, resample_to_field, read_nml, sim_metrics

Examples

## Not run: 
sim_folder <- run_example_sim(verbose = FALSE)
nc_file <- file.path(sim_folder, 'output/output.nc')
nml_file <- file.path(sim_folder, 'glm3.nml')
field_file <- file.path(sim_folder, 'LakeMendota_field_data_hours.csv')

#create a multiple metric diagnostic fig within R:
validate_sim(nc_file, field_file, nml_file = nml_file,
                          metrics = c('thermo.depth', 'schmidt.stability'), 
                          fig_path = NULL)      

# write the fig out to file:
validate_sim(nc_file, field_file, nml_file = nml_file, fig_path = 'test_fig.png',
                          metrics = c('thermo.depth', 'schmidt.stability'))   
                  
# return the diagnostic info but avoid the plot:                                   
validate_sim(nc_file, field_file, nml_file = nml_file, report = TRUE,
                          metrics = c('thermo.depth', 'schmidt.stability'))     

## End(Not run)

USGS-R/glmtools documentation built on March 26, 2024, 5:43 p.m.