From 4792053e69466f9e55919f69c246b189a80c4679 Mon Sep 17 00:00:00 2001 From: Fariborz Daneshvar Date: Mon, 22 Jan 2024 17:43:05 +0000 Subject: [PATCH 1/5] change datum default to MSL for coops_product_within_region --- stormevents/stormevent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stormevents/stormevent.py b/stormevents/stormevent.py index 28e561e..695415a 100644 --- a/stormevents/stormevent.py +++ b/stormevents/stormevent.py @@ -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 @@ -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) From 2e17470a03eaee43c65a8cd1ce250cbc3b76aa83 Mon Sep 17 00:00:00 2001 From: Fariborz Daneshvar Date: Mon, 22 Jan 2024 22:36:42 +0000 Subject: [PATCH 2/5] format stormevent.py with black --- stormevents/stormevent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stormevents/stormevent.py b/stormevents/stormevent.py index 695415a..0395180 100644 --- a/stormevents/stormevent.py +++ b/stormevents/stormevent.py @@ -468,7 +468,7 @@ def coops_product_within_region( 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 + datum = "MSL" # change the default from STND to MSL if not isinstance(region, BaseGeometry): region = shapely_shape(region) From 0ec8b30187da8ef386f93f7951ba748f27a1a6a2 Mon Sep 17 00:00:00 2001 From: "Soroosh.Mani" Date: Wed, 24 Jan 2024 08:28:52 -0500 Subject: [PATCH 3/5] Update test references for USGS storms --- tests/data/reference/test_usgs_flood_events/events.csv | 4 ++-- tests/data/reference/test_usgs_flood_storms/storms.csv | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/data/reference/test_usgs_flood_events/events.csv b/tests/data/reference/test_usgs_flood_events/events.csv index f469311..8ba1c1d 100644 --- a/tests/data/reference/test_usgs_flood_events/events.csv +++ b/tests/data/reference/test_usgs_flood_events/events.csv @@ -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 diff --git a/tests/data/reference/test_usgs_flood_storms/storms.csv b/tests/data/reference/test_usgs_flood_storms/storms.csv index 13ea59f..45944ad 100644 --- a/tests/data/reference/test_usgs_flood_storms/storms.csv +++ b/tests/data/reference/test_usgs_flood_storms/storms.csv @@ -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 From 59dd75dde747c4331af25c06e3445aee485730e7 Mon Sep 17 00:00:00 2001 From: "Soroosh.Mani" Date: Tue, 30 Jan 2024 16:56:45 -0500 Subject: [PATCH 4/5] Try get the coverage test working! --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aff539a..be81fd4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: From 563886bf9e41d27c41d451d1cc88454a98a02b57 Mon Sep 17 00:00:00 2001 From: "Soroosh.Mani" Date: Tue, 30 Jan 2024 16:59:54 -0500 Subject: [PATCH 5/5] Styling fix --- stormevents/nhc/storms.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stormevents/nhc/storms.py b/stormevents/nhc/storms.py index 29e8896..91e1baf 100644 --- a/stormevents/nhc/storms.py +++ b/stormevents/nhc/storms.py @@ -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(