Skip to content

Commit

Permalink
fix name and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Nov 5, 2021
1 parent f3cde6b commit 51529ea
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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')
```
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = ModelForcings
name = modelforcings
lead_developer = Zachary Burnett
author = Jaime R Calzada, Zachary Burnett
author_email = [email protected], [email protected]
Expand Down
24 changes: 12 additions & 12 deletions tests/test_besttrack.py → tests/test_vortex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit 51529ea

Please sign in to comment.