Skip to content

Commit

Permalink
Merge pull request #98 from rcjackson/precommit
Browse files Browse the repository at this point in the history
ADD: Pre-commit hooks as actions
  • Loading branch information
rcjackson authored Aug 31, 2023
2 parents 17e4628 + 4adb694 commit 64d9306
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 19 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: linting

on:
push:
pull_request:
workflow_dispatch:

jobs:
pre-job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'false'
do_not_skip: '["workflow_dispatch", "schedule"]'
linting:
needs: pre-job
runs-on: ubuntu-latest
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3
33 changes: 14 additions & 19 deletions doc/source/user_guide/gridding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Converting the radar data to Cartesian coordinates with Py-ART
PyDDA expects radar data to be in Cartesian coordinates before it retrieves
the wind fields. Most radar data, however, is in the radar's native antenna
coordinates. Therefore, the radar data needs to be converted to Cartesian
coordinates. Py-ART's mapping toolbox contains the necessary utilties
coordinates. Py-ART's mapping toolbox contains the necessary utilties

We will assume that you have followed the steps outlined in :ref:`reading-radar-data`
for reading the radar data in its native coordinates. PyDDA requires dealiased velocities
Expand Down Expand Up @@ -45,26 +45,26 @@ limits of the grid in meters. The :code:`grid_shape` specifies the shape of the
points. We then use PyART's `grid_from_radars <https://arm-doe.github.io/pyart/API/generated/pyart.map.grid_from_radars.html>`_
function to create the grids :code:`grid_sw` and :code:`grid_se`.

.. code-block:: python
.. code-block:: python
grid_sw = pyart.map.grid_from_radars([radar_sw], grid_limits=grid_limits,
grid_sw = pyart.map.grid_from_radars([radar_sw], grid_limits=grid_limits,
grid_shape=grid_shape, gatefilter=gatefilter_sw)
grid_se = pyart.map.grid_from_radars([radar_se], grid_limits=grid_limits,
grid_se = pyart.map.grid_from_radars([radar_se], grid_limits=grid_limits,
grid_shape=grid_shape, gatefilter=gatefilter_se)
Finally, we should visualize the output grids using Py-ART's
Finally, we should visualize the output grids using Py-ART's
`GridMapDisplay <https://arm-doe.github.io/pyart/API/generated/pyart.graph.GridMapDisplay.html>`_.

.. code-block:: python
fig = plt.figure(figsize=(8, 12))
ax1 = plt.subplot(211)
display1 = pyart.graph.GridMapDisplay(grid_sw)
display1.plot_latitude_slice('corrected_velocity', lat=36.5,
display1.plot_latitude_slice('corrected_velocity', lat=36.5,
ax=ax1, fig=fig, vmin=-30, vmax=30)
ax2 = plt.subplot(212)
display2 = pyart.graph.GridMapDisplay(grid_se)
display2.plot_latitude_slice('corrected_velocity', lat=36.5,
display2.plot_latitude_slice('corrected_velocity', lat=36.5,
ax=ax2, fig=fig, vmin=-30, vmax=30)
.. plot::
Expand Down Expand Up @@ -129,9 +129,9 @@ Finally, we should visualize the output grids using Py-ART's
grid_limits = ((0., 15000.), (-50000., 50000.), (-50000., 50000.))
grid_shape = (31, 201, 201)

grid_sw = pyart.map.grid_from_radars([radar_sw], grid_limits=grid_limits,
grid_sw = pyart.map.grid_from_radars([radar_sw], grid_limits=grid_limits,
grid_shape=grid_shape, gatefilter=gatefilter_sw)
grid_se = pyart.map.grid_from_radars([radar_se], grid_limits=grid_limits,
grid_se = pyart.map.grid_from_radars([radar_se], grid_limits=grid_limits,
grid_shape=grid_shape, gatefilter=gatefilter_se)

fig = plt.figure(figsize=(8, 12))
Expand All @@ -141,15 +141,15 @@ Finally, we should visualize the output grids using Py-ART's
ax2 = plt.subplot(212)
display2 = pyart.graph.GridMapDisplay(grid_se)
display2.plot_latitude_slice('corrected_velocity', lat=36.5, ax=ax2, fig=fig, vmin=-30, vmax=30)


Note that, as the spacing between the sweeps increases with
altitude that there can be gridding artifacts that can produce spurious air motion in the
retrievals (Collis et al. 2010). To reduce these artifacts it's important that the velocity
field at higher altitudes be as continuous as possible. This requires a grid resolution that
will you will need to balance with keeping important details of the feature of interest that
you are trying to grid. You may have to adjust your grid resolution to balance these two
concerns in order to properly retrieve wind velocities. With the current grid spacing,
concerns in order to properly retrieve wind velocities. With the current grid spacing,
it is apparent that there are discontinuities in the radial velocity field above 7.5 km
altitude that could cause spurious noise in the retrieved vertical velocity field.
Vertical velocities are likely to be most reliable about 20-40 km from either radar.
Expand All @@ -163,13 +163,8 @@ https://doi.org/10.1175/2010JTECHA1402.1.

Koch, S. E., M. desJardins, and P. J. Kocin, 1983: An Interactive Barnes Objective Map Analysis
Scheme for Use with Satellite and Conventional Data. J. Appl. Meteor. Climatol., 22, 1487–1503,
https://doi.org/10.1175/1520-0450(1983)022<1487:AIBOMA>2.0.CO;2.
https://doi.org/10.1175/1520-0450(1983)022<1487:AIBOMA>2.0.CO;2.

Kosiba, K., J. Wurman, Y. Richardson, P. Markowski, P. Robinson, and J. Marquis, 2013:
Genesis of the Goshen County, Wyoming, Tornado on 5 June 2009 during VORTEX2.
Kosiba, K., J. Wurman, Y. Richardson, P. Markowski, P. Robinson, and J. Marquis, 2013:
Genesis of the Goshen County, Wyoming, Tornado on 5 June 2009 during VORTEX2.
Mon. Wea. Rev., 141, 1157–1181, https://doi.org/10.1175/MWR-D-12-00056.1.





45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[tool.ruff]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F"]
ignore = ["E402", "F401", "E731", "E501"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
per-file-ignores = {}

# Same as Black.
line-length = 88

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.8
target-version = "py38"

0 comments on commit 64d9306

Please sign in to comment.