The Package

October 11, 2007

Version 1.2-8

Date 2004-10-16

Title Tools for plotting skew-T diagrams and profiles

Author Tim Hoar, Eric Gilleland, Doug Nychka

Maintainer Tim Hoar

Description RadioSonde is a collection of programs for reading and plotting SKEW-T,log p diagrams and wind profiles for data collected by (the typical weather -borne instrument), which we will call “flights”, “sondes”, or “profiles” throughout the associated documentation. The raw data files are in a common format that has a header followed by specific variables. Use “help(ExampleSonde)” for the full explanation of the data files.

License GPL (Version 2 or later)

URL http://www.image.ucar.edu/Software/RadioSonde

R topics documented:

ExampleSonde ...... 2 PWV ...... 4 RadioSonde internal ...... 5 getsonde ...... 5 plotsonde ...... 8 plotwind ...... 9 sample.sonde ...... 10 skewt.axis ...... 11 skewt.lines ...... 13 skewt.points ...... 14 station.symbol ...... 15

Index 17

1 2 ExampleSonde

ExampleSonde Example Sonde/Balloon/Profiler Data

Description This data was collected by a radiosonde which was carried aloft by a weather balloon. This data was collected as part of a special field program, but the instrument and data formats are very common in the atmospheric community.

Fundamentally; temperature, pressure, and sensors are bundled with a transmitter and are either sent aloft on a balloon (rawindsonde) or tied to a small parachute and dropped from a plane (). Either way, the location of the sonde is observed (either visually or with GPS), the data from the radio transmitter recorded, and the result is an ascii file that contains a header (of varying length) with descriptive information followed by a table of information.

For rawindsondes, the first entry for the table is actually the surface data from the , but the remaining entries are from the sonde. Also, the wind is inferred from the position of the balloon. Since this is real data, there are missing values – which arise all the time. If you get a profile without missing values, you can be sure it is synthetic or interpolated. The datastreme ends when the operator calls it quits. This happens when a) the balloon breaks, or b) the radio reception has so many dropouts that is is not worth it anymore. Different fields have different missing flags. Where possible, we replace the "standard" missing flags with NaN

Format ExampleSonde is the nominal output and is a mixture of ancillary data (contained in the first ???? lines of the file), and the instrument measures and some derived fields that follow in a fixed-format table with an unknown number of lines.

Field varname width format description units missing value [ 1] time 6 F6.1 Time Seconds 9999.0 [ 2] press 6 F6.1 Pressure Millibars 9999.0 [ 3] temp 5 F5.1 Dry-bulb Temperature Degrees C 999.0 [ 4] dewpt 5 F5.1 Dew Point Temperature Degrees C 999.0 [ 5] rhum 5 F5.1 Relative Humidity Percent 999.0 [ 6] uwind 6 F6.1 U Wind Component Meters/Second 9999.0 [ 7] vwind 6 F6.1 V Wind Component Meters/Second 9999.0 [ 8] wspd 5 F5.1 Wind Speed Meters/Second 999.0 [ 9] wdir 5 F5.1 Wind Direction Degrees 999.0 [10] dz 5 F5.1 Ascension Rate Meters/Second 999.0 [11] lon 8 F8.3 Longitude Degrees 9999.0 [12] lat 7 F7.3 Latitude Degrees 999.0 [13] range 5 F5.1 Variable (see below) 999.0 [14] angle 5 F5.1 Variable (see below) 999.0 [15] alt 7 F7.1 Altitude Meters 99999.0 [16] qp 4 F4.1 QC flag for Pressure Code (see below) 99.0 ExampleSonde 3

[17] qt 4 F4.1 QC flag for Temperature Code (see below) 99.0 [18] qh 4 F4.1 QC flag for Humidity Code (see below) 99.0 [19] qu 4 F4.1 QC flag for U Component Code (see below) 99.0 [20] qv 4 F4.1 QC flag for V Component Code (see below) 99.0 [21] quv 4 F4.1 QC flag for Ascension Rate Code (see below) 99.0

The missing value flags are in brackets []. Fields 13 and 14 are ‘variable’ because depending on the sounding system the variables used in these positions can vary.

Fields 16 through 21 contain the Quality Control information (flags) generated at JOSS. These flags are based on the automated or visual checks made.

The JOSS QC flag codes are as follows:

99.0 Unchecked (QC information is ‘missing.’) (‘UNCHECKED’)

