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

fix HWM multi-storm bug for Hurricane Laura [#40] #43

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/quick_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
path: ${{ env.pythonLocation }}
key: lint-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install linters
run: pip install flake8 oitnb
run: pip install flake8 black
- name: lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: lint with oitnb
run: oitnb . --check
- name: lint with black
run: black . --check
test:
needs: lint
name: quick test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
path: ${{ env.pythonLocation }}
key: lint-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install linters
run: pip install flake8 oitnb
run: pip install flake8 black
- name: lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: lint with oitnb
run: oitnb . --check
- name: lint with black
run: black . --check
test:
needs: lint
name: test
Expand Down
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
default_language_version:
python: "python3"
fail_fast: true
ci:
skip: ["poetry-lock", "prospector", "mypy"]

repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.2.0"
hooks:
- id: "check-added-large-files"
- id: "check-ast"
- id: "check-byte-order-marker"
- id: "check-docstring-first"
- id: "check-executables-have-shebangs"
- id: "check-json"
- id: "check-symlinks"
- id: "check-merge-conflict"
- id: "check-vcs-permalinks"
- id: "check-xml"
- id: "check-yaml"
- id: "debug-statements"
- id: "end-of-file-fixer"
exclude: .+\.ipynb

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-use-type-annotations

- repo: "https://github.com/asottile/reorder_python_imports"
rev: "v3.1.0"
hooks:
- id: "reorder-python-imports"
args:
- "--py39-plus"

- repo: "https://github.com/psf/black"
rev: "22.3.0"
hooks:
- id: "black"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![codecov](https://codecov.io/gh/oceanmodeling/StormEvents/branch/main/graph/badge.svg?token=BQWB1QKJ3Q)](https://codecov.io/gh/oceanmodeling/StormEvents)
[![version](https://img.shields.io/pypi/v/StormEvents)](https://pypi.org/project/StormEvents)
[![license](https://img.shields.io/github/license/oceanmodeling/StormEvents)](https://opensource.org/licenses/gpl-license)
[![style](https://sourceforge.net/p/oitnb/code/ci/default/tree/_doc/_static/oitnb.svg?format=raw)](https://sourceforge.net/p/oitnb/code)
[![style](https://github.com/psf/black)](https://img.shields.io/badge/code%20style-black-000000.svg)

`stormevents` provides Python interfaces for observational data surrounding named storm events.

Expand Down Expand Up @@ -292,7 +292,7 @@ coops_stations_within_region(region=region)

```
nws_id name state removed geometry
nos_id
nos_id
8651370 DUKN7 Duck NC NaT POINT (-75.75000 36.18750)
8652587 ORIN7 Oregon Inlet Marina NC NaT POINT (-75.56250 35.78125)
8654467 HCGN7 USCG Station Hatteras NC NaT POINT (-75.68750 35.21875)
Expand Down Expand Up @@ -488,7 +488,7 @@ StormEvent(name='HENRI', year=2021, start_date=Timestamp('2021-08-21 12:00:00'),
from stormevents import StormEvent
from datetime import timedelta

StormEvent('ida', 2021, end_date=timedelta(days=2)) # <- end 2 days after NHC start time
StormEvent('ida', 2021, end_date=timedelta(days=2)) # <- end 2 days after NHC start time
```

```
Expand Down Expand Up @@ -537,7 +537,7 @@ flood.high_water_marks()

```
latitude longitude eventName ... siteZone peak_summary_id geometry
hwm_id ...
hwm_id ...
33496 37.298440 -80.007750 Florence Sep 2018 ... NaN NaN POINT (-80.00775 37.29844)
33497 33.699720 -78.936940 Florence Sep 2018 ... NaN NaN POINT (-78.93694 33.69972)
33498 33.758610 -78.792780 Florence Sep 2018 ... NaN NaN POINT (-78.79278 33.75861)
Expand Down
50 changes: 24 additions & 26 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import os
from os import PathLike
from pathlib import Path
import subprocess
import sys
from os import PathLike
from pathlib import Path

from dunamai import Version
from setuptools import config
Expand All @@ -26,7 +24,7 @@ def repository_root(path: PathLike = None) -> Path:
path = Path(path)
if path.is_file():
path = path.parent
if '.git' in (child.name for child in path.iterdir()) or path == path.parent:
if ".git" in (child.name for child in path.iterdir()) or path == path.parent:
return path
else:
return repository_root(path.parent)
Expand All @@ -35,35 +33,35 @@ def repository_root(path: PathLike = None) -> Path:
sys.path.insert(0, str(repository_root()))

subprocess.run(
f'{sys.executable} -m pip install -U pip',
f"{sys.executable} -m pip install -U pip",
shell=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)

# -- Project information -----------------------------------------------------
metadata = config.read_configuration('../../setup.cfg')['metadata']
metadata = config.read_configuration("../../setup.cfg")["metadata"]

project = metadata['name']
author = metadata['author']
copyright = f'2021, {author}'
project = metadata["name"]
author = metadata["author"]
copyright = f"2021, {author}"

# The full version, including alpha/beta/rc tags
try:
release = Version.from_any_vcs().serialize()
except RuntimeError:
release = os.environ.get('VERSION')
release = os.environ.get("VERSION")

# -- General configuration ---------------------------------------------------

autoclass_content = 'both' # include both class docstring and __init__
autoclass_content = "both" # include both class docstring and __init__
autodoc_default_options = {
# Make sure that any autodoc declarations show the right members
'members': True,
'inherited-members': True,
'private-members': True,
'member-order': 'bysource',
'exclude-members': '__weakref__',
"members": True,
"inherited-members": True,
"private-members": True,
"member-order": "bysource",
"exclude-members": "__weakref__",
}
autosummary_generate = True # Make _autosummary files and include them
napoleon_numpy_docstring = False # Force consistency, leave only Google
Expand All @@ -74,15 +72,15 @@ def repository_root(path: PathLike = None) -> Path:
# ones.
extensions = [
# Need the autodoc and autosummary packages to generate our docs.
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
# The Napoleon extension allows for nicer argument formatting.
'sphinx.ext.napoleon',
'm2r2',
"sphinx.ext.napoleon",
"m2r2",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -94,13 +92,13 @@ def repository_root(path: PathLike = None) -> Path:
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# -- Extension configuration -------------------------------------------------
source_suffix = ['.rst', '.md']
bibtex_bibfiles = ['references.bib']
source_suffix = [".rst", ".md"]
bibtex_bibfiles = ["references.bib"]
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ shapely = '>=1.8'
typepigeon = '>=1.0.5'
xarray = '*'
isort = { version = '*', optional = true }
oitnb = { version = '*', optional = true }
black = { version = '*', optional = true }
pytest = { version = '*', optional = true }
pytest-cov = { version = '*', optional = true }
pytest-socket = { version = '*', optional = true }
Expand All @@ -43,5 +43,5 @@ sphinx-rtd-theme = { version = '*', optional = true }

[tool.poetry.extras]
testing = ['pytest', 'pytest-cov', 'pytest-socket', 'pytest-xdist']
development = ['isort', 'oitnb']
development = ['isort', 'black']
documentation = ['m2r2', 'sphinx', 'sphinx-rtd-theme']
26 changes: 12 additions & 14 deletions stormevents/coops/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from stormevents.coops.tidalstations import (
COOPS_Interval,
COOPS_Product,
coops_product_within_region,
COOPS_Query,
COOPS_Station,
coops_stations,
coops_stations_within_region,
COOPS_StationStatus,
COOPS_TidalDatum,
COOPS_TimeZone,
COOPS_Units,
COOPS_VelocityType,
)
from stormevents.coops.tidalstations import COOPS_Interval
from stormevents.coops.tidalstations import COOPS_Product
from stormevents.coops.tidalstations import coops_product_within_region
from stormevents.coops.tidalstations import COOPS_Query
from stormevents.coops.tidalstations import COOPS_Station
from stormevents.coops.tidalstations import coops_stations
from stormevents.coops.tidalstations import coops_stations_within_region
from stormevents.coops.tidalstations import COOPS_StationStatus
from stormevents.coops.tidalstations import COOPS_TidalDatum
from stormevents.coops.tidalstations import COOPS_TimeZone
from stormevents.coops.tidalstations import COOPS_Units
from stormevents.coops.tidalstations import COOPS_VelocityType
Loading