Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/winash12/metpy into main
Browse files Browse the repository at this point in the history
  • Loading branch information
winash12 committed Dec 11, 2023
2 parents cfd99c2 + 7888358 commit 1d3b603
Show file tree
Hide file tree
Showing 75 changed files with 781 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-pypi/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/assign-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Assign Latest Milestone
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Run script
with:
script: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backport-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
labels: backport

- name: Comment on completion
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Comment on error
if: failure()
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const workflow_url = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: 'pip'
Expand All @@ -39,7 +39,7 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
ruff check . | reviewdog -f=pep8 -name=flake8 -reporter=github-check -filter-mode=nofilter
ruff check . | reviewdog -f=pep8 -name=ruff -reporter=github-check -filter-mode=nofilter
- name: Run flake8
env:
Expand All @@ -65,3 +65,10 @@ jobs:
run: |
set -o pipefail
codespell | reviewdog -efm='%f:%l: %m' -name=codespell -reporter=github-check -filter-mode=nofilter
- name: Check static data registry
# Don't skip if any other steps fail
if: always()
run: |
python -c "import pooch; pooch.make_registry('staticdata', 'src/metpy/static-data-manifest.txt')"
git diff --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
touch tests-nightly.log build.log linkchecker.log
- name: Report failures
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Set up Python
id: setup
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

