ESMValGroup / ESMValTool

ESMValTool: A community diagnostic and performance metrics tool for routine evaluation of Earth system models in CMIP
https://www.esmvaltool.org
Apache License 2.0
210 stars 123 forks source link

Using reference data instead of relative difference in plot for catchment_analysis.py #3544

Open ccarouge opened 4 months ago

ccarouge commented 4 months ago

Describe the bug Looking into ESMValTool/esmvaltool/diag_scripts/runoff_et/catchment_analysis.py, I think I found a typo that results in the wrong data being plotted but no error being shown.

I think it is plotting the reference data (diag['ref']) where it should plot the relative data (diag['rel']). So just a typo on one line. It's the first time I look in this recipe so I could be wrong in my interpretation but considering the comments and labelling on the plots, it does not seem right. I don't know how to check what the intention of the authors was.

Detail When plotting the absolute and relative difference bar plots, the code is:

https://github.com/ESMValGroup/ESMValTool/blob/1703b5ddef660ddc582a3fb770e9d9173e0e8c20/esmvaltool/diag_scripts/runoff_et/catchment_analysis.py#L325-L326

This line refers to diag['ref'] for the relative difference but in the code that prepares the diagnostics we see:

https://github.com/ESMValGroup/ESMValTool/blob/1703b5ddef660ddc582a3fb770e9d9173e0e8c20/esmvaltool/diag_scripts/runoff_et/catchment_analysis.py#L252-L253

This shows that diag['ref'] is the reference data and diag['rel'] is the relative difference.

Fixing the typo is enough, but maybe also using relative instead of rel would avoid similar issues in the future.

Please attach

tepmo42 commented 4 months ago

@bouweandela , can you help with this?

ccarouge commented 3 months ago

If it helps, I'm happy to put a pull request in but I'd appreciate someone confirming my read of the code.

bouweandela commented 3 months ago

@bouweandela , can you help with this?

I was not involved in the development of this diagnostic. We could try asking the author of the code. @tobstac Are you still active on GitHub? Would you be able to comment on this?