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

update stormevents API to >=1.3.0 #79

Merged
6 commits merged into from
Mar 16, 2022

Conversation

ghost
Copy link

@ghost ghost commented Mar 14, 2022

use new method names and ATCF reading functionality from stormevents, and apply new improved CI workflow that fixes running tests

* use new `StormEvents` API

* install wheel first

* install PROJ

* linting step

* build PROJ

* build PROJ

* build PROJ

* build PROJ

* fix workflows

* fix test files

* skip test that hangs

* fix original file test

* change original track handling (write to file first and then read from threads)

* update workflow names

* we no longer need to write pickles to a temporary file if the track object already exists in memory

* revert import change
…e_stormevents

# Conflicts:
#	ensembleperturbation/perturbation/atcf.py
#	setup.cfg
@ghost ghost added the enhancement New feature or request label Mar 14, 2022
@ghost ghost requested a review from WPringle March 14, 2022 14:43
@ghost ghost self-assigned this Mar 14, 2022
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2022

Codecov Report

❗ No coverage uploaded for pull request base (feature/regression_selection@7912f5c). Click here to learn what that means.
The diff coverage is n/a.

@@                       Coverage Diff                       @@
##             feature/regression_selection      #79   +/-   ##
===============================================================
  Coverage                                ?   31.12%           
===============================================================
  Files                                   ?       26           
  Lines                                   ?     2940           
  Branches                                ?        0           
===============================================================
  Hits                                    ?      915           
  Misses                                  ?     2025           
  Partials                                ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7912f5c...4c86d52. Read the comment docs.

Copy link
Author

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here are the major changes that are applied with the new stormevents API, as well as the new build and testing workflow

@@ -0,0 +1,43 @@
name: 'Setup PROJ'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes the GitHub Actions CI tests by setting up PROJ so that cartopy can be built (and cached) correctly within the container

@@ -215,7 +215,7 @@ def plot_node_map(
if storm is not None:
if not isinstance(storm, VortexTrack):
try:
storm = VortexTrack.from_fort22(storm)
storm = VortexTrack.from_file(storm)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VortexTrack.from_fort22() and VortexTrack.from_atcf_file() were merged into VortexTrack.from_file()

@@ -32,7 +32,7 @@ install_requires =
requests
shapely
scikit-learn
stormevents == 1.2.5
stormevents >= 1.3.1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where pip install . gets the dependencies from

AL, 06, 2018091100, , BEST, 0,256N, 618W, 115, 944, HU, 34, NEQ, 130, 130, 90, 130, 1010, 200, 10, 145, 0, L, 0, , 0, 0, FLORENCE ,1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reference files for the tests are updated to include the additional ATCF fields that came from the original file

@@ -23,7 +24,7 @@ def test_monovariate_besttrack_ensemble():
output_directory.mkdir(parents=True, exist_ok=True)

perturber = VortexPerturber(
storm='al062018', start_date='20180911', end_date=None, file_deck=ATCF_FileDeck.b,
storm='al062018', start_date='20180911', end_date=None, file_deck='b',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows the file deck input to be a single letter, or alternatively the name (BEST, OFCL, etc.), along with the option to directly call the enum value

Comment on lines +179 to +181
pandas.testing.assert_frame_equal(original_track_1.data[comparison_fields], original_data)
pandas.testing.assert_frame_equal(original_track_2.data[comparison_fields], original_data)
pandas.testing.assert_frame_equal(original_track_3.data[comparison_fields], original_data)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is now updated to use the output original.22 instead of relying on a reference file. This should test for regression of this bug more thoroughly

@ghost ghost marked this pull request as ready for review March 14, 2022 14:53
@ghost ghost merged commit 9ce16db into feature/regression_selection Mar 16, 2022
@WPringle
Copy link
Contributor

WPringle commented Mar 16, 2022

@zacharyburnettNOAA Can make sure the tests are all working as we upgrade the version, and we need to work out how to better treat the advisories (from the a deck) of the storms. All the advisories are squashed together but we need to work out a way to separate them for each individual forecast.

@ghost
Copy link
Author

ghost commented Mar 16, 2022

@zacharyburnettNOAA Can make sure the tests are all working as we upgrade the version, and we need to work out how to better treat the advisories (from the a deck) of the storms. All the advisories are squashed together but we need to work out a way to separate them for each individual forecast.

Ok, that's easily done by iterating over the 'record_type' field, which is 'BEST', 'OFCL', 'CARQ', etc.. You can do that in pandas by using track.data.groupby('record_type)`

But you are right, we need to add native handling of the record types. I added functionality for that in the .linestrings method (to separate into multiple line strings for each advisory track) but I don't think it is elsewhere in the code

@ghost ghost deleted the merge/update_stormevents branch March 16, 2022 18:39
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants