autoplot_anomaly_map: Wrapper function to calculate and visualize anomaly of...

Description Usage Arguments Output Details See Also Examples

View source: R/autoplot_anomaly_map.R

Description

This function calls the function calc_index and plots the anomaly of the mean of the index values of defined years against the mean of a set of reference years in a map. It can be used for either gridded or station data or a combination of both.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
autoplot_anomaly_map(
  dat_grid,
  dat_p,
  index,
  index_args = list(),
  refyears = NULL,
  anomyears,
  NAmaxClim = 20,
  col = "default",
  title = "",
  plot_title = TRUE,
  plot_args = list(),
  output = NULL,
  plotdir,
  plotname = ""
)

Arguments

dat_grid

Climindvis-object with type = "grid" generated by make_object.

dat_p

Climindvis-object with type = "p" generated by make_object.

index

Name of index to be calculated., e.g. index = "dd" or index = "tnn". For list of indices see indices_list

index_args

List of arguments for index. See indices_list.

refyears

Optional. Array of reference years for calculating anomaly. If not defined, all years in dataset are used (default).

anomyears

Year or array of years for which anomaly is calculated with respect to refyears. If more than one anomyear is given, the mean of these years is calculated and subtracted from the mean of refyears.

NAmaxClim

Integer [0,100]. Maximum percentage of years with missing values for calculation of climatology. If exceeded value for respective grid point/station is set to NA. Default = 20 ( = 20"%").

col

Array of colors for plotting of length 3 or longer (must be a valid arguments to col2rgb). Length of array is adjusted to number of levels. If not provided, package default colors for index anomaly are used. Default="default".

title

Optional. Character string. If provided added above the plot in addition to default information from the respective function (e.g. index name/aggregation/time period/...). Default = "", no additional title is written.

plot_title

Logical. Add plot title to graphic. Default = TRUE.

plot_args

Optional. List of arguments passed to plotting function, see plot_args_map.

output

Format of image to be plotted ("png", "jpeg", "tiff", "pdf","dev.new"). Default = NULL, output to null device (getOption("device") will show you the null device. If you are not using RStudio, NULL and dev.new will give the same output).

plotdir

Character string of path of directory for saving plots. Ignored if output is NULL or "dev.new".

plotname

Optional. Character string. First part of plot name followed by character string containing index name/aggregation/time period/... depending on the autoplot function. Default = "".

Output

This function returns one plot per temporal aggregation whch is covered by the data( e.g. if aggt="seasonal" it would return 4 graphics, one for each season).

If output is not NULL or "dev.new" the graphics are directly saved in the user specified directory (plotdir) with the following filename structure:

plotname //"Anomaly_"// index name // plot_value // aggregation // anomyears // "_refyears-"//refyears// output
e.g.:
plotname"Anomaly_dry_days_mean_MAM_1990_refyears1981-2010.png

Details

When using ensemble data, the plot value is calculated over the whole ensemble (i.e. ensemble mean over the corresponding time period).

See Also

Other autoplot_functions: autoplot_anomaly_ts(), autoplot_climatology_map(), autoplot_forecast_map(), autoplot_forecast_spi(), autoplot_forecast_stations(), autoplot_overview_stations(), autoplot_trend_map(), autoplot_ts_stations(), autoplot_verification_map()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(object_st, object_grid)
autoplot_anomaly_map(
      dat_grid = object_grid, dat_p = object_st,
      anomyears=1990,
      index = "tnn", index_args = list(aggt = "seasonal", selagg = "JJA"))

data(object_hc_grid)
index_args=list(aggt = "dates", start_days = "0000-01-15", end_days = "0000-04-15")
autoplot_anomaly_map(
      dat_grid = object_hc_grid,
      anomyears=1981,refyears=1991:2010,
      index = "dd", index_args = index_args)

Climandes/ClimIndVis documentation built on Oct. 24, 2021, 10:52 a.m.