qair2rh.html 4.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of qair2rh</title>
  <meta name="keywords" content="qair2rh">
  <meta name="description" content="Convert specific humitidy to relative humidity.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">utilities</a> &gt; qair2rh.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for utilities&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>qair2rh
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Convert specific humitidy to relative humidity.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function rh = qair2rh(qair, temp, press) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> 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)</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function rh = qair2rh(qair, temp, press)</a>
0002 <span class="comment">% Convert specific humitidy to relative humidity.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% INPUTS:</span>
0005 <span class="comment">%   qair - Specific humidity. Dimensionless ratio of water mass /</span>
0006 <span class="comment">%       total air mass (0-1).</span>
0007 <span class="comment">%   temp - Temperature. Celsius.</span>
0008 <span class="comment">%   press - Pressure, optional. Millibar. Assume as 1013.25 if</span>
0009 <span class="comment">%       missing.</span>
0010 <span class="comment">%</span>
0011 <span class="comment">% OUTPUT:</span>
0012 <span class="comment">%   rh  - relative humidity, ratio of actual water mixing ratio to</span>
0013 <span class="comment">%       saturation mixing ratio.</span>
0014 <span class="comment">%</span>
0015 <span class="comment">% NOTES:</span>
0016 <span class="comment">%   Translated from the R code here:</span>
0017 <span class="comment">%       http://earthscience.stackexchange.com/questions/2360</span>
0018 <span class="comment">%</span>
0019 <span class="comment">% Author(s):</span>
0020 <span class="comment">%   Pierre Cazenave (Plymouth Marine Laboratory)</span>
0021 
0022 <span class="keyword">if</span> nargin == 2
0023     press = 1013.25;
0024 <span class="keyword">end</span>
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 &gt; 1) = 1;
0029 rh(rh &lt; 0) = 0;</pre></div>
92
<hr><address>Generated on Wed 20-Feb-2019 16:06:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
93 94
</body>
</html>