Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bairdlangenbrunner committed Jul 13, 2018
1 parent 3cf38df commit 30f3c4d
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 15 deletions.
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ collections:
collections:
coding:
output: true
# permalink: python-for-climate-scientists/:collection/:path
# permalink: python-for-climate-scientists/:collection/:path
pages:
output: true
# permalink: /:name
pages:
output: true

defaults:
- scope:
Expand Down
10 changes: 10 additions & 0 deletions _site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/pages/setting-up-conda-environments.html">
conda environments for NCO, NCL, and CDO
</a>
</li>
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/about/">
about
Expand Down Expand Up @@ -74,6 +82,8 @@






<li class="inline-block">
<a class="align-middle link-primary ml-2 align-left-and-pad-when-small" href="/about/">
Expand Down
10 changes: 10 additions & 0 deletions _site/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/pages/setting-up-conda-environments.html">
conda environments for NCO, NCL, and CDO
</a>
</li>
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/about/">
about
Expand Down Expand Up @@ -74,6 +82,8 @@






<li class="inline-block">
<a class="align-middle link-primary ml-2 align-left-and-pad-when-small" href="/about/">
Expand Down
20 changes: 14 additions & 6 deletions _site/coding/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/pages/setting-up-conda-environments.html">
conda environments for NCO, NCL, and CDO
</a>
</li>
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/about/">
about
Expand Down Expand Up @@ -74,6 +82,8 @@






<li class="inline-block">
<a class="align-middle link-primary ml-2 align-left-and-pad-when-small" href="/about/">
Expand Down Expand Up @@ -109,6 +119,10 @@ <h1 class="h0 mt-3 mb-2 header-title-page">coding tips</h1>
<div class="prose mb-4">
<!--
<h2>conda environments for NCO, NCL, and CDO</h2>
<p></p>
<p><a href="/pages/setting-up-conda-environments.html">conda environments for NCO, NCL, and CDO</a></p>
<h2>about</h2>
<p></p>
<p><a href="/about/">about</a></p>
Expand All @@ -119,12 +133,6 @@ <h2>coding tips</h2>
-->

<p><!-- <h2>conda environments for NCO, NCL, and CDO</h2>-->
<!--<p></p>--></p>
<h2><a href="/coding/setting-up-conda-environments.html">conda environments for NCO, NCL, and CDO</a></h2>
<h2 class="no-underline h4 bold">July, 2018</h2>
<p></p>


</div>
</article>
Expand Down
216 changes: 216 additions & 0 deletions _site/collections/_pages/setting-up-conda-environments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>conda environments for NCO, NCL, and CDO</title>
<meta name="description" content="Materials for Earth science data wrangling">



<link rel="stylesheet" href="http://localhost:4000/assets/style.css">

<link rel="canonical" href="http://localhost:4000/collections/_pages/setting-up-conda-environments.html">
<link rel="alternate" type="application/rss+xml" title="Python for climate scientists" href="http://localhost:4000/feed.xml">

<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>


<body>

<!--
<header class="border-bottom-thick px-2 clearfix">
BAIRD NOTE: this is the navigation bar
<div class="left sm-width-full py-1 mt-1 mt-lg-0">
<a class="align-middle link-primary text-accent" href="/">
Python for climate scientists
</a>
</div>
<div class="right sm-width-full">
<ul class="list-reset mt-lg-1 mb-2 mb-lg-1">
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/pages/setting-up-conda-environments.html">
conda environments for NCO, NCL, and CDO
</a>
</li>
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/about/">
about
</a>
</li>
<li class="inline-block">
<a class="align-middle link-primary mr-2 mr-lg-0 ml-lg-2" href="/coding/index.html">
coding tips
</a>
</li>
</ul>
</div>
</header>
-->


<header class="border-bottom-thick px-2 clearfix">

<!-- BAIRD NOTE: this is the navigation bar -->

<div class="left sm-width-full py-1">
<a class="align-middle link-primary text-accent" href="/">
Python for climate scientists
</a>
</div>
<div class="right sm-width-full py-1">
<ul class="list-reset">






<li class="inline-block">
<a class="align-middle link-primary ml-2 align-left-and-pad-when-small" href="/about/">
about
</a>
</li>





<li class="inline-block">
<a class="align-middle link-primary ml-2 align-left-and-pad-when-small" href="/coding/index.html">
coding tips
</a>
</li>



</ul>
</div>

</header>


<div>
<article class="container mx-auto px-2 mt2 mb4">

<header>
<h1 class="h0 mt-3 mb-2 header-title-page">conda environments for NCO, NCL, and CDO</h1>
</header>

<div class="prose mb-4">
<p>Environments in conda are incredibly useful: they allow you to install parallel versions of Python and its packages, or even other languages and software, that mind their own business and never affect one another.</p>

