Skip to content

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented Apr 19, 2020

Many supposed parameters are actually hard-coded. Documentation has been updated to adhere to numpydoc formatting. Unnecessary looping has been removed.

This merge also improves plotting of cell widths in define_base_mesh. Imports are now at the top of the file. Colormap is now perceptually uniform (not "jet"!) Plot layout is now tighter (though there's still considerable whitespace).

xylar added 2 commits April 19, 2020 10:25
Many supposed parameters are actually hard-coded.

Documentation has been updated to adhere to numpydoc formatting.

Unnecessary looping has been removed.
Imports should be at the top of the file.

Colormap is now perceputally uniform (not "jet"!)

Plot layout is now tighter (though there's still considerable
whitespace.
@xylar
Copy link
Collaborator Author

xylar commented Apr 19, 2020

@sbrus89 and @pwolfram, these changes may affect you depending on what you use as your background mesh. Either way, these changes would be a good template for future changes to mesh_definition_tools.py

), extent=[-180, 180, -90, 90], cmap='jet')
im = ax.imshow(cellWidth, origin='lower',
transform=ccrs.PlateCarree(),
extent=[-180, 180, -90, 90], cmap='viridis_r')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Make this rainbow.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't-- this doesn't add value and rainbow is a notoriously bad colormap.

Copy link
Contributor

Choose a reason for hiding this comment

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

(unless rainbow is the perceptually uniform one, not "jet") In that case this is ok.

Copy link
Collaborator Author

@xylar xylar Apr 20, 2020

Choose a reason for hiding this comment

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

@pwolfram, thanks for the feedback. I agree, rainbow isn't a big improvement over jet. How about another solution? I have been using a colormap from paraview for resolution that is made up of 3 perceptually uniform segments ("Blue - Green - Orange"), the second colormap here: https://sciviscolor.org/3-wave-colormaps/. It will be more complicated to add this to COMPASS, since it's not standard in matplotlib, but I'll see what I can do. Would that work for you? @mark-petersen, what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem with viridis is that it's too dark and the black outlines from cartopy don't show up well, but this could be fixed by drawing in the continents, not just the outlines.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy with perceptually uniform solutions, but don't like it when you can see "lines" like yellow, in the colormap. But, I'm ok with non-jet solutions like proposed below-- thanks!

Comment on lines +79 to +80
fig.canvas.draw()
plt.tight_layout()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This cleans up some whitespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@xylar
Copy link
Collaborator Author

xylar commented Apr 20, 2020

@mark-petersen, I'm still tinkering with this one. Please don't merge yet.

@xylar
Copy link
Collaborator Author

xylar commented Apr 20, 2020

@pwolfram, @mark-petersen and anyone else who wants to weigh in, which is better?
1.
cellWidthGlobal_bgo
2.
cellWidthGlobal_viridis

I personally prefer 2 (viridis_r) because it's perceptually uniform. I can see how you could get more granularity from the blue-green-orange version. But it's much harder to tell which is higher and which is lower res.

@xylar xylar removed the in progress label Apr 20, 2020
@xylar
Copy link
Collaborator Author

xylar commented Apr 20, 2020

Pending @pwolfram and @mark-petersen's approval of using viridis now that I'm drawing the continents and not just their outlines, I think this is ready to merge.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bbox_inches='tight' eliminates some of the remaining white space around the image so it looks right.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, good to know.

@mark-petersen
Copy link
Contributor

@xylar I strongly prefer your first one above (de-saturated rainbow?) because I can perceive six colors, and they are in an order I expect. In viridis_r I only see three colors, and the top half of the colorbar looks the same to me, all dark blue. I made a similar one at the same time, but with slightly muted colors compared to above. I didn't realize we were both working on it:
cellWidthGlobal
Here is the colorbar code.
I really like your continents filled in. Thanks for changing it.
Despite my work on this one, I would go with your de-saturated rainbow above, out of these three.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you downloaded this directly from Paraview? That was smart.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, copied from MPAS-Analysis, which gives proper credit and got it from the original source (LANL's own SciVisColor web page, I believe).

@xylar
Copy link
Collaborator Author

xylar commented Apr 20, 2020

@mark-petersen, so the problem is a really hard one. More colors does give more granularity in some sense but it really leaves you with no intuition about where is high res and where is low. As Leif pointed out, he couldn't even tell how many regions of different resolution there were in my plot 1. above -- he thought there were 9, and that the yellow bands were really distracting as if they had extra meaning. This is the general complaint about color maps that don't transition uniformly from dark to light or visa versa, and the reason for the push for perceptual uniformity.

@xylar
Copy link
Collaborator Author

xylar commented Apr 20, 2020

I played around with a bunch more color maps and I do think 3Wbgy5, my option 1. above, might be the best option. As @mark-petersen points out, anything that's perceptually uniform tends to be made up of 3 distinct colors or so (the ones that aren't are gawd-awfully ugly). So I think we sacrifice the intuitive transition from light meaning high res to dark meaning low res in order to get more granularity in what isocontours correspond to what resolutions.

Add support for a colormap form SciVisColor (3Wbgy5).
@xylar xylar force-pushed the ocean/generalize_ec branch from 67f6b51 to 964e31a Compare April 20, 2020 19:47
@mark-petersen
Copy link
Contributor

Added a min/max to title because it is easier to read there:
image

@mark-petersen mark-petersen self-requested a review April 20, 2020 20:37
Copy link
Contributor

@mark-petersen mark-petersen left a comment

Choose a reason for hiding this comment

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

@xylar thanks for your work on this. It all looks great!

@mark-petersen
Copy link
Contributor

@pwolfram and @sbrus89 I think this is a nice improvement. I'd like to merge today, so we can rebase the mesh PRs on it.

Copy link
Contributor

@pwolfram pwolfram left a comment

Choose a reason for hiding this comment

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

Approved by inspection

@pwolfram
Copy link
Contributor

@sbrus89, can you please review the above?

Copy link

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

I agree this is a nice improvement. I approve by inspection.

@mark-petersen
Copy link
Contributor

Thanks. Tested one last time with QU240, QU240wISC, EC60to30wISC, EC60to30, SO60to10wISC. Everything appears to be working and making the plots correctly.

@mark-petersen mark-petersen merged commit 5c7fc77 into MPAS-Dev:ocean/develop Apr 20, 2020
@xylar xylar deleted the ocean/generalize_ec branch April 21, 2020 09:27
caozd999 pushed a commit to caozd999/MPAS-Model that referenced this pull request Jan 14, 2021
Generalize EC cell widths function MPAS-Dev#526

Many supposed parameters are actually hard-coded. Documentation has been
updated to adhere to numpydoc formatting. Unnecessary looping has been
removed.

This merge also improves plotting of cell widths in define_base_mesh.
Imports are now at the top of the file. Colormap is now perceptually
uniform (not "jet"!) Plot layout is now tighter (though there's still
considerable whitespace).
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.

5 participants