# NOT RUN {
library(amber)
library(classInt)
library(doParallel)
library(foreach)
library(Hmisc)
library(latex2exp)
library(ncdf4)
library(parallel)
library(raster)
library(rgdal)
library(rgeos)
library(scico)
library(sp)
library(stats)
library(utils)
library(viridis)
library(xtable)
# (1) Global plots on a regular grid
long.name <- 'soil carbon'
nc.mod <- system.file('extdata/modelRegular', 'cSoil_monthly.nc', package = 'amber')
ref.csv <- system.file('extdata/siteLevelRefData', 'siteLevelDataNoTime.csv', package = 'amber')
mod.id <- 'CLASSIC' # define a model experiment ID
ref.id <- 'ABC' # give reference dataset a name
unit.conv.mod <- 1 # optional unit conversion for model data
unit.conv.ref <- 1 # optional unit conversion for reference data
variable.unit <- 'kgC m$^{-2}$' # unit after conversion (LaTeX notation)
# Short version using default settings:
scores.site.notime(long.name, nc.mod, ref.csv, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit)
# To zoom into a particular region:
scores.site.notime(long.name, nc.mod, ref.csv, mod.id, ref.id, unit.conv.mod,
unit.conv.ref, variable.unit, score.weights = c(1, 2, 1, 1, 1),
my.xlim = c(-150, -60), my.ylim = c(20, 60), plot.width = 6, plot.height = 3.8)
# (2) Regional plots on a rotated grid
nc.mod <- system.file('extdata/modelRotated', 'cSoil_monthly.nc', package = 'amber')
ref.csv <- system.file('extdata/siteLevelRefData', 'siteLevelDataNoTime.csv', package = 'amber')
mod.id <- 'CLASSIC' # define a model experiment ID
ref.id <- 'ABC' # give reference dataset a name
unit.conv.mod <- 1 # optional unit conversion for model data
unit.conv.ref <- 1 # optional unit conversion for reference data
variable.unit <- 'kgC m$^{-2}$' # unit after conversion (LaTeX notation)
rotate.me <- FALSE
irregular <- TRUE
my.projection <-'+proj=ob_tran +o_proj=longlat +o_lon_p=83. +o_lat_p=42.5 +lon_0=263.'
# shp.filename <- system.file('extdata/ne_50m_admin_0_countries/ne_50m_admin_0_countries.shp',
# package = 'amber')
shp.filename <- system.file("extdata/ne_110m_land/ne_110m_land.shp", package = "amber")
my.xlim <- c(-171, 0) # longitude range that you wish to plot
my.ylim <- c(32, 78) # latitude range that you wish to plot
plot.width <- 7
plot.height <- 3.8
numCores <- 2
scores.site.notime(long.name, nc.mod, ref.csv, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit, rotate.me = TRUE, irregular = TRUE,
my.projection = my.projection, shp.filename = shp.filename,
my.xlim = my.xlim, my.ylim = my.ylim, plot.width = plot.width, plot.height = plot.height)
# }
# NOT RUN {
#donttest
# }
Run the code above in your browser using DataLab