-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting_up_an_environment.html
296 lines (276 loc) · 17.8 KB
/
setting_up_an_environment.html
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
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Setting up an Environment — Py-ART 1.11.7.dev+c829faf documentation</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/plot_directive.css" type="text/css" />
<link rel="stylesheet" href="_static/copybutton.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/clipboard.min.js"></script>
<script src="_static/copybutton.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.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="Contributor’s Guide" href="contributors_guide.html" />
<link rel="prev" title="Installation" href="INSTALL.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" class="icon icon-home"> Py-ART
</a>
<div class="version">
1.11.7.dev+c829faf
</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" />
<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">Documentation</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="API/index.html">API Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="INSTALL.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Setting up an Environment</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#anaconda">Anaconda</a></li>
<li class="toctree-l2"><a class="reference internal" href="#setting-a-channel">Setting a Channel</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-an-environment">Creating an Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="#adding-optional-dependencies-with-setting-paths">Adding Optional Dependencies with setting Paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="#more-information">More Information</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contributors_guide.html">Contributor’s Guide</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Downloads</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://anaconda.org/conda-forge/arm_pyart">Anaconda Cloud</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/ARM-DOE/pyart">GitHub Repo</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/ARM-DOE/pyart/archive/master.zip">Zip File of Repository</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Notebooks</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="notebooks/basic_ingest_using_test_radar_object.html">Creating a basic ingest of a NetCDF file</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/changing_fields_and_saving.html">Field manipulation and Saving the Radar Object to a file.</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/dealiasing_velocity.html">Dealiasing Velocity</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/mapping_data_to_a_cartesian_grid.html">Mapping Data to a Cartesian Grid</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/masking_data_with_gatefilters.html">Masking Data With Py-ART Gatefilters</a></li>
<li class="toctree-l1"><a class="reference internal" href="notebooks/the_pyart_radar_object_and_indexing.html">The Py-ART Radar object and indexing</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Getting Help</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://github.com/ARM-DOE/pyart/issues">GitHub Issue Tracker</a></li>
<li class="toctree-l1"><a class="reference external" href="https://groups.google.com/forum/#!forum/pyart-users">Mailing List</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Science Lead</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://www.anl.gov/profile/scott-m-collis">Scott Collis</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">Py-ART</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"></a> »</li>
<li>Setting up an Environment</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/setting_up_an_environment.rst.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">
<style>
/* CSS overrides for sphinx_rtd_theme */
/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
margin-bottom: 19px; /* padding has already 5px */
}
/* ... except between code cells! */
.nblast.container + .nbinput.container {
margin-top: -19px;
}
.admonition > p:before {
margin-right: 4px; /* make room for the exclamation icon */
}
/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
text-align: unset;
}
</style>
<section id="setting-up-an-environment">
<h1>Setting up an Environment<a class="headerlink" href="#setting-up-an-environment" title="Permalink to this headline">¶</a></h1>
<section id="anaconda">
<h2>Anaconda<a class="headerlink" href="#anaconda" title="Permalink to this headline">¶</a></h2>
<p>Creating environments using Anaconda is recommended due to the ability to
create more than one environment. It is also recommended because you can
keep dependencies separate from one another that might conflict if you had
them all in your root environment. For example, if you had all the dependencies
for a Pandas environment and all the dependencies for a Py-ART environment in
your root environment, there might be conflicts between channels and packages.
So Anaconda allows you to create multiple environments to avoid these issues.</p>
<p>To download and install <a class="reference external" href="https://www.anaconda.com/download/#">Anaconda</a>.</p>
<p>While Anaconda is downloading, it will ask if you want to set a path to it, or
let Anaconda set a default path. After choosing, Anaconda should finish
downloading. After it is done, exit the terminal and open a new one to make
sure the environment path is set. If conda command is not found, there is help
on running conda and fixing the environment path, found here:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://stackoverflow.com/questions/18675907/how-to-run-conda">How to Run Conda</a></p></li>
</ul>
</section>
<section id="setting-a-channel">
<h2>Setting a Channel<a class="headerlink" href="#setting-a-channel" title="Permalink to this headline">¶</a></h2>
<p>Anaconda has a cloud that stores many of its packages. It is recommended, at
times, to use the conda-forge channel instead. Conda-Forge is a community led
collection of packages, and typically contains the most recent versions of the
packages required for Py-ART. Also Py-ART is on Conda-Forge. Having packages in
an environment, within the same channel, helps avoid conflict issues. To add
conda-forge as the priority channel, simply do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">config</span> <span class="o">--</span><span class="n">add</span> <span class="n">channels</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span>
</pre></div>
</div>
<p>You can also just flag the channel when conda install packages such as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">c</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> <span class="n">numpy</span>
</pre></div>
</div>
<p>More on managing channels can be found here:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://conda.io/docs/user-guide/tasks/manage-channels.html">Managing Channels</a></p></li>
</ul>
</section>
<section id="creating-an-environment">
<h2>Creating an Environment<a class="headerlink" href="#creating-an-environment" title="Permalink to this headline">¶</a></h2>
<p>There are a few ways to create a conda environment for using Py-ART or other
packages. One way is to use the environment file, found here:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/ARM-DOE/pyart/blob/master/environment.yml">https://github.com/ARM-DOE/pyart/blob/master/environment.yml</a></p></li>
</ul>
<p>To create an environment using this file, use the command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">env</span> <span class="n">create</span> <span class="o">-</span><span class="n">f</span> <span class="n">environment</span><span class="o">.</span><span class="n">yml</span>
</pre></div>
</div>
<p>This will then create an environment called pyart_env that can be activated
by:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">source</span> <span class="n">activate</span> <span class="n">pyart_env</span>
</pre></div>
</div>
<p>or deactivated after use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">source</span> <span class="n">deactivate</span> <span class="n">pyart_env</span>
</pre></div>
</div>
<p>Once the environment is created and activated, you can install more packages
into the environment by simply conda installing them. An example of this is,
if you want Jupyter Notebook to run in that enviroment with those packages:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">c</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> <span class="n">jupyter</span> <span class="n">notebook</span>
</pre></div>
</div>
<p>while that environment is activated. Another way to create a conda environment
is by doing it from scratch using the conda create command. An example of this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">create</span> <span class="o">-</span><span class="n">n</span> <span class="n">pyart_env</span> <span class="o">-</span><span class="n">c</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> <span class="n">python</span><span class="o">=</span><span class="mf">3.6</span> <span class="n">arm_pyart</span> <span class="n">netCDF4</span>
<span class="n">cartopy</span> <span class="n">scipy</span> <span class="n">numpy</span> <span class="n">matplotlib</span>
</pre></div>
</div>
<p>This will also create an environment called pyart_env that can be activate the
same way, as mentioned above. To then run your coding editor within the
environment, run in the command line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span>
</pre></div>
</div>
<p>or:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ipython</span>
</pre></div>
</div>
<p>or:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">jupyter</span> <span class="n">notebook</span>
</pre></div>
</div>
<p>or even:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">spyder</span>
</pre></div>
</div>
<p>depending on what you installed in your environment and want to use for coding.</p>
</section>
<section id="adding-optional-dependencies-with-setting-paths">
<h2>Adding Optional Dependencies with setting Paths<a class="headerlink" href="#adding-optional-dependencies-with-setting-paths" title="Permalink to this headline">¶</a></h2>
<p>There are other optional dependencies that can enhance the use of Py-ART. One,
such package is <a class="reference external" href="https://github.com/jjhelmus/CyLP">CyLP</a>. To get CyLP to work,
installing of the package <a class="reference external" href="https://projects.coin-or.org/Cbc">coincbc</a> is
needed as a dependency for CyLP. Simply do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">c</span> <span class="n">conda</span><span class="o">-</span><span class="n">forge</span> <span class="n">coincbc</span>
</pre></div>
</div>
<p>within your pyart_env. After that though, the coincbc path needs to be exported
so CyLP knows where to find it during its install. To do this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">COIN_INSTALL_DIR</span><span class="o">=/</span><span class="n">Users</span><span class="o">/</span><span class="n">yourusername</span><span class="o">/</span><span class="n">youranacondadir</span><span class="o">/</span><span class="n">envs</span><span class="o">/</span><span class="n">pyart_env</span>
</pre></div>
</div>
<p>or real example on a Linux machine:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">COIN_INSTALL_DIR</span><span class="o">=/</span><span class="n">home</span><span class="o">/</span><span class="n">zsherman</span><span class="o">/</span><span class="n">anaconda3</span><span class="o">/</span><span class="n">envs</span><span class="o">/</span><span class="n">pyart_env</span>
</pre></div>
</div>
<p>CyLP was actually adapted by Jonathan Helmus to be Python 3 compatible, so we
will install a specific CyLP branch after doing the export path step above.
GitHub repositories can actually be pip installed within your environment. So
to install the CyLP version we want:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">git</span><span class="o">+</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">jjhelmus</span><span class="o">/</span><span class="n">CyLP</span><span class="o">.</span><span class="n">git</span><span class="nd">@py3</span>
</pre></div>
</div>
<p>This will install a Python 3 compatible version of CyLP found on GitHub.</p>
</section>
<section id="more-information">
<h2>More Information<a class="headerlink" href="#more-information" title="Permalink to this headline">¶</a></h2>
<p>For more an conda and help with conda:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://conda.io/docs/">https://conda.io/docs/</a></p></li>
<li><p><a class="reference external" href="https://gitter.im/conda/conda">https://gitter.im/conda/conda</a></p></li>
</ul>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="INSTALL.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="contributors_guide.html" class="btn btn-neutral float-right" title="Contributor’s Guide" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2013-2020, Py-ART developers.</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>