|
|
|
@ -0,0 +1,447 @@
|
|
|
|
|
<!DOCTYPE html> |
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> |
|
|
|
|
|
|
|
|
|
<meta charset="utf-8"> |
|
|
|
|
<meta name="generator" content="quarto-1.1.189"> |
|
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<title>drcstools - MOM preprocessing mergtime</title> |
|
|
|
|
<style> |
|
|
|
|
code{white-space: pre-wrap;} |
|
|
|
|
span.smallcaps{font-variant: small-caps;} |
|
|
|
|
div.columns{display: flex; gap: min(4vw, 1.5em);} |
|
|
|
|
div.column{flex: auto; overflow-x: auto;} |
|
|
|
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} |
|
|
|
|
ul.task-list{list-style: none;} |
|
|
|
|
ul.task-list li input[type="checkbox"] { |
|
|
|
|
width: 0.8em; |
|
|
|
|
margin: 0 0.8em 0.2em -1.6em; |
|
|
|
|
vertical-align: middle; |
|
|
|
|
} |
|
|
|
|
pre > code.sourceCode { white-space: pre; position: relative; } |
|
|
|
|
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } |
|
|
|
|
pre > code.sourceCode > span:empty { height: 1.2em; } |
|
|
|
|
.sourceCode { overflow: visible; } |
|
|
|
|
code.sourceCode > span { color: inherit; text-decoration: inherit; } |
|
|
|
|
div.sourceCode { margin: 1em 0; } |
|
|
|
|
pre.sourceCode { margin: 0; } |
|
|
|
|
@media screen { |
|
|
|
|
div.sourceCode { overflow: auto; } |
|
|
|
|
} |
|
|
|
|
@media print { |
|
|
|
|
pre > code.sourceCode { white-space: pre-wrap; } |
|
|
|
|
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } |
|
|
|
|
} |
|
|
|
|
pre.numberSource code |
|
|
|
|
{ counter-reset: source-line 0; } |
|
|
|
|
pre.numberSource code > span |
|
|
|
|
{ position: relative; left: -4em; counter-increment: source-line; } |
|
|
|
|
pre.numberSource code > span > a:first-child::before |
|
|
|
|
{ content: counter(source-line); |
|
|
|
|
position: relative; left: -1em; text-align: right; vertical-align: baseline; |
|
|
|
|
border: none; display: inline-block; |
|
|
|
|
-webkit-touch-callout: none; -webkit-user-select: none; |
|
|
|
|
-khtml-user-select: none; -moz-user-select: none; |
|
|
|
|
-ms-user-select: none; user-select: none; |
|
|
|
|
padding: 0 4px; width: 4em; |
|
|
|
|
color: #aaaaaa; |
|
|
|
|
} |
|
|
|
|
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } |
|
|
|
|
div.sourceCode |
|
|
|
|
{ } |
|
|
|
|
@media screen { |
|
|
|
|
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } |
|
|
|
|
} |
|
|
|
|
code span.al { color: #ff0000; font-weight: bold; } /* Alert */ |
|
|
|
|
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ |
|
|
|
|
code span.at { color: #7d9029; } /* Attribute */ |
|
|
|
|
code span.bn { color: #40a070; } /* BaseN */ |
|
|
|
|
code span.bu { color: #008000; } /* BuiltIn */ |
|
|
|
|
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ |
|
|
|
|
code span.ch { color: #4070a0; } /* Char */ |
|
|
|
|
code span.cn { color: #880000; } /* Constant */ |
|
|
|
|
code span.co { color: #60a0b0; font-style: italic; } /* Comment */ |
|
|
|
|
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ |
|
|
|
|
code span.do { color: #ba2121; font-style: italic; } /* Documentation */ |
|
|
|
|
code span.dt { color: #902000; } /* DataType */ |
|
|
|
|
code span.dv { color: #40a070; } /* DecVal */ |
|
|
|
|
code span.er { color: #ff0000; font-weight: bold; } /* Error */ |
|
|
|
|
code span.ex { } /* Extension */ |
|
|
|
|
code span.fl { color: #40a070; } /* Float */ |
|
|
|
|
code span.fu { color: #06287e; } /* Function */ |
|
|
|
|
code span.im { color: #008000; font-weight: bold; } /* Import */ |
|
|
|
|
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ |
|
|
|
|
code span.kw { color: #007020; font-weight: bold; } /* Keyword */ |
|
|
|
|
code span.op { color: #666666; } /* Operator */ |
|
|
|
|
code span.ot { color: #007020; } /* Other */ |
|
|
|
|
code span.pp { color: #bc7a00; } /* Preprocessor */ |
|
|
|
|
code span.sc { color: #4070a0; } /* SpecialChar */ |
|
|
|
|
code span.ss { color: #bb6688; } /* SpecialString */ |
|
|
|
|
code span.st { color: #4070a0; } /* String */ |
|
|
|
|
code span.va { color: #19177c; } /* Variable */ |
|
|
|
|
code span.vs { color: #4070a0; } /* VerbatimString */ |
|
|
|
|
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="site_libs/quarto-nav/quarto-nav.js"></script> |
|
|
|
|
<script src="site_libs/quarto-nav/headroom.min.js"></script> |
|
|
|
|
<script src="site_libs/clipboard/clipboard.min.js"></script> |
|
|
|
|
<script src="site_libs/quarto-search/autocomplete.umd.js"></script> |
|
|
|
|
<script src="site_libs/quarto-search/fuse.min.js"></script> |
|
|
|
|
<script src="site_libs/quarto-search/quarto-search.js"></script> |
|
|
|
|
<meta name="quarto:offset" content="./"> |
|
|
|
|
<script src="site_libs/quarto-html/quarto.js"></script> |
|
|
|
|
<script src="site_libs/quarto-html/popper.min.js"></script> |
|
|
|
|
<script src="site_libs/quarto-html/tippy.umd.min.js"></script> |
|
|
|
|
<script src="site_libs/quarto-html/anchor.min.js"></script> |
|
|
|
|
<link href="site_libs/quarto-html/tippy.css" rel="stylesheet"> |
|
|
|
|
<link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"> |
|
|
|
|
<script src="site_libs/bootstrap/bootstrap.min.js"></script> |
|
|
|
|
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> |
|
|
|
|
<link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light"> |
|
|
|
|
<script id="quarto-search-options" type="application/json">{ |
|
|
|
|
"location": "navbar", |
|
|
|
|
"copy-button": false, |
|
|
|
|
"collapse-after": 3, |
|
|
|
|
"panel-placement": "end", |
|
|
|
|
"type": "overlay", |
|
|
|
|
"limit": 20, |
|
|
|
|
"language": { |
|
|
|
|
"search-no-results-text": "No results", |
|
|
|
|
"search-matching-documents-text": "matching documents", |
|
|
|
|
"search-copy-link-title": "Copy link to search", |
|
|
|
|
"search-hide-matches-text": "Hide additional matches", |
|
|
|
|
"search-more-match-text": "more match in this document", |
|
|
|
|
"search-more-matches-text": "more matches in this document", |
|
|
|
|
"search-clear-button-title": "Clear", |
|
|
|
|
"search-detached-cancel-button-title": "Cancel", |
|
|
|
|
"search-submit-button-title": "Submit" |
|
|
|
|
} |
|
|
|
|
}</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="styles.css"> |
|
|
|
|
<meta property="og:title" content="drcstools - MOM preprocessing mergtime"> |
|
|
|
|
<meta property="og:site-name" content="drcstools"> |
|
|
|
|
<meta name="twitter:title" content="drcstools - MOM preprocessing mergtime"> |
|
|
|
|
<meta name="twitter:card" content="summary"> |
|
|
|
|
</head> |
|
|
|
|
|
|
|
|
|
<body class="nav-sidebar floating nav-fixed"> |
|
|
|
|
|
|
|
|
|
<div id="quarto-search-results"></div> |
|
|
|
|
<header id="quarto-header" class="headroom fixed-top"> |
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-dark "> |
|
|
|
|
<div class="navbar-container container-fluid"> |
|
|
|
|
<div class="navbar-brand-container"> |
|
|
|
|
<a class="navbar-brand" href="./index.html"> |
|
|
|
|
<span class="navbar-title">drcstools</span> |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> |
|
|
|
|
<span class="navbar-toggler-icon"></span> |
|
|
|
|
</button> |
|
|
|
|
<div class="collapse navbar-collapse" id="navbarCollapse"> |
|
|
|
|
<ul class="navbar-nav navbar-nav-scroll ms-auto"> |
|
|
|
|
<li class="nav-item compact"> |
|
|
|
|
<a class="nav-link" href="https://github.com/florianboergel/drcstools/tree/master/"><i class="bi bi-github" role="img"> |
|
|
|
|
</i> |
|
|
|
|
</a> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div id="quarto-search" class="" title="Search"></div> |
|
|
|
|
</div> <!-- /navcollapse --> |
|
|
|
|
</div> <!-- /container-fluid --> |
|
|
|
|
</nav> |
|
|
|
|
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> |
|
|
|
|
<div class="container-fluid d-flex justify-content-between"> |
|
|
|
|
<h1 class="quarto-secondary-nav-title">MOM preprocessing mergtime</h1> |
|
|
|
|
<button type="button" class="quarto-btn-toggle btn" aria-label="Show secondary navigation"> |
|
|
|
|
<i class="bi bi-chevron-right"></i> |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</nav> |
|
|
|
|
</header> |
|
|
|
|
<!-- content --> |
|
|
|
|
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar"> |
|
|
|
|
<!-- sidebar --> |
|
|
|
|
<nav id="quarto-sidebar" class="sidebar collapse sidebar-navigation floating overflow-auto"> |
|
|
|
|
<div class="sidebar-menu-container"> |
|
|
|
|
<ul class="list-unstyled mt-1"> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./index.html" class="sidebar-item-text sidebar-link">Dynamics of Regional Climate Systems (DRCS) - Tools</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./derivative.html" class="sidebar-item-text sidebar-link">Derivatives</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./stats.html" class="sidebar-item-text sidebar-link">stats</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./helper_functions.html" class="sidebar-item-text sidebar-link">helper_functions</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./read_data.html" class="sidebar-item-text sidebar-link">read_data</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./ergom.html" class="sidebar-item-text sidebar-link">Ergom</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./lfca.html" class="sidebar-item-text sidebar-link">Low-frequency component analysis</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./lanczos_filter.html" class="sidebar-item-text sidebar-link">Filter</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./mom_preprocessing_obc.html" class="sidebar-item-text sidebar-link">MOM preprocessing OBC</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./09_mom_preprocessing_mergetime.html" class="sidebar-item-text sidebar-link active">MOM preprocessing mergtime</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
<li class="sidebar-item"> |
|
|
|
|
<div class="sidebar-item-container"> |
|
|
|
|
<a href="./mom_validation.html" class="sidebar-item-text sidebar-link">MOM validation</a> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
</nav> |
|
|
|
|
<!-- margin-sidebar --> |
|
|
|
|
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar"> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<!-- main --> |
|
|
|
|
<main class="content" id="quarto-document-content"> |
|
|
|
|
|
|
|
|
|
<header id="title-block-header" class="quarto-title-block default"> |
|
|
|
|
<div class="quarto-title"> |
|
|
|
|
<h1 class="title d-none d-lg-block">MOM preprocessing mergtime</h1> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="quarto-title-meta"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</header> |
|
|
|
|
|
|
|
|
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> |
|
|
|
|
<div class="cell" data-execution_count="1"> |
|
|
|
|
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> os, glob, re, argparse</span> |
|
|
|
|
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> subprocess <span class="im">as</span> sp</span> |
|
|
|
|
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span> |
|
|
|
|
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">"Remember to use 'module load cdo && module load nco'"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> |
|
|
|
|
<div class="cell-output cell-output-stdout"> |
|
|
|
|
<pre><code>Remember to use 'module load cdo && module load nco'</code></pre> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell" data-execution_count="3"> |
|
|
|
|
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="op">!</span>ls <span class="op">/</span>silod7<span class="op">/</span>boergel<span class="op">/</span>MOM_projections<span class="op">/</span><span class="dv">1961</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> |
|
|
|
|
<div class="cell-output cell-output-stdout"> |
|
|
|
|
<pre><code>dsr_1961_remap.nc slp_1961_remap.nc |
|
|
|
|
dsr.mom.dta.nc slp.mom.dta.nc |
|
|
|
|
huss_1961_remap.nc snf_1961_remap.nc |
|
|
|
|
huss.mom.dta.nc snf.mom.dta.nc |
|
|
|
|
lsr_1961_remap.nc t2m_1961_obc.nc |
|
|
|
|
lsr.mom.dta.nc t2m_1961_obc.nc.mom.dta.nc |
|
|
|
|
precip_1961_obc.nc t2m_1961_remap.nc |
|
|
|
|
precip_1961_obc.nc.mom.dta.nc t2m.mom.dta.nc |
|
|
|
|
precip_1961_remap.nc uv10_1961_obc.nc |
|
|
|
|
precip.mom.dta.nc uv10_1961_obc.nc.mom.dta.nc |
|
|
|
|
slp_1961_obc.nc uv10_1961_remap.nc |
|
|
|
|
slp_1961_obc.nc.mom.dta.nc uv10.mom.dta.nc</code></pre> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell" data-execution_count="46"> |
|
|
|
|
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> mergetime(data_path, year, suffix):</span> |
|
|
|
|
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(<span class="ss">f"</span><span class="sc">{</span>data_path<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>year<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>suffix<span class="sc">}</span><span class="ss">"</span>) </span> |
|
|
|
|
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> files <span class="op">=</span> glob.glob(<span class="ss">f"</span><span class="sc">{</span>data_path<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>year<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>suffix<span class="sc">}</span><span class="ss">"</span>)</span> |
|
|
|
|
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(files)</span> |
|
|
|
|
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> </span> |
|
|
|
|
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="bu">file</span> <span class="kw">in</span> files:</span> |
|
|
|
|
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> </span> |
|
|
|
|
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="co"># get file name as string and remove .nc</span></span> |
|
|
|
|
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> fname <span class="op">=</span> os.path.basename(<span class="bu">file</span>).strip(<span class="st">".nc"</span>) </span> |
|
|
|
|
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(fname)</span> |
|
|
|
|
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="co"># sometimes the file name itself contains some year information</span></span> |
|
|
|
|
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="bu">str</span>(year) <span class="kw">in</span> fname:</span> |
|
|
|
|
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="co"># we replace the year with the * flag</span></span> |
|
|
|
|
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="co"># this helps to search for previous years</span></span> |
|
|
|
|
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(<span class="st">"Found <year> in string ... adapting"</span>)</span> |
|
|
|
|
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> fnameSearch <span class="op">=</span> fname.replace(<span class="bu">str</span>(year), <span class="st">"*"</span>)</span> |
|
|
|
|
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span>:</span> |
|
|
|
|
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> fnameSearch <span class="op">=</span> fname</span> |
|
|
|
|
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> <span class="co"># Search for previous and past year</span></span> |
|
|
|
|
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a> fpath_prev <span class="op">=</span> glob.glob(<span class="ss">f"</span><span class="sc">{</span>data_path<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>year<span class="op">-</span><span class="dv">1</span><span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>fnameSearch<span class="sc">}</span><span class="ss">.nc"</span>)</span> |
|
|
|
|
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a> fpath_past <span class="op">=</span> glob.glob(<span class="ss">f"</span><span class="sc">{</span>data_path<span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>year<span class="op">+</span><span class="dv">1</span><span class="sc">}</span><span class="ss">/</span><span class="sc">{</span>fnameSearch<span class="sc">}</span><span class="ss">.nc"</span>)</span> |
|
|
|
|
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a> </span> |
|
|
|
|
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> os.path.isfile(fpath_prev):</span> |
|
|
|
|
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(<span class="st">"Found previous month"</span>)</span> |
|
|
|
|
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a> sp.check_call(<span class="st">"cdo seldate,</span><span class="sc">{}</span><span class="st">-12-01T00:00:00,</span><span class="sc">{}</span><span class="st">-01-01T00:00:00 -setcalendar,standard </span><span class="sc">{}</span><span class="st"> tmp1.nc"</span>.<span class="bu">format</span>(year<span class="op">-</span><span class="dv">1</span>, year, fpath_prev), shell<span class="op">=</span><span class="va">True</span>)</span> |
|
|
|
|
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a> fpath_prev <span class="op">=</span> <span class="st">"tmp1.nc"</span></span> |
|
|
|
|
<span id="cb5-27"><a href="#cb5-27" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span>:</span> |
|
|
|
|
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true" tabindex="-1"></a> fpath_prev <span class="op">=</span> <span class="st">""</span></span> |
|
|
|
|
<span id="cb5-29"><a href="#cb5-29" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> os.path.isfile(fpath_past):</span> |
|
|
|
|
<span id="cb5-30"><a href="#cb5-30" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(<span class="st">"Found past month"</span>)</span> |
|
|
|
|
<span id="cb5-31"><a href="#cb5-31" aria-hidden="true" tabindex="-1"></a> sp.check_call(<span class="st">"cdo seldate,</span><span class="sc">{}</span><span class="st">-01-01T00:00:00,</span><span class="sc">{}</span><span class="st">-01-31T23:59:59 -setcalendar,standard </span><span class="sc">{}</span><span class="st"> tmp3.nc"</span>.<span class="bu">format</span>(year, year<span class="op">+</span><span class="dv">1</span>, fpath_past), shell<span class="op">=</span><span class="va">True</span>)</span> |
|
|
|
|
<span id="cb5-32"><a href="#cb5-32" aria-hidden="true" tabindex="-1"></a> fpath_past <span class="op">=</span> <span class="st">"tmp3.nc"</span></span> |
|
|
|
|
<span id="cb5-33"><a href="#cb5-33" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span>:</span> |
|
|
|
|
<span id="cb5-34"><a href="#cb5-34" aria-hidden="true" tabindex="-1"></a> fpath_past <span class="op">=</span> <span class="st">""</span></span> |
|
|
|
|
<span id="cb5-35"><a href="#cb5-35" aria-hidden="true" tabindex="-1"></a></span> |
|
|
|
|
<span id="cb5-36"><a href="#cb5-36" aria-hidden="true" tabindex="-1"></a> <span class="bu">print</span>(<span class="st">"MERGING </span><span class="sc">{}</span><span class="st"> to </span><span class="sc">{}{}</span><span class="st">/</span><span class="sc">{}</span><span class="st">.mom.dta.nc"</span>.<span class="bu">format</span>(<span class="bu">file</span>,data_path,YEAR,fname))</span> |
|
|
|
|
<span id="cb5-37"><a href="#cb5-37" aria-hidden="true" tabindex="-1"></a> sp.check_call(<span class="st">"cdo -O mergetime </span><span class="sc">{}</span><span class="st"> </span><span class="sc">{}</span><span class="st"> </span><span class="sc">{}</span><span class="st"> </span><span class="sc">{}{}</span><span class="st">/</span><span class="sc">{}</span><span class="st">.mom.dta.nc"</span>.<span class="bu">format</span>(fpath_prev,<span class="bu">file</span>,fpath_past,data_path,YEAR,fname),shell <span class="op">=</span><span class="va">True</span>)</span> |
|
|
|
|
<span id="cb5-38"><a href="#cb5-38" aria-hidden="true" tabindex="-1"></a> sp.check_call(<span class="st">"ncatted -a calendar,time,o,c,julian </span><span class="sc">{}{}</span><span class="st">/</span><span class="sc">{}</span><span class="st">.mom.dta.nc"</span>.<span class="bu">format</span>(data_path,YEAR,fname),shell<span class="op">=</span><span class="va">True</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell" data-execution_count="47"> |
|
|
|
|
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>fname<span class="op">=</span><span class="st">"snf_1962_remap"</span></span> |
|
|
|
|
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>fname.replace(<span class="st">"1962"</span>, <span class="st">"*"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> |
|
|
|
|
<div class="cell-output cell-output-display" data-execution_count="47"> |
|
|
|
|
<pre><code>'snf_*_remap'</code></pre> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell" data-execution_count="48"> |
|
|
|
|
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co">#mergetime("/silod7/boergel/MOM_projections", year=1962, suffix="*????_remap*")</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> |
|
|
|
|
<div class="cell-output cell-output-stdout"> |
|
|
|
|
<pre><code>/silod7/boergel/MOM_projections/1962/*????_remap* |
|
|
|
|
['/silod7/boergel/MOM_projections/1962/snf_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/t2m_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/dsr_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/lsr_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/huss_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/precip_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/slp_1962_remap.nc', '/silod7/boergel/MOM_projections/1962/uv10_1962_remap.nc'] |
|
|
|
|
snf_1962_remap |
|
|
|
|
Found <year> in string ... adapting |
|
|
|
|
snf_1962_remap |
|
|
|
|
snf_*_remap |
|
|
|
|
['/silod7/boergel/MOM_projections/1961/snf_1961_remap.nc']</code></pre> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</main> <!-- /main --> |
|
|
|
|
<script id="quarto-html-after-body" type="application/javascript"> |
|
|
|
|
window.document.addEventListener("DOMContentLoaded", function (event) { |
|
|
|
|
const toggleBodyColorMode = (bsSheetEl) => { |
|
|
|
|
const mode = bsSheetEl.getAttribute("data-mode"); |
|
|
|
|
const bodyEl = window.document.querySelector("body"); |
|
|
|
|
if (mode === "dark") { |
|
|
|
|
bodyEl.classList.add("quarto-dark"); |
|
|
|
|
bodyEl.classList.remove("quarto-light"); |
|
|
|
|
} else { |
|
|
|
|
bodyEl.classList.add("quarto-light"); |
|
|
|
|
bodyEl.classList.remove("quarto-dark"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const toggleBodyColorPrimary = () => { |
|
|
|
|
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap"); |
|
|
|
|
if (bsSheetEl) { |
|
|
|
|
toggleBodyColorMode(bsSheetEl); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
toggleBodyColorPrimary(); |
|
|
|
|
const icon = ""; |
|
|
|
|
const anchorJS = new window.AnchorJS(); |
|
|
|
|
anchorJS.options = { |
|
|
|
|
placement: 'right', |
|
|
|
|
icon: icon |
|
|
|
|
}; |
|
|
|
|
anchorJS.add('.anchored'); |
|
|
|
|
const clipboard = new window.ClipboardJS('.code-copy-button', { |
|
|
|
|
target: function(trigger) { |
|
|
|
|
return trigger.previousElementSibling; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
clipboard.on('success', function(e) { |
|
|
|
|
// button target |
|
|
|
|
const button = e.trigger; |
|
|
|
|
// don't keep focus |
|
|
|
|
button.blur(); |
|
|
|
|
// flash "checked" |
|
|
|
|
button.classList.add('code-copy-button-checked'); |
|
|
|
|
var currentTitle = button.getAttribute("title"); |
|
|
|
|
button.setAttribute("title", "Copied!"); |
|
|
|
|
setTimeout(function() { |
|
|
|
|
button.setAttribute("title", currentTitle); |
|
|
|
|
button.classList.remove('code-copy-button-checked'); |
|
|
|
|
}, 1000); |
|
|
|
|
// clear code selection |
|
|
|
|
e.clearSelection(); |
|
|
|
|
}); |
|
|
|
|
function tippyHover(el, contentFn) { |
|
|
|
|
const config = { |
|
|
|
|
allowHTML: true, |
|
|
|
|
content: contentFn, |
|
|
|
|
maxWidth: 500, |
|
|
|
|
delay: 100, |
|
|
|
|
arrow: false, |
|
|
|
|
appendTo: function(el) { |
|
|
|
|
return el.parentElement; |
|
|
|
|
}, |
|
|
|
|
interactive: true, |
|
|
|
|
interactiveBorder: 10, |
|
|
|
|
theme: 'quarto', |
|
|
|
|
placement: 'bottom-start' |
|
|
|
|
}; |
|
|
|
|
window.tippy(el, config); |
|
|
|
|
} |
|
|
|
|
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]'); |
|
|
|
|
for (var i=0; i<noterefs.length; i++) { |
|
|
|
|
const ref = noterefs[i]; |
|
|
|
|
tippyHover(ref, function() { |
|
|
|
|
// use id or data attribute instead here |
|
|
|
|
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href'); |
|
|
|
|
try { href = new URL(href).hash; } catch {} |
|
|
|
|
const id = href.replace(/^#\/?/, ""); |
|
|
|
|
const note = window.document.getElementById(id); |
|
|
|
|
return note.innerHTML; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); |
|
|
|
|
for (var i=0; i<bibliorefs.length; i++) { |
|
|
|
|
const ref = bibliorefs[i]; |
|
|
|
|
const cites = ref.parentNode.getAttribute('data-cites').split(' '); |
|
|
|
|
tippyHover(ref, function() { |
|
|
|
|
var popup = window.document.createElement('div'); |
|
|
|
|
cites.forEach(function(cite) { |
|
|
|
|
var citeDiv = window.document.createElement('div'); |
|
|
|
|
citeDiv.classList.add('hanging-indent'); |
|
|
|
|
citeDiv.classList.add('csl-entry'); |
|
|
|
|
var biblioDiv = window.document.getElementById('ref-' + cite); |
|
|
|
|
if (biblioDiv) { |
|
|
|
|
citeDiv.innerHTML = biblioDiv.innerHTML; |
|
|
|
|
} |
|
|
|
|
popup.appendChild(citeDiv); |
|
|
|
|
}); |
|
|
|
|
return popup.innerHTML; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
</div> <!-- /content --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body></html> |