[89] | 1 | |
---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
| 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
| 4 | |
---|
| 5 | <!-- Generated by IDLdoc 2.0 --> |
---|
| 6 | |
---|
| 7 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
| 8 | <head> |
---|
| 9 | <title>spl_keep_mean.pro (IDLdoc API documentation)</title> |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | <link rel="stylesheet" type="text/css" media="all" href="./../main_files.css" /> |
---|
| 13 | <link rel="stylesheet" type="text/css" media="print" href="./../main_files_print.css" /> |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | <script type="text/javascript"> |
---|
| 17 | function setTitle() { |
---|
| 18 | parent.document.title="spl_keep_mean.pro (IDLdoc API documentation)"; |
---|
| 19 | } |
---|
| 20 | </script> |
---|
| 21 | </head> |
---|
| 22 | |
---|
| 23 | <body onload="setTitle();"> |
---|
| 24 | |
---|
| 25 | <div id="navbar_title"> |
---|
| 26 | <h1>IDLdoc API documentation</h1> |
---|
| 27 | </div> |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | <div id="main_navbar"> |
---|
| 31 | |
---|
| 32 | <table cellspacing="0"> |
---|
| 33 | <tr> |
---|
| 34 | |
---|
| 35 | <td><a href="./../overview.html?format=raw" title="Overview of library">Overview</a></td> |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | <td >Directory</td> |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | <td><a href="./../idldoc-categories.html?format=raw" title="Browse library by category">Categories</a></td> |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | <td><a href="./../idldoc-index.html?format=raw" title="Index of files, routines, and parameters">Index</a></td> |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | <td><a href="./../search-page.html?format=raw" title="Search library">Search</a></td> |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | <td id="selected">File</td> |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | <td >Source</td> |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | <td><a href="./../idldoc-help.html?format=raw" title="Help on IDLdoc">Help</a></td> |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | <td >Etc</td> |
---|
| 65 | |
---|
| 66 | <td id="flexible">Developer documentation</td> |
---|
| 67 | </tr> |
---|
| 68 | </table> |
---|
| 69 | |
---|
| 70 | </div> |
---|
| 71 | |
---|
| 72 | <div id="secondary_navbar"> |
---|
| 73 | |
---|
| 74 | <a href="spl_incr.html"><<prev file</a> | <a href="square2quadrilateral.html">next file >></a> <a href="spl_keep_mean.html" target="_TOP">view single page</a> | <a href="./../index.html?format=raw" target="_TOP">view frames</a> summary: fields | routine details: <a href="#routine_details">routine</a> |
---|
| 75 | |
---|
| 76 | </div> |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | <div id="container"> |
---|
| 80 | |
---|
| 81 | <h1 class="directory"><a href="directory-overview.html?format=raw">Interpolation/</a></h1> |
---|
| 82 | <h2 class="pro_file">spl_keep_mean.pro</h2> |
---|
| 83 | |
---|
| 84 | <div id="file_attr"> |
---|
| 85 | <dl> |
---|
| 86 | </dl> |
---|
| 87 | </div> |
---|
| 88 | |
---|
| 89 | <div id="file_comments"></div> |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | <div id="routine_details"> |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | <div class="routine_details" id="_spl_keep_mean"> |
---|
| 103 | |
---|
| 104 | <h2><a class="top" href="#container">top</a>spl_keep_mean </h2> |
---|
| 105 | |
---|
| 106 | <p class="header"> |
---|
| 107 | <span class="result">result = </span>spl_keep_mean(<span class="result"><a href="#_spl_keep_mean_param_x">x</a>, <a href="#_spl_keep_mean_param_yin">yin</a>, <a href="#_spl_keep_mean_param_x2">x2</a></span>, <a href="#_spl_keep_mean_keyword_YP0">YP0</a>=<span class="result">YP0</span>, <a href="#_spl_keep_mean_keyword_YPN_1">YPN_1</a>=<span class="result">YPN_1</span>, <a href="#_spl_keep_mean_keyword_GE0">GE0</a>=<span class="result">GE0</span>)</p> |
---|
| 108 | |
---|
| 109 | <div class="comments"> |
---|
| 110 | NAME:spl_keep_mean |
---|
| 111 | |
---|
| 112 | PURPOSE: |
---|
| 113 | |
---|
| 114 | Given the arrays X and Y, which tabulate a function (with the X[i] |
---|
| 115 | AND Y[i] in ascending order), and given an input value X2, the |
---|
| 116 | SPL_INCR function returns an interpolated value for the given values |
---|
| 117 | of X2. The interpolation method is based on cubic spline, corrected |
---|
| 118 | in a way that integral of the interpolated values is the same as the |
---|
| 119 | integral of the input values. (-> for exemple to build daily data |
---|
| 120 | from monthly mean and keep the monthly mean of the computed daily |
---|
| 121 | data equa to the original values) |
---|
| 122 | |
---|
| 123 | CATEGORY: |
---|
| 124 | |
---|
| 125 | CALLING SEQUENCE: y2 = spl_keep_mean(x, y, x2) |
---|
| 126 | |
---|
| 127 | INPUTS: |
---|
| 128 | |
---|
| 129 | x: An n-element (at least 2) input vector that specifies the |
---|
| 130 | tabulate points in a strict ascending order. |
---|
| 131 | |
---|
| 132 | y: an array with one element less than x. y[i] represents the |
---|
| 133 | mean value between x[i] and x[i+1]. if /GE0 is activated, y must |
---|
| 134 | have positive values. |
---|
| 135 | |
---|
| 136 | x2: The input values for which the interpolated values are |
---|
| 137 | desired. Its values must be strictly monotonically increasing. |
---|
| 138 | |
---|
| 139 | KEYWORD PARAMETERS: |
---|
| 140 | |
---|
| 141 | /GE0: to force that y2 is always GE than 0. In that case, y must |
---|
| 142 | also be GE than 0. |
---|
| 143 | |
---|
| 144 | YP0: The first derivative of the interpolating function at the |
---|
| 145 | point X0. If YP0 is omitted, the second derivative at the |
---|
| 146 | boundary is set to zero, resulting in a "natural spline." |
---|
| 147 | |
---|
| 148 | YPN_1: The first derivative of the interpolating function at the |
---|
| 149 | point Xn-1. If YPN_1 is omitted, the second derivative at the |
---|
| 150 | boundary is set to zero, resulting in a "natural spline." |
---|
| 151 | |
---|
| 152 | OUTPUTS: |
---|
| 153 | |
---|
| 154 | y2: the meean value between two consecutive values of x2. This |
---|
| 155 | array has one element less than y2. y2 has double precision. |
---|
| 156 | |
---|
| 157 | COMMON BLOCKS: none |
---|
| 158 | |
---|
| 159 | SIDE EFFECTS: ? |
---|
| 160 | |
---|
| 161 | RESTRICTIONS: |
---|
| 162 | It might be possible that y2 has very small negative values |
---|
| 163 | (amplitude smaller than 1.e-6)... |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | EXAMPLE: |
---|
| 167 | |
---|
| 168 | 12 monthly values of precipitations into daily values: |
---|
| 169 | |
---|
| 170 | yr1 = 1990 |
---|
| 171 | yr2 = 1992 |
---|
| 172 | nyr = yr2-yr1+1 |
---|
| 173 | n1 = 12*nyr+1 |
---|
| 174 | x = julday(1+findgen(n1), replicate(1, n1) $ |
---|
| 175 | , replicate(yr1, n1), fltarr(n1)) |
---|
| 176 | n2 = 365*nyr + total(leapyr(yr1+indgen(nyr))) + 1 |
---|
| 177 | x2 = julday(replicate(1, n2), 1+findgen(n2) $ |
---|
| 178 | , replicate(yr1, n2), fltarr(n2)) |
---|
| 179 | y = abs(randomn(0, n1-1)) |
---|
| 180 | y2 = spl_keep_mean(x, y, x2, /ge0) |
---|
| 181 | |
---|
| 182 | print, min(x, max = ma), ma |
---|
| 183 | print, min(x2, max = ma), ma |
---|
| 184 | print, vairdate([min(x, max = ma), ma]) |
---|
| 185 | print, total(y*(x[1:n1-1]-x[0:n1-2])) |
---|
| 186 | print, total(y2*(x2[1:n2-1]-x2[0:n2-2])) |
---|
| 187 | |
---|
| 188 | MODIFICATION HISTORY:</div> |
---|
| 189 | |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | |
---|
| 193 | <h3>Parameters</h3> |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | <h4 id="_spl_keep_mean_param_x">x |
---|
| 197 | |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | </h4> |
---|
| 206 | |
---|
| 207 | <div class="comments"></div> |
---|
| 208 | |
---|
| 209 | <h4 id="_spl_keep_mean_param_yin">yin |
---|
| 210 | |
---|
| 211 | |
---|
| 212 | |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | </h4> |
---|
| 219 | |
---|
| 220 | <div class="comments"></div> |
---|
| 221 | |
---|
| 222 | <h4 id="_spl_keep_mean_param_x2">x2 |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | </h4> |
---|
| 232 | |
---|
| 233 | <div class="comments"></div> |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | |
---|
| 240 | <h3>Keywords</h3> |
---|
| 241 | |
---|
| 242 | <h4 id="_spl_keep_mean_keyword_YP0">YP0 |
---|
| 243 | |
---|
| 244 | |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | |
---|
| 251 | </h4> |
---|
| 252 | |
---|
| 253 | <div class="comments"></div> |
---|
| 254 | |
---|
| 255 | <h4 id="_spl_keep_mean_keyword_YPN_1">YPN_1 |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | </h4> |
---|
| 265 | |
---|
| 266 | <div class="comments"></div> |
---|
| 267 | |
---|
| 268 | <h4 id="_spl_keep_mean_keyword_GE0">GE0 |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | |
---|
| 274 | |
---|
| 275 | |
---|
| 276 | |
---|
| 277 | </h4> |
---|
| 278 | |
---|
| 279 | <div class="comments"></div> |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | |
---|
| 287 | |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | |
---|
| 292 | |
---|
| 293 | |
---|
| 294 | |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | |
---|
| 302 | |
---|
| 303 | |
---|
| 304 | |
---|
| 305 | |
---|
| 306 | </div> |
---|
| 307 | |
---|
| 308 | </div> |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | |
---|
| 312 | <div id="tagline">Produced by IDLdoc 2.0.</div> |
---|
| 313 | |
---|
| 314 | </div> |
---|
| 315 | |
---|
| 316 | </body> |
---|
| 317 | </html> |
---|