Skip to content

Commit

Permalink
Deploy dev to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dcamron committed Jan 9, 2025
1 parent e8bade5 commit de86770
Show file tree
Hide file tree
Showing 465 changed files with 6,104 additions and 1,312 deletions.
Binary file not shown.
Binary file modified dev/_downloads/082a0fab3fe1251c35a5c076fbfdaaaf/Bulk_Shear.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) 2025 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
=================
High/Low Analysis
=================
This uses MetPy's `find_peaks` function to automatically identify locations of high and low
centers, and then plots them on a map.
"""

import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import xarray as xr

from metpy.calc import find_peaks
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, scattertext
from metpy.units import units

###########################################
# Start by loading some data from our sample GFS model dataset. Pull out the geopotential
# heights field for the 850 hPa layer, as well as grab the projection metadata.
data = xr.open_dataset(get_test_data('GFS_test.nc', as_file_obj=False)).metpy.parse_cf()
mslp = data.Geopotential_height_isobaric.metpy.sel(vertical=850 * units.hPa).squeeze()
dataproj = mslp.metpy.cartopy_crs


###########################################
# Here we use `find_peaks` to find the locations of the highs and then the lows
h_y, h_x = find_peaks(mslp.values)
l_y, l_x = find_peaks(mslp.values, maxima=False)

###########################################
# Plot the analyzed locations on top of the contours of height on a map
fig = plt.figure(figsize=(11., 8.))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.LambertConformal(central_longitude=-95))
ax.contour(mslp.metpy.x, mslp.metpy.y, mslp, range(0, 2000, 30),
colors='k', linewidths=1.25, linestyles='solid', transform=dataproj)

# Using scattertext() plot the high centers using a red 'H' and put the height value
# below the 'H' using a smaller font.
scattertext(ax, mslp.metpy.x[h_x], mslp.metpy.y[h_y], 'H', size=20, color='red',
fontweight='bold', transform=dataproj)
scattertext(ax, mslp.metpy.x[h_x], mslp.metpy.y[h_y], mslp.values[h_y, h_x], formatter='.0f',
size=12, color='red', loc=(0, -15), fontweight='bold', transform=dataproj)

# Now do the same for the lows using a blue 'L'
scattertext(ax, mslp.metpy.x[l_x], mslp.metpy.y[l_y], 'L', size=20, color='blue',
fontweight='bold', transform=dataproj)
scattertext(ax, mslp.metpy.x[l_x], mslp.metpy.y[l_y], mslp.values[l_y, l_x], formatter='.0f',
size=12, color='blue', loc=(0, -15), fontweight='bold', transform=dataproj)

ax.add_feature(cfeature.OCEAN)
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)

ax.set_title('Automated 850hPa High and Low Locations')
add_metpy_logo(fig, 275, 295, size='large')
plt.show()
Binary file modified dev/_downloads/1523f155da5959646e27c2eaca8007cb/Station_Plot.zip
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/1aa267885c4b6699e5357f95474588e6/Divergence.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/52a7c4e2d2473999748f1de66b9de91d/Parse_Angles.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/78b733bd37148dbb5ae99df3a7fabf14/QVector.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/7ad5a62cb10cfd5d67f19e01218a8d48/Smoothing.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/bacdb1a56b06049d5bfcf2fe02725944/Wind_Speed.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/c3ed37a5ecf3e5a9c07a95643273f96d/Gradient.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# High/Low Analysis\n\nThis uses MetPy's `find_peaks` function to automatically identify locations of high and low\ncenters, and then plots them on a map.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import cartopy.crs as ccrs\nimport cartopy.feature as cfeature\nimport matplotlib.pyplot as plt\nimport xarray as xr\n\nfrom metpy.calc import find_peaks\nfrom metpy.cbook import get_test_data\nfrom metpy.plots import add_metpy_logo, scattertext\nfrom metpy.units import units"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Start by loading some data from our sample GFS model dataset. Pull out the geopotential\nheights field for the 850 hPa layer, as well as grab the projection metadata.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"data = xr.open_dataset(get_test_data('GFS_test.nc', as_file_obj=False)).metpy.parse_cf()\nmslp = data.Geopotential_height_isobaric.metpy.sel(vertical=850 * units.hPa).squeeze()\ndataproj = mslp.metpy.cartopy_crs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here we use `find_peaks` to find the locations of the highs and then the lows\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"h_y, h_x = find_peaks(mslp.values)\nl_y, l_x = find_peaks(mslp.values, maxima=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the analyzed locations on top of the contours of height on a map\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(11., 8.))\nax = fig.add_subplot(1, 1, 1, projection=ccrs.LambertConformal(central_longitude=-95))\nax.contour(mslp.metpy.x, mslp.metpy.y, mslp, range(0, 2000, 30),\n colors='k', linewidths=1.25, linestyles='solid', transform=dataproj)\n\n# Using scattertext() plot the high centers using a red 'H' and put the height value\n# below the 'H' using a smaller font.\nscattertext(ax, mslp.metpy.x[h_x], mslp.metpy.y[h_y], 'H', size=20, color='red',\n fontweight='bold', transform=dataproj)\nscattertext(ax, mslp.metpy.x[h_x], mslp.metpy.y[h_y], mslp.values[h_y, h_x], formatter='.0f',\n size=12, color='red', loc=(0, -15), fontweight='bold', transform=dataproj)\n\n# Now do the same for the lows using a blue 'L'\nscattertext(ax, mslp.metpy.x[l_x], mslp.metpy.y[l_y], 'L', size=20, color='blue',\n fontweight='bold', transform=dataproj)\nscattertext(ax, mslp.metpy.x[l_x], mslp.metpy.y[l_y], mslp.values[l_y, l_x], formatter='.0f',\n size=12, color='blue', loc=(0, -15), fontweight='bold', transform=dataproj)\n\nax.add_feature(cfeature.OCEAN)\nax.add_feature(cfeature.LAND)\nax.add_feature(cfeature.COASTLINE)\n\nax.set_title('Automated 850hPa High and Low Locations')\nadd_metpy_logo(fig, 275, 295, size='large')\nplt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"outputs": [],
"source": [
"import cartopy.crs as ccrs\nimport cartopy.feature as cfeature\nimport matplotlib.pyplot as plt\n\nfrom metpy.cbook import get_test_data\nfrom metpy.io import parse_wpc_surface_bulletin\nfrom metpy.plots import (add_metpy_logo, ColdFront, OccludedFront, StationaryFront,\n StationPlot, WarmFront)"
"import cartopy.crs as ccrs\nimport cartopy.feature as cfeature\nimport matplotlib.pyplot as plt\n\nfrom metpy.cbook import get_test_data\nfrom metpy.io import parse_wpc_surface_bulletin\nfrom metpy.plots import (add_metpy_logo, ColdFront, OccludedFront, scattertext,\n StationaryFront, WarmFront)"
]
},
{
Expand All @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"def plot_bulletin(ax, data):\n \"\"\"Plot a dataframe of surface features on a map.\"\"\"\n # Set some default visual styling\n size = 4\n fontsize = 9\n complete_style = {'HIGH': {'color': 'blue', 'fontsize': fontsize},\n 'LOW': {'color': 'red', 'fontsize': fontsize},\n 'WARM': {'linewidth': 1, 'path_effects': [WarmFront(size=size)]},\n 'COLD': {'linewidth': 1, 'path_effects': [ColdFront(size=size)]},\n 'OCFNT': {'linewidth': 1, 'path_effects': [OccludedFront(size=size)]},\n 'STNRY': {'linewidth': 1, 'path_effects': [StationaryFront(size=size)]},\n 'TROF': {'linewidth': 2, 'linestyle': 'dashed',\n 'edgecolor': 'darkorange'}}\n\n # Handle H/L points using MetPy's StationPlot class\n for field in ('HIGH', 'LOW'):\n rows = data[data.feature == field]\n x, y = zip(*((pt.x, pt.y) for pt in rows.geometry), strict=False)\n sp = StationPlot(ax, x, y, transform=ccrs.PlateCarree(), clip_on=True)\n sp.plot_text('C', [field[0]] * len(x), **complete_style[field])\n sp.plot_parameter('S', rows.strength, **complete_style[field])\n\n # Handle all the boundary types\n for field in ('WARM', 'COLD', 'STNRY', 'OCFNT', 'TROF'):\n rows = data[data.feature == field]\n ax.add_geometries(rows.geometry, crs=ccrs.PlateCarree(), **complete_style[field],\n facecolor='none')"
"def plot_bulletin(ax, data):\n \"\"\"Plot a dataframe of surface features on a map.\"\"\"\n # Set some default visual styling\n size = 4\n fontsize = 9\n complete_style = {'HIGH': {'color': 'blue', 'fontsize': fontsize},\n 'LOW': {'color': 'red', 'fontsize': fontsize},\n 'WARM': {'linewidth': 1, 'path_effects': [WarmFront(size=size)]},\n 'COLD': {'linewidth': 1, 'path_effects': [ColdFront(size=size)]},\n 'OCFNT': {'linewidth': 1, 'path_effects': [OccludedFront(size=size)]},\n 'STNRY': {'linewidth': 1, 'path_effects': [StationaryFront(size=size)]},\n 'TROF': {'linewidth': 2, 'linestyle': 'dashed',\n 'edgecolor': 'darkorange'}}\n\n # Handle H/L points using MetPy's StationPlot class\n for field in ('HIGH', 'LOW'):\n rows = data[data.feature == field]\n x, y = zip(*((pt.x, pt.y) for pt in rows.geometry), strict=False)\n scattertext(ax, x, y, field[0],\n **complete_style[field], transform=ccrs.PlateCarree(), clip_on=True)\n scattertext(ax, x, y, rows.strength, formatter='.0f', loc=(0, -10),\n **complete_style[field], transform=ccrs.PlateCarree(), clip_on=True)\n\n # Handle all the boundary types\n for field in ('WARM', 'COLD', 'STNRY', 'OCFNT', 'TROF'):\n rows = data[data.feature == field]\n ax.add_geometries(rows.geometry, crs=ccrs.PlateCarree(), **complete_style[field],\n facecolor='none')"
]
},
{
Expand Down
Binary file modified dev/_downloads/d7027451c04b467ccd181464c81c91de/Advection.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

from metpy.cbook import get_test_data
from metpy.io import parse_wpc_surface_bulletin
from metpy.plots import (add_metpy_logo, ColdFront, OccludedFront, StationaryFront,
StationPlot, WarmFront)
from metpy.plots import (add_metpy_logo, ColdFront, OccludedFront, scattertext,
StationaryFront, WarmFront)

###########################################
# Define a function that can be used to readily plot a bulletin that has been parsed into a
Expand All @@ -45,9 +45,10 @@ def plot_bulletin(ax, data):
for field in ('HIGH', 'LOW'):
rows = data[data.feature == field]
x, y = zip(*((pt.x, pt.y) for pt in rows.geometry), strict=False)
sp = StationPlot(ax, x, y, transform=ccrs.PlateCarree(), clip_on=True)
sp.plot_text('C', [field[0]] * len(x), **complete_style[field])
sp.plot_parameter('S', rows.strength, **complete_style[field])
scattertext(ax, x, y, field[0],
**complete_style[field], transform=ccrs.PlateCarree(), clip_on=True)
scattertext(ax, x, y, rows.strength, formatter='.0f', loc=(0, -10),
**complete_style[field], transform=ccrs.PlateCarree(), clip_on=True)

# Handle all the boundary types
for field in ('WARM', 'COLD', 'STNRY', 'OCFNT', 'TROF'):
Expand Down
Binary file not shown.
Binary file modified dev/_downloads/e50a0b920fc44505e926eaeef27dacd5/US_Counties.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/f335ba0ca08bde86784c71d671d92211/Vorticity.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added dev/_images/sphx_glr_High_Low_Analysis_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions dev/_sources/api/generated/metpy.calc.find_peaks.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_peaks
=====================

.. currentmodule:: metpy.calc

.. autofunction:: find_peaks

.. include:: metpy.calc.find_peaks.examples

.. raw:: html

<div style='clear:both'></div>
12 changes: 12 additions & 0 deletions dev/_sources/api/generated/metpy.calc.peak_persistence.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
peak_persistence
===========================

.. currentmodule:: metpy.calc

.. autofunction:: peak_persistence

.. include:: metpy.calc.peak_persistence.examples

.. raw:: html

<div style='clear:both'></div>
2 changes: 2 additions & 0 deletions dev/_sources/api/generated/metpy.calc.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ Other
azimuth_range_to_lat_lon
find_bounding_indices
find_intersections
find_peaks
get_layer
get_layer_heights
get_perturbation
isentropic_interpolation
isentropic_interpolation_as_dataset
nearest_intersection_idx
parse_angle
peak_persistence
reduce_point_density
resample_nn_1d

1 change: 1 addition & 0 deletions dev/_sources/api/generated/metpy.plots.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Plots ``(metpy.plots)``
:toctree: ./

read_colortable
scattertext
wx_code_to_numeric
add_metpy_logo
add_timestamp
Expand Down
12 changes: 12 additions & 0 deletions dev/_sources/api/generated/metpy.plots.scattertext.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
scattertext
=======================

.. currentmodule:: metpy.plots

.. autofunction:: scattertext

.. include:: metpy.plots.scattertext.examples

.. raw:: html

<div style='clear:both'></div>
5 changes: 5 additions & 0 deletions dev/_sources/api/references.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ References
.. [Holton2004] Holton, J. R., 2004: *An Introduction to Dynamic Meteorology*. 4th ed.
Academic Press, 535 pp.
.. [Huber2021] Huber, S., 2020: Persistent Homology in Data Science.
*Proc. Int. Data Sci. Conf.*, doi:`10.1007/978-3-658-32182-6_13
<https://doi.org/10.1007/978-3-658-32182-6_13>`_.
`[PDF] <https://www.sthu.org/research/publications/files/Hub20.pdf>`_
.. [IAPWS1995] The International Association for the Properties of Water and Steam, 1995:
`Revised Release on the IAPWS Formulation 1995 for the Thermodynamic Properties
of Ordinary Water Substance for General and Scientific Use (updated
Expand Down
2 changes: 1 addition & 1 deletion dev/_sources/examples/Advanced_Sounding.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Create a new figure. The dimensions here give a good aspect ratio.

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.189 seconds)
**Total running time of the script:** (0 minutes 0.174 seconds)


.. _sphx_glr_download_examples_Advanced_Sounding.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Create a new figure. The dimensions here give a good aspect ratio
.. code-block:: none
[<matplotlib.lines.Line2D object at 0x7f7de14b3750>]
[<matplotlib.lines.Line2D object at 0x7f6a6c4dae90>]
Expand Down Expand Up @@ -429,7 +429,7 @@ try another Skew-T with a few more advanced features:

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.649 seconds)
**Total running time of the script:** (0 minutes 0.682 seconds)


.. _sphx_glr_download_examples_Advanced_Sounding_With_Complex_Layout.py:
Expand Down
2 changes: 1 addition & 1 deletion dev/_sources/examples/Four_Panel_Map.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ By reading model output data from a netCDF file, we can create a four panel plot

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 7.264 seconds)
**Total running time of the script:** (0 minutes 7.308 seconds)


.. _sphx_glr_download_examples_Four_Panel_Map.py:
Expand Down
2 changes: 1 addition & 1 deletion dev/_sources/examples/XArray_Projections.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ data on a map using CartoPy.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 7.982 seconds)
**Total running time of the script:** (0 minutes 8.073 seconds)


.. _sphx_glr_download_examples_XArray_Projections.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Dataset and plotting using Matplotlib.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.131 seconds)
**Total running time of the script:** (0 minutes 0.139 seconds)


.. _sphx_glr_download_examples_calculations_Absolute_Vorticity.py:
Expand Down
2 changes: 1 addition & 1 deletion dev/_sources/examples/calculations/Advection.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ the example xarray Dataset and plotting using Matplotlib.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.116 seconds)
**Total running time of the script:** (0 minutes 0.115 seconds)


.. _sphx_glr_download_examples_calculations_Advection.py:
Expand Down
2 changes: 1 addition & 1 deletion dev/_sources/examples/calculations/Divergence.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Dataset and plotting using Matplotlib.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 0.115 seconds)
**Total running time of the script:** (0 minutes 0.126 seconds)


.. _sphx_glr_download_examples_calculations_Divergence.py:
Expand Down
Loading

0 comments on commit de86770

Please sign in to comment.