1.0 Checked, datum seems physically reasonable. (‘GOOD’)

2.0 Checked, datum seems questionable on physical basis. (‘MAYBE’)

3.0 Checked, datum seems to be in error. (‘BAD’)

4.0 Checked, datum is interpolated. (‘ESTIMATED’)

9.0 Checked, datum was missing in original file. (‘MISSING’)

Source

http://www.joss.ucar.edu/cgi-bin/codiac/dss?2.151

See Also

getsonde, plotsonde, skewt.lines, skewt.points

Examples

filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename) 4 PWV

PWV Precipitable Water Vapor

Description Calculates precipitable water (in mm) up to minp (minimum pressure) using dew-point temperature (td) and temperature (temp) (both in degrees C).

Usage PWV(sonde = NULL, press, td, temp, minp = 400)

Arguments sonde Sonde data read in using getsonde function. press Pressure (only used if sonde is NULL) td Dew-point temperature (in deg C) (only used if sonde is NULL) temp Temperature (in deg C) (only used if sonde is NULL) minp Minimum Pressure

Value single numeric value is returned.

Author(s) Junhong Wang

See Also getsonde, td.to.q

Examples # Example 1 filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename)

###### # OK, now find precipitable water vapor.

PWV( sample.sonde) RadioSonde internal 5

RadioSonde internal RadioSonde internal and secondary functions

Description Listed below are supporting functions for the major methods in RadioSonde.

Usage

satlft(thw, p)

skewt.data

skewtx(temp, ycoord)

skewty(pres)

sonde.data

td.to.q(temp, td, p)

wobf

getsonde read a radiosonde file to an R dataframe.

Description getsonde takes a common radiosonde data file and reads it in as an R dataframe.

Usage getsonde(filename, datakey="------", varkey=" Time", unitkey=" sec")

Arguments filename Full path and file name of radiosonde data. datakey character string identifying the line preceeding the datastream. The string gets compared to the first N characters of each line, so all whitespace is important! varkey character string identifying the line containing the variable names. The string gets compared to the first N characters of each line, so all whitespace is impor- tant! 6 getsonde

unitkey character string identifying the line containing the units of the variables. The string gets compared to the first N characters of each line, so all whitespace is important!

Details getsonde assumes the data is in a very common format for radiosonde data. The files are typically ASCII files with a header of unknown length stating such things as the location and time of the data collection etc. Appended to this is a table of data where each column is a particular quantity and each row corresponds to the time of the observation. This typically has a header identifying the quantity in each of the columns and is separated from the data by a particular character string. The location of this string in the file is crucial in deciphering the start of the datastream from the metadata. For much more about the file format, go to http://www.cgd.ucar.edu/stats/ RadioSonde or look at the example in ‘RadioSonde/data/ExampleSonde.txt’

Value Returns a dataframe with the following items, if present in the input file. Note that each of these items can be present in any order in the input file.

time time in seconds since weather balloon launched or recording begins. press Pressure in mb. temp Dry-bulb Temperature in degrees C. dewpt Dew point temperature in degrees C. rhum Relative Humidity (Percent). uwind East-West wind component (m/s). vwind North-South wind component (m/s). wspd Wind speed (m/s). wdir Wind direction (deg.). dz Ascension rate of weather balloon (m/s). lon Longitude of weather balloon. lat Latitude of weather balloon . rng Range (see warning below) az Azimuth of weather balloon from originating station (see warning below) alt Altitude of weather balloon (m). qp Quality Control (QC) flag for pressure (see note below) qt QC flag for temperature (see note below) qh QC flag for humidity (see note below) qu QC flag for U Component (see note below) qv QC flag for V Component (see note below) quv QC flag for Ascension rate (see note below) getsonde 7

If the units are avialable in the datafile, they are included in the dataframe as the attribute units.

Rather than throw away the original header information, which usually contains valuable metadata, it is included as another attribute: metadata.

Warning The connotation of fields is not exactly standard. Different recording systems use these fields in different ways. Hence, they cannot be automatically interpreted without knowledge of the recording system.

Note The Quality Control information (flags): qp, qt, qh, qu, qv, and quv are generated at JOSS are based on the automated or visual checks made. The JOSS QC flags are as follows: 99.0 means it is unchecked, 1.0 implies datum seems physically reasonable (good), 2.0 implies datum seems questionable on physical basis (maybe), 3.0 implies datum seems to be in error (bad), 4.0 implies datum is interpolated (estimated), and 9.0 implies datum was missing in original file (missing).

