E3SM-Project / e3sm_diags

E3SM Diagnostics package
https://e3sm-project.github.io/e3sm_diags
BSD 3-Clause "New" or "Revised" License
39 stars 32 forks source link

Unify extents of colorbars in comparison plots #704

Open mahf708 opened 1 year ago

mahf708 commented 1 year ago

In comparison (i.e., model-vs-model or model-vs-obs) plots, the default non-specified behavior is often unsatisfactory, and the current approach in this repository is to manually set/specify "sane defaults" for each derived (or raw) variable in the ini/cfg files. See the first example below for one derived parameter I've recently aded as part of the aerosol working group efforts.

A three-panel figure without specifying the colorbars

![image](https://github.com/E3SM-Project/e3sm_diags/assets/122953255/e6b6b8d7-ff52-4e96-87eb-1a3ee9638fb9)

In order to fix the plots, I had to manually set contour_levels and diff_levels so that the colorbars are more informative. See below.

A three-panel figure with specifying the colorbars

![](https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.ngmahfouz/E3SMv3_dev/pd.free.3b3a953.v3alpha02.plus0K.chrysalis/misc/lat_lon/lat_lon_mass_328mb/pi.free.3b3a953.v3alpha02.plus0K.chrysalis-Mass_so4_328mb-ANN-global.png)

In this particular case, I made two quick edits.

  1. Because the default scientific notation doesn't appear readily for the min, max, and mean fields, I decided to convert this to a unit where it will appear more readily.
  2. Because I found the unspecified defaults for colorbars to be misleading, I set contour_levels and diff_levels such that: a. The top two panels share the same minimum and maximum; and b. the third (diff) panel goes from -max(abs(val)) to +max(abs(val)) with the diverging (default) color scheme.

**

I think setting the default behavior to be like 2 above makes more sense than letting the plotting libraries choose (current behavior). Thankfully, we already have all the values of interest calculated (min and max) and the plotting functionality can easily accept these new defaults without disrupting the current behavior of e3sm_diags since most (if not all) variables have their defaults overridden by the manually set configs. Therefore, I propose we adopt the items in point 2 above as new defaults.

Pros:

Cons (I chose the above example on purpose to illustrate the drawbacks of this proposal ahead of time):

**

I am going to adopt the above solution in my fork for our custom diagnostics, but it may be good to adopt it for all of e3sm_diags.

Let me know if you have any feedback or thoughts on this. If there is openness to this proposal, I can draft a PR with the necessary changes to make it more actionable.

chengzhuzhang commented 1 year ago

Hi @mahf708 Thanks for the suggested change. It would be nice to have the default behavior polished so that we can rely less on manually set the fields for colorbars. I'm also curious about your solution for convert scientific notion to a unit that can be readily printed and shown as metrics. I wondered if there is a generic solution to convert large/small values, while have reasonable metrics values to be printed.