-
Notifications
You must be signed in to change notification settings - Fork 24
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
Mom5 laplacians #27
Mom5 laplacians #27
Conversation
Merge branch 'master' of https://github.com/Zanna-ResearchTeam/gcm-filters
Merge branch 'master' of https://github.com/Zanna-ResearchTeam/gcm-filters
Do we feel this is ready for me to review? We agree this is the way to go for MOM5? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just reviewed this and it looks 👍 to me! Tests are passing, code looks clean. So it seems we are ready to merge.
My only concern is about the notebook. Was it your intention to add the notebook to the documentation? If so, it needs to go in the docs folder and get linked from index.rst
.
Furthermore, this notebook is quite long, and there are some sections that I'm not sure belong in the docs (e.g. "Our implementation of the MOM5 Laplacian (B-grid) for tracer fields".) To document the details of the Laplacian, you can put this information right in the documentation string (including latex equations) for the new Laplacian classes.
Once the notebooks is cleaned up and put in the right place, then I think we can merge this.
Any other comments from anyone else?
gcm_filters/kernels.py
Outdated
@@ -51,6 +58,95 @@ def __call__(self, field: ArrayType): | |||
ALL_KERNELS[GridType.CARTESIAN] = CartesianLaplacian | |||
|
|||
|
|||
@dataclass | |||
class MOM5LaplacianU(BaseLaplacian): | |||
"""Laplacian for MOM5 gird (velocity points)""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add description and equations here.
Thanks for the review @rabernat I had missed that message sorry. I think we can happily leave the notebook aside as it is probably more suited to the paper. Does that make sense @NoraLoose? Also yes I'll put that in the post unit and submit and then it'll be ready for merging. |
@arthurBarthe, @ElizabethYankovsky, and @LaureZanna: it would be great to merge this PR before we submit the JOSS paper. Whenever you have the chance, would you mind making the changes discussed above? In addition, it would be great to add your MOM5 Laplacian to the table of Laplacians in our documentation. This can be done by modifying Let me know how I can help. Thanks! |
Thanks @NoraLoose for the ping. Last month I checked with @arthurBarthe and @ElizabethYankovsky who told me that MOM5 was not going to be included in gcm-filter, glad to see that this has changed :-). @arthurBarthe has started a new faculty job but @ElizabethYankovsky and I can make the changes on Tue or Wed! We will surely ping you for help. Thanks!! |
@LaureZanna, this must have been a misunderstanding. The last time we talked about this PR was in our meeting on May 5th (as far as I remember). And I thought we all agreed that we want to merge the MOM5 Laplacians, and that this PR just needs some minor modifications, as discussed above. Sorry if there was some miscommunication. I would be more than happy to help you and @ElizabethYankovsky to finalize this PR. The code has advanced quite a bit in the last few months, so we will have to resolve some conflicts. On Tuesday I will be available until around 2pm Eastern, but then I will have to leave to the airport to catch a flight to Europe. I will be fully back online in the week after, starting September 13th (though in a time zone 6 hours ahead of you). |
Resolving conflicts
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #27 +/- ##
==========================================
+ Coverage 98.25% 98.72% +0.47%
==========================================
Files 9 9
Lines 861 944 +83
==========================================
+ Hits 846 932 +86
+ Misses 15 12 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks for the making the changes, @ElizabethYankovsky! Is this ready for another round of review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ElizabethYankovsky! This looks good to me. I just left a few comments.
Another question is whether you meant to add the notebook MOM5_Laplacian_Filter.ipynb
(part of this PR) to the documentation? I think @arthurBarthe mentioned that he wanted to remove it from this PR. If you'd like to keep the notebook, please let me know and I will review it.
docs/basic_filtering.rst
Outdated
@@ -38,6 +38,10 @@ The following table provides an overview of these different grid type options: w | |||
| ``IRREGULAR_WITH_LAND`` | locally orthogonal grid | yes | periodic | Scalar Laplacian | :doc:`examples/example_filter_types`; | | |||
| | | | | | :doc:`examples/example_tripole_grid` | | |||
+--------------------------------+-----------------------------------------------------------------+--------------+--------------------+------------------+------------------------------------------+ | |||
| ``MOM5U`` | Velocity-point on Arakawa B-Grid | yes | tripole | Scalar Laplacian | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of now, the Laplacians MOM5U
and MOM5T
do not use a tripole boundary condition (even though this could be easily done following the implementation for the TRIPOLAR_POP_WITH_LAND
Laplacian). I think we should change tripole
--> periodic
.
docs/basic_filtering.rst
Outdated
@@ -38,6 +38,10 @@ The following table provides an overview of these different grid type options: w | |||
| ``IRREGULAR_WITH_LAND`` | locally orthogonal grid | yes | periodic | Scalar Laplacian | :doc:`examples/example_filter_types`; | | |||
| | | | | | :doc:`examples/example_tripole_grid` | | |||
+--------------------------------+-----------------------------------------------------------------+--------------+--------------------+------------------+------------------------------------------+ | |||
| ``MOM5U`` | Velocity-point on Arakawa B-Grid | yes | tripole | Scalar Laplacian | | | |||
+--------------------------------+-----------------------------------------------------------------+--------------+--------------------+------------------+------------------------------------------+ | |||
| ``MOM5T`` | Tracer-point on Arakawa B-Grid | yes | tripole | Scalar Laplacian | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: tripole
--> periodic
gcm_filters/kernels.py
Outdated
@@ -302,6 +304,116 @@ def __call__(self, field: ArrayType): | |||
ALL_KERNELS[GridType.IRREGULAR_WITH_LAND] = IrregularLaplacianWithLandMask | |||
|
|||
|
|||
@dataclass | |||
class MOM5LaplacianU(BaseScalarLaplacian): | |||
"""Laplacian for MOM5 (tracer points). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracer points
--> velocity points
gcm_filters/kernels.py
Outdated
self.y_wet_mask = self.wet_mask * np.roll(self.wet_mask, -1, axis=-2) | ||
|
||
def __call__(self, field: ArrayType): | ||
"""Uses code by Elizabeth""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this line.
@NoraLoose thank you for the comments! I've updated the code with the changes you requested made. Please let me know if there are any other problems you notice. And yes, we can remove MOM5_Laplacian_Filter.ipynb from this PR -- where would be a good place to put this notebook? I can add it to the documentation and make sure it still works with the latest version of the package. |
Thanks @ElizabethYankovsky! Updated code and documentation look good to me! I just had a quick look at the notebook |
I agree 💯 with this. The documentation should not document the implementation. It should document how to use the package. 🙏 to @ElizabethYankovsky and @NoraLoose for the excellent work on this. |
Thanks @NoraLoose and @rabernat! I've removed the notebook, and agree that it will be more useful to add an example to the documentation pages of how gcm-filters can be used on a MOM5 grid. @NoraLoose please feel free to merge this PR as it is now. For the JAMES paper I ended up re-rewriting the notebook to first interpolate all fields onto a C-grid (using the xgcm package) and then applying the vector laplacian formulated for a C-grid. However, in my original version of that notebook there was an example of B-grid usage. We can work on including this in the documentation (@NoraLoose I'll message you about this separately). |
Sounds great, @ElizabethYankovsky! I think this PR is ready to be merged. We can wait a little bit longer to give @rabernat (and potentially others) a chance to also approve the changes. Thanks @ElizabethYankovsky, @arthurBarthe, and @LaureZanna for this contribution! |
Thanks @NoraLoose and @rabernat!! this is amazing work. It was a lot of fun to play with the MOM5 kernels and getting involved in the coding with Arthur + Elizabeth. We are also using it for our ML work with Andrew Ross (and people in M2LInES). |
This adds the MOM5 laplacians and the corresponding grid types. The PR is not ready for now but at least we thought we'd show where we are at.