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

Add ability to save whether or not an iris to xarray conversion happened in the decorators #380

Merged
merged 7 commits into from
Mar 12, 2024

Conversation

freemansw1
Copy link
Member

Pulls code from #354 to allow developers to specify (with a new argument to the decorator irispandas_to_xarray) whether or not an iris->xarray conversion occurred, via a passed keyword argument.

Important note: I've now changed all of our decorators to allow keyword arguments. That means that when calling decorators in the future, you must call with an empty () regardless of whether or not you want to use them.

  • Have you followed our guidelines in CONTRIBUTING.md?
  • Have you self-reviewed your code and corrected any misspellings?
  • Have you written documentation that is easy to understand?
  • Have you written descriptive commit messages?
  • Have you added NumPy docstrings for newly added functions?
  • Have you formatted your code using black?
  • If you have introduced a new functionality, have you added adequate unit tests?
  • Have all tests passed in your local clone?
  • If you have introduced a new functionality, have you added an example notebook?
  • Have you kept your pull request small and limited so that it is easy to review?
  • Have the newest changes from this branch been merged?

@freemansw1 freemansw1 changed the title Add ability to save whether or not an iris to xarray conversion happened Add ability to save whether or not an iris to xarray conversion happened in the decorators Dec 4, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Attention: Patch coverage is 93.39623% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 57.05%. Comparing base (7ded724) to head (0800478).
Report is 39 commits behind head on RC_v1.5.x.

Files Patch % Lines
tobac/utils/decorators.py 93.20% 7 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           RC_v1.5.x     #380      +/-   ##
=============================================
+ Coverage      56.91%   57.05%   +0.13%     
=============================================
  Files             20       20              
  Lines           3440     3472      +32     
=============================================
+ Hits            1958     1981      +23     
- Misses          1482     1491       +9     
Flag Coverage Δ
unittests 57.05% <93.39%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@freemansw1 freemansw1 added enhancement Addition of new features, or improved functionality of existing features xarray transition Part of the transition to xarray support labels Dec 5, 2023
Copy link
Member

@w-k-jones w-k-jones left a comment

Choose a reason for hiding this comment

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

A function that creates a function that contains a wrapper... python decorators are a little messy... A couple of minor suggestions, but I'm happy for this to be merged

tobac/utils/decorators.py Outdated Show resolved Hide resolved
tobac/utils/decorators.py Outdated Show resolved Hide resolved
Comment on lines 69 to 70
else:
output = func(*args, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

These two lines should be removed, as they are recalculating the output when it could just be returned as is

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I understand how to resolve this. I tried to delete the two lines, but you then reference output before assignment.

Copy link
Member

Choose a reason for hiding this comment

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

That's odd, as output should be defined on line 150. Did you remove these two lines (163-164) or the similar lines at 166-167 (which are still required)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I had deleted the (wrong) similar lines.

Copy link
Collaborator

@snilsn snilsn left a comment

Choose a reason for hiding this comment

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

Just a comment about the docstrings, otherwise happy to merge.

tobac/utils/decorators.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Feb 23, 2024

Linting results by Pylint:

Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00)
The linting score is an indicator that reflects how well your code version follows Pylint’s coding standards and quality metrics with respect to the RC_v1.5.x branch.
A decrease usually indicates your new code does not fully meet style guidelines or has potential errors.

@freemansw1
Copy link
Member Author

@w-k-jones @snilsn I am ready for re-review when you are!

Copy link
Member

@w-k-jones w-k-jones left a comment

Choose a reason for hiding this comment

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

Thanks for the updates, breaking out the conversion process into separate functions is a good idea. Only one comment regarding lines 163-164 but otherwise happy to merge

Comment on lines 69 to 70
else:
output = func(*args, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

That's odd, as output should be defined on line 150. Did you remove these two lines (163-164) or the similar lines at 166-167 (which are still required)

@freemansw1
Copy link
Member Author

Ok, resolved that last comment. @w-k-jones, @snilsn ready to merge when you are.

@w-k-jones
Copy link
Member

Great! Happy for this to be merged

@snilsn
Copy link
Collaborator

snilsn commented Mar 12, 2024

Great, please go ahead and merge! @freemansw1

@freemansw1 freemansw1 merged commit e3c1414 into tobac-project:RC_v1.5.x Mar 12, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Addition of new features, or improved functionality of existing features xarray transition Part of the transition to xarray support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants