Skip to content

Commit

Permalink
Update grib2io_interp package structure
Browse files Browse the repository at this point in the history
grib2io_interp now has an __init__.py for proper package structuring.

__version__ string is now available.

Minor documentation.
  • Loading branch information
EricEngle-NOAA committed Jun 26, 2023
1 parent 7aefd6d commit 8b643d5
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
src/grib2io_interp/__config__.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
2 changes: 1 addition & 1 deletion create_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
sysarch=$(uname -m)
build_dir=$(find . -name "lib.*${sysarch}*" -type d)
echo "Building docs from: $build_dir"
pdoc -o 'docs' $build_dir/grib2io_interp
pdoc -o 'docs' $build_dir/grib2io_interp !grib2io_interp.interpolate
46 changes: 41 additions & 5 deletions docs/grib2io_interp.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
<input type="search" placeholder="Search..." role="searchbox" aria-label="search"
pattern=".+" required>

<h2>Contents</h2>
<ul>
<li><a href="#introduction">Introduction</a></li>
</ul>


<h2>Submodules</h2>
<ul>
<li><a href="grib2io_interp/interpolate.html">interpolate</a></li>
</ul>


Expand All @@ -41,10 +45,42 @@ <h2>Submodules</h2>
<h1 class="modulename">
grib2io_interp </h1>





<div class="docstring"><h1 id="introduction">Introduction</h1>

<p>grib2io_interp is a component package to the parent package, <a href="https://github.com/NOAA-MDL/grib2io">grib2io</a>.
This package provides interfaces to the <a href="https://github.com/NOAA-EMC/NCEPLIBS-ip">NCEPLIBS-ip</a> general
interpolation library.</p>

<p>grib2io_interp provides interfaces for performing scalar and vector interpolation. <code>grib2io_interp.interpolate</code> is
a f2py module extension that contains 2 subroutines: <code>interpolate_scalar</code> and <code>interpolate_vector</code>. These
subroutines serve as wrappers to the NCEPLIBS-ip subroutines <code>ipolates_grib2</code> and <code>ipolatev_grib2</code> respectively.</p>

<p>It is <strong>recommended</strong> that you access these interpolateion subroutines via <a href="https://noaa-mdl.github.io/grib2io/grib2io.html#interpolate"><code>grib2io.interpolate()</code></a>.</p>
</div>

<input id="mod-grib2io_interp-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">

<label class="view-source-button" for="mod-grib2io_interp-view-source"><span>View Source</span></label>

