Learn R Programming

apsimx (version 2.8.0)

compare_apsim_met: 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 met_mrg print(x, ..., digits = 2)

# S3 method for 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 )

Value

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

it prints the index.table data.frame

it produces a plot

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’

Examples

Run this code
if (FALSE) {
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)
}

Run the code above in your browser using DataLab