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 Horizontal Streamfunction plots + Subpolar North Atlantic projection #898

Merged
merged 23 commits into from
Sep 29, 2022

Conversation

anirban89
Copy link
Collaborator

Summary :
Config option (climatologyMapBSF) for plotting climatological depth integrated transport streamfunction

  • either full depth (Barotropic) or up to a specified depth (task file = ocean/climatology_map_bsf.py)
  • option to add arrows to contourlines: config option arrowsOnContour<suffix> in default.cfg, files updated shared/plot/climatology_map.py, shared/plot/colormap.py
    Subpolar North Atlantic projection to visualize sub polar gyre.
  • subpolar North Atlantic projection added to shared/projection/__init__.py, shared/climatology/comparison_descriptors.py and shared/climatology/remap_mpas_climatology_subtask.py
  • doctoring updated in shared/climatology/comparison_descriptors.py

@anirban89
Copy link
Collaborator Author

Hi, Can you all please review this pull request? Maybe test this functionality with other E3SM runs. I only tested with a Southern Ocean refined run: /lcrc/group/e3sm/ac.abarthel/E3SMv2/20220808.v2.cryo.Bcase.submesoscale.ne30pg2_SOwISC12to60E2r4.chrysalis.

@anirban89
Copy link
Collaborator Author

I changed the figsize of some of the projections (North Pacific, North Atlantic, Antarctic) to help formatting (reduce whitespace etc.) in the default config file, but I only looked at single panel plots and didn't check any of the 3 panel plots. We would need to check how the figures get formatted with the 3 panel plot

Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

@anirban89, this is really fantastic! Here are a few comments. Some are changes I noticed on a quick look through the code. Some are notes that will need to be followed up on once I've run the full analysis on a typical cryosphere simulation so we can see the effects on our usual plots.

@@ -245,6 +245,11 @@ comparisonNorthPacificWidth = 15000.
comparisonNorthPacificHeight = 5000.
comparisonNorthPacificResolution = 20.

# The comparison North Atlantic grid size and resolution in km
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# The comparison North Atlantic grid size and resolution in km
# The comparison Subpolar North Atlantic grid size and resolution in km