<div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">Introduction</span>
</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="sd">============</span>
</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a>
</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="sd">grib2io_interp is a component package to the parent package, [grib2io](https://github.com/NOAA-MDL/grib2io).</span>
</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="sd">This package provides interfaces to the [NCEPLIBS-ip](https://github.com/NOAA-EMC/NCEPLIBS-ip) general</span>
</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="sd">interpolation library.</span>
</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a>
</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd">grib2io_interp provides interfaces for performing scalar and vector interpolation. `grib2io_interp.interpolate` is</span>
</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd">a f2py module extension that contains 2 subroutines: `interpolate_scalar` and `interpolate_vector`. These</span>
</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd">subroutines serve as wrappers to the NCEPLIBS-ip subroutines `ipolates_grib2` and `ipolatev_grib2` respectively.</span>
</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a>
</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd">It is **recommended** that you access these interpolateion subroutines via [`grib2io.interpolate()`](https://noaa-mdl.github.io/grib2io/grib2io.html#interpolate).</span>
</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd">&quot;&quot;&quot;</span>
</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a>
</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="kn">from</span> <span class="nn">.__config__</span> <span class="kn">import</span> <span class="n">grib2io_interp_version</span> <span class="k">as</span> <span class="n">__version__</span>
</span></pre></div>


</section>
</main>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="pdoc 14.0.0"/>
<title>grib2io_interp.interpolate API documentation</title>
<title>grib2io_interp.__config__ API documentation</title>

<style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style>
<style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style>
Expand All @@ -28,6 +28,13 @@



<h2>API Documentation</h2>
<ul class="memberlist">
<li>
<a class="variable" href="#grib2io_interp_version">grib2io_interp_version</a>
</li>
</ul>



<a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank">
Expand All @@ -40,19 +47,32 @@
<main class="pdoc">
<section class="module-info">
<h1 class="modulename">
<a href="./../grib2io_interp.html">grib2io_interp</a><wbr>.interpolate </h1>

<div class="docstring"><p>This module 'interpolate' is auto-generated with f2py (version:1.24.3).
Functions:
no,ibo,lo,iret = interpolate_scalar(ip,ipopt,igdtnumi,igdtmpli,igdtnumo,igdtmplo,ibi,li,gi,go,rlat,rlon,igdtleni=shape(igdtmpli, 0),igdtleno=shape(igdtmplo, 0),mi=shape(li, 0),mo=shape(go, 0),km=shape(ibi, 0))
no,ibo,lo,iret = interpolate_vector(ip,ipopt,igdtnumi,igdtmpli,igdtnumo,igdtmplo,ibi,li,ui,vi,uo,vo,rlat,rlon,crot,srot,igdtleni=shape(igdtmpli, 0),igdtleno=shape(igdtmplo, 0),mi=shape(li, 0),mo=shape(uo, 0),km=shape(ibi, 0))
.</p>
</div>
<a href="./../grib2io_interp.html">grib2io_interp</a><wbr>.__config__ </h1>




<input id="mod-__config__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">

<label class="view-source-button" for="mod-__config__-view-source"><span>View Source</span></label>

<div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos">1</span></a><span class="c1"># This file is generated by grib2io-interps&#39;s setup.py</span>
</span><span id="L-2"><a href="#L-2"><span class="linenos">2</span></a><span class="c1"># It contains configuration information when building this package.</span>
</span><span id="L-3"><a href="#L-3"><span class="linenos">3</span></a><span class="n">grib2io_interp_version</span> <span class="o">=</span> <span class="s1">&#39;1.0.0rc1&#39;</span>
</span></pre></div>


</section>
<section id="grib2io_interp_version">
<div class="attr variable">
<span class="name">grib2io_interp_version</span> =
<span class="default_value">&#39;1.0.0rc1&#39;</span>


</div>
<a class="headerlink" href="#grib2io_interp_version"></a>



</section>
</main>
<script>
function escapeHTML(html) {
Expand Down
2 changes: 1 addition & 1 deletion docs/search.js

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _find_library_linux(name):
# Define interpolation NumPy extension module.
# ----------------------------------------------------------------------------------------
interpext = Extension(name = 'grib2io_interp.interpolate',
sources = ['src/interpolate.pyf','src/interpolate.f90'],
sources = ['src/interpolate/interpolate.pyf','src/interpolate/interpolate.f90'],
extra_f77_compile_args = ['-O3','-fopenmp'],
extra_f90_compile_args = ['-O3','-fopenmp'],
include_dirs = incdirs,
Expand All @@ -88,19 +88,20 @@ def _find_library_linux(name):
libraries = libraries)

# ----------------------------------------------------------------------------------------
# Define testing class
# Create __config__.py
# ----------------------------------------------------------------------------------------
#class TestCommand(Command):
# user_options = []
# def initialize_options(self):
# pass
# def finalize_options(self):
# pass
# def run(self):
# import sys, subprocess
# for f in glob.glob('./tests/*.py'):
# raise SystemExit(subprocess.call([sys.executable,f]))
#cmdclass['test'] = TestCommand
cnt = \
"""# This file is generated by grib2io-interps's setup.py
# It contains configuration information when building this package.
grib2io_interp_version = '%(grib2io_interp_version)s'
"""
a = open('src/grib2io_interp/__config__.py','w')
cfgdict = {}
cfgdict['grib2io_interp_version'] = VERSION
try:
a.write(cnt % cfgdict)
finally:
a.close()

# ----------------------------------------------------------------------------------------
# Run setup
Expand All @@ -123,4 +124,6 @@ def _find_library_linux(name):
'Intended Audience :: Science/Research',
'License :: OSI Approved',
'Topic :: Software Development :: Libraries :: Python Modules'],
packages = ["grib2io_interp"],
package_dir = {'': 'src'},
ext_modules = [interpext])
16 changes: 16 additions & 0 deletions src/grib2io_interp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Introduction
============
grib2io_interp is a component package to the parent package, [grib2io](https://github.com/NOAA-MDL/grib2io).
This package provides interfaces to the [NCEPLIBS-ip](https://github.com/NOAA-EMC/NCEPLIBS-ip) general
interpolation library.
grib2io_interp provides interfaces for performing scalar and vector interpolation. `grib2io_interp.interpolate` is
a f2py module extension that contains 2 subroutines: `interpolate_scalar` and `interpolate_vector`. These
subroutines serve as wrappers to the NCEPLIBS-ip subroutines `ipolates_grib2` and `ipolatev_grib2` respectively.
It is **recommended** that you access these interpolation subroutines via [`grib2io.interpolate()`](https://noaa-mdl.github.io/grib2io/grib2io.html#interpolate).
"""

from .__config__ import grib2io_interp_version as __version__
File renamed without changes.
4 changes: 4 additions & 0 deletions src/interpolate.pyf → src/interpolate/interpolate.pyf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
! -*- f90 -*-
! Note: the context of this file is case sensitive.

"""
HELLO WORLD!
"""

python module interpolate ! in
interface ! in :interpolate
subroutine interpolate_scalar(ip,ipopt,igdtnumi,igdtmpli,igdtleni,igdtnumo,igdtmplo,igdtleno,mi,mo,km,ibi,li,gi,no,ibo,lo,go,rlat,rlon,iret) ! in :interpolate:interpolate.f90
Expand Down

0 comments on commit 8b643d5

Please sign in to comment.