-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functions to read and interpolate from all constituents to …
…address #91 to do: need to add tests that outputs are as expected to do: need to see if these are actual optimizations test: switch interpolation test to soft tabs
- Loading branch information
1 parent
b74c01e
commit d0653e3
Showing
14 changed files
with
1,397 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
============ | ||
constituents | ||
============ | ||
|
||
Basic tide model constituent class | ||
|
||
`Source code`__ | ||
|
||
.. __: https://github.com/tsutterley/pyTMD/blob/main/pyTMD/constituents.py | ||
|
||
General Attributes and Methods | ||
============================== | ||
|
||
.. autoclass:: pyTMD.constituents | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python | ||
u""" | ||
constituents.py | ||
Written by Tyler Sutterley (12/2022) | ||
Basic tide model constituent class | ||
UPDATE HISTORY: | ||
Written 12/2022 | ||
""" | ||
|
||
class constituents: | ||
""" | ||
Class for tide model constituents | ||
Attributes | ||
---------- | ||
fields: list | ||
list of tide model constituents | ||
""" | ||
def __init__(self, **kwargs): | ||
# set initial attributes | ||
self.fields = [] | ||
# set optional fields | ||
for key, val in kwargs.items(): | ||
setattr(self, key, val) | ||
|
||
def append(self, field, constituent): | ||
""" | ||
Append tide model constituents | ||
Parameters | ||
---------- | ||
field: str | ||
Tide model constituent name | ||
constituent: float | ||
Tide model constituent (complex form) | ||
""" | ||
# append field | ||
self.fields.append(field) | ||
setattr(self, field, constituent) | ||
return self | ||
|
||
def get(self, field): | ||
""" | ||
Get model constituent | ||
Parameters | ||
---------- | ||
field: str | ||
Tide model constituent name | ||
Returns | ||
------- | ||
constituent: float | ||
Tide model constituent (complex form) | ||
""" | ||
return getattr(self, field) |
Oops, something went wrong.