Comment on lines 381 to 388
onePanelFigSize = (8, 7.5)
onePanelFigSize = (7, 7.5)
threePanelVertFigSize = (8, 22)
threePanelHorizFigSize = (22, 7.5)
threePanelHorizFigSize = (20, 7.5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will have to see what kind of an effect this has on other Antarctic plots, since it will affect all of them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Arctic plots will likely need tweaks. See overlapping titles:

image

Comment on lines -1382 to +1401
comparisonGrids = ['latlon']
comparisonGrids = ['latlon', 'subpolar_north_atlantic']
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing this was just for testing and we don't want this by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this was for testing, you are right

Comment on lines 1392 to 1462
colormapTypeResult = indexed
colormapTypeResult = continuous
# the type of norm used in the colormap
normTypeResult = linear
# A dictionary with keywords for the norm
normArgsResult = {'vmin': -12., 'vmax': 12.}
# color indices into colormapName for filled contours
colormapIndicesResult = numpy.array(numpy.linspace(0, 255, 38), int)
# colormap levels/values for contour boundaries
colorbarLevelsResult = numpy.linspace(-12., 12., 37)
# colormap levels/values for ticks (defaults to same as levels)
colorbarTicksResult = numpy.linspace(-12., 12., 9)

# Adding contour lines to the figure
contourLevelsResult = np.arange(-12., 12., 1.)
contourThicknessResult = 0.5
contourColorResult = black
# colormap for differences
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may want to change these but it shouldn't be done in this PR.

Comment on lines 1414 to 1481
comparisonGrids = ['latlon']
comparisonGrids = ['latlon','subpolar_north_atlantic']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, this doesn't belong in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry you are right

mpas_analysis/shared/plot/climatology_map.py Outdated Show resolved Hide resolved
Comment on lines 527 to 560
ax.set_title(title, y=1.06, **plottitle_font)
ax.set_title(title,**plottitle_font)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will have to see what the effects of this change are on other plots. It could have a positive effect on the BSF plots but be a problem for other plots.

@@ -597,7 +634,7 @@ def plot_panel(ax, title, array, colormap, norm, levels, ticks, contours,
else:
figsize = config.getexpression(section, 'threePanelHorizFigSize')
subplots = [131, 132, 133]

aspectratio = figsize[0]/figsize[1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you ended up using this so I'd remove it again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, we can remove this for now

mpas_analysis/shared/plot/colormap.py Show resolved Hide resolved
mpas_analysis/shared/projection/__init__.py Outdated Show resolved Hide resolved
mpas_analysis/default.cfg Outdated Show resolved Hide resolved
Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

A few more comments.

mpas_analysis/ocean/climatology_map_bsf.py Outdated Show resolved Hide resolved
mpas_analysis/polar_regions.cfg Outdated Show resolved Hide resolved
mpas_analysis/default.cfg Show resolved Hide resolved
Comment on lines 381 to 388
onePanelFigSize = (8, 7.5)
onePanelFigSize = (7, 7.5)
threePanelVertFigSize = (8, 22)
threePanelHorizFigSize = (22, 7.5)
threePanelHorizFigSize = (20, 7.5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Arctic plots will likely need tweaks. See overlapping titles:

image

@xylar
Copy link
Collaborator

xylar commented Sep 26, 2022

Hi, Can you all please review this pull request?

@anirban89, I think if you don't @ people, they won't notice this.

@milenaveneziani, @alicebarthel, could you have a look?

We should also ask LeAnn for feedback before we merge.

@milenaveneziani
Copy link
Collaborator

This looks great! Thanks @anirban89, @xylar.
I will test this PR on one of the ARRM simulations.

@milenaveneziani
Copy link
Collaborator

This worked great for me, @anirban89!
Here is the full analysis link: https://portal.nersc.gov/project/m1199/milena/20220810.WCYCL1950.arcticx4v1pg2_ARRM10to60E2r1.baseline_bdvslat/Years11-20/ocean/index.html

And here is the full barotropic SF for the Subpolar gyre:
image

Copy link
Collaborator

@milenaveneziani milenaveneziani left a comment

Choose a reason for hiding this comment

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

I understand that Anirban wants to change a few aesthetic details, but this is already great for me.

@xylar
Copy link
Collaborator

xylar commented Sep 27, 2022

@anirban89, this is really fantastic! I'm going to post some figures where the formatting needs a little work. Let's talk about how to fix these so we can get this merged.

Here's the full analysis:
https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.xylar/analysis_testing/bsf_vertices2/v2.cryo.Bcase.submesoscale.ne30pg2_SOwISC12to60E2r4.chrysalis/clim_0001-0020_ts_0001-0020/ocean/index.html

Here is a fake main vs. control analysis (with the same run as main and control) so we can look at the 3-panel plots:

https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.xylar/analysis_testing/bsf_main_vs_ctrl/main/clim_0001-0020_ts_0001-0020/ocean/index.html

Too much whitespace between title and panel titles. Probably, just need to shorten the height of the 3-panel Antarctic figure:
image

Same with Arctic 3-panel:
image

The title font in the Subpolar North Atlantic plots seems a lot bigger than in other plots:
image
This seems to be leading to undesirable whitespace to the left.

We don't plot North Atlantic and North Pacific regions by default but it might be worth doing a test with those regions (both 1 and 3 panel plots) to make sure your modifications here are appropriate. I'm not super worried about those until we start using them by default, though.

@xylar
Copy link
Collaborator

xylar commented Sep 28, 2022

@anirban89, it would be good to rebase this branch onto the latest develop now that #906 has gone in. It would be important to make sure the 3 commits from that PR no longer appear here. We can chat about this tomorrow.

@anirban89
Copy link
Collaborator Author

Yes lets reconvene tomorrow

mpas_analysis/__main__.py Outdated Show resolved Hide resolved
@anirban89
Copy link
Collaborator Author

anirban89 commented Sep 29, 2022

@xylar I am not saying it has to be part of this PR, but I noticed that EKE is being plotted on a linear scale with units in cm^2s^-2, whereas surface speed is plotted in linear scale with units in ms^-1. I have always seen EKE being plotted on a logarithmic scale. Is there any specific reason to not have SI units for this one plot? I would expect EKE to be plotted in m^2s^-2 with a logarithmic scale and a different colormap. That will definitely make for a better visualization. Thoughts?
eke_main_ANN_years0001-0020
velocityMagnitudeSOSE_antarctic_main_depth_top_ANN_years0001-0020

@xylar
Copy link
Collaborator

xylar commented Sep 29, 2022

@xylar I am not saying it has to be part of this PR, but I noticed that EKE is being plotted on a linear scale with units in cm^2s^-2, whereas surface speed is plotted in linear scale with units in ms^-1. I have always seen EKE being plotted on a logarithmic scale. Is there any specific reason to not have SI units for this one plot? I would expect EKE to be plotted in m^2s^-2 with a logarithmic scale and a different colormap. That will definitely make for a better visualization. Thoughts?

A separate PR to address these things would be very welcome. The analysis was added by a summer student many years ago. It hasn't received much attention since then, in part because we don't always even include it in our output. I agree with all your suggestions: log scale, SI units and a different colormap. What colormap did you have in mind? Is there a typical choice that the community expects?

@anirban89
Copy link
Collaborator Author

anirban89 commented Sep 29, 2022

I was thinking something on the lines of this. This is a pretty commonly used colormap for speed and EKE. This is named as Black Blue and White in Paraview.
KE 0004

It doesn't appear to match with any of the available maps under MPAS-Tools sciviz color maps.
colormaps

But I have a python recipe for a custom colormap like this which could work
Unknown-2

Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

@anirban89, this is excellent work! Further tweaks can be made in follow-up PRs if we find anything that needs it but this looks like exactly what I was hoping for!

@xylar
Copy link
Collaborator

xylar commented Sep 29, 2022

@anirban89, let's move the discussion on EKE to a separate issue. I don't want this PR to be confused with an unrelated issue.

@xylar xylar removed the request for review from alicebarthel September 29, 2022 20:33
@xylar
Copy link
Collaborator

xylar commented Sep 29, 2022

@lconlon, are you okay with this plot of the subpolar gyre?

image

We'd welcome feedback. As I said, we can also tweak it to your liking later if this is okay as a first pass.

(It's duplicated twice in this plot just to test model vs. model comparison. You can ignore that.)

@xylar xylar merged commit 1447f4a into MPAS-Dev:develop Sep 29, 2022
@xylar
Copy link
Collaborator

xylar commented Oct 10, 2022

@anirban89, would you have time to add a documentation page for this task?
Here's an example to work from:
https://github.com/MPAS-Dev/MPAS-Analysis/blob/develop/docs/users_guide/tasks/climatologyMapEKE.rst
They're pretty formulaic but still I think it would be great if you take care of this rather than me since you put in the effort on this task.

@xylar
Copy link
Collaborator

xylar commented Oct 10, 2022

You can make a new PR just for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants