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

Improves error when axis is missing/incorrect attributes #481

Merged
merged 6 commits into from
Jun 14, 2023

Conversation

jasonb5
Copy link
Collaborator

@jasonb5 jasonb5 commented May 20, 2023

Description

Improves regrid2 error when axis is missing from dataset or has incorrect attributes.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

If applicable:

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass with my changes (locally and CI/CD build)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

@jasonb5
Copy link
Collaborator Author

jasonb5 commented May 20, 2023

I'd like to revisit this in the future and refactor regrid2 to use the newer xcdat axis functions to mitigate this issue all together.

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (44e0e3b) 100.00% compared to head (99400d6) 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@             Coverage Diff             @@
##              main      #481     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files           14        28     +14     
  Lines         1425      2856   +1431     
===========================================
+ Hits          1425      2856   +1431     
Impacted Files Coverage Δ
xcdat/regridder/regrid2.py 100.00% <100.00%> (ø)

... and 14 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jasonb5 jasonb5 changed the title Improves error when axis is missing Improves error when axis is missing/incorrect attributes May 20, 2023
@tomvothecoder tomvothecoder self-requested a review May 24, 2023 17:55
@tomvothecoder tomvothecoder added the type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Jun 7, 2023
Copy link
Collaborator

@tomvothecoder tomvothecoder left a comment

Choose a reason for hiding this comment

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

One minor code suggestion, then LGTM.

Co-authored-by: Tom Vo <tomvothecoder@gmail.com>
@tomvothecoder
Copy link
Collaborator

There's some weird mamba error going on in the GH Actions build.

I'll take a look at it.

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/usr/share/miniconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1124, in __call__
        return func(*args, **kwargs)
      File "/usr/share/miniconda3/lib/python3.10/site-packages/conda_env/cli/main.py", line 78, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/usr/share/miniconda3/lib/python3.10/site-packages/conda/notices/core.py", line 109, in wrapper
        return func(*args, **kwargs)
      File "/usr/share/miniconda3/lib/python3.10/site-packages/conda_env/cli/main_update.py", line 132, in execute
        result[installer_type] = installer.install(prefix, specs, args, env)
      File "/usr/share/miniconda3/lib/python3.10/site-packages/mamba/mamba_env.py", line 55, in mamba_install
        index = load_channels(pool, channel_urls, repos, prepend=False)
      File "/usr/share/miniconda3/lib/python3.10/site-packages/mamba/utils.py", line 178, in load_channels
        repo = subdir.create_repo(pool)
    RuntimeError: Could not read JSON repodata file (/home/runner/conda_pkgs_dir/cache/47929eba.json) parse error line 593230: subdir mismatch

`$ /usr/share/miniconda3/condabin/mamba update -n xcdat_ci -f conda-env/ci.yml`

@jasonb5
Copy link
Collaborator Author

jasonb5 commented Jun 9, 2023

Nothing changed the conda-env files. I though it might be a caching issue so I restarted them last night. Guess that didn't clear it up, I might try restarting them again.

@jasonb5
Copy link
Collaborator Author

jasonb5 commented Jun 9, 2023

Guess this restart clear it up.

@tomvothecoder
Copy link
Collaborator

Yeah I tried restarting it a few times lol. You can merge if you are ready.

@lee1043
Copy link
Collaborator

lee1043 commented Jun 13, 2023

I wonder if this improvement is going to be included for v0.6.0, which I hope so. Let me know if there is anything I can help on this PR.

@tomvothecoder
Copy link
Collaborator

I wonder if this improvement is going to be included for v0.6.0, which I hope so. Let me know if there is anything I can help on this PR.

Yes this will be included in v0.6.0 since it is a simple fix. We're just waiting on @jasonb5 to merge whenever he's ready.

@jasonb5 jasonb5 merged commit c70827a into xCDAT:main Jun 14, 2023
@jasonb5 jasonb5 deleted the fix_regrid2_axis_error branch June 14, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Improve KeyError message when cf_xarray can't find CF attributes for coordinates with regrid2
4 participants