geoglows / pygeoglows

A python package of tools coming from the GEOGloWS initiative
https://geoglows.org
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

adds deprecated streamflow module for backwards compatibility. correc… #32

Closed rileyhales closed 7 months ago

rileyhales commented 7 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 7 months ago

Walkthrough

The recent update to the GEOGLOWS software involves significant refinements, including the deprecation of the streamflow module, introduction of new functions in the data and streams modules, and a shift from reach_id to river_id. Version 1.1.0 also sees enhanced plotting categorizations and the removal of outdated features, streamlining the interface and improving usability for streamflow data management and visualization.

Changes

Files Change Summary
docs/api-documentation/... Removed FAQ section on CSV data saving; added new functions for forecasted streamflow; reorganized plot functions; deprecated streamflow module.
geoglows/__init__.py Updated package version to '1.1.0'; added new import for streamflow.
geoglows/data.py Replaced reach_id with river_id; updated parameter validations and error handling.
geoglows/streamflow.py Introduced functions for streamflow prediction API; added deprecation warning.
geoglows/streams.py Renamed functions to reflect new naming conventions for river operations.

🐇✨ In the land of code and stream, Where the rivers of data gleam, A rabbit hopped with a new update, river_id in place, oh so great! Farewell streamflow, we'll meet anew, In the streams of GEOGLOWS, ever so true! 🌊📊 🐇✨


Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between 24e2c10727bb00b96c583be654e75e499ec6436c and 4aaee21c64b077a578dfa6ff85cac9d6048c2bb1.
Files selected for processing (8) * docs/api-documentation.rst (1 hunks) * docs/api-documentation/data.rst (1 hunks) * docs/api-documentation/plots.rst (1 hunks) * docs/api-documentation/streamflow.rst (1 hunks) * geoglows/__init__.py (1 hunks) * geoglows/data.py (11 hunks) * geoglows/streamflow.py (1 hunks) * geoglows/streams.py (1 hunks)
Files skipped from review due to trivial changes (1) * docs/api-documentation.rst
Additional comments not posted (22)
docs/api-documentation/plots.rst (1)
`10-12`: The reorganization of plot functions into new categories like forecast, retrospective, and averages is well-documented here. This should help users find relevant plotting functions more easily.
geoglows/__init__.py (1)
`15-15`: Update of the package version to '1.1.0' correctly reflects the new features and deprecations as mentioned in the PR summary.
geoglows/streams.py (4)
`5-5`: The update to the `__all__` list correctly reflects the new function names, ensuring that they are correctly exposed as part of the module's public API. --- `8-8`: The function `river_to_vpu` correctly replaces `reach_to_vpu`. Ensure that all references to this function across the codebase are updated to reflect this change.
Verification successful --- The shell script executed to search for occurrences of the old function name `reach_to_vpu` in Python files did not return any results. This indicates that there are no references to the old function name in the Python files of the codebase. Based on this information, it appears that the function name has been successfully updated across the codebase to `river_to_vpu`.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for old function name to ensure it's fully replaced. rg --type py 'reach_to_vpu' ``` Length of output: 27
--- `16-16`: The function `latlon_to_river` is correctly renamed and the implementation looks consistent with the previous version. This should maintain functionality while improving naming clarity. --- `22-22`: The function `river_to_latlon` is correctly renamed. As with other renamings, ensure all calls to the old function name are updated.
Verification successful --- Based on the results of the executed script, which searched for the old function name `reach_to_latlon` and found no occurrences, it can be concluded that the function `river_to_latlon` has been correctly renamed and all references to the old function name have been updated in the codebase.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for old function name to ensure it's fully replaced. rg --type py 'reach_to_latlon' ``` Length of output: 30
docs/api-documentation/streamflow.rst (4)
`5-6`: The deprecation notice is clearly stated, directing users to transition to the `geoglows.data` or `geoglows.streams` modules. This is crucial for ensuring users are aware of the upcoming changes and can plan accordingly. --- `14-16`: Documentation for the deprecated functions `forecast_stats`, `forecast_ensembles`, `forecast_warnings`, and `forecast_records` is updated. While these are still accessible, it's important that users are encouraged to transition to the new modules as these will not be maintained. --- `21-23`: Documentation for historical functions is maintained, which is important for users who rely on this data. Ensure that equivalent functionality is clearly documented in the new modules to facilitate user transition. --- `29-31`: The utility function `available_dates` is still documented here. It's essential to ensure that similar utility functions are available and documented in the new modules to prevent any loss of functionality.
docs/api-documentation/data.rst (1)
`16-18`: Documentation for the new functions `forecast`, `forecast_stats`, `forecast_ensembles`, and `forecast_records` is correctly added. This is essential for users to understand how to use the new functionalities in the `geoglows.data` module.
geoglows/data.py (5)
`50-51`: The handling of `river_id` from either positional arguments or keyword arguments is a good practice for flexibility. However, ensure that the documentation is clear about how users should pass this parameter. --- `71-78`: The data retrieval and transformation process here is well-implemented. The renaming of columns to match the REST API and the handling of different data structures based on the type of `river_id` are good practices. --- `105-116`: The validation of the `version` parameter is crucial to ensure that users are interacting with the correct API version. The detailed error messages will help in debugging and maintaining the code. --- `192-202`: The `forecast` function is well-documented and the implementation handles various scenarios effectively. The use of decorators for common functionality is a good practice. --- `267-280`: The `retrospective` function provides a good example of how to handle data retrieval from AWS. The use of `s3fs` and `xarray` for handling complex data structures is appropriate.
geoglows/streamflow.py (6)
`10-15`: The deprecation warning is clearly stated and provides users with guidance on transitioning to the new model and modules. This is crucial for managing user expectations and helping them plan for future changes. --- `21-56`: The `forecast_stats` function includes a deprecation warning and maintains its functionality. This is important for backward compatibility but should be clearly communicated to users to encourage transition to the new functions. --- `58-93`: Similarly, the `forecast_ensembles` function is maintained with a deprecation warning. Ensure that all functionalities provided here are available in the new `geoglows.data` module to facilitate user transition. --- `96-125`: The `forecast_warnings` function provides important functionality for predicting critical streamflow events. It's good that this is maintained during the transition period. Ensure that similar functionality is clearly documented and available in the new modules. --- `127-165`: The `forecast_records` function is well-implemented and includes handling for different date formats and return formats. This flexibility is important for user applications and should be mirrored in the new modules. --- `168-201`: The `historic_simulation` function provides essential historical data, and its maintenance in the deprecated module ensures that users have time to transition. Documentation and equivalent functionality in the new modules are important.
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.