<p>In my own research, I actively use several different conda environments to keep everything in its place. To see what environments you currently have, type <code class="highlighter-rouge">conda list env</code>. You’ll have at least one, called the base environment, and the asterisk means it’s the current/active environment:</p>

<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>conda env list

# conda environments:
#
base * /Users/baird/miniconda3

vcv076219:python-for-climate-scientists baird$
</code></pre></div></div>

<p>Installing an environment is also a great way to make the switch to a new Python library or package without breaking your installation for all your current scripts. For example, if you use <a href="https://matplotlib.org/basemap/">basemap</a> for plotting maps, you may have heard it’s <a href="https://matplotlib.org/basemap/users/intro.html">being retired</a> in the next couple years (see also <a href="https://github.com/SciTools/cartopy/issues/920">this discussion</a>). Its replacement is officially <a href="https://scitools.org.uk/cartopy/">cartopy</a>, but when you try to install them both, their packages conflict (or at least they did in the past). <strong>The solution: Install a separate cartopy environment to get used to it, and later switch your base environment over to cartopy.</strong></p>

<p>I typically keep at least four separate environments (in addition to the default), described below. You could get away with putting things like NCO and NCL into your base environment, but I’ve run into compatibility issues in the past, and I keep them separate to be safe.</p>

<table>
<thead>
<tr>
<th>conda environment</th>
<th>use for</th>
<th>install commands</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>base</strong></td>
<td>most things</td>
<td></td>
</tr>
<tr>
<td><strong>nco_stable</strong></td>
<td>NCO (NetCDF Operators)</td>
<td>conda install -c conda-forge nco</td>
</tr>
<tr>
<td><strong>ncl_stable</strong></td>
<td>NCL (NCAR Command Language)</td>
<td>conda install -c conda-forge ncl</td>
</tr>
<tr>
<td><strong>cdo_stable</strong></td>
<td>CDO (Climate Data Operators)</td>
<td>conda install -c conda-forge cdo</td>
</tr>
<tr>
<td><strong>basemap_stable</strong></td>
<td>basmap (assuming you have cartopy in your base environment)</td>
<td>conda install basemap</td>
</tr>
</tbody>
</table>

<p>To create these environments yourself (base is the default), type the following (choose <code class="highlighter-rouge">y</code> after each). I like to use the <code class="highlighter-rouge">_stable</code> suffix because it helps me mentally separate an <em>environment</em> related to NCO from the language itself. You can name them anything you like, though.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>conda create --name nco_stable
conda create --name ncl_stable
conda create --name cdo_stable
</code></pre></div></div>

<ul>
<li>To activate an environment: <code class="highlighter-rouge">source activate env_name</code></li>
<li>To get back to your default conda: <code class="highlighter-rouge">source deactivate</code></li>
<li>The active environment will have an asterisk next to it in <code class="highlighter-rouge">conda env list</code></li>
</ul>

<blockquote>
<p>More to come…</p>
</blockquote>


</div>
</article>

</div>

<div class="border-top-thin clearfix mt-2 mt-lg-4">
<div class="container mx-auto px-2">
<!--<p class="col-8 sm-width-full left py-2 mb-0">This project is maintained by <a class="text-accent" href="https://github.com/"></a></p>-->
<p class="col-8 left always-width-full py-2 mb-0">This website is a modification of <a class="text-accent" href="https://github.com/broccolini/swiss">Jekyll Swiss</a> and is maintained by Baird. Contact me <a class="text-accent" href="mailto:[email protected]">here</a>.</p>
<!--
<ul class="list-reset right clearfix sm-width-full py-2 mb-2 mb-lg-0">
<li class="inline-block mr-1">
<a href="https://twitter.com/share" class="twitter-share-button" data-hashtags="Python for climate scientists">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</li>
<li class="inline-block">
<a class="github-button" href="https://github.com//" data-icon="octicon-star" data-count-href="//stargazers" data-count-api="/repos//#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star / on GitHub">Star</a>
</li>
-->
</ul>
</div>
</div>


</body>

</html>
2 changes: 1 addition & 1 deletion _site/feed.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.7.3">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2018-07-12T22:57:49-07:00</updated><id>http://localhost:4000/</id><title type="html">Python for climate scientists</title><subtitle>Materials for Earth science data wrangling</subtitle><author><name>Baird</name></author></feed>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.7.3">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2018-07-12T23:02:19-07:00</updated><id>http://localhost:4000/</id><title type="html">Python for climate scientists</title><subtitle>Materials for Earth science data wrangling</subtitle><author><name>Baird</name></author></feed>
6 changes: 6 additions & 0 deletions _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@



<li class="inline-block">
<a class="align-middle link-primary header-link mr-2" href="/pages/setting-up-conda-environments.html">conda environments for NCO, NCL, and CDO</a>
</li>



<li class="inline-block">
<a class="align-middle link-primary header-link mr-2" href="/about/">about</a>
</li>
Expand Down
Loading

0 comments on commit 30f3c4d

Please sign in to comment.