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

Refactor MB06 #51

Merged
merged 3 commits into from
Jun 30, 2021
Merged

Refactor MB06 #51

merged 3 commits into from
Jun 30, 2021

Conversation

malmans2
Copy link
Member

@oceandie if you are done with MB06, I think this can be merged into #33.
Needs a good check, but I think it's consistent with the implementation with loops.
I used this notebook to test.

@malmans2 malmans2 requested a review from oceandie June 30, 2021 07:36
@codecov
Copy link

codecov bot commented Jun 30, 2021

Codecov Report

Merging #51 (b317b50) into sco_dev (6750533) will increase coverage by 7.12%.
The diff coverage is 4.76%.

Impacted file tree graph

@@             Coverage Diff             @@
##           sco_dev      #51      +/-   ##
===========================================
+ Coverage    74.54%   81.67%   +7.12%     
===========================================
  Files            5        5              
  Lines          275      251      -24     
===========================================
  Hits           205      205              
+ Misses          70       46      -24     
Flag Coverage Δ
unittests 81.67% <4.76%> (+7.12%) ⬆️

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

Impacted Files Coverage Δ
pydomcfg/utils.py 52.00% <4.76%> (+12.60%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6750533...b317b50. Read the comment docs.

@malmans2 malmans2 added the enhancement New feature or request label Jun 30, 2021

# TODO:
# Warning or error?
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally would put an error: from personal experience, usually it is sufficient tiincrease the tolerance of a couple of orders, an many tines it is relating with the precision of your data ... in this way we force the user to be aware and maybe make the input more consistent precision wise

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, changed to error! Maybe we should decrease the default number of iterations... I'd get pretty mad if I wait hours to get an error and no return :)
Anyways, not urgent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree!

pydomcfg/utils.py Outdated Show resolved Hide resolved
rmax: float,
tol: float = 1.0e-8,
max_iter: int = 10_000,
) -> DataArray:
"""
This is NEMO implementation of the direct iterative method
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add something like: This is the xarray version of NEMO implementation ....

Copy link
Member Author

Choose a reason for hiding this comment

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

Reworded, although I didn't explicitly mention xarray as we use it pretty much everywhere and it should be clear from the docs. Also I removed the units, any units should work fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree with your point ... it was just to make clear to the users (an us :) ) that this is only a more efficient version of the NEMO MB06 implementation

@oceandie
Copy link
Contributor

Very clear implementation, thanks @malmans2 !

@malmans2
Copy link
Member Author

Very clear implementation, thanks @malmans2 !

Thanks! BTW, eventually I think we should make this function public. But no need to do it right now, we can wait until we're ready to merge dev_sco.

@malmans2
Copy link
Member Author

All set! Not sure if you're ready to integrate this in your sco_dev PR, so I'll let you merge this.

@oceandie oceandie merged commit 8e08398 into pyNEMO:sco_dev Jun 30, 2021
@malmans2 malmans2 deleted the mb06_vectorized branch June 30, 2021 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants