-
Notifications
You must be signed in to change notification settings - Fork 45
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
Lint Tidal #386
Lint Tidal #386
Conversation
This PR updates our git workflow to use `main` as the MHKiT default branch : - Many modern projects use `main` as the default branch, aligning with the GitHub recommendation and broader conventions. - There is some non-linear history in the previous rebase causing issues between `develop` & `master` - `main` was created from the current `develop` branch creating a 1-to-1 liner history between `develop` and the new `main` branch
@akeeste could you review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ssolson, looks great! Take a look at the suggestions:
- pulling in a couple of the descriptions from our docs when they were informative
- removing functions from the module-level docstrings.
On module-level docstrings--the autosummary tool allows us to automatically populate the function doc strings within a module without duplicating them, so I'd defer to that. Generally though the module level docstrings are a nice improvement. Once we're through a chunk of linting we can make a docs PR to reference this new content and reduce duplication outside of the source
mhkit/tidal/io/noaa.py
Outdated
|
||
Functions: | ||
---------- | ||
request_noaa_data(station, parameter, start_date, end_date, proxy=None, | ||
write_json=None): | ||
Loads NOAA current data from the API into a pandas DataFrame, | ||
with optional support for proxy settings and writing data to a JSON | ||
file. | ||
request_noaa_data(station, parameter, start_date, end_date, options=None): | ||
Fetches NOAA data from the API, converts it into a pandas DataFrame (or xarray Dataset), | ||
and caches the result. Supports proxy settings and JSON file export. | ||
|
||
_xml_to_dataframe(response): | ||
Converts NOAA response data in XML format into a pandas DataFrame | ||
and returns metadata. | ||
Converts NOAA response data from XML format into a pandas DataFrame and extracts metadata. | ||
|
||
read_noaa_json(filename): | ||
Reads a JSON file containing NOAA data saved from the request_noaa_data | ||
function and returns a DataFrame with timeseries site data and metadata. | ||
read_noaa_json(filename, to_pandas=True): | ||
Reads a previously saved JSON file containing NOAA data and returns a pandas DataFrame | ||
(or xarray Dataset) with time-series data and metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove in favor of the docs "autosummary" feature https://mhkit-software.github.io/MHKiT/mhkit-python/api.tidal.html#io. This will also prevent duplicate descriptions to upkeep
Functions: | |
---------- | |
request_noaa_data(station, parameter, start_date, end_date, proxy=None, | |
write_json=None): | |
Loads NOAA current data from the API into a pandas DataFrame, | |
with optional support for proxy settings and writing data to a JSON | |
file. | |
request_noaa_data(station, parameter, start_date, end_date, options=None): | |
Fetches NOAA data from the API, converts it into a pandas DataFrame (or xarray Dataset), | |
and caches the result. Supports proxy settings and JSON file export. | |
_xml_to_dataframe(response): | |
Converts NOAA response data in XML format into a pandas DataFrame | |
and returns metadata. | |
Converts NOAA response data from XML format into a pandas DataFrame and extracts metadata. | |
read_noaa_json(filename): | |
Reads a JSON file containing NOAA data saved from the request_noaa_data | |
function and returns a DataFrame with timeseries site data and metadata. | |
read_noaa_json(filename, to_pandas=True): | |
Reads a previously saved JSON file containing NOAA data and returns a pandas DataFrame | |
(or xarray Dataset) with time-series data and metadata. |
@@ -84,7 +88,82 @@ def request_noaa_data( | |||
Request metadata. If returning xarray, metadata is instead attached to | |||
the data's attributes. | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git compares the changes in request_noaa_data
poorly, but I'm more or less following how things are broken up into multiple functions
Co-authored-by: Adam Keester <[email protected]>
Co-authored-by: Adam Keester <[email protected]>
Co-authored-by: Adam Keester <[email protected]>
Co-authored-by: Adam Keester <[email protected]>
Co-authored-by: Adam Keester <[email protected]>
Co-authored-by: Adam Keester <[email protected]>
This PR enforces automatic linting on the tidal module and adds type hints to improve readability and maintainability.
Key Updates: