devtools::use_build_ignore("Speed_Precip_Compliance")
library(weathermetrics)

Compliance of Wind Speed conversions:

Knots to other speed units:

Testing compliance of Wind Speed conversions for knots to other units of measure using the knots_to_speed function in the weathermetrics package with the National Oceanic and Atmospheric Administration's online wind speed converter (accessed February 22, 2016).

The following examples convert from 10 knots to mph, mps, fps, and kmph.

#knots to mph
mph <- knots_to_speed(10, "mph", round = 3)
mph

The value from the above example using the knots_to_speed function, r mph mph, complies with that obtained using the NOAA converter, which returns a value of 11.5 mph for a value of 10 knots.

#knots to mps
mps <- knots_to_speed(10, "mps", round = 1)
mps

The value from the above example using the knots_to_speed function, r mpsmps, complies with that obtained using the NOAA converter, which returns a value of 5.1 mps for a value of 10 knots.

#knots to ftps
ftps <- knots_to_speed(10, "ftps", round = 1)
ftps

The value from the above example using the knots_to_speed function, r ftps ftps, complies with that obtained using the NOAA converter, which returns a value of 16.9 ftps for a value of 10 knots.

#knots to kmph
kmph <- knots_to_speed(10, "kmph", round = 3)
kmph

The value from the above example using the knots_to_speed function, r kmph kmph, complies with that obtained using the NOAA converter, which returns a value of 18.5 kmph for a value of 10 knots.

Common speed units to knots:

Testing compliance of Wind Speed conversions for common wind speed units (mph, mps, ftps, kmph) to knots using the speed_to_knots function in the weathermetrics package with the National Oceanic and Atmospheric Administration's online wind speed converter (accessed February 22, 2016).

The following examples convert from 10 mph, mps, fps, and kmph, to knots.

#mph to knots
knots <- speed_to_knots(10, "mph", round = 2)
knots

The value from the above example using the speed_to_knots function, r knots knots, complies with that obtained using the NOAA converter, which returns a value of 8.7 knots for a value of 10 mph.

#mps to knots
knots <- speed_to_knots(10, "mps", round = 1)
knots

The value from the above example using the speed_to_knots function, r knots knots, complies with that obtained using the NOAA converter, which returns a value of 19.4 knots for a value of 10 mps.

#ftps to knots
knots <- speed_to_knots(10, "ftps", round = 2)
knots

The value from the above example using the speed_to_knots function, r knots knots, complies with that obtained using the NOAA converter, which returns a value of 5.9 knots for a value of 10 ftps.

#kmph to knots
knots <- speed_to_knots(10, "kmph", round = 2)
knots

The value from the above example using the speed_to_knots function, r knots knots, complies with that obtained using the NOAA converter, which returns a value of 5.4 knots for a value of 10 kmph.

Example converting from one speed unit, through knots, to another:

Testing compliance of Wind Speed conversions for common wind speed units (mph, mps, ftps, kmph) to another common wind speed unit converting through knots, using the speed_to_knots and knots_to_speed functions in the weathermetrics package with the National Oceanic and Atmospheric Administration's online wind speed converter (accessed February 22, 2016).

The following examples converts 10 mph to kmph, converting through knots.

knots <- speed_to_knots(10, "mph", round = 1)
kmph <- knots_to_speed(knots, "kmph", round = 1)
kmph

The value from the above example using the speed_to_knots and knots_to_speed functions to convert from 10 mph to kmph, r kmph kmph, complies with that obtained using the NOAA converter, which returns a value of 16.1 kmph for a value of 10 mph.

Check the convert_wind_speed funciton:

#knots to all
convert_wind_speed(10, "knots", "mph")
convert_wind_speed(10, "knots", "mps")
convert_wind_speed(10, "knots", "kmph")
convert_wind_speed(10, "knots", "ftps")
#mph to all
convert_wind_speed(10, "mph", "knots")
convert_wind_speed(10, "mph", "mps")
convert_wind_speed(10, "mph", "kmph")
convert_wind_speed(10, "mph", "ftps")
#mps to all
convert_wind_speed(10, "mps", "knots")
convert_wind_speed(10, "mps", "mph")
convert_wind_speed(10, "mps", "kmph")
convert_wind_speed(10, "mps", "ftps")
#kmph to all
convert_wind_speed(10, "kmph", "knots")
convert_wind_speed(10, "kmph", "mph")
convert_wind_speed(10, "kmph", "mps")
convert_wind_speed(10, "kmph", "ftps")
#ftps to all
convert_wind_speed(10, "ftps", "knots")
convert_wind_speed(10, "ftps", "mph")
convert_wind_speed(10, "ftps", "mps")
convert_wind_speed(10, "ftps", "kmph")

Compliance of Precipitation Conversions

inches_to_metric(10, "mm")
inches_to_metric(10, "cm")
metric_to_inches(10, "mm")
metric_to_inches(10, "cm")
convert_precip(254, "mm", "cm")
convert_precip(25.4, "cm", "mm")


geanders/weathermetrics documentation built on May 17, 2019, 12:14 a.m.