Skip to content

Commit

Permalink
Add pre-commit hooks, black formatting, and style fixes (#1341)
Browse files Browse the repository at this point in the history
* first cut at pre-commit hooks and code style fixes

* fix aux io, source, test_radardisplay

* clean up next section of files

* cleanup sigmet rhi data file

* clean up sinarame aux io

* clean up mdv related files

* fix exception errors

* fix next batch of cleanup

* fix debug module

* update auxio and phase proc sections

* clean up large batch of modules

* last few formatting issues solved

* add linting to workflow

* fix remaining linting errors

* remove support for python 3.7

* remove nbstripout and revert to previous notebooks

* combine kazr spectra auxio string

* STY: Fix combined strings in graph module.

* STY: More combining.

* STY: More combining and revert of errors.

* MNT: Revert back to OSerror.

* MNT: More changes.

* MNT: More changes.

* MNT: Revert setuptools.

* ADD: Add dev file.

* MNT: Reverting environment files.

Co-authored-by: zssherman <[email protected]>
  • Loading branch information
mgrover1 and zssherman authored Jan 4, 2023
1 parent f2e182c commit 61fe772
Show file tree
Hide file tree
Showing 292 changed files with 24,215 additions and 20,943 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [macos, ubuntu, windows]

steps:
Expand All @@ -44,7 +44,7 @@ jobs:
use-mamba: true
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}

- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
Expand All @@ -59,7 +59,7 @@ jobs:
run: |
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run Tests
id: run_tests
shell: bash -l {0}
Expand All @@ -73,4 +73,4 @@ jobs:
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
fail_ci_if_error: false
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/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
Expand Down
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args:
- '--py38-plus'

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--config, setup.cfg]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
18 changes: 9 additions & 9 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ without these packages.

* `TRMM RSL <https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/>`_

* `CyLP <https://github.com/mpy/CyLP>`_ or
* `CyLP <https://github.com/mpy/CyLP>`_ or
`PyGLPK <https://tfinley.net/software/pyglpk/>`_ or
`CVXOPT <https://cvxopt.org/>`_ and their dependencies.

Expand Down Expand Up @@ -127,25 +127,25 @@ Frequently asked questions
https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html
Once the proper compilers are installed, reinstall CyLP.

* I'm getting a segfault or another error in python when using
* I'm getting a segfault or another error in python when using
``pyart.io.read_rsl()`` with IRIS/other files.

This is due to a bug in RSL, and can be remedied by adding
``-fno-stack-protector -D_FORTIFY_SOURCE=0`` to the CFLAGS parameter of the
makefile of RSL. This issue has been fixed with the release of rsl-v1.44.

* I'm having trouble getting PyGLPK to compile on my 64-bit operating system.

Change the line in the setup.py file from

::

define_macros = macros, extra_compile_args=['-m32'], extra_link_args=['-m32'],

to

::

define_macros = macros, extra_compile_args=['-m64'], extra_link_args=['-m64'],

Then build and install PyGLPK as recommended in the PYGLPK README.txt file.
Expand Down
14 changes: 7 additions & 7 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Copyright (c) 2013, UChicago Argonne, LLC
All rights reserved.

Copyright 2013 UChicago Argonne, LLC. This software was produced under U.S.
Copyright 2013 UChicago Argonne, LLC. This software was produced under U.S.
Government contract DE-AC02-06CH11357 for Argonne National Laboratory (ANL),
which is operated by UChicago Argonne, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this
software. NEITHER THE GOVERNMENT NOR UCHICAGO ARGONNE, LLC MAKES ANY
software. NEITHER THE GOVERNMENT NOR UCHICAGO ARGONNE, LLC MAKES ANY
WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS
SOFTWARE. If software is modified to produce derivative works, such modified
software should be clearly marked, so as not to confuse it with the version
available from ANL.
Additionally, redistribution and use in source and binary forms, with or

Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

Expand All @@ -23,11 +23,11 @@ are met:
documentation and/or other materials provided with the distribution.

