Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hooks, black formatting, and style fixes #1341

Merged
merged 28 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5ca1b3a
first cut at pre-commit hooks and code style fixes
mgrover1 Dec 5, 2022
5539cbe
fix aux io, source, test_radardisplay
mgrover1 Dec 5, 2022
e65e776
Merge branch 'main' into add-pre-commit-hooks-black-formatting
mgrover1 Dec 7, 2022
cce5fb7
clean up next section of files
mgrover1 Dec 7, 2022
28f1723
cleanup sigmet rhi data file
mgrover1 Dec 7, 2022
f637021
clean up sinarame aux io
mgrover1 Dec 7, 2022
b930216
clean up mdv related files
mgrover1 Dec 7, 2022
3f0eff3
fix exception errors
mgrover1 Dec 7, 2022
0e68d49
merge updates from main
mgrover1 Dec 21, 2022
2bb07e1
fix next batch of cleanup
mgrover1 Dec 21, 2022
b9d7f3d
fix debug module
mgrover1 Dec 21, 2022
0d174dd
update auxio and phase proc sections
mgrover1 Dec 21, 2022
62bbc8c
clean up large batch of modules
mgrover1 Dec 21, 2022
c5517a9
last few formatting issues solved
mgrover1 Dec 21, 2022
f32942d
add linting to workflow
mgrover1 Dec 21, 2022
b7034a7
fix remaining linting errors
mgrover1 Dec 21, 2022
dbd6288
remove support for python 3.7
mgrover1 Dec 21, 2022
ca20ac7
remove nbstripout and revert to previous notebooks
mgrover1 Dec 22, 2022
68ae771
combine kazr spectra auxio string
mgrover1 Dec 22, 2022
cd7a976
STY: Fix combined strings in graph module.
zssherman Dec 22, 2022
9250d7c
STY: More combining.
zssherman Dec 22, 2022
0d5b979
STY: More combining and revert of errors.
zssherman Dec 22, 2022
b0599d9
MNT: Revert back to OSerror.
zssherman Dec 22, 2022
6a09870
MNT: More changes.
zssherman Dec 22, 2022
496e589
MNT: More changes.
zssherman Dec 22, 2022
84ccb70
MNT: Revert setuptools.
zssherman Dec 22, 2022
6512598
ADD: Add dev file.
zssherman Dec 22, 2022
0f72ddf
MNT: Reverting environment files.
zssherman Jan 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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/kynan/nbstripout
rev: 0.6.0
hooks:
- id: nbstripout
args:
- '--extra-keys "metadata.kernelspec"'

- 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