MeteoSwiss / pyrad

Python Radar Data Processing
https://meteoswiss.github.io/pyrad/
Other
37 stars 10 forks source link

bug in plotting colorbar in plot_grid when field has norm #25

Closed jfigui closed 1 year ago

jfigui commented 2 years ago

When I tried to plot a field with norm I get this: 20200626000500_surface_RAW_GRID_Raccu_l0 This did not happen before we aligned it with the ARM-DOE pyart. I suspect that it has to do with using the wrong axis but I got lost. @wolfidan , can you have a look at it?

wolfidan commented 2 years ago

Ciao @jfigui ,

I have some trouble reproducing your issue, would you mind sharing your pyrad config file? Cheers

jfigui commented 2 years ago

@wolfidan mf_bin_qpe_toul.txt mf_bin_qpe_toul_loc.txt mf_bin_qpe_toul_prod.txt I will send you an example data file by mail.

Cheers,

Jordi

wolfidan commented 1 year ago

Hi @jfigui

The issue occurs here. Why do we use cmap.N as the number of colors, to me it makes no sense to use more colors than levels. Setting ncolors = len(boundaries) -1 seems to fix the problem for me. Would that be an option?

jfigui commented 1 year ago

Hi @wolfidan ,

I would have never guessed that was the issue! Well done! Change it in the dev version and we can make sure that nothing breaks before the new release

wolfidan commented 1 year ago

Solved in https://github.com/MeteoSwiss/pyrad/releases/tag/v1.6

jfigui commented 1 year ago

We solved the plotting when using xarrays data but we created a new one when using regular fields such as in the PPI or RHI plots

wolfidan commented 1 year ago

@jfigui

Sorry about that, I think we need to make it more specific then, such as with a isxarray boolean in the get_norm function, that would be true only when the function is called from plot_grid I will change that

jfigui commented 1 year ago

@wolfidan Perfectly fine solution. Thanks

wolfidan commented 1 year ago

I pushed it to the latest commit, unfortunately the tests fail due to a weird xarray issue, I have to look into it

wolfidan commented 1 year ago

@jfigui I managed to make the tests pass for 3.8 and 3.9. I don't have the time currently to check why 3.7 fails in the test (a weird cython or xarray issue that does not concern pyrad), so I removed 3.7 from the tests. Could you check if it works with the latest commit on dev please.

wolfidan commented 1 year ago

I think that we can close the issue