* Neither the name of UChicago Argonne, LLC, Argonne National
Laboratory, ANL, the U.S. Government, nor the names of its
Laboratory, ANL, the U.S. Government, nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY UCHICAGO ARGONNE, LLC AND CONTRIBUTORS "AS IS"
THIS SOFTWARE IS PROVIDED BY UCHICAGO ARGONNE, LLC AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL UCHICAGO ARGONNE, LLC OR CONTRIBUTORS BE LIABLE
Expand Down
50 changes: 25 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ The Python ARM Radar Toolkit (Py-ART)
.. |Tweet| image:: https://img.shields.io/twitter/url/http/shields.io.svg?style=social
:target: https://twitter.com/Py_ART

The Python ARM Radar Toolkit, Py-ART, is an open source Python module
The Python ARM Radar Toolkit, Py-ART, is an open source Python module
containing a growing collection of weather radar algorithms and utilities
build on top of the Scientific Python stack and distributed under the
3-Clause BSD license. Py-ART is used by the
`Atmospheric Radiation Measurement (ARM) User Facility
3-Clause BSD license. Py-ART is used by the
`Atmospheric Radiation Measurement (ARM) User Facility
<http://www.arm.gov>`_ for working with data from a number of precipitation
and cloud radars, but has been designed so that it can be used by others in
the radar and atmospheric communities to examine, processes, and analyze
data from many types of weather radars.
data from many types of weather radars.


Important Links
Expand Down Expand Up @@ -80,8 +80,8 @@ Install
The easiest method for installing Py-ART is to use the conda packages from
the latest release and use Python 3, as Python 2 support ended January 1st,
2020 and many packages including Py-ART no longer support Python 2.
To do this you must download and install
`Anaconda <https://www.anaconda.com/download/#>`_ or
To do this you must download and install
`Anaconda <https://www.anaconda.com/download/#>`_ or
`Miniconda <https://conda.io/miniconda.html>`_.
With Anaconda or Miniconda install, it is recommended to create a new conda
environment when using Py-ART or even other packages. To create a new
Expand All @@ -107,7 +107,7 @@ If you are using mamba::
mamba install -c conda-forge arm_pyart

If you do not wish to use Anaconda or Miniconda as a Python environment or want
to use the latest, unreleased version of Py-ART see the section below on
to use the latest, unreleased version of Py-ART see the section below on
**Installing from source**.


Expand All @@ -127,16 +127,16 @@ Extensions and related software
A number of projects are available which extend the functionality of Py-ART.
These include:

* `ARTView <https://github.com/nguy/artview>`_ :
* `ARTView <https://github.com/nguy/artview>`_ :
Interactive radar viewing browser.

* `pyrad <https://github.com/MeteoSwiss/pyrad>`_ :
A real-time data processing framework developed by MeteoSwiss and MeteoFrance.
A real-time data processing framework developed by MeteoSwiss and MeteoFrance.

* `PyTDA <https://github.com/nasa/PyTDA>`_ :
* `PyTDA <https://github.com/nasa/PyTDA>`_ :
Python Turbulence Detection Algorithm.

* `SingleDop <https://github.com/nasa/SingleDop>`_ :
* `SingleDop <https://github.com/nasa/SingleDop>`_ :
Single Doppler Retrieval Toolkit.

* `DualPol <https://github.com/nasa/DualPol>`_ :
Expand All @@ -150,7 +150,7 @@ Other related open source software for working with weather radar data:

* `wradlib <https://wradlib.org>`_ :
An open source library for weather radar data processing.

* `BALTRAD <https://baltrad.eu/>`_ : Community-based weather radar networking.

* `MMM-Py <https://github.com/nasa/MMM-Py>`_ :
Expand Down Expand Up @@ -186,7 +186,7 @@ The required dependencies to install Py-ART in addition to Python are:
* `setuptools <https://setuptools.pypa.io/en/latest/index.html>`_

