Home > utilities > qair2rh.m

# qair2rh

## PURPOSE

Convert specific humitidy to relative humidity.

## SYNOPSIS

function rh = qair2rh(qair, temp, press)

## DESCRIPTION

``` Convert specific humitidy to relative humidity.

INPUTS:
qair - Specific humidity. Dimensionless ratio of water mass /
total air mass (0-1).
temp - Temperature. Celsius.
press - Pressure, optional. Millibar. Assume as 1013.25 if
missing.

OUTPUT:
rh  - relative humidity, ratio of actual water mixing ratio to
saturation mixing ratio.

NOTES:
Translated from the R code here:
http://earthscience.stackexchange.com/questions/2360

Author(s):
Pierre Cazenave (Plymouth Marine Laboratory)```

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

## SOURCE CODE

```0001 function rh = qair2rh(qair, temp, press)
0002 % Convert specific humitidy to relative humidity.
0003 %
0004 % INPUTS:
0005 %   qair - Specific humidity. Dimensionless ratio of water mass /
0006 %       total air mass (0-1).
0007 %   temp - Temperature. Celsius.
0008 %   press - Pressure, optional. Millibar. Assume as 1013.25 if
0009 %       missing.
0010 %
0011 % OUTPUT:
0012 %   rh  - relative humidity, ratio of actual water mixing ratio to
0013 %       saturation mixing ratio.
0014 %
0015 % NOTES:
0016 %   Translated from the R code here:
0017 %       http://earthscience.stackexchange.com/questions/2360
0018 %
0019 % Author(s):
0020 %   Pierre Cazenave (Plymouth Marine Laboratory)
0021
0022 if nargin == 2
0023     press = 1013.25;
0024 end
0025 es = 6.112 .* exp((17.67 .* temp) ./ (temp + 243.5));
0026 e = qair .* press ./ (0.378 .* qair + 0.622);
0027 rh = e ./ es;
0028 rh(rh > 1) = 1;
0029 rh(rh < 0) = 0;```

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005