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

eNATL60 vorticity / strain histogram #15

Open
rabernat opened this issue May 6, 2021 · 8 comments
Open

eNATL60 vorticity / strain histogram #15

rabernat opened this issue May 6, 2021 · 8 comments

Comments

@rabernat
Copy link

rabernat commented May 6, 2021

I am giving a talk at the SIO SWOT seminar in less than two weeks about Pangeo and the AdAC model data effort. So I am trying to come up with a cool example.

I put together this notebook - https://nbviewer.jupyter.org/gist/rabernat/2f9ca9a0a54840fa1c2b96068574c7c5 - where I am trying to reproduce @dhruvbalwada's vorticity strain histogram analysis (see also ocean-transport/coiled_collaboration#5).

I am getting some weird results and would like some help from @roxyboy or @lesommer debugging. I figure we will need these sorts of demos for this project anyway, so hopefully this is time well spent. The notebook is 💯 runnable on https://us-central1-b.gcp.pangeo.io/, so please feel free to run it and reproduce / fix.

This is what my histogram looks like:

image

Obviously very different from Dhruv's result in the channel model:

image

My vorticity just doesn't look very vorticity-like 😱

image

I worry I am calculating it wrong:

def nemo_vort(u, v, e1f, e2f, e2v, e1u):
    return (
        np.roll(v * e2v, 1, axis=-1)
        - np.roll(u * e1u, 1, axis=-2)
    ) / (e1f  * e2f)

Note that I am not using xgcm, for the reason described in pangeo-forge/staged-recipes#24 (comment) and also because this "kernel function" + apply_ufunc approach scales much better. But I did base my code off of @raphaeldussin's xgcm example at https://xgcm.readthedocs.io/en/stable/example_nemo_idealized.html.

I would very much appreciate if someone could have a look and help me find out what's going wrong.

I look forward to collaborating this way and building up more and more complex examples of multi-model analysis.

@rabernat
Copy link
Author

rabernat commented May 6, 2021

And of course, immediately after writing this up, I found my mistake. 🙃 I am not actually taking any differences!

Sorry for spamming everyone. I'll keep this open and update you soon with my results.

@rabernat
Copy link
Author

rabernat commented May 6, 2021

So if I fix my vorticity calculation to be

def diff(a, shift, axis):
    return a - np.roll(a, shift, axis)

def nemo_vort(u, v, e1f, e2f, e2v, e1u):
    return (
        diff(v * e2v, 1, axis=-1)
        - diff(u * e1u, 1, axis=-2)
    ) / (e1f  * e2f)

I get this beautiful field

image

And this nice histogram

image

(Gist also updated)

Would this repo be a good place to collect such examples?

@roxyboy
Copy link
Owner

roxyboy commented May 6, 2021

Looks great! I also had in mind to look at the vorticity-strain histograms for each model :)
We'll (soon) have a SWOT-AdAC Jupyterhub operational so I think placing examples there could be an option but in the meantime, I think this repo would be a good place 👍

@rabernat
Copy link
Author

rabernat commented May 6, 2021

so I think placing examples there could be an option

I think we should definitely keep the examples in a separate repo from the jupyterhub image. We can easily use nbgitpuller to bring them in.

@roxyboy
Copy link
Owner

roxyboy commented May 7, 2021

I think we should definitely keep the examples in a separate repo from the jupyterhub image. We can easily use nbgitpuller to bring them in.

@rabernat Are you suggesting I make a new repo for the example notebooks or that Pangeo-forge makes one as part of their gallery?

@rabernat
Copy link
Author

rabernat commented May 7, 2021

Pangeo Forge doesn't do notebooks / examples.

I'm suggestion we have a standalone repo where we keep example notebooks for working with the SWOT AdAC data. Why not this repo? But what is all the stuff in this repo now? Is it being used for anything?

@roxyboy
Copy link
Owner

roxyboy commented May 7, 2021

I'm suggestion we have a standalone repo where we keep example notebooks for working with the SWOT AdAC data. Why not this repo? But what is all the stuff in this repo now? Is it being used for anything?

I'm perfectly ok with having an example subdirectory in this repo with example notebooks 👍

@roxyboy
Copy link
Owner

roxyboy commented May 7, 2021

I guess I got confused with #6 .

@rabernat rabernat changed the title Trying to calculate eNATL60 vorticity / strain histogram, getting weird results eNATL60 vorticity / strain histogram May 7, 2021
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

No branches or pull requests

2 participants