-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodes.html
More file actions
433 lines (411 loc) · 35.5 KB
/
nodes.html
File metadata and controls
433 lines (411 loc) · 35.5 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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!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>Nodes — 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/nodes.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="Coordinates" href="coordinates.html" />
<link rel="prev" title="Dependencies" href="dependencies.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 current"><a class="current reference internal" href="#">Nodes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#datasource">DataSource</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#interpolation">Interpolation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#compositor">Compositor</a></li>
<li class="toctree-l2"><a class="reference internal" href="#algorithm">Algorithm</a></li>
<li class="toctree-l2"><a class="reference internal" href="#extending-podpac-with-custom-nodes">Extending Podpac with Custom Nodes</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#example">Example</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tagging-attributes">Tagging attributes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#serialization">Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="#node-definition">Node Definition</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">DataSource</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#sample">Sample</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id2">Compositor</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#additional-properties">Additional Properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">Sample</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id4">Algorithm</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id5">Additional Properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id6">Sample</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#notes">Notes</a></li>
</ul>
</li>
</ul>
</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"><a class="reference internal" href="interpolation.html">Interpolation</a></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">Nodes</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/nodes.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="nodes">
<h1>Nodes<a class="headerlink" href="#nodes" title="Permalink to this heading"></a></h1>
<p>This document describes the detailed interfaces for core node types so that a user may know what to expect. It also documents some of the available nodes implemented as part of the core library.</p>
<p>In PODPAC, Nodes represent the basic unit of computation. They take inputs, produce outputs, and can represent source data, intermediate results, or final output. The base <code class="docutils literal notranslate"><span class="pre">Node</span></code> class defined a common interface for all PODPAC <code class="docutils literal notranslate"><span class="pre">Nodes</span></code>.</p>
<p>In particular, the base <code class="docutils literal notranslate"><span class="pre">Node</span></code> class implements:</p>
<ul class="simple">
<li><p>Caching behaviour of <code class="docutils literal notranslate"><span class="pre">Node</span></code> outputs, and interfaces with the cache system</p></li>
<li><p>Serialization and deserialization of <code class="docutils literal notranslate"><span class="pre">Nodes</span></code> using our JSON format</p></li>
<li><p>Saving and loading <code class="docutils literal notranslate"><span class="pre">Node</span></code> outputs</p></li>
<li><p>Creating <code class="docutils literal notranslate"><span class="pre">Node</span></code> output data structures using the <code class="docutils literal notranslate"><span class="pre">create_output_array</span></code> method.</p></li>
<li><p>Common interfaces required and used by all subsequent nodes:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">Node.eval(coordinates,</span> <span class="pre">output)</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">Node.find_coordinates()</span></code></p></li>
</ul>
</li>
</ul>
<section id="datasource">
<h2>DataSource<a class="headerlink" href="#datasource" title="Permalink to this heading"></a></h2>
<p>DataSource nodes interface with remote geospatial data sources (i.e. raster images, DAP servers, numpy arrays) and define how to retrieve data from these remote sources using PODPAC coordinates. PODPAC defines common generic DataSource nodes (i.e. Array, PyDAP), but advanced users can define their own DataSource nodes by defining the methods to retrieve data (<code class="docutils literal notranslate"><span class="pre">get_data(coordinates,</span> <span class="pre">index)</span></code>) and the method to define the <code class="docutils literal notranslate"><span class="pre">coordinates</span></code> property (<code class="docutils literal notranslate"><span class="pre">get_native_coordinates()</span></code>).</p>
<p>Key properties of DataSource nodes include:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">source</span></code>: The location of the source data. Depending on the child node this can be a filepath, numpy array, or server URL).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">coordinates</span></code>: The PODPAC coordinates of the data in <code class="docutils literal notranslate"><span class="pre">source</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">interpolation</span></code>: Definition of the interpolation method to use with the data source.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">nan_vals</span></code>: List of values from source data that should be interpreted as ‘no data’ or ‘nans’.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">boundary</span></code>: A structure defining the boundary of each data point in the data source (for example to define a point, area, or arbitrary polygon)</p></li>
</ul>
<p>To evaluate data at arbitrary PODPAC coordinates, users can input <code class="docutils literal notranslate"><span class="pre">coordinates</span></code> to the eval method of the DataSource node. The DataSource <code class="docutils literal notranslate"><span class="pre">eval</span></code> process consists of the following steps:</p>
<ol class="arabic simple">
<li><p>Verify native coordinates support the dimensions of the requested coordinates</p></li>
<li><p>Remove extra dimensions from the requested coordinates</p></li>
<li><p>Intersect the requested coordinates with the native coordinates</p></li>
<li><p>Further down-select the necessary native coordinates if the requested coordinates are sparser than the native coordinates.</p></li>
<li><p>Retrieve data from the data source (<code class="docutils literal notranslate"><span class="pre">get_data</span></code>) at the subset of native coordinates</p></li>
<li><p>Interpolate the retrieved data to the locations of the requested coordinates</p></li>
</ol>
<section id="interpolation">
<h3>Interpolation<a class="headerlink" href="#interpolation" title="Permalink to this heading"></a></h3>
<p>The DataSource <code class="docutils literal notranslate"><span class="pre">interpolation</span></code> property defines how to handle interpolation of coordinates and data within the DataSource node. Based on a string or dictionary definition, the DataSource instantiates an Interpolation class that orchestrates the selection and use of different interpolators depending on the native and input coordinates. PODPAC natively supports an array of interpolator methods covering a wide range of use cases. Users can also write their own Interpolator class to use for specific nodes. Under the hood, PODPAC leverages interpolation methods from xarray, scipy, and rasterio to do some of the heavy lifting.</p>
<p>Definition of the interpolation method on a DataSource node may either be a string:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">interpolation</span> <span class="o">=</span> <span class="s1">'nearest'</span> <span class="c1"># nearest neighbor interpolation</span>
</pre></div>
</div>
<p>or a dictionary that supplies extra parameters:</p>
<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="s1">'spatial_tolerance'</span><span class="p">:</span> <span class="mf">1.1</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>For the most advanced users, the interpolation definition supports defining different interpolation methods for different dimensions (as of 2.0.0 this functionality is not fully implemented):</p>
<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>
<p>When a DataSource node is created, the interpolation manager selects a list of applicable <code class="docutils literal notranslate"><span class="pre">Interpolator</span></code> classes to apply to each set of defined dimensions. When a DataSource node is being evaluated, the interpolation manager chooses the first interpolator that is capable of handling the dimensions defined in the requested coordinates and the native coordinates using the <code class="docutils literal notranslate"><span class="pre">can_interpolate</span></code> method. After selecting an interpolator for all sets of dimensions, the manager sequentially interpolates data for each set of dimensions using the <code class="docutils literal notranslate"><span class="pre">interpolate</span></code> method.</p>
</section>
</section>
<section id="compositor">
<h2>Compositor<a class="headerlink" href="#compositor" title="Permalink to this heading"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Compositor</span></code> <code class="docutils literal notranslate"><span class="pre">Nodes</span></code> are used to combine multiple data files or dataset into a single interface.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">BaseCompositor</span></code> implements:</p>
<ul class="simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">find_coordinates</span></code> method</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">eval</span></code> method</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">iteroutputs</span></code> method used to iterate over all possible input data sources</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">select_sources(coordinates</span></code>) method to sub-select input data sources BEFORE evaluating them, as an optimization</p></li>
<li><p>The interface for the <code class="docutils literal notranslate"><span class="pre">composite(coordinates,</span> <span class="pre">data_arrays,</span> <span class="pre">result)</span></code> method. Child classes implement this method which determines the logic for combining data sources.</p></li>
</ul>
<p>Beyond that there is the:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">OrderedCompositor</span></code></p>
<ul>
<li><p>This is meant to composite disparate data sources together that might have different resolutions and coverage</p></li>
<li><p>For example, prefer a high resolution elevation model which has missing data, but fill missing values with a coarser elevation datasource</p></li>
<li><p>In practice, we use this <code class="docutils literal notranslate"><span class="pre">Compositor</span></code> to provide a single interface for a dataset that is divided into multiple files</p></li>
<li><p>Data sources are composited AFTER harmonization.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TileCompositor</span></code></p>
<ul>
<li><p>This is meant to composite a data source stored in multiple files into a single interface</p></li>
<li><p>For example, consider an elevation data source that covers the globe and is stored in 10K different files that only cover land areas</p></li>
<li><p>Data source are composited BEFORE harmonization</p></li>
</ul>
</li>
</ul>
</section>
<section id="algorithm">
<h2>Algorithm<a class="headerlink" href="#algorithm" title="Permalink to this heading"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Algorithm</span></code> <code class="docutils literal notranslate"><span class="pre">Nodes</span></code> are the backbone of the pipeline architecture and are used to perform computations on one or many data sources or the user-requested coordinates.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">BaseAlgorithm</span></code>, <code class="docutils literal notranslate"><span class="pre">Algorithm</span></code> (for multiple input nodes) and <code class="docutils literal notranslate"><span class="pre">UnaryAlgorithm</span></code> (for single input nodes) <code class="docutils literal notranslate"><span class="pre">Nodes</span></code> implement the basic functionality:</p>
<ul class="simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">find_coordinates</span></code> method</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">Algorithm.eval</span></code> method for multiple input <code class="docutils literal notranslate"><span class="pre">Nodes</span></code></p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">inputs</span></code> property that finds any PODPAC <code class="docutils literal notranslate"><span class="pre">Node</span></code> as part of the class definition</p></li>
<li><p>The interfaces for the <code class="docutils literal notranslate"><span class="pre">algorith(inputs)</span></code> method which is used to implement the actual algorithm</p></li>
</ul>
<p>Based on this basic interface, PODPAC implements algorithms that manipulate coordinates, does signal processing (e.g. convolutions), statistics (e.g. Mean), and completely generic, user-defined algorithms.</p>
<p>In particular, the <code class="docutils literal notranslate"><span class="pre">Arithmetic</span></code> allows users to specify and <code class="docutils literal notranslate"><span class="pre">eqn</span></code> which allows nearly arbitrary point-wise computations. Also the <code class="docutils literal notranslate"><span class="pre">Generic</span></code> algorithm allows users to specify arbitrary Python code, as long as the <code class="docutils literal notranslate"><span class="pre">output</span></code> variable is set.</p>
</section>
<section id="extending-podpac-with-custom-nodes">
<h2>Extending Podpac with Custom Nodes<a class="headerlink" href="#extending-podpac-with-custom-nodes" title="Permalink to this heading"></a></h2>
<p>In addition to the core data sources and algorithms, you may need to write your own node to handle unique data sources or additional data processing. You can do this by subclassing a core podpac node and extending it for your needs. The DataSource node in particular is designed to be extended for new sources of data.</p>
<section id="example">
<h3>Example<a class="headerlink" href="#example" title="Permalink to this heading"></a></h3>
<p>An example of creating a simple array-based datasource can be found in the <a class="reference external" href="https://github.com/creare-com/podpac-examples/blob/master/notebooks/4-advanced/create-data-source.ipynb">array-data-source</a> notebook.</p>
</section>
<section id="tagging-attributes">
<h3>Tagging attributes<a class="headerlink" href="#tagging-attributes" title="Permalink to this heading"></a></h3>
<p>Node attributes are defined when instantiating the node. For each attribute, the class definition should include a traitlets attribute that is tagged as an <code class="docutils literal notranslate"><span class="pre">attr</span></code>, and you can optionally include a default value.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyDataSource</span><span class="p">(</span><span class="n">DataSource</span><span class="p">):</span>
<span class="n">my_attr1</span> <span class="o">=</span> <span class="n">tl</span><span class="o">.</span><span class="n">Float</span><span class="p">(</span><span class="n">allow_none</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span><span class="o">.</span><span class="n">tag</span><span class="p">(</span><span class="n">attr</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">my_attr2</span> <span class="o">=</span> <span class="n">tl</span><span class="o">.</span><span class="n">Float</span><span class="p">(</span><span class="n">default_value</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span><span class="o">.</span><span class="n">tag</span><span class="p">(</span><span class="n">attr</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="o">...</span>
</pre></div>
</div>
<p>You will be able to set attrs when instantiating the node:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">node</span> <span class="o">=</span> <span class="n">MyDataSource</span><span class="p">(</span><span class="n">my_attr1</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">my_attr2</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">coords</span><span class="p">)</span>
</pre></div>
</div>
<p>You will also be able to set these tagged attrs in node definitions.</p>
</section>
</section>
<section id="serialization">
<h2>Serialization<a class="headerlink" href="#serialization" title="Permalink to this heading"></a></h2>
<p>Any podpac Node can be saved, shared, and loaded using a JSON definition. This definition describes all of the nodes required to create and evaluate the final Node.</p>
<p><strong>Serialization Properties and Methods:</strong></p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">save(path)</span></code>: writes the node to file.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">json</span></code>: provides the node definition as a JSON string.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">definition</span></code>: provides the node definition as an ordered dictionary.</p></li>
</ul>
<p><strong>Deserialization Methods:</strong></p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">load(path)</span></code>: load a Node from file.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">from_json</span></code>: create a Node from a JSON definition</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">from_definition</span></code>: create a Node from a dictionary definition</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">from_url</span></code>: create a Node from a WMS/WCS request.</p></li>
</ul>
</section>
<section id="node-definition">
<h2>Node Definition<a class="headerlink" href="#node-definition" title="Permalink to this heading"></a></h2>
<p>The full JSON definition for a Node contains an entry for <em>all</em> of the nodes required. Input nodes must be defined before they can be referenced by later Nodes, so the final output Node must be at the end.</p>
<p>Individual node definition specify the node class along with its inputs and attributes. It also names the node so that it can be used as an input to other nodes later in the pipeline. The following properties are common to all podpac node definitions:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">node</span></code>: a path to the node class. The path is relative to the podpac module, unless <code class="docutils literal notranslate"><span class="pre">plugin</span></code> is defined. See Notes. <em>(string, required)</em></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">plugin</span></code>: a path to a plugin module to use (prepended node path). See Notes. <em>(string, optional)</em></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">attrs</span></code>: set attributes in the node for custom behavior. Each value can be a number, string, boolean, dictionary, or list. <em>(object, optional)</em></p></li>
</ul>
<p>Additional properties and examples for each of the core node types are provided below.</p>
<section id="id1">
<h3>DataSource<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h3>
<section id="sample">
<h4>Sample<a class="headerlink" href="#sample" title="Permalink to this heading"></a></h4>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">"mynode"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"node"</span><span class="p">:</span> <span class="s2">"algorithm.CoordData"</span><span class="p">,</span>
<span class="s2">"attrs"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"coord_name"</span><span class="p">:</span> <span class="s2">"time"</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</section>
<section id="id2">
<h3>Compositor<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h3>
<section id="additional-properties">
<h4>Additional Properties<a class="headerlink" href="#additional-properties" title="Permalink to this heading"></a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">sources</span></code>: nodes to composite <em>(list, required)</em></p></li>
</ul>
</section>
<section id="id3">
<h4>Sample<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h4>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">"SourceA"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="s2">"SourceB"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="s2">"SourceC"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="n">MyCompositor</span><span class="s2">": {</span>
<span class="s2">"node"</span><span class="p">:</span> <span class="s2">"OrderedCompositor"</span><span class="p">,</span>
<span class="s2">"sources"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"SourceA"</span><span class="p">,</span> <span class="s2">"SourceB"</span><span class="p">,</span> <span class="s2">"SourceC"</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</section>
<section id="id4">
<h3>Algorithm<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<section id="id5">
<h4>Additional Properties<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">inputs</span></code>: node inputs to the algorithm. <em>(object, required)</em></p></li>
</ul>
</section>
<section id="id6">
<h4>Sample<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h4>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">"MyNode"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="s2">"MyOtherNode"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="s2">"MyThirdNode"</span><span class="p">:</span> <span class="p">{</span> <span class="o">...</span> <span class="p">},</span>
<span class="s2">"MyResult"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"node"</span><span class="p">:</span> <span class="s2">"Arithmetic"</span><span class="p">,</span>
<span class="s2">"inputs"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"A"</span><span class="p">:</span> <span class="s2">"MyNode"</span><span class="p">,</span>
<span class="s2">"B"</span><span class="p">:</span> <span class="s2">"MyOtherNode"</span><span class="p">,</span>
<span class="s2">"C"</span><span class="p">:</span> <span class="s2">"MyThirdNode"</span>
<span class="p">},</span>
<span class="s2">"attrs"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"eqn"</span><span class="p">:</span> <span class="s2">"A + </span><span class="si">{tsmtr}</span><span class="s2"> / </span><span class="si">{kappa}</span><span class="s2"> * (B - C)"</span><span class="p">,</span>
<span class="s2">"params"</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"kappa"</span><span class="p">:</span> <span class="s2">"13"</span><span class="p">,</span>
<span class="s2">"tsmtr"</span><span class="p">:</span> <span class="s2">"0.3"</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</section>
<section id="notes">
<h3>Notes<a class="headerlink" href="#notes" title="Permalink to this heading"></a></h3>
<ul class="simple">
<li><p>The <code class="docutils literal notranslate"><span class="pre">node</span></code> path should include the submodule path and the node class. The submodule path is omitted for top-level classes. For example:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">"node":</span> <span class="pre">"datalib.smap.SMAP"</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">podpac.datalib.smap</span> <span class="pre">import</span> <span class="pre">SMAP</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">"node":</span> <span class="pre">"compositor.OrderedCompositor"</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">podpac.compositor</span> <span class="pre">import</span> <span class="pre">OrderedCompositor</span></code>.</p></li>
</ul>
</li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">plugin</span></code> path replaces ‘podpac’ in the full node path. For example</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">"plugin":</span> <span class="pre">"path.to.myplugin",</span> <span class="pre">"node":</span> <span class="pre">"mymodule.MyCustomNode"</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">path.to.myplugin.mymodule</span> <span class="pre">import</span> <span class="pre">MyCustomNode</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">"plugin":</span> <span class="pre">"myplugin",</span> <span class="pre">"node":</span> <span class="pre">"MyCustomNode"</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">myplugin</span> <span class="pre">import</span> <span class="pre">MyCustomNode</span></code></p></li>
</ul>
</li>
</ul>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="dependencies.html" class="btn btn-neutral float-left" title="Dependencies" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="coordinates.html" class="btn btn-neutral float-right" title="Coordinates" 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>