compare_apsim_met: Compare two or more metfiles

View source: R/compare_apsim_met.R

compare_apsim_metR Documentation

Compare two or more metfiles

Description

Helper function which allows for a simple comparison among ‘met’ objects

print method for ‘met_mrg’

plotting function for compare_apsim_met, it requires ggplot2

Usage

compare_apsim_met(
  ...,
  met.var = c("all", "radn", "maxt", "mint", "rain", "rh", "wind_speed", "vp"),
  labels,
  check = FALSE,
  verbose = FALSE
)

## S3 method for class 'met_mrg'
print(x, ..., digits = 2)

## S3 method for class 'met_mrg'
plot(
  x,
  ...,
  plot.type = c("vs", "diff", "ts", "density"),
  pairs = c(1, 2),
  cumulative = FALSE,
  met.var = c("radn", "maxt", "mint", "rain"),
  id,
  span = 0.75
)

Arguments

...

met file objects. Should be of class ‘met’

met.var

meteorological variable to plot

labels

labels for plotting and identification of ‘met’ objects.

check

whether to check ‘met’ objects using ‘check_apsim_met’.

verbose

whether to print agreement stats to console (default is FALSE).

x

object of class ‘met_mrg’

digits

digits to print (default is 2)

plot.type

either ‘vs’, ‘diff’, ‘ts’ - for time series or ‘density’

pairs

pair of objects to compare, defaults to 1 and 2 but others are possible

cumulative

whether to plot cumulative values (default FALSE)

id

identification (not implemented yet)

span

argument to be passed to ‘geom_smooth’

Value

object of class ‘met_mrg’, which can be used for further plotting

it prints the index.table data.frame

it produces a plot

Note

I have only tested this for 2 or 3 objects. The code is set up to be able to compare more, but I'm not sure that would be all that useful.

Examples

## Not run: 
require(nasapower)
## Specify the location
lonlat <- c(-93, 42)
## dates
dts <- c("2017-01-01","2017-12-31")
## Get pwr
pwr <- get_power_apsim_met(lonlat = lonlat, dates = dts)
## Get data from IEM
iem <- get_iem_apsim_met(lonlat = lonlat, dates = dts)
## Compare them
cmet <- compare_apsim_met(pwr[,1:6], iem, labels = c("pwr","iem"))
## Visualize radiation
plot(cmet, met.var = "radn")
plot(cmet, plot.type = "diff")
plot(cmet, plot.type = "ts")
## Visualize maxt
plot(cmet, met.var = "maxt")
plot(cmet, met.var = "maxt", plot.type = "diff")
plot(cmet, met.var = "maxt", plot.type = "ts")
## Cumulative rain
plot(cmet, met.var = "rain", plot.type = "ts", cumulative = TRUE)

## End(Not run)


apsimx documentation built on Sept. 11, 2024, 5:42 p.m.