Skip to content

Commit

Permalink
Add VGF reader (#11)
Browse files Browse the repository at this point in the history
Adds a GEMPAK VGF reader and tests for a majority of possible VGF elements.
  • Loading branch information
nawendt authored Jul 13, 2024
1 parent fca70ea commit c415f30
Show file tree
Hide file tree
Showing 26 changed files with 4,550 additions and 28 deletions.
18 changes: 18 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
coverage:
status:
patch:
default:
target: '80'
project:
library:
target: auto
threshold: 0.1%
paths:
- "src/gempakio/.*"

tests:
target: 100%
paths:
- "tests/.*"

comment: off
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[paths]
source =
src/
/*/site-packages

[run]
source = tests
source_pkgs = gempakio
35 changes: 31 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,39 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ci/requirements.txt -r ci/test_requirements.txt
python -m pip install --upgrade setuptools
python -m pip install -r ci/requirements.txt -r ci/test_requirements.txt
- name: Install gempakIO
run: |
python setup.py install
python -m pip install .
- name: Test with pytest
run: |
pytest
python -m pytest --cov-report json --cov src/gempakio tests
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: pypi-${{ matrix.python-version }}-${{ runner.os }}
path: coverage.json
retention-days: 1

codecov:
name: Codecov Upload
runs-on: ubuntu-latest
needs: build
timeout-minutes: 2
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Download coverage artifacts
uses: actions/download-artifact@v4

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
17 changes: 3 additions & 14 deletions ci/linting_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
flake8>=5.0.4
flake8
ruff
pycodestyle
pyflakes
ruff

flake8-bugbear
flake8-builtins
flake8-comprehensions
flake8-continuation
flake8-copyright
flake8-isort
isort
flake8-mutable
flake8-pie
flake8-print
flake8-quotes
flake8-requirements
flake8-simplify

flake8-docstrings
pydocstyle
pydocstyle
3 changes: 2 additions & 1 deletion ci/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pytest
pytest
pytest-cov
7 changes: 4 additions & 3 deletions examples/gempakio_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
# %% [markdown]
# ### Imports

from cartopy import feature
# %%
import cartopy.crs as ccrs
from cartopy import feature
import matplotlib.pyplot as plt
from matplotlib import colors
import matplotlib.pyplot as plt
import metpy.calc as mpcalc
from metpy.plots import Hodograph, SkewT, StationPlot
from metpy.units import units
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import pyproj

from gempakio import GempakGrid, GempakSounding, GempakSurface, GridFile, SoundingFile, SurfaceFile
from gempakio import (GempakGrid, GempakSounding, GempakSurface, GridFile, SoundingFile,
SurfaceFile)

# %% [markdown]
# ### Misc.
Expand Down
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ lint = [
]
test = [
'pytest',
'pytest-cov'
]

[build-system]
Expand All @@ -55,35 +56,37 @@ combine_star = true
[tool.ruff]
line-length = 95
exclude = ['examples']

[tool.ruff.lint]
select = ['A', 'B', 'C', 'CPY001', 'D', 'E', 'E226', 'F', 'G', 'I', 'N', 'NPY', 'Q', 'R', 'S', 'SIM', 'T', 'U', 'W']
ignore = ['F405', 'I001', 'RET504', 'RET505', 'RET506', 'RET507', 'RUF100']
preview = true
explicit-preview-rules = true

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
'src/gempakio/__init__.py' = ['F401']
'tests/*.py' = ['S101']

[tool.ruff.lint.flake8-copyright]
notice-rgx = '(?i)Copyright\s+(\(C\)\s+)?\d{4}'
author = 'Nathan Wendt'

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = 'single'
multiline-quotes = 'double'

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ['gempakio']
force-single-line = false
relative-imports-order = 'closest-to-furthest'
force-sort-within-sections = true
order-by-type = false
combine-as-imports = true

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 61

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = 'numpy'

[tool.setuptools]
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ line =
pydocstyle
test =
pytest
pytest-cov

[pycodestyle]
ignore = W503
Expand Down
3 changes: 2 additions & 1 deletion src/gempakio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""gempakIO."""

from gempakio.decode.gempak import GempakGrid, GempakSounding, GempakSurface
from gempakio.decode.vgf import VectorGraphicFile
from gempakio.encode.gempak import GridFile, SoundingFile, SurfaceFile

__version__ = '1.0.2'
__version__ = '1.1.0'
Loading

0 comments on commit c415f30

Please sign in to comment.