Expand Down Expand Up @@ -56,4 +56,4 @@ jobs:
cp packages-*/* dist/
- name: Publish Package
uses: pypa/gh-action-pypi-publish@v1.8.10
uses: pypa/gh-action-pypi-publish@v1.8.11
6 changes: 3 additions & 3 deletions ci/doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sphinx==7.2.6
pydata-sphinx-theme==0.14.3
pydata-sphinx-theme==0.14.4
sphinx-design==0.5.0
sphinx-gallery==0.14.0
sphinx-gallery==0.15.0
myst-parser==2.0.0
netCDF4==1.6.5
geopandas==0.14.0
geopandas==0.14.1
rtree==1.1.0
2 changes: 1 addition & 1 deletion ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cartopy==0.22.0
dask==2023.10.1
dask==2023.12.0
shapely==2.0.2
6 changes: 4 additions & 2 deletions ci/linting_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruff==0.1.4
ruff==0.1.7

flake8==6.1.0
pycodestyle==2.11.1
Expand All @@ -8,11 +8,13 @@ flake8-continuation==1.0.5
flake8-copyright==0.2.4
flake8-isort==6.1.1
isort==5.12.0
flake8-requirements==1.7.8
flake8-requirements==2.0.1

flake8-rst-docstrings==0.3.0

doc8==1.1.1
restructuredtext_lint==1.4.0

codespell==2.2.6

pooch==1.8.0
12 changes: 6 additions & 6 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
matplotlib==3.8.1
numpy==1.26.0
pandas==2.1.2
matplotlib==3.8.2
numpy==1.26.2
pandas==2.1.3
pooch==1.8.0
pint==0.22
pyproj==3.6.1
scipy==1.11.3
traitlets==5.13.0
xarray==2023.10.1
scipy==1.11.4
traitlets==5.14.0
xarray==2023.11.0
13 changes: 11 additions & 2 deletions docs/_static/theme-unidata.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Define "Unidata Blue" RGB values */
:root {
html {
--unidata-blue-rgb: 6, 119, 143;
}

Expand All @@ -19,10 +19,19 @@

.bd-header .navbar-nav>.nav-item>.nav-link,
.bd-header .dropdown-toggle,
.bd-header .fa-solid {
.bd-header .fa-solid,
.bd-header .btn {
color: #fff !important;
}

.version-switcher__button {
border-color: #fff !important;
}

.search-button {
padding: 0 0 0;
}

.navbar-nav .dropdown-menu {
background-color: var(--pst-color-background);
}
Expand Down
3 changes: 3 additions & 0 deletions docs/_templates/overrides/metpy.calc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Moist Thermodynamics
virtual_temperature
virtual_temperature_from_dewpoint
wet_bulb_temperature
wet_bulb_potential_temperature


Soundings
Expand All @@ -71,10 +72,12 @@ Soundings

bulk_shear
bunkers_storm_motion
corfidi_storm_motion
cape_cin
ccl
critical_angle
cross_totals
downdraft_cape
el
k_index
lcl
Expand Down
12 changes: 12 additions & 0 deletions docs/api/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ References
doi:`10.1175/1520-0434(2000)015\<0061:PSMUAN\>2.0.CO;2
<https://doi.org/10.1175/1520-0434(2000)015\<0061:PSMUAN\>2.0.CO;2>`_.
.. [Corfidi2003] Corfidi, S. F., 2003: Cold Pools and MCS Propagation:
Forecasting the Motion of Downwind-Developing MCSs.
*Wea. Forecasting.*, **18**, 997–1017,
doi:`10.1175/1520-0434(2003)018\<0997:CPAMPF\>2.0.CO;2
<https://doi.org/10.1175/1520-0434(2003)018\<0997:CPAMPF\>2.0.CO;2>`_.
.. [CODATA2018] Tiesinga, Eite, Peter J. Mohr, David B. Newell, and Barry N. Taylor, 2020:
The 2018 CODATA Recommended Values of the Fundamental Physical Constants
(Web Version 8.1). Database developed by J. Baker, M. Douma, and S. Kotochigova.
Expand All @@ -54,10 +60,16 @@ References
*Mon. Wea. Rev.*, **137**, 3137-3148,
doi: `10.1175/2009mwr2774.1 <https://doi.org/10.1175/2009MWR2774.1>`_.
.. [DaviesJones2008] Davies-Jones, R., 2008: An Efficient and Accurate Method for Computing the Wet-Bulb Temperature along Pseudoadiabats.
*Mon. Wea. Rev.*, **136**, 2764-2785,
doi: `10.1175/2007mwr2224.1 <https://doi.org/10.1175/2007MWR2224.1>`_.
.. [DoswellSchultz2006] Doswell, C. A. III, and D. M. Schultz, 2006: `On the Use of Indices and
Parameters in Forecasting Severe Storms <https://ejssm.org/archives/2006/vol-1-3-2006/>`_.
*Electronic J. Severe Storms Meteor.*, **1** (3), 1-22.
.. [Emanuel1994] Emanuel, K. A., 1994: Atmospheric Convection. Oxford University Press, 592 pp.
.. [Esterheld2008] Esterheld, J. M. and D. J. Giuliano, 2008: `Discriminating between Tornadic and
Non-Tornadic Supercells: A New Hodograph Technique <https://ejssm.org/archives/2008/vol-3-2-2008/>`_.
*Electronic J. Severe Storms Meteor.*, **3** (2), 1-50.
Expand Down
77 changes: 71 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# serve to show the default.

from datetime import datetime
import inspect
import os
from pathlib import Path
import re
Expand Down Expand Up @@ -37,9 +38,9 @@
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx_design',
'sphinx_gallery.gen_gallery',
'matplotlib.sphinxext.plot_directive',
Expand Down Expand Up @@ -138,8 +139,8 @@

# noinspection PyShadowingBuiltins
copyright = (
f'2008\u2013{cur_date:%Y}, MetPy Developers.'
'Development is supported by Unidata and the National Science Foundation.'
f'2008\u2013{cur_date:%Y}, MetPy Developers. '
'Development is supported by Unidata and the National Science Foundation'
)

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -213,13 +214,19 @@
{
'name': 'GitHub',
'url': 'https://github.com/Unidata/MetPy',
'icon': 'fa-brands fa-github-square',
'icon': 'fa-brands fa-github',
'type': 'fontawesome',
},
{
'name': 'Twitter',
'url': 'https://twitter.com/MetPy',
'icon': 'fa-brands fa-twitter-square',
'icon': 'fa-brands fa-twitter',
'type': 'fontawesome',
},
{
'name': 'Calendar',
'url': 'https://calendar.google.com/calendar/embed?src=c_596cc34cd7196caec223786795c8730786aead6e2dbffe03403186f203075973%40group.calendar.google.com&ctz=America%2FDenver',
'icon': 'fa-solid fa-calendar',
'type': 'fontawesome',
}
],
Expand Down Expand Up @@ -316,7 +323,7 @@
# html_split_index = False

# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
html_show_sourcelink = False

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
Expand Down Expand Up @@ -452,3 +459,61 @@
r'https://docs.github.com/': {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686; '
'rv:24.0) Gecko/20100101 Firefox/24.0'}
}

