plotSD: plotSD

plotSDR Documentation

plotSD

Description

Plot a size distribution from CDP, FSSP, 2DC (1DC), UHSAS, etc.

Usage

plotSD(
  data,
  CellLimits = NA,
  logAxis = "",
  ucon = rep(NA, 5),
  col = "blue",
  FirstCell = rep(1, 5),
  title = NA,
  lwd = rep(2, 5),
  xlim = NA,
  ylim = NA,
  CDF = FALSE,
  LWC = FALSE,
  addBar = FALSE,
  ADD = FALSE,
  legend.position = NA,
  ...
)

Arguments

data

A data.frame containing "Time" and one size-distribution variable to be plotted, as the second column after "Time". Example: CCDP_LWOI. To add other variables, call this function again with the other size-distribution variables and .ADD=TRUE. It may be necessary to supply xlim spanning all sizes with the first call because this is not reset. An example of a suitable data.frame is generated from "D <- getNetCDF('/Data/CSET/CSETrf06.nc', c('CCDP_', 'C1DC_'), 173000, 173500)". Then make individual calls for each size distribution: "plotSD(D[ , c('Time', 'CCDP_LWOI')], CellLimits=NA)" and "plotSD(D[ , c('Time', 'C1DC_LWOO')], CellLimits=NA, ucon=1.e-4, ADD=TRUE)".

CellLimits

A vector containing the bin limits for the data. This is usually obtained from "attr(Data$CCDP_LWOI, 'CellSizes'). It represents the lower limits of the bins, so it should have one more entry than the number of columns in data to represent the upper limit of the last bin. The deault is a vector of bin limits applicable to the CDP. If the supplied value is NA, the vector will be loaded from the attribute. In this case, if the attribute is unavailable, the function will fail. Don't use the standard plot parameter 'log' because, while logarithmic axes will be generated, the weighted distribution won't be constructed.

logAxis

A string indicating which axes should be logarithmic; e.g., logAxis='xy' for both logarithmic.

ucon

A numeric value specifying the unit conversion factor (e.g., 1.e-3 for /L to /cc). The default is 'NA', in which case the conversion factor will be 1 for CDP or FSSP or UHSAS variables and 1.e-3 for 2DC or 1DC variables (normally specified in units of /L).

col

Color for the plotted size distribution. Default: 'blue'.

FirstCell

The first cell to include. Default is 1; use 3 or higher for the 2D probe. For multiple probes, this can be a vector with an entry for each probe in order.

title

A title for the plot. The default is the data and time range used for the data. You can suppress this with "title = ”" and then add your own title, perhaps including the concentration, mean diameter, and standard deviation in diameter as returned from the function.

lwd

Line width(s); default is 2.

xlim

Limits for the abscissa of the plot. Default is to take this from the range of data.

ylim

Limits for the ordinate of the plot. Default is to take this from the range of data.

CDF

Include a cumulative distribution function? (Default is FALSE.)

LWC

Construct the plot to show the distribution of liquid water content in logarithmic intervals.

addBar

Plot an indication of the mean diameter and standard deviation for all the probes included in the plot. Default is FALSE.

ADD

A logical flag that, if true, does not generate the plot frame and axes but instead just adds a new line to an existing plot. This will not reset the scales, so it may be necessary to set them with the first call. log-x and log-y will be reloaded from the preceding call. A legend can be added after the last call with a statement like "legend('topright', legend=c('CDP', '2DC'), lwd=c(2,2), col=c('blue', 'forestgreen'))

legend.position

If set, place legend as specified (e.g., 'topright'). Defaults use 'topright' for normal size distributions and 'topleft' for LWC plots.

...

Additional arguments passed to the plot routine to control graphics parameters etc.

Details

The size distribution can be plotted with linear or log abscissa and linear or log ordinate. If the ordinate is log, the plotted variable is the size distribution weighted by the particle size, as appropriate for a logarithmic density function. Several size distributions can be combined on one plot. The size distribution will be averaged over all rows in the data.frame, so the time range should be limited before calling. Because subsetting removes attributes, save the 'CellSizes' attribute before subsetting. Here is example code: D <- getNetCDF('/Data/CSET/CSETrf06.nc', c('CCDP_', 'C1DC_'), 173000, 173500) T <- plotSD(D, CellLimits=NA, logAxis='xy', xlim=c(1,1000)) title(bquote('CDP concentration' == .(format(T[1], digits=3)) ~ cm^"-3" ~ ' mean diameter' == .(format(T[2], digits=3)) ~ mu*"m")) T <- plotSD(D[, c("Time", "C1DC_LWOO")], CellLimits=NA, ucon=1.e-3, col='forestgreen', ADD=TRUE) legend('topright', legend=c('CDP', '2DC'), lwd=c(2,2), col=c('blue', 'forestgreen'))

Value

T – The result is the plot, but the mean concentration, mean diameter, standard deviation in the diameter, and liquid water content (assuming all particles are liquid) are returned in a four-component vector. This is for possible plot annotation in, e.g., a plot title. An example of a plot title is: "title(bquote('concentration' == .(format(T[1], digits=3)) ~ cm^"-3" ~ ' mean diameter' == .(format(T[2], digits=3)) ~ mu*"m"))"

Author(s)

William Cooper


NCAR/Ranadu documentation built on Jan. 27, 2023, 1:09 a.m.