A working C/C++ compiler is required for some optional modules. An easy method
to install these dependencies is by using a
to install these dependencies is by using a
`Scientific Python distributions <http://scipy.org/install.html>`_.
`Anaconda <https://www.anaconda.com/distribution/>`_ will install all of
the above packages by default on Windows, Linux and Mac computers and is
Expand All @@ -202,10 +202,10 @@ Optional Dependences
The above Python modules are require before installing Py-ART, additional
functionality is available of the following modules are installed.

* `TRMM Radar Software Library (RSL)
<https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/>`_.
If installed Py-ART will be able to read in radar data in a number of
additional formats (Lassen, McGill, Universal Format, and RADTEC) and
* `TRMM Radar Software Library (RSL)
<https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/>`_.
If installed Py-ART will be able to read in radar data in a number of
additional formats (Lassen, McGill, Universal Format, and RADTEC) and
perform automatic dealiasing of Doppler velocities. RSL should be
install prior to installing Py-ART. The environmental variable `RSL_PATH`
should point to the location where RSL was installed if RSL was not
Expand All @@ -218,10 +218,10 @@ functionality is available of the following modules are installed.

* A linear programming solver and Python wrapper to use the LP phase
processing method. `CyLP <https://github.com/mpy/CyLP>`_ is recommended as
it gives the fastest results, but
`PyGLPK <https://tfinley.net/software/pyglpk/>`_ and
`CVXOPT <https://cvxopt.org/>`_ are also supported. The underlying LP
solvers `CBC <https://projects.coin-or.org/Cbc>`_ or
it gives the fastest results, but
`PyGLPK <https://tfinley.net/software/pyglpk/>`_ and
`CVXOPT <https://cvxopt.org/>`_ are also supported. The underlying LP
solvers `CBC <https://projects.coin-or.org/Cbc>`_ or
`GLPK <https://www.gnu.org/software/glpk/>`_ will also be required depending
on which wrapper is used. When using `CyLP <https://github.com/mpy/CyLP>`_
a path to coincbc is needed by setting the `COIN_INSTALL_DIR` path, such as
Expand All @@ -245,15 +245,15 @@ functionality is available of the following modules are installed.

* `gdal <https://pypi.python.org/pypi/GDAL/>`_.
Required to output GeoTIFFs from `Grid` objects.

Installing from source
======================

Installing Py-ART from source is the only way to get the latest updates and
enhancement to the software that have not yet made it into a release.
The latest source code for Py-ART can be obtained from the GitHub repository,
https://github.com/ARM-DOE/pyart. Either download and unpack the
`zip file <https://github.com/ARM-DOE/pyart/archive/master.zip>`_ of
https://github.com/ARM-DOE/pyart. Either download and unpack the
`zip file <https://github.com/ARM-DOE/pyart/archive/master.zip>`_ of
the source code or use git to checkout the repository::

git clone https://github.com/ARM-DOE/pyart.git
Expand Down Expand Up @@ -281,7 +281,7 @@ the package are welcomed from all users.
Code
----
The latest source code can be obtained with the command::

git clone https://github.com/ARM-DOE/pyart.git

If you are planning on making changes that you would like included in Py-ART,
Expand Down
1 change: 0 additions & 1 deletion doc/rebuild_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
rm -r build
rm -r source/source/auto_examples/*
BUILD_PYART_EXAMPLES=1 make html

4 changes: 2 additions & 2 deletions doc/source/API/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ API Reference Manual
:Release: |version|
:Date: |today|

This guide provides documentation for all modules, function, methods,
This guide provides documentation for all modules, function, methods,
and classes within Py-ART for those in the public API.

Documentation is broken down by directory and module.
Expand All @@ -16,7 +16,7 @@ Documentation is broken down by directory and module.

.. autosummary::
:toctree: generated/

core
io
aux_io
Expand Down
2 changes: 1 addition & 1 deletion doc/source/_static/doc_shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ $(document).ready(function () {
$('#banner').prepend(data);
}
})
})
})
Loading

0 comments on commit 61fe772

Please sign in to comment.