# Function to resolve source code links for `linkcode`
# adapted from NumPy, Pandas implementations
def linkcode_resolve(domain, info):
"""
Determine the URL corresponding to Python object
"""
if domain != "py":
return None

modname = info["module"]
fullname = info["fullname"]

submod = sys.modules.get(modname)
if submod is None:
return None

obj = submod
for part in fullname.split("."):
try:
obj = getattr(obj, part)
except AttributeError:
return None

try:
fn = inspect.getsourcefile(inspect.unwrap(obj))
except TypeError:
try: # property
fn = inspect.getsourcefile(inspect.unwrap(obj.fget))
except (AttributeError, TypeError):
fn = None
if not fn:
return None

try:
source, lineno = inspect.getsourcelines(obj)
except TypeError:
try: # property
source, lineno = inspect.getsourcelines(obj.fget)
except (AttributeError, TypeError):
lineno = None
except OSError:
lineno = None

if lineno:
linespec = f"#L{lineno}-L{lineno + len(source) - 1}"
else:
linespec = ""

fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__))

if "+" in metpy.__version__:
return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}"
else:
return (
f"https://github.com/Unidata/MetPy/blob/"
f"v{metpy.__version__}/src/metpy/{fn}{linespec}"
)
16 changes: 14 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ with weather data. MetPy supports Python >= 3.9 and is freely available under a

If you're new to MetPy, check out our :doc:`Getting Started <userguide/startingguide>` guide.


.. grid:: 1 2 2 2
:gutter: 2

Expand Down Expand Up @@ -68,8 +67,21 @@ If you're new to MetPy, check out our :doc:`Getting Started <userguide/startingg
Check out MetPy's gallery of examples which contains
sample code demonstrating various parts of MetPy's functionality.

Calendar
--------
Check out the MetPy Community Calendar below. The bi-weekly MetPy Community Dev Call
is an open discussion for community input, developer highlights and updates, and
community code showcase opportunities. Stop by!
Find more information in the pinned thread in the
`Announcements section <https://github.com/Unidata/MetPy/discussions/categories/announcements>`
of MetPy GitHub Discussions.

.. raw:: html

<iframe src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23ffffff&ctz=America%2FDenver&title=MetPy%20Community%20Calendar&showPrint=0&showTabs=0&showCalendars=0&showTz=1&src=Y181OTZjYzM0Y2Q3MTk2Y2FlYzIyMzc4Njc5NWM4NzMwNzg2YWVhZDZlMmRiZmZlMDM0MDMxODZmMjAzMDc1OTczQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20&color=%23D50000" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

Our up-to-date references for grants and funding can be found `here <https://github.com/Unidata/MetPy/blob/main/CITATION.cff>`_.
Our up-to-date references for grants and funding can be found
`here <https://github.com/Unidata/MetPy/blob/main/CITATION.cff>`_.

.. image:: _static/NSF.jpg
:width: 100 px
Expand Down
4 changes: 2 additions & 2 deletions docs/userguide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ Bulletin of the American Meteorological Society.
from metpy.cbook import get_test_data
import metpy.plots as mpplots

data = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False),
infer_datetime_format=True, parse_dates=['valid'])
data = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False))
data['valid'] = pd.to_datetime(data['valid'], format='%Y-%m-%d %H:%M:%S')

obs = mpplots.PlotObs()
obs.data = data
Expand Down
4 changes: 2 additions & 2 deletions examples/plots/surface_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
# Python script. The data are pre-processed to determine sky cover and weather symbols from
# text output.

data = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False),
infer_datetime_format=True, parse_dates=['valid'])
data = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False))
data['valid'] = pd.to_datetime(data['valid'], format='%Y-%m-%d %H:%M:%S')

########################################
# **Plotting the data**
Expand Down
Loading

0 comments on commit 1d3b603

Please sign in to comment.