Stream: ESDS

Topic: polar plotting


view this post on Zulip Alice DuVivier (Jan 24 2022 at 23:19):

I have been trying to plot some scalar and vector fields with a North Stereographic projection and running into issues both with contours and vectors. I have a standard sea ice data from CESM - sea ice speed and the u and v vectors.

I just tried to plot the contours and they are creating weird polygons over the pole, though they look fine further south. Any idea what's going on? I have used contourf this same way with CAM data, so I'm wondering if it has to do with the ice/ocean grid?
Screen-Shot-2022-01-24-at-4.11.05-PM.png

Here I plotted the scalar speed with pcolormesh and then tried to overlay just contour labels. Same issue as above probably.
Screen-Shot-2022-01-24-at-4.12.04-PM.png

Finally, I tried to overlay vectors on the pcolormesh using quiver and I am seeing some weird, non-physical, convergence at the North Pole.
Screen-Shot-2022-01-24-at-4.12.27-PM.png

@Michael Levy and I worked on this briefly during office hours today and couldn't find a solution. I have also looked through the GeoCat webpage and googled in general and not found a clear solution. I am hoping I am just missing something minor. But this github quiver issue (https://github.com/SciTools/cartopy/issues/1179) makes me concerned that there wasn't actually an existing solution for the vectors.

@Max Grover do you have any suggestions? I think in a pervious session you were named as the visualization guru.

view this post on Zulip Max Grover (Jan 25 2022 at 13:56):

@Alice DuVivier I can dig into this later today - Ill post any updates in this stream

view this post on Zulip John Clyne (Jan 25 2022 at 16:33):

@Max Grover , @Alice DuVivier , if something comes out of this effort that you think would benefit a broader community, please consider contributing to the GeoCAT gallery: https://geocat-examples.readthedocs.io/en/latest/

view this post on Zulip Alice DuVivier (Jan 25 2022 at 18:00):

Sure, it would be good to figure out the weird details with high latitude plots. @Max Grover today is not good, but I'm a lot more flexible in the coming days if it would help to hop on a zoom and talk through what's going on. :)

view this post on Zulip Max Grover (Jan 25 2022 at 21:05):

Do you have a path to the notebook you are using @Alice DuVivier

view this post on Zulip Alice DuVivier (Jan 25 2022 at 22:00):

@Max Grover Yes, but I asked @Lorenzo Zampieri today and he might have a solution. So I'm going to wait to send it and maybe save you some time/effort. :)

view this post on Zulip Alice DuVivier (Jan 26 2022 at 23:12):

Alice DuVivier said:

Max Grover Yes, but I asked Lorenzo Zampieri today and he might have a solution. So I'm going to wait to send it and maybe save you some time/effort. :)

@Max Grover , @Lorenzo Zampieri and I figured this out. You have to do a fairly simple rotation from the CICE grid to the "real" map. There are a few keys that I think can be posted somewhere (blog post, geocat example, etc.) and probably something that could be added to pop_tools.

1) You need to have the ANGLE value from the pop grid. This is not currently in the grid from pop_tools, but could be added.
2) Then you rotate the raw u and v vectors using the following:

u_rot = (u_raw*np.cos(angle)) - (v_raw*np.sin(angle))
v_rot = (u_raw*np.sin(angle)) + (v_raw*np.cos(angle))

That's it. Pretty simple, but it took a while to sort out. See below for the comparison of rotated and non-rotated vectors. I also wrote it up simply in the following notebook that might be useful as well.
/glade/p/cgd/ppc/duvivier/cesm2_arctic_cyclones/rufmod_analysis/version_2/ice_transport/vector_tests/testing3.ipynb
Screen-Shot-2022-01-26-at-4.07.50-PM.png


Last updated: Jan 30 2022 at 12:01 UTC