monitor_climate {cmsafvis}R Documentation

A 'cmsaf' extension for creating various climate plots.

Description

This plotting routine generates graphical output of the evolution of the given variable within the given time range and area. The intended application is for daily accumulated data, such as sunshine duration. Dependent on the output format a PNG or MP4 is created.

Usage

monitor_climate(
  plot_type = "absolute_map",
  config = NULL,
  variable = NULL,
  accumulate = FALSE,
  mean_value = FALSE,
  infile = NULL,
  temp_dir = tempdir(),
  out_dir = getwd(),
  climate_dir = NULL,
  climate_year_start = 1983,
  climate_year_end = 2018,
  show_extreme_climate_years = NULL,
  climatology_until_eoy = FALSE,
  start_date = NULL,
  end_date = NULL,
  country_code = "S_A",
  lon_min = NULL,
  lon_max = NULL,
  lat_min = NULL,
  lat_max = NULL,
  outfile_name = NULL,
  output_format = "animation",
  animation_pace = 0.07,
  freeze_animation = FALSE,
  min_value = NULL,
  max_value = NULL,
  nbreaks = NULL,
  language = "eng",
  keep_files = TRUE,
  states = FALSE,
  attach = FALSE,
  infile_attach = "auto",
  analyze_method = TRUE,
  selected_number = 1,
  color_pal = 1,
  relative = FALSE,
  circ_plot = FALSE,
  dwd_logo = FALSE,
  verbose = TRUE,
  nc = NULL
)

Arguments

plot_type

Specifies the type of the plot ('absolute_map', 'anomaly_map', 'climatology_map', 'fieldmean_plot', 'fieldmean_and_anomaly_map').

config

Path to YAML config file (character). The config file does not have to specify all arguments. Each addressed argument has to be formatted according to the example config file: (#TODO: LINK EXAMPLE CONFIG FILE!).

variable

Name of variable in infile (NULL or character). If NULL then the first variable from the infile is taken.

accumulate

Whether the input file should be accumulated (logical).

mean_value

Whether the input file should be averaged (logical).

infile

Path to NetCDF file (NULL or character). If NULL then it needs to be specified in the config file.

temp_dir

Path to temporary working directory (character).

out_dir

Path to output directory (character).

climate_dir

Path to directory in which climatology is computed or contained (NULL or character). If NULL then the temp_dir directory is taken.

climate_year_start

Start year of climatology (integer).

climate_year_end

End year of climatology (integer).

show_extreme_climate_years

Whether the minimum and maximum of the climate years should be titled in the fieldmean plot (NULL or logical). This is usually only of interest when plotting accumulated data. If the default NULL is chosen, then it will be set to the value of accumulate.

climatology_until_eoy

Plot the climatology and fieldmeans until the end of year (logical). Only affects fieldmean plots analyzed from January 1st.

start_date

Start date in format of 'YYYY-MM-DD' (NULL or character). If NULL then the first date of the infile is used.

end_date

End date in format of 'YYYY-MM-DD' (NULL or character). If NULL then the last date of the infile is used.

country_code

Either a country code in iso3c format or from the following: 'AFR' for Africa, 'EUR' for Europe, 'TOT' for the total disc, or 'S_A' for an arbitrary region selection (character). If a country is passed the data from within this country is extracted, else a rectangular box is visualized. Directly provided latitude and longitude ranges will be ignored in case of 'AFR', 'EUR' or 'TOT'.

lon_min

Longitude of lower left corner (NULL or numeric). If NULL then the smallest longitude of the infile is used.

lon_max

Longitude of upper right left corner (NULL or numeric). If NULL then the largest longitude of the infile is used.

lat_min

Latitude of lower left corner (NULL or numeric). If NULL then the smallest latitude of the infile is used.

lat_max

Latitude of upper right corner (NULL or numeric). If NULL then the largest latitude of the infile is used.

outfile_name

Filename of the PNG or MP4 outfile (NULL or character). If NULL then a name is computed from the current configuration. Please match the file ending according to the output_format.

output_format

Specification of output format (either 'graphic' for PNG or 'animation' for MP4).

animation_pace

Pace of the animation in seconds (positive numeric). This only has an effect if output_format == 'animation'.

freeze_animation

If TRUE then the animation will freeze at the last frame (logical).

min_value

Lower values than this are ignored (NULL or numeric). If NULL, no values are ignored.

max_value

Larger values than this are ignored (NULL or numeric). If NULL, no values are ignored.

nbreaks

Number of color breaks (NULL or positive integer). A value will be computed if NULL is passed.

language

Language used for title, legend, etc. in plots (either 'eng' for English or 'deu' for German).

keep_files

A flag indicating whether all files created in the process of obtaining the output file should be kept (logical). If false, all intermediate results are deleted, otherwise all are kept. Keeping these files could improve performance in further function calls.

states

Whether to crop/plot administration level of states (logical).

attach

Whether to temporaly merge the infile to an already existing one. (logical).

infile_attach

File to attach the infile to. When 'auto', a suitable file will be searched in out_dir. If attach is false, this will be ignored(character).

analyze_method

Two analyze methods: mean == FALSE; accumulate == TRUE (logical) (Warming Stripes Plots, Time Series Plots, Trend Plots)

selected_number

Timesteps of the same selected time range (Warming Stripes Plots, Time Series Plots, Trend Plots)

color_pal

Color option for stripe and anomaly plots

relative

Use relative values for anomaly plots

circ_plot

Circular stripe plots (logical)

Whether to add the DWD logo (logical).

verbose

Whether to display progress messages (logical).

nc

Alternatively to infile you can specify the input as an object of class ncdf4 (as returned from ncdf4::nc_open).

Details

Circular stripe plots are inspired by Emanuele Bevacqua (see emanuele.bevacqua.eu)

You can pass a YAML config file and/or specify the arguments directly. Argument prioritization is done in the following way: Direct argument > config argument > default argument. Thus, if you pass a existing config file but also want to modify a specific argument you can do that easily.


[Package cmsafvis version 1.2.3 Index]