Author(s) Tim Hoar, Eric Gilleland, Doug Nychka

See Also plotsonde , skewt.points , skewt.lines

Examples # Read a typical radiosonde (ASCII) datafile, headers and all. # The datakey,varkey,and unitkey arguments come from examining # the datafile. The whitespace is important.

filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") datakey <- "------" varkey <- " Time" unitkey <- " sec" sample.sonde <- getsonde(filename,datakey,varkey,unitkey) attr(sample.sonde,"units") attr(sample.sonde,"metadata") plotsonde(sample.sonde,title=filename) # # Read the same radiosonde dataset, but ignore the units ... # datakey <- "------" varkey <- " Time" 8 plotsonde

sample.sonde <- getsonde(filename,datakey,varkey) attr(sample.sonde,"metadata")

plotsonde Creates a SKEW-T, log p diagram for a radiosonde dataframe.

Description

Creates a SKEW-T, log p diagram with dry-bulb temperature and dewpoint temperature traces ver- sus (log) pressure. Optionally plots the vertical wind profile using wind barbs.

Usage

plotsonde(dataframe, skewT=TRUE, =FALSE, site="", title="", windplot=NULL, s=3, col=c(1, 2), ... )

Arguments

dataframe R dataframe of a radiosonde dataset (as created by getsonde) skewT Logical value. If false, will not plot the SKEW-T, log p diagram. winds Logical value. If false, will not plot the winds profile. site Optional character to add to plot title. title Title for plot (must be a character value). windplot 4X1 numeric vector that gives the position of wind profile plot (next to SKEW- T diagram). Only used if it is desired to have this plot in a different position. Generally, the default NULL is used and the placement is chosen automatically. s Size of winds profile plot. col Usual plotting parameter. ... Other optional plotting parameters.

Value

No value returned. Creates a plot.

Author(s)

Tim Hoar, Eric Gilleland, Doug Nychka plotwind 9

References 1. Department of Defense, 1969, "USAF SKEW-T, log p DIAGRAM," DOD-WPC-9-16-1, Aero- nautical Chart and Information Center, United States Air Force, St. Louis, Missouri 63118. 2. List, R.J. (editor), 1958, Smithsonian Meteorological Tables, Smithsonian Institute, Washington, D.C. 3. Nordquist, W.S., 1973, "Numerical Approximations of Selected Meteorological Parameters for Cloud Physics Problems," ECOM-5475, Atmospheric Sciences Laboratory, US Army Electronics Command, White Sands Missile Range, New Mexico 88002. 4. Stipanuk, G.S., 1973, "Algorithms for Generating a SKEW-T, log p Diagram and Computing Selected Meteorological Quantities," American Sciences Laboratory, US Army Electronics Com- mand, White Sands Missile Range, New Mexico 88002. 5. http://www.atd.ucar.edu/dir_off/tc_corr/index.html 6. http://weather.unisys.com/upper_air/skew/details.html

See Also getsonde, skewt.axis , skewt.lines , skewt.points

Examples # Example 1 filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename) plotsonde(sample.sonde)

plotwind Winds Profile Plot

Description Creates a wind profile in the standard atmospheric notation. Each full barb = 10 m/s, half barb = 5 m/s, and a filled triangle for 50 m/s. The maximum wind speed that can be plotted without amending the program is 65 m/s.

Usage plotwind(dataframe, size=5, ylim=c(1050, 100), legend=FALSE)

Arguments dataframe Data frame for sounding data, must have components for wind speed wspd, wind direction dir, and pressure press. size change the thickness of the plotted lines ylim plot extent, in units of pressure legend explains wind barb strategy 10 sample.sonde

Details the dataframe must have components for wind speed wspd, wind direction dir, and pressure press. Missing values may be coded as either NA or 999. and are not plotted. The standard atmospheric wind sybmol is a vector of fixed length with barbs proportional to wind speed. A full barb for each 10 m/s, half barbs for 5 m/s and a triangular barb for 50 m/s.

Value None – creates a plot.

Author(s) Eric Gilleland, Tim Hoar, Doug Nychka

See Also getsonde, plotsonde

Examples # Example 1: filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename) plotwind(sample.sonde) # Example 2: plotwind(sample.sonde, size = 7, legend=TRUE)

