Skip to content
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

update to the official new CDS #44

Merged
merged 3 commits into from
Feb 8, 2025
Merged

update to the official new CDS #44

merged 3 commits into from
Feb 8, 2025

Conversation

yunjunz
Copy link
Member

@yunjunz yunjunz commented Feb 6, 2025

  • autoget.py:

    • update cds_url link
    • update to the latest syntax of cdsapi for the request dictionary input
    • use f'{}' instead of .format syntax
  • README.md: update account setup doc for the official new CDS

  • requirements.txt: the new CDS requires cdsapi>=0.7.2

  • update model.cfg and tests/test_dload.py for the new CDS

  • processor.intP2H(): add whitespace for better readability

Summary by Sourcery

Update to the official new Copernicus Data Store (CDS).

Enhancements:

  • Updated the autoget.py script to use the new CDS URL and the latest cdsapi syntax, also replaced the .format syntax with f-strings.
  • Improved readability of the processor.intP2H() function by adding whitespace.

Documentation:

  • Updated the account setup documentation in the README to reflect the new CDS URL and API key instructions.

Tests:

  • Updated the test suite to be compatible with the new CDS.

+ autoget.py:
   - update `cds_url` link
   - update to the latest syntax of `cdsapi` for the request dictionary input
   - use `f'{}'` instead of `.format` syntax

+ README.md: update account setup doc for the official new CDS

+ requirements.txt: the new CDS requires cdsapi>=0.7.2

+ update `model.cfg` and `tests/test_dload.py` for the new CDS

+ processor.intP2H(): add whitespace for better readability
Copy link

sourcery-ai bot commented Feb 6, 2025

Reviewer's Guide by Sourcery

This pull request updates the package to be compatible with the official new Copernicus Climate Data Store (CDS). This includes updating the CDS URL, updating the cdsapi syntax, updating the account setup documentation, and updating the required version of cdsapi.

Sequence diagram for ERA5 data download with updated CDS API

sequenceDiagram
    participant User
    participant PyAPS3
    participant CDS

    User->>PyAPS3: Call ECMWFdload()
    PyAPS3->>CDS: Connect to new CDS URL
    Note over PyAPS3,CDS: https://cds.climate.copernicus.eu/api
    PyAPS3->>CDS: Authenticate with Personal Access Token
    PyAPS3->>CDS: Send updated request format
    Note over PyAPS3,CDS: New dictionary structure with list values
    CDS-->>PyAPS3: Return requested data
    PyAPS3-->>User: Save data to file
Loading

File-Level Changes

Change Details Files
Update CDS URL and cdsapi syntax in autoget.py
  • Update cds_url link to the official CDS URL.
  • Update to the latest syntax of cdsapi for the request dictionary input.
  • Use f'{}' instead of .format syntax for string formatting.
src/pyaps3/autoget.py
Update account setup documentation in README.md
  • Update the account setup documentation for the official new CDS.
  • Update the CDS API setup link.
  • Update the link to the profile page.
  • Clarify the need to accept the data license in the Terms of use on the ECMWF website.
README.md
Update requirements.txt to require cdsapi>=0.7.2
  • Update the required version of cdsapi to 0.7.2.
requirements.txt
Update model.cfg and tests/test_dload.py for the new CDS
  • Update the comments in model.cfg to reflect the new CDS.
  • Update the account setup message in tests/test_dload.py to reflect the new CDS.
src/pyaps3/model.cfg
tests/test_dload.py
Add whitespace for better readability in processor.intP2H()
  • Add whitespace around operators for better readability.
src/pyaps3/processor.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@yunjunz yunjunz requested a review from yuankailiu February 6, 2025 08:24
Copy link

codeautopilot bot commented Feb 6, 2025

PR Summary

This Pull Request updates the codebase to align with the new Copernicus Climate Data Store (CDS) infrastructure. Key changes include:

  • autoget.py Updates: The script now uses the updated CDS URL and adopts the latest cdsapi syntax for request dictionaries. Additionally, it replaces the .format method with Python f-strings for improved readability and consistency.

  • Documentation: The README.md has been updated to reflect the new CDS account setup process, ensuring users have the correct instructions for accessing data.

  • Dependencies: The requirements.txt file now specifies cdsapi>=0.7.2 to ensure compatibility with the new CDS.

  • Configuration and Tests: Updates to model.cfg and tests/test_dload.py ensure they are compatible with the new CDS infrastructure.

  • Code Readability: Minor improvements in processor.intP2H() by adding whitespace for better readability.

These changes ensure that the project remains functional and up-to-date with the latest CDS infrastructure, improving both usability and maintainability.

Suggestion

  • Consider adding a migration guide or a changelog entry to document these updates for users who may be transitioning from the legacy CDS to the new system. This could help in easing the transition and addressing any potential issues users might face.

This comment was generated by AI. Information provided may be incorrect.

Current plan usage: 0%

Have feedback or need help?
Documentation
[email protected]

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @yunjunz - I've reviewed your changes - here's some feedback:

Overall Comments:

  • In autoget.py, the check 'if model in "ERA5"' could lead to unintended matches if model values vary. Consider using an explicit equality check (e.g. 'if model == "ERA5"') to ensure clarity and correctness.
  • Verify that the changes in the request dictionary (switching from string values to list values for parameters like year, month, day, and time) are fully compatible with the new CDS API. If not already documented, a brief inline comment for this change would help future maintainers.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@yuankailiu yuankailiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yunjunz , thanks for the PR to update the official urls. The links are working for me. The PR looks good.

@yunjunz yunjunz merged commit cce7fa6 into insarlab:main Feb 8, 2025
4 checks passed
@yunjunz yunjunz deleted the cds branch February 8, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants