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

change datum default to MSL for coops_product_within_region #90

Merged
merged 5 commits into from
Feb 1, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip install ".[test]" pytest-cov pytest-xdist
- run: pytest -n auto --cov . --cov-report xml:coverage.xml
- run: pytest --cov . --cov-report xml:coverage.xml
- run: coverage report -m
- uses: codecov/codecov-action@main
with:
Expand Down
8 changes: 5 additions & 3 deletions stormevents/nhc/storms.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def nhc_storms(year: int = None) -> pandas.DataFrame:
header=0,
names=columns,
parse_dates=["start_date", "end_date"],
date_parser=lambda x: pandas.to_datetime(x.strip(), format="%Y%m%d%H")
if x.strip() != "9999999999"
else numpy.nan,
date_parser=lambda x: (
pandas.to_datetime(x.strip(), format="%Y%m%d%H")
if x.strip() != "9999999999"
else numpy.nan
),
)

storms = storms.astype(
Expand Down
4 changes: 3 additions & 1 deletion stormevents/stormevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def coops_product_within_region(
:param start_date: start date
:param end_date: end date
:param status: either ``current`` or ``historical``
:param datum: tidal datum
:param datum: tidal datum, one of ``STND``, ``MSL``, ``MHHW``, ``MHW``, ``MTL``, ``MLW``, ``MLLW``, ``NAVD``
:param units: either ``metric`` or ``english``
:param time_zone: time zone
:param interval: time interval
Expand All @@ -467,6 +467,8 @@ def coops_product_within_region(
f (nos_id, t) object '0,0,0,0' '0,0,0,0' ... '0,0,0,0' '0,0,0,0'
q (nos_id, t) object 'v' 'v' 'v' 'v' 'v' 'v' ... 'p' 'p' 'p' 'p' 'p'
"""
if datum is None:
datum = "MSL" # change the default from STND to MSL

if not isinstance(region, BaseGeometry):
region = shapely_shape(region)
Expand Down
4 changes: 2 additions & 2 deletions tests/data/reference/test_usgs_flood_events/events.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
usgs_id,name,year,description,event_type,event_status,coordinator,instruments,last_updated,last_updated_by,start_date,end_date
7,FEMA 2013 exercise,2013,Ardent/Sentry 2013 FEMA Exercise,HURRICANE,COMPLETED,36,[],,,2013-05-15 04:00:00,2013-05-23 04:00:00
8,2005 Wilma,2005,"Category 3 in west FL.
Hurricane Wilma was the most intense tropical cyclone ever recorded in the Atlantic basin. Part of the record breaking 2005 Atlantic hurricane season.",HURRICANE,COMPLETED,515,[],2022-09-08 20:02:25.510152,1.0,2005-10-20 04:00:00,2005-10-31 05:00:00
8,2005 Wilma,2005,"Category 3 in west FL.
Hurricane Wilma was the most intense tropical cyclone ever recorded in the Atlantic basin. Part of the record breaking 2005 Atlantic hurricane season.",HURRICANE,COMPLETED,515,[],2023-12-19 20:47:51.435776,1.0,2005-10-20 04:00:00,2005-10-31 05:00:00
18,2012 Isaac,2012,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,36,[],2022-09-09 14:57:23.815290,2062.0,2012-08-27 04:00:00,2012-09-02 04:00:00
19,2005 Rita,2005,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,515,[],2022-09-08 20:10:38.533682,1.0,2005-09-23 04:00:00,2005-09-25 04:00:00
23,2011 Irene,2011,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,36,[],2022-09-09 15:04:03.637296,2062.0,2011-08-26 04:00:00,2011-08-29 04:00:00
Expand Down
4 changes: 2 additions & 2 deletions tests/data/reference/test_usgs_flood_storms/storms.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nhc_code,usgs_id,usgs_name,year,nhc_name,description,event_type,event_status,coordinator,instruments,last_updated,last_updated_by,start_date,end_date
AL252005,8,2005 Wilma,2005,WILMA,"Category 3 in west FL.
Hurricane Wilma was the most intense tropical cyclone ever recorded in the Atlantic basin. Part of the record breaking 2005 Atlantic hurricane season.",HURRICANE,COMPLETED,515,[],2022-09-08 20:02:25.510152,1.0,2005-10-20 04:00:00,2005-10-31 05:00:00
AL252005,8,2005 Wilma,2005,WILMA,"Category 3 in west FL.
Hurricane Wilma was the most intense tropical cyclone ever recorded in the Atlantic basin. Part of the record breaking 2005 Atlantic hurricane season.",HURRICANE,COMPLETED,515,[],2023-12-19 20:47:51.435776,1.0,2005-10-20 04:00:00,2005-10-31 05:00:00
AL092012,18,2012 Isaac,2012,ISAAC,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,36,[],2022-09-09 14:57:23.815290,2062.0,2012-08-27 04:00:00,2012-09-02 04:00:00
AL182005,19,2005 Rita,2005,RITA,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,515,[],2022-09-08 20:10:38.533682,1.0,2005-09-23 04:00:00,2005-09-25 04:00:00
AL092011,23,2011 Irene,2011,IRENE,historical hurricane data loaded by the data archive team,HURRICANE,COMPLETED,36,[],2022-09-09 15:04:03.637296,2062.0,2011-08-26 04:00:00,2011-08-29 04:00:00
Expand Down
Loading