-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapping-datasets.html
More file actions
188 lines (169 loc) · 11.3 KB
/
wrapping-datasets.html
File metadata and controls
188 lines (169 loc) · 11.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
<!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>Wrapping Datasets — 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/wrapping-datasets.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="References" href="references.html" />
<link rel="prev" title="podpac.version.VERSION_INFO" href="api/podpac.version.VERSION_INFO.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>
<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"><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 class="current">
<li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Wrapping Datasets</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#rules">Rules</a></li>
<li class="toctree-l2"><a class="reference internal" href="#guide">Guide</a></li>
</ul>
</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">Wrapping Datasets</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/wrapping-datasets.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="wrapping-datasets">
<h1>Wrapping Datasets<a class="headerlink" href="#wrapping-datasets" title="Permalink to this heading"></a></h1>
<p>Wrapping a new dataset is challenging because you have to understand all of the quirks of the new dataset and deal with the quirks of PODPAC as well. This reference is meant to record a few rules of thumb when wrapping new datasets to help you deal with the latter.</p>
<section id="rules">
<h2>Rules<a class="headerlink" href="#rules" title="Permalink to this heading"></a></h2>
<ol class="arabic simple">
<li><p>When evaluating a node with a set of coordinates:</p>
<ol class="arabic simple">
<li><p>The evaluation coordinates must include ALL of the dimensions present in the source dataset</p></li>
<li><p>The evaluation coordinates MAY contain additional dimensions NOT present in the source dataset, and the source may ignore these</p></li>
</ol>
</li>
<li><p>When returning data from a data source node:</p>
<ol class="arabic simple">
<li><p>The ORDER of the evaluation coordinates MUST be preserved (see <code class="docutils literal notranslate"><span class="pre">UnitsDataArray.part_transpose</span></code>)</p></li>
<li><p>Any multi-channel data must be returned using the <code class="docutils literal notranslate"><span class="pre">output</span></code> dimension which is ALWAYS the LAST dimension</p></li>
</ol>
</li>
<li><p>Nodes should be <strong>lightweight</strong> to instantiate and users should expect <em>fail on eval</em>. Easy checks should be performed on initialization, but anything expensive should be delayed.</p></li>
</ol>
</section>
<section id="guide">
<h2>Guide<a class="headerlink" href="#guide" title="Permalink to this heading"></a></h2>
<p>In theory, to wrap a new <code class="docutils literal notranslate"><span class="pre">DataSource</span></code>:</p>
<ol class="arabic simple">
<li><p>Create a new class that inherits from <code class="docutils literal notranslate"><span class="pre">podpac.core.data.DataSource</span></code> or a derived class (see the <code class="docutils literal notranslate"><span class="pre">podpac.core.data</span></code> module for generic data readers).</p></li>
<li><p>Implement a method for opening/accessing the data, or use an existing generic data node and hard-code certain attributes</p></li>
<li><p>Implement the <code class="docutils literal notranslate"><span class="pre">get_coordinates(self)</span></code> method</p></li>
<li><p>Implement the <code class="docutils literal notranslate"><span class="pre">get_data(self,</span> <span class="pre">coordinates,</span> <span class="pre">coordinates_index)</span></code> method</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">coordinates</span></code> is a <code class="docutils literal notranslate"><span class="pre">podpac.Coordinates</span></code> object and it’s in the same coordinate system as the data source (i.e. a subset of what comes out of <code class="docutils literal notranslate"><span class="pre">get_coordinates</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">coordinates_index</span></code> is a list (or tuple?) of slices or boolean arrays or index arrays to indexes into the output of <code class="docutils literal notranslate"><span class="pre">get_coordinates()</span></code> to produce <code class="docutils literal notranslate"><span class="pre">coordinates</span></code> that come into this function.</p></li>
</ol>
</li>
</ol>
<p>In practice, the real trick is implementing a compositor to put multiple tiles together to look like a single <code class="docutils literal notranslate"><span class="pre">DataSource</span></code>. We tend to use the <code class="docutils literal notranslate"><span class="pre">podpac.compositor.OrderedCompositor</span></code> node for this task, but it does not handle interpolation between tiles. Instead, see the <code class="docutils literal notranslate"><span class="pre">podpac.core.compositor.tile_compositor</span></code> module.</p>
<p>When using compositors, it is prefered the that <code class="docutils literal notranslate"><span class="pre">sources</span></code> attribute is populated at instantiation, but on-the-fly (i.e. at eval) population of sources is also acceptible and sometimes necessary for certain datasources.</p>
<p>For examples, check the <code class="docutils literal notranslate"><span class="pre">podpac.datalib</span></code> module.</p>
<p>Happy wrapping!</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="api/podpac.version.VERSION_INFO.html" class="btn btn-neutral float-left" title="podpac.version.VERSION_INFO" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="references.html" class="btn btn-neutral float-right" title="References" 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>