-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterpolation.html
More file actions
371 lines (352 loc) · 31.3 KB
/
interpolation.html
File metadata and controls
371 lines (352 loc) · 31.3 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Interpolation — 3.2.0+3.gb2780d4a</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/style.css" type="text/css" />
<link rel="shortcut icon" href="_static/favicon.png"/>
<link rel="canonical" href="https://podpac.org/interpolation.html" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="NASA Earth Data Login" href="earthdata.html" />
<link rel="prev" title="Supported Datasets" href="datasets.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html">
<img src="_static/icon.svg" class="logo" alt="Logo"/>
</a>
<div class="version">
3.2.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="settings.html">Settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="aws.html">AWS Integration</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Topics</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="why-podpac.html">Why PODPAC?</a></li>
<li class="toctree-l1"><a class="reference internal" href="design.html">Design</a></li>
<li class="toctree-l1"><a class="reference internal" href="dependencies.html">Dependencies</a></li>
<li class="toctree-l1"><a class="reference internal" href="nodes.html">Nodes</a></li>
<li class="toctree-l1"><a class="reference internal" href="coordinates.html">Coordinates</a></li>
<li class="toctree-l1"><a class="reference internal" href="cache.html">Cache</a></li>
<li class="toctree-l1"><a class="reference internal" href="datasets.html">Supported Datasets</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Interpolation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">Examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#as-a-string">…as a string</a></li>
<li class="toctree-l3"><a class="reference internal" href="#as-a-dictionary">…as a dictionary</a></li>
<li class="toctree-l3"><a class="reference internal" href="#as-a-list">…as a list</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#interpolators">Interpolators</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#nearestneighbor">NearestNeighbor</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="#advanced-nearestneighbor-interpolation-examples">Advanced NearestNeighbor Interpolation Examples</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#notes-and-caveats">Notes and Caveats</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="earthdata.html">NASA Earth Data Login</a></li>
<li class="toctree-l1"><a class="reference internal" href="aws-development.html">AWS Development</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">References</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="wrapping-datasets.html">Wrapping Datasets</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Support</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="references.html">References</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="docs.html">Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="roadmap.html">Development Roadmap</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">PODPAC</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Interpolation</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/interpolation.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="interpolation">
<h1>Interpolation<a class="headerlink" href="#interpolation" title="Permalink to this heading"></a></h1>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this heading"></a></h2>
<p>PODPAC allows users to specify various different interpolation schemes for nodes with
increased granularity, and even lets users write their own interpolators. By default
PODPAC uses the <code class="docutils literal notranslate"><span class="pre">podpac.settings["DEFAULT_INTERPOLATION"]</span> <span class="pre">==</span> <span class="pre">"nearest"</span></code>, which may
be modified by users. Users who wish to see raw datasources can also use <code class="docutils literal notranslate"><span class="pre">"none"</span></code>
for the interpolator type.</p>
<p>Relevant example notebooks include:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/creare-com/podpac-examples/blob/master/notebooks/4-advanced/interpolation.ipynb">Advanced Interpolation</a></p></li>
<li><p><a class="reference external" href="https://github.com/creare-com/podpac-examples/blob/master/notebooks/2-combining-data/automatic-interpolation-and-regridding.ipynb">Basic Interpolation</a></p></li>
<li><p><a class="reference external" href="https://github.com/creare-com/podpac-examples/blob/master/notebooks/examples/drought-monitor/03-data-access-harmonization-processing.ipynb">Drought Monitor Data Access Harmonization Processing</a></p></li>
</ul>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this heading"></a></h2>
<p>Consider a <code class="docutils literal notranslate"><span class="pre">DataSource</span></code> with <code class="docutils literal notranslate"><span class="pre">lat</span></code>, <code class="docutils literal notranslate"><span class="pre">lon</span></code>, <code class="docutils literal notranslate"><span class="pre">time</span></code> coordinates that we will instantiate as:
<code class="docutils literal notranslate"><span class="pre">node</span> <span class="pre">=</span> <span class="pre">DataSource(...,</span> <span class="pre">interpolation=interpolation)</span></code></p>
<p><code class="docutils literal notranslate"><span class="pre">interpolation</span></code> can be specified …</p>
<section id="as-a-string">
<h3>…as a string<a class="headerlink" href="#as-a-string" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">interpolation='nearest'</span></code>
<<<<<<< HEAD</p>
<ul class="simple">
<li><p><strong>Descripition</strong>: All dimensions are interpolated using nearest neighbor interpolation. This is the default, but available options can be found here: <code class="docutils literal notranslate"><span class="pre">podpac.core.interpolation.interpolation.INTERPOLATION_METHODS</span></code>. In particular, for no interpolation, use <code class="docutils literal notranslate"><span class="pre">interpolation="none"</span></code>. <em>NOTE</em> the <code class="docutils literal notranslate"><span class="pre">none</span></code> interpolator ONLY considers the bounds of any evaluated coordinates. This means the data is returned at FULL resolution (no striding or sub-selection).</p></li>
<li><p><strong>Details</strong>: PODPAC will automatically select appropriate interpolators based on the source coordinates and eval coordinates. Default interpolator orders can be found in <code class="docutils literal notranslate"><span class="pre">podpac.core.interpolation.interpolation.INTERPOLATION_METHODS_DICT</span></code></p></li>
</ul>
</section>
<section id="as-a-dictionary">
<h3>…as a dictionary<a class="headerlink" href="#as-a-dictionary" title="Permalink to this heading"></a></h3>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'method'</span><span class="p">:</span> <span class="s1">'nearest'</span><span class="p">,</span>
<span class="s1">'params'</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Optional. Available parameters depend on the particular interpolator</span>
<span class="s1">'spatial_tolerance'</span><span class="p">:</span> <span class="mf">1.1</span><span class="p">,</span>
<span class="s1">'time_tolerance'</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">timedelta64</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">'D'</span><span class="p">)</span>
<span class="p">},</span>
<span class="s1">'interpolators'</span><span class="p">:</span> <span class="p">[</span><span class="n">ScipyGrid</span><span class="p">,</span> <span class="n">NearestNeighbor</span><span class="p">]</span> <span class="c1"># Optional. Available options are in podpac.core.interpolation.interpolation.INTERPOLATORS</span>
<span class="p">}</span>
</pre></div>
</div>
<ul class="simple">
<li><p><strong>Descripition</strong>: All dimensions are interpolated using nearest neighbor interpolation, and the type of interpolators are tried in the order specified. For applicable interpolators, the specified parameters will be used.</p></li>
<li><p><strong>Details</strong>: PODPAC loops through the <code class="docutils literal notranslate"><span class="pre">interpolators</span></code> list, checking if the interpolator is able to interpolate between the evaluated and source coordinates. The first capable interpolator available will be used.</p></li>
</ul>
</section>
<section id="as-a-list">
<h3>…as a list<a class="headerlink" href="#as-a-list" title="Permalink to this heading"></a></h3>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s1">'method'</span><span class="p">:</span> <span class="s1">'bilinear'</span><span class="p">,</span>
<span class="s1">'dims'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'lat'</span><span class="p">,</span> <span class="s1">'lon'</span><span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s1">'method'</span><span class="p">:</span> <span class="s1">'nearest'</span><span class="p">,</span>
<span class="s1">'dims'</span><span class="p">:</span> <span class="p">[</span><span class="s1">'time'</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
</pre></div>
</div>
<ul class="simple">
<li><p><strong>Descripition</strong>: The dimensions listed in the <code class="docutils literal notranslate"><span class="pre">'dims'</span></code> list will used the specified method. These dictionaries can also specify the same field shown in the previous section.</p></li>
<li><p><strong>Details</strong>: PODPAC loops through the <code class="docutils literal notranslate"><span class="pre">interpolation</span></code> list, using the settings specified for each dimension independently.</p></li>
</ul>
<p><strong>NOTE! Specifying the interpolation as a list also control the ORDER of interpolation.</strong>
The first item in the list will be interpolated first. In this case, <code class="docutils literal notranslate"><span class="pre">lat</span></code>/<code class="docutils literal notranslate"><span class="pre">lon</span></code> will be bilinearly interpolated BEFORE <code class="docutils literal notranslate"><span class="pre">time</span></code> is nearest-neighbor interpolated.</p>
</section>
</section>
<section id="interpolators">
<h2>Interpolators<a class="headerlink" href="#interpolators" title="Permalink to this heading"></a></h2>
<p>The list of available interpolators are as follows:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">NoneInterpolator</span></code>: An interpolator that passes through the raw, source data at full resolution – it does not do any interpolation. <strong>Note</strong>: This interpolator can be used for <strong>some</strong> of the dimension by specifying <code class="docutils literal notranslate"><span class="pre">interpolation</span></code> as a list.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">NearestNeighbor</span></code>: A custom implementation based on <code class="docutils literal notranslate"><span class="pre">scipy.cKDtree</span></code>, which handles nearly any combination of source and destination coordinates</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">XarrayInterpolator</span></code>: A light-weight wrapper around <code class="docutils literal notranslate"><span class="pre">xarray</span></code>’s <code class="docutils literal notranslate"><span class="pre">DataArray.interp</span></code> method, which is itself a wrapper around <code class="docutils literal notranslate"><span class="pre">scipy</span></code> interpolation functions, but with a clean <code class="docutils literal notranslate"><span class="pre">xarray</span></code> interface</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">RasterioInterpolator</span></code>: A wrapper around <code class="docutils literal notranslate"><span class="pre">rasterio</span></code>’s interpolation/reprojection routines. Appropriate for grid-to-grid interpolation.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ScipyGrid</span></code>: An optimized implementation for <code class="docutils literal notranslate"><span class="pre">grid</span></code> sources that uses <code class="docutils literal notranslate"><span class="pre">scipy</span></code>’s <code class="docutils literal notranslate"><span class="pre">RegularGridInterpolator</span></code>, or <code class="docutils literal notranslate"><span class="pre">RectBivariateSplit</span></code> interpolator depending on the method.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ScipyPoint</span></code>: An implementation based on <code class="docutils literal notranslate"><span class="pre">scipy.KDtree</span></code> capable of <code class="docutils literal notranslate"><span class="pre">nearest</span></code> interpolation for <code class="docutils literal notranslate"><span class="pre">point</span></code> sources</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">NearestPreview</span></code>: An approximate nearest-neighbor interpolator useful for rapidly viewing large files</p></li>
</ul>
<p>The default order for these interpolators can be found in <code class="docutils literal notranslate"><span class="pre">podpac.data.INTERPOLATORS</span></code>.</p>
<section id="nearestneighbor">
<h3>NearestNeighbor<a class="headerlink" href="#nearestneighbor" title="Permalink to this heading"></a></h3>
<p>Since this is the most general of the interpolators, this section deals with the available parameters and settings for the <code class="docutils literal notranslate"><span class="pre">NearestNeighbor</span></code> interpolator.</p>
<section id="parameters">
<h4>Parameters<a class="headerlink" href="#parameters" title="Permalink to this heading"></a></h4>
<p>The following parameters can be set by specifying the interpolation as a dictionary or a list, as described above.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">respect_bounds</span></code> : <code class="docutils literal notranslate"><span class="pre">bool</span></code></p>
<ul>
<li><p>Default is <code class="docutils literal notranslate"><span class="pre">True</span></code>. If <code class="docutils literal notranslate"><span class="pre">True</span></code>, any requested dimension OUTSIDE of the bounds will be interpolated as <code class="docutils literal notranslate"><span class="pre">nan</span></code>.
Otherwise, any point outside the bounds will have the value of the nearest neighboring point</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">remove_nan</span></code> : <code class="docutils literal notranslate"><span class="pre">bool</span></code></p>
<ul>
<li><p>Default is <code class="docutils literal notranslate"><span class="pre">False</span></code>. If <code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">nan</span></code>’s in the source dataset will NOT be interpolated. This can be used if a value for the function
is needed at every point of the request. It is not helpful when computing statistics, where <code class="docutils literal notranslate"><span class="pre">nan</span></code> values will be explicitly
ignored. In that case, if <code class="docutils literal notranslate"><span class="pre">remove_nan</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">nan</span></code> values will take on the values of neighbors, skewing the statistical result.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">*_tolerance</span></code> : <code class="docutils literal notranslate"><span class="pre">float</span></code>, where <code class="docutils literal notranslate"><span class="pre">*</span></code> in [“spatial”, “time”, “alt”]</p>
<ul>
<li><p>Default is <code class="docutils literal notranslate"><span class="pre">inf</span></code>. Maximum distance to the nearest coordinate to be interpolated.
Corresponds to the unit of the <code class="docutils literal notranslate"><span class="pre">*</span></code> dimension.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">*_scale</span></code> : <code class="docutils literal notranslate"><span class="pre">float</span></code>, where <code class="docutils literal notranslate"><span class="pre">*</span></code> in [“spatial”, “time”, “alt”]</p>
<ul>
<li><p>Default is <code class="docutils literal notranslate"><span class="pre">1</span></code>. This only applies when the source has stacked dimensions with different units. The <code class="docutils literal notranslate"><span class="pre">*_scale</span></code>
defines the factor that the coordinates will be scaled by (coordinates are divided by <code class="docutils literal notranslate"><span class="pre">*_scale</span></code>) to output
a valid distance for the combined set of dimensions.
For example, when “lat, lon, and alt” dimensions are stacked, [“lat”, “lon”] are in degrees
and “alt” is in feet, the <code class="docutils literal notranslate"><span class="pre">*_scale</span></code> parameters should be set so that
<code class="docutils literal notranslate"><span class="pre">||</span> <span class="pre">[dlat</span> <span class="pre">/</span> <span class="pre">spatial_scale,</span> <span class="pre">dlon</span> <span class="pre">/</span> <span class="pre">spatial_scale,</span> <span class="pre">dalt</span> <span class="pre">/</span> <span class="pre">alt_scale]</span> <span class="pre">||</span></code> results in a reasonable distance.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">use_selector</span></code> : <code class="docutils literal notranslate"><span class="pre">bool</span></code></p>
<ul>
<li><p>Default is <code class="docutils literal notranslate"><span class="pre">True</span></code>. If <code class="docutils literal notranslate"><span class="pre">True</span></code>, a subset of the coordinates will be selected BEFORE the data of a dataset is retrieved. This
reduces the number of data retrievals needed for large datasets. In cases where <code class="docutils literal notranslate"><span class="pre">remove_nan</span></code> = <code class="docutils literal notranslate"><span class="pre">True</span></code>, the selector may select
only <code class="docutils literal notranslate"><span class="pre">nan</span></code> points, in which case the interpolation fails to produce non-<code class="docutils literal notranslate"><span class="pre">nan</span></code> data. This usually happens when requesting a single
point from a dataset that contains <code class="docutils literal notranslate"><span class="pre">nan</span></code>s. As such, in these cases set <code class="docutils literal notranslate"><span class="pre">use_selector</span></code> = <code class="docutils literal notranslate"><span class="pre">False</span></code> to get a non-<code class="docutils literal notranslate"><span class="pre">nan</span></code> value.</p></li>
</ul>
</li>
</ul>
</section>
<section id="advanced-nearestneighbor-interpolation-examples">
<h4>Advanced NearestNeighbor Interpolation Examples<a class="headerlink" href="#advanced-nearestneighbor-interpolation-examples" title="Permalink to this heading"></a></h4>
<ul class="simple">
<li><p>Only interpolate points that are within <code class="docutils literal notranslate"><span class="pre">1</span></code> of the source data lat/lon locations</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span><span class="o">=</span><span class="p">{</span><span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span> <span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"spatial_tolerance"</span><span class="p">:</span> <span class="mi">1</span><span class="p">}},</span>
</pre></div>
</div>
<ul class="simple">
<li><p>When interpolating with mixed time/space, use <code class="docutils literal notranslate"><span class="pre">1</span></code> day as equivalent to <code class="docutils literal notranslate"><span class="pre">1</span></code> degree for determining the distance</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span><span class="o">=</span><span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"spatial_scale"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s2">"time_scale"</span><span class="p">:</span> <span class="s2">"1,D"</span><span class="p">,</span>
<span class="s2">"alt_scale"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Remove nan values in the source datasource – in some cases a <code class="docutils literal notranslate"><span class="pre">nan</span></code> may still be interpolated</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span><span class="o">=</span><span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"remove_nan"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Remove nan values in the source datasource in all cases, even for single point requests located directly at <code class="docutils literal notranslate"><span class="pre">nan</span></code>-values in the source.</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span><span class="o">=</span><span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"remove_nan"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">"use_selector"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Do nearest-neighbor extrapolation outside of the bounds of the source dataset</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span><span class="o">=</span><span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"respect_bounds"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Do nearest-neighbor interpolation of time with <code class="docutils literal notranslate"><span class="pre">nan</span></code> removal followed by spatial interpolation</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"remove_nan"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">},</span>
<span class="s2">"dims"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"time"</span><span class="p">]</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"method"</span><span class="p">:</span> <span class="s2">"nearest"</span><span class="p">,</span>
<span class="s2">"dims"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"lat"</span><span class="p">,</span> <span class="s2">"lon"</span><span class="p">,</span> <span class="s2">"alt"</span><span class="p">]</span>
<span class="p">},</span>
<span class="p">]</span>
</pre></div>
</div>
</section>
</section>
</section>
<section id="notes-and-caveats">
<h2>Notes and Caveats<a class="headerlink" href="#notes-and-caveats" title="Permalink to this heading"></a></h2>
<p>While the API is well developed, all conceivable functionality is not. For example, while we can interpolate gridded data to point data, point data to grid data interpolation is not as well supported, and there may be errors or unexpected results. Advanced users can develop their own interpolators, but this is not currently well-documented.</p>
<p><strong>Gotcha</strong>: Parameters for a specific interpolator may be ignored if a different interpolator is automatically selected. These ignored parameters are logged as warnings.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="datasets.html" class="btn btn-neutral float-left" title="Supported Datasets" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="earthdata.html" class="btn btn-neutral float-right" title="NASA Earth Data Login" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2017-2023, Creare.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>