diff --git a/README.md b/README.md index 06a399e..daa7cf2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ -# ModelForcing +# ModelForcings -Python interfaces for model forcings +`modelforcings` provides Python interfaces for various forcings commonly used in coupled ocean modeling. + +## Usage + +### Vortex Data + +```python +from modelforcings.vortex import VortexForcing + +# retrieve vortex data for Florence 2018 from the Internet +vortex_florence2018 = VortexForcing('irma2017') + +# write to a file in the ADCIRC `fort.22` format +vortex_florence2018.write('fort.22') + +# read vortex data from an existing ATCF track file (`*.trk`) +vortex_irma2017 = VortexForcing.from_atcf_file('irma2017_atcf.trk') + +# read vortex data from an existing file in the ADCIRC `fort.22` format +vortex_from_fort22 = VortexForcing.from_atcf_file('fort.22') +``` diff --git a/setup.cfg b/setup.cfg index c125e19..f0821b4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = ModelForcings +name = modelforcings lead_developer = Zachary Burnett author = Jaime R Calzada, Zachary Burnett author_email = jreniel@gmail.com, zachary.burnett@noaa.gov diff --git a/tests/test_besttrack.py b/tests/test_vortex.py similarity index 84% rename from tests/test_besttrack.py rename to tests/test_vortex.py index 7b02580..c53a08d 100644 --- a/tests/test_besttrack.py +++ b/tests/test_vortex.py @@ -22,12 +22,12 @@ def test_from_fort22(): if not output_directory.exists(): output_directory.mkdir(parents=True, exist_ok=True) - best_track = VortexForcing.from_fort22(fort22=input_directory / 'irma2017_fort.22',) + vortex = VortexForcing.from_fort22(fort22=input_directory / 'irma2017_fort.22',) - assert best_track.storm_id == 'AL112017' - assert best_track.name == 'IRMA' + assert vortex.storm_id == 'AL112017' + assert vortex.name == 'IRMA' - best_track.write(output_directory / 'irma2017_fort.22', overwrite=True) + vortex.write(output_directory / 'irma2017_fort.22', overwrite=True) check_reference_directory(output_directory, reference_directory) @@ -40,12 +40,12 @@ def test_from_atcf(): if not output_directory.exists(): output_directory.mkdir(parents=True, exist_ok=True) - best_track = VortexForcing.from_atcf_file(atcf=input_directory / 'florence2018_atcf.trk',) + vortex = VortexForcing.from_atcf_file(atcf=input_directory / 'florence2018_atcf.trk',) - assert best_track.storm_id == 'BT02008' - assert best_track.name == 'WRT00001' + assert vortex.storm_id == 'BT02008' + assert vortex.name == 'WRT00001' - best_track.write(output_directory / 'florence2018_fort.22', overwrite=True) + vortex.write(output_directory / 'florence2018_fort.22', overwrite=True) check_reference_directory(output_directory, reference_directory) @@ -57,12 +57,12 @@ def test_recompute_velocity(): if not output_directory.exists(): output_directory.mkdir(parents=True, exist_ok=True) - best_track = VortexForcing('irma2017') + vortex = VortexForcing('irma2017') - best_track.dataframe['latitude'][5] += 0.1 - best_track.dataframe['longitude'][5] -= 0.1 + vortex.dataframe['latitude'][5] += 0.1 + vortex.dataframe['longitude'][5] -= 0.1 - best_track.write(output_directory / 'irma2017_fort.22', overwrite=True) + vortex.write(output_directory / 'irma2017_fort.22', overwrite=True) check_reference_directory(output_directory, reference_directory)