View source: R/compare_apsim_met.R
compare_apsim_met | R Documentation |
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
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
)
... |
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’ |
If the ‘met’ files do not have the same number of columns or the same names for the data frame, then an error will be returned. If the years are not the same a message will be returned with the different years and the years in common.
object of class ‘met_mrg’, which can be used for further plotting
it prints the index.table data.frame
it produces a plot
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.