FESOM / tripyview

Triangular plotting for FESOM2
MIT License
4 stars 3 forks source link

cmin and cmax computation does not work if a box (region) is selected for plotting #141

Closed alxthor closed 3 weeks ago

alxthor commented 3 weeks ago

Example: Plotting NH sea ice using hslice with proj='nps', box= [-180, 180, 60, 90], cmin=None, cmax=None, chist=False should calculate cmin and cmax based on maximum and minimum values in the desired region. However, the calculated cmax (which is then finally used for the colormap) is too small.

Looking into the code I think the issue is the following:

  1. plot_hslice creates a triangulation object tri which uses do_reindex_vert_and_elem to reindex the vertices.
  2. do_setupcinfo then tries to use the reindexed vertices to access the nod2 of the original data_plot which will the select a totally different region from the data than it is supposed to: https://github.com/FESOM/tripyview/blob/5c85295dcac30b12774da917fa8e357a38b4826f/tripyview/sub_plot.py#L5700-L5701

If chist is set to True then it seems like global values are taken and the regional selection is discarded entirely https://github.com/FESOM/tripyview/blob/5c85295dcac30b12774da917fa8e357a38b4826f/tripyview/sub_plot.py#L5696-L5697

I'm not sure how to fix this issue. Somehow the information of the remapping needs to be remembered for calculating cmin and cmax.

patrickscholz commented 3 weeks ago

You are right, that was a bit sloppy Theoretical all info was already there i just forgot to apply it. I fixed and pushed this issue through https://github.com/FESOM/tripyview/pull/142 into the main branch!