sample.sonde Example R dataframe for radiosonde observations

Description The sample.sonde data frame has 461 rows and 21 columns. The columns are different physical measurements made during the balloon’s ascent.

Format This data frame contains the following named components:

time Time in seconds from the ballon’s release, a numeric vector. press Pressure (mb), a numeric vector temp Dry-bulb Temperature (deg. C), a numeric vector dewpt Dew point temperaure (deg. C), a numeric vector rh Relative humidity (%), a numeric vector uwind East-West component of the wind, a numeric vector vwind North-South component of the wind, a numeric vector wspd wind speed (m/s), a numeric vector dir Wind direction, a numeric vector skewt.axis 11

dz Ascension rate (m/s), a numeric vector lon Longitude, a numeric vector lat Latitude, a numeric vector rng range, a numeric vector az azimuth (angle along horizon), a numeric vector alt altitude (m), a numeric vector qp QC flag for pressure, a numeric vector qt QC flag for temperature, a numeric vector qh QC flag for humidity, a numeric vector qu QC flag for U component, a numeric vector qv QC flag for V component, a numeric vector quv QC flag for ascension rate, a numeric vector

Note Quality Control (QC) flags are generated locally at JOSS based on either automated or visual checks made. 999.0 implies the QC information is missing, 1.0 implies datum seems physically reasonable (good), 2.0 implies datum questionable on a physical basis (maybe), 3.0 implies datum seems to be in error (bad), 4.0 implies datum interpolated (estimated), 9.0 implies datum missing in original file.

See Also getsonde , skewt.lines, skewt.points, plotsonde

skewt.axis Draws a SKEW-T, log p axis.

Description Draws a SKEW-T, log p axis. This is the standard axis for interpreting profiles like those collected by the instrument carried aloft by a weather balloon (radiosonde). Use skewt.lines or skewt.points to layer information on top of the skewt axis.

Usage skewt.axis(BROWN="brown", GREEN="green", redo=FALSE, ... )

Arguments BROWN Color of lines for both Temperature (solid skewed) and Pressure (dashed hori- zontal) GREEN Color of lines for dry adiabats (solid) and constant mixing ratio (dashed) 12 skewt.axis

redo flag to generate the adiabats, should skewt.data become corrupt. The adia- bats are the result of an iterative process and to make smooth curves, you need a lot of points. Hence this is time-consuming, so [FALSE] is the preferred value. ... The usual plot parameters.

Details Radiosondes record temperature, humidity and winds. They can be lifted by weather , dropped from aircraft, there is even something called a glidersonde. The data collected by radioson- des are plotted versus pressure/height to give details on the vertical structure of the atmosphere. The type of plot is called a SKEW-T, log p diagram. ‘skewt.axis’ creates the traditional axis for a SKEW-T, log p diagram, including moist and dry adiabats, etc ... Generating the necessary plot data is time-consuming, so there is an option to read from a specific dataset that Doug will change.

Value Returns the par()$plt values, which are used by plotsonde if you choose to plot the wind profile adjacent to the skewt axis.

Author(s) Tim Hoar

See Also getsonde, plotsonde, skewt.lines, skewt.points

Examples # draw a background, then # draw the temperature (with a solid line) in color 6 # draw the dewpoint in color 7 # overlay the temperature observations in a different color # you get the point ... # filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename) skewt.axis( mar=c(5.1, 1.1, 2.1, 5.1) ) skewt.lines( sample.sonde$temp, sample.sonde$press, col = 6) skewt.lines( sample.sonde$dewpt, sample.sonde$press, col = 7) skewt.points(sample.sonde$temp, sample.sonde$press, col = 3) skewt.points(sample.sonde$dewpt, sample.sonde$press, col = 4) # # Changing the moist adiabats: you must edit the this-is-escaped-code{ function # directly and then capture the output in this-is-escaped-codenormal-bracket36bracket-normal to be used in # subsequent calls. skewt.data <- skewt.axis(redo=TRUE) skewt.axis() skewt.axis() skewt.lines 13

skewt.lines Overlays data on a SKEW-T, log p axis

Description

Overlays observations as lines on a SKEW-T, log p axis (as created by skewt.axis).

Usage

skewt.lines(temp, pressure, ...)

Arguments

temp Temperature in degrees C. pressure Pressure in millibars ... Any graphical arguments

Details

skewt.lines overlays observations on a SKEW-T, log p axis

