CCI-Tools / cate

ESA CCI Toolbox (Cate)
MIT License
50 stars 15 forks source link

Apply min/max of dataset on opening #426

Open thomas-eldridge opened 7 years ago

thomas-eldridge commented 7 years ago

Expected behavior

When opening a dataset, expect display range to be set to min(ds) - max(ds), such that range of variable can be seen immediately.

Actual behavior

In case of ozone, cloud (UC9) initial display range is 0 - 1, which is ok for normalised datasets but does not show any range at all (min of ozone ds is 4.75 for first layer & time step, so colorbar saturates at 1 for all pixels).

Steps to reproduce the problem

  1. Open ozone dataset (no need to apply time/space/variable constraints)
  2. Go to 'Layers' tab
  3. Click 'Compute valid min/max' button (to right of 'Display range' dialogue box.

Suggested improvement

Make it so that 'Compute valid min/max' button is effectively applied whenever a dataset is opened/ layer or timestep is changed. Perhaps better would be to add 'min' and 'max' keywords as possible args for 'Display range' dialogue box (and make these the defaults) so that changing layer/ timestep automatically changes range, but defaults can be replaced by fixed values if user wants, for instance, to see how pixels below/above a threshold evolve with time/height.

Specifications

Cate-0.9.0-dev.7

forman commented 7 years ago

Tom, computing min/max on the fly when you click on another variable can cause high CPU loads with unwanted delays before the image is displayed. Also, actual data min/max does not necessarily reflect the best display min/max due to outliers which are quite common in almost all ECVs I've seen so far.

Hence, in 0.9.0.dev7, I introduced default settings for colour map / display range for individual geo-physical variables. They are here (far from being complete): https://github.com/CCI-Tools/cate/blob/master/cate/conf/defaults.py#L84-L115

In $home/.cate/<version>/conf.py you can add/overwrite defaults by your own preferences. See template: https://github.com/CCI-Tools/cate/blob/master/cate/conf/template.py#L50-L59

Hope this helps. I wonder why the defaults haven't been applied in your case. Could you please delete $home/.cate/preferences.json and $home/.cate/<version>/conf.py and restart?

mzuehlke commented 6 years ago

Hi @thomas-eldridge, Which variable did you try to open?

thomas-eldridge commented 6 years ago

Hi Marco,

It was the O3_du variable from the 'ESA Ozone Climate Change Initiative (Ozone CCI): Level 3 Nadir Ozone Profile Merged Data Product, version 2' dataset.

I haven't yet implemented Norman's instructions above - will do so when I have a spare moment and will report back to you.

mzuehlke commented 6 years ago

I could reproduce the problem.

The min/max settings are taken from your $HOME/.cate/preferences.json file. Please remove this file and try again.

forman commented 6 years ago

We should fix that by providing a button set resets the value range to its defaults. Moving it to IRM7.

forman commented 6 years ago

@thomas-eldridge any updates?

forman commented 6 years ago

Moving it to IRM10.