diff --git a/DESCRIPTION b/DESCRIPTION index aca2c02..a933b89 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,9 +11,9 @@ Suggests: loadeR.ECOMS, visualizeR Type: Package -Title: A climate4R Package for Handling Unit Transformations and Variable derivation -Version: 0.1.0 -Date: 2018-06-25 +Title: A climate4R Package for Performing Unit Conversion and Variable Derivation +Version: 0.1.1 +Date: 2018-06-26 Authors@R: as.person(c( "Santander Meteorology Group [cph]", "Joaquin Bedia [aut, cre]", diff --git a/NAMESPACE b/NAMESPACE index a934147..3ad1767 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ export(hurs2huss) export(hurs2w) export(huss2hurs) +export(huss2pvp) export(rad2cc) export(tas2ws) export(udConvertGrid) diff --git a/NEWS b/NEWS index c762943..660f7af 100644 --- a/NEWS +++ b/NEWS @@ -3,4 +3,12 @@ ## v0.1.0 * First public release with the `udConvertGrid` function for grid unit conversion * Derivation utilities `rad2cc` and `huss2hurs` - * Added example datasets from NCEP reanalysis \ No newline at end of file + * Added example datasets from NCEP reanalysis + +## v0.1.1 + * New derivation functions: + * `hurs2w` for water vapor mixing ratio estimation + * `hurs2huss` for conversion from relative to specific humidity + * `huss2pvp`, for partial vapor pressure estimation from specific humidity + * Add references to methods + * Other minor changes and documentation updates diff --git a/R/huss2hurs.R b/R/huss2hurs.R index 4af2798..bf93f80 100644 --- a/R/huss2hurs.R +++ b/R/huss2hurs.R @@ -79,7 +79,7 @@ huss2hurs <- function(huss, ps, tas) { huss <- ws <- ps <- NULL hurs <- suppressWarnings(bindGrid(l, dimension = "member")) hurs$Variable$varName <- "hurs" - wt$Variable$level <- NULL + hurs$Variable$level <- NULL attr(hurs$Variable, "units") <- "%" attr(hurs$Variable, "longname") <- "Surface_air_relative_humidity" attr(hurs$Variable, "description") <- "Estimated relative humidity from saturation pressure and specific humidity" diff --git a/README.md b/README.md index 5f257ae..e30861f 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ `convertR` is an R package performing unit conversion and variable derivation using the [**climate4R**](http://meteo.unican.es/climate4r) Common Data Model. -Unit conversion is done via the Unidata's [UDUNITS](https://www.unidata.ucar.edu/software/udunits/) software libraries, tailoring the functionalities of the R package `udunits2` to the **climate4R** framework. +Unit conversion is done via the Unidata's [UDUNITS-2](https://www.unidata.ucar.edu/software/udunits/) software libraries, tailoring the functionalities of the R package `udunits2` to the **climate4R** framework. diff --git a/man/hurs2huss.Rd b/man/hurs2huss.Rd index d13b3fe..6203379 100644 --- a/man/hurs2huss.Rd +++ b/man/hurs2huss.Rd @@ -49,8 +49,8 @@ spatialPlot(climatology(hurs), rev.colors = TRUE, backdrop.theme = "coastline") } \seealso{ Other derivation: \code{\link{hurs2w}}, - \code{\link{huss2hurs}}, \code{\link{rad2cc}}, - \code{\link{tas2ws}} + \code{\link{huss2hurs}}, \code{\link{huss2pvp}}, + \code{\link{rad2cc}}, \code{\link{tas2ws}} } \author{ J. Bedia, S. Herrera diff --git a/man/hurs2w.Rd b/man/hurs2w.Rd index ab721ed..00ab5f3 100644 --- a/man/hurs2w.Rd +++ b/man/hurs2w.Rd @@ -59,8 +59,8 @@ spatialPlot(climatology(w), rev.colors = TRUE, backdrop.theme = "coastline") } \seealso{ Other derivation: \code{\link{hurs2huss}}, - \code{\link{huss2hurs}}, \code{\link{rad2cc}}, - \code{\link{tas2ws}} + \code{\link{huss2hurs}}, \code{\link{huss2pvp}}, + \code{\link{rad2cc}}, \code{\link{tas2ws}} } \author{ J. Bedia, S. Herrera diff --git a/man/huss2hurs.Rd b/man/huss2hurs.Rd index 0a5714d..a036ae5 100644 --- a/man/huss2hurs.Rd +++ b/man/huss2hurs.Rd @@ -45,8 +45,8 @@ spatialPlot(climatology(hurs), rev.colors = TRUE, backdrop.theme = "coastline") } \seealso{ Other derivation: \code{\link{hurs2huss}}, - \code{\link{hurs2w}}, \code{\link{rad2cc}}, - \code{\link{tas2ws}} + \code{\link{hurs2w}}, \code{\link{huss2pvp}}, + \code{\link{rad2cc}}, \code{\link{tas2ws}} } \author{ J. Bedia, S. Herrera diff --git a/man/huss2pvp.Rd b/man/huss2pvp.Rd new file mode 100644 index 0000000..e393cf1 --- /dev/null +++ b/man/huss2pvp.Rd @@ -0,0 +1,54 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/huss2pvp.R +\name{huss2pvp} +\alias{huss2pvp} +\title{Specific humidity to partial vapor pressure conversion} +\usage{ +huss2pvp(huss, ps) +} +\arguments{ +\item{huss}{Specific humidity grid} + +\item{ps}{Surface pressure} +} +\value{ +A climate4R CDM grid of partial vapor pressure (in Pascals) +} +\description{ +Specific humidity to partial vapor pressure conversion using surface pressure and specific humidity +} +\details{ +The partial pressure of a gaseous constituent of air (water vapor in this case) + is the pressure which it alone would exert with unchanged temperature and number of moles per unit volume. +} +\section{Input units}{ + +In principle, the derivation functions will work regardless of the input units, as all units are internally + converted as necessary according to the specific formulae definitions. + However, the units string (see \code{\link[transformeR]{getGridUnits}}) must be parseable. In the same vein, + the input units need to be convertible to the required ones. Unit consistency is internally achieved + by the function \code{\link{udConvertGrid}}. +} + +\examples{ +data("ps.iberia") +data("huss.iberia") +pvp <- huss2pvp(huss = huss.iberia, ps = ps.iberia) +\dontrun{ +require(visualizeR) +spatialPlot(climatology(pvp), rev.colors = TRUE, backdrop.theme = "coastline") +} +} +\references{ +\itemize{ +\item Gregory, D. (2000), Atmospheric thermodynamics. By Craig F. Bohren and Bruce A. Albrecht. Oxford University Press. xiv + 402 pp. Price £49.50 (hardback). ISBN 019 5099044. Q.J.R. Meteorol. Soc., 126: 2631-2632. doi:10.1002/qj.49712656815 +} +} +\seealso{ +Other derivation: \code{\link{hurs2huss}}, + \code{\link{hurs2w}}, \code{\link{huss2hurs}}, + \code{\link{rad2cc}}, \code{\link{tas2ws}} +} +\author{ +J. Bedia, S. Herrera +} diff --git a/man/rad2cc.Rd b/man/rad2cc.Rd index 08c3c6d..e515540 100644 --- a/man/rad2cc.Rd +++ b/man/rad2cc.Rd @@ -45,7 +45,7 @@ identical(cc2, cc) \seealso{ Other derivation: \code{\link{hurs2huss}}, \code{\link{hurs2w}}, \code{\link{huss2hurs}}, - \code{\link{tas2ws}} + \code{\link{huss2pvp}}, \code{\link{tas2ws}} } \author{ J. Bedia, S. Herrera diff --git a/man/tas2ws.Rd b/man/tas2ws.Rd index 69ec54f..d7a69e6 100644 --- a/man/tas2ws.Rd +++ b/man/tas2ws.Rd @@ -12,11 +12,16 @@ tas2ws(tas, ps) \item{ps}{Surface pressure} } \value{ -A climate4R grid of saturation pressure (in atm) +A climate4R CDM grid of water vapor saturation pressure (in atm) } \description{ Calculates the saturation pressure using near-surface air temperature and surface pressure data } +\details{ +The vapour pressure of water is the pressure at which water vapour is in thermodynamic equilibrium + with its condensed state. At higher pressures water would condense. At this equilibrium condition + the vapor pressure is the saturation pressure. +} \section{Input units}{ In principle, the derivation functions will work regardless of the input units, as all units are internally @@ -43,7 +48,7 @@ spatialPlot(climatology(ws), backdrop.theme = "coastline") \seealso{ Other derivation: \code{\link{hurs2huss}}, \code{\link{hurs2w}}, \code{\link{huss2hurs}}, - \code{\link{rad2cc}} + \code{\link{huss2pvp}}, \code{\link{rad2cc}} } \author{ J. Bedia, S. Herrera