See Also

skewt.points, skewt.axis, plotsonde

Examples

# draw a background, then # draw the temperature (with a solid line) in color 6 # draw the dewpoint in color 7 # overlay the temperature observations in a different color # you get the point ...

filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") print(filename) sample.sonde <- getsonde(filename) skewt.axis() skewt.lines( sample.sonde$temp, sample.sonde$press, col = 6) skewt.lines( sample.sonde$dewpt, sample.sonde$press, col = 7) skewt.points(sample.sonde$temp, sample.sonde$press, col = 3) skewt.points(sample.sonde$dewpt, sample.sonde$press, col = 4) 14 skewt.points

skewt.points Overlays data on a SKEW-T, log p axis

Description

Overlays observations on a SKEW-T, log p axis (as created by skewt.axis).

Usage

skewt.points(temp, pressure, ...)

Arguments

temp Temperature in degrees C. pressure Pressure in millibars ... Any graphical arguments

Details

skewt.points overlays observations on a SKEW-T, log p axis

See Also

skewt.axis, skewt.lines, plotsonde

Examples

# draw a background, then # draw the temperature (with a solid line) in color 6 # draw the dewpoint in color 7 # overlay the temperature observations in a different color # you get the point ...

filename <- system.file("exampleData", "ExampleSonde.txt", package = "RadioSonde") sample.sonde <- getsonde(filename) skewt.axis() skewt.lines( sample.sonde$temp, sample.sonde$press, col = 6) skewt.lines( sample.sonde$dewpt, sample.sonde$press, col = 7) skewt.points(sample.sonde$temp, sample.sonde$press, col = 3) skewt.points(sample.sonde$dewpt, sample.sonde$press, col = 4) station.symbol 15

station.symbol Adds a meteorological surface station annotation to a plot.

Description Adds a meteorological surface station annotation at the given coordinates. The annotation includes speed and direction of the wind, temperature, pressure, dewpoint ... to a given plot.

Usage station.symbol(cx, cy, direction = 0, speed = 0, fill = 0, color = "green", temp = NULL, press = NULL, dewpt = NULL, circle=TRUE, cex = 2)

Arguments cx x coordinate for location of the annotation. cy y coordinate for the annotation. direction Wind direction. speed Wind speed. fill Fill for visibility: 0 = clear skies, 1 = 25% obscured, 2 = 50% obscured, 3 = 75% obscured, 4 = no visibility color Fill color. Used only when fill > 0 temp Temperature value to plot symbol (must be a scalar). If NULL then no temper- ature value will be annotated. press Pressure value to plot symbol (must be a scalar). If NULL then no pressure value will be annotated. dewpt Dewpoint Temperature value to plot symbol (must be a scalar). If NULL then no dewpoint value will be annotated. circle If TRUE, will plot the usual station symbol with a circle at its base. cex Usual plotting parameter.

Value Adds to a plot.

Author(s) Doug Nychka, Eric Gilleland

See Also plotsonde, plotwind, skewt.axis 16 station.symbol

Examples plot(0:1, 0:1, type="n") station.symbol(0.5, 0.5, direction=75, speed=30, fill=3, temp=31, press=987, dewpt=26) Index

∗Topic aplot station.symbol, 14 plotsonde, 7 skewt.lines, 12 td.to.q (RadioSonde internal), 4 skewt.points, 13 station.symbol, 14 wobf (RadioSonde internal), 4 ∗Topic datasets ExampleSonde, 1 sample.sonde, 10 ∗Topic hplot plotsonde, 7 plotwind, 9 skewt.axis, 11 ∗Topic internal RadioSonde internal, 4 ∗Topic manip getsonde, 5 PWV, 3 ∗Topic misc RadioSonde internal, 4

ExampleSonde, 1 getsonde, 3, 4, 5, 8, 9, 11, 12 plotsonde, 3, 7, 7, 9, 11–13, 15 plotwind, 9, 15 PWV, 3

RadioSonde internal, 4 sample.sonde, 10 satlft (RadioSonde internal), 4 skewt.axis, 8, 11, 13, 15 skewt.data (RadioSonde internal), 4 skewt.lines, 3, 7, 8, 11, 12, 12, 13 skewt.points, 3, 7, 8, 11, 12, 13, 13 skewtx (RadioSonde internal), 4 skewty (RadioSonde internal), 4 sonde.data (RadioSonde internal), 4

17