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
227 stars 128 forks source link

Fix contourf plots for masked data #3797

Closed schlunma closed 3 weeks ago

schlunma commented 3 weeks ago

Description

See https://github.com/SciTools/cartopy/issues/2468: contourf with transform_first=True does not handle masked data correctly. Thus, we use a filled array with np.nan here which works correctly.

Related to

Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the ๐Ÿ›  Technical or ๐Ÿงช Scientific review.

New or updated recipe/diagnostic


To help with the number of pull requests:

schlunma commented 3 weeks ago

@esmvalbot please run monitor/recipe_monitor_with_refs.yml

esmvalbot[bot] commented 3 weeks ago

Since @schlunma asked, ESMValBot will run recipe monitor/recipe_monitor_with_refs.yml as soon as possible, output will be generated here

esmvalbot[bot] commented 3 weeks ago

ESMValBot is happy to report recipe monitor/recipe_monitor_with_refs.yml ran OK, output has been generated here

valeriupredoi commented 3 weeks ago

swanky plots, do they look the way you wanted them to look, Manu? :beer:

schlunma commented 3 weeks ago

Yes Sir! They look identical to https://esmvaltool.dkrz.de/shared/esmvaltool/stable_release/recipe_monitor_with_refs_20240523_095356/

schlunma commented 3 weeks ago

BTW, it's so nice that the bot is back again! ๐Ÿค–

valeriupredoi commented 3 weeks ago

BTW, it's so nice that the bot is back again! ๐Ÿค–

it's a wee one but does wonders :grinning:

schlunma commented 3 weeks ago

code looks good! The only wiggle I can think of is that this may break after cartopy fixes their show, if they treat NaNs in a special way - don;t think this will be the case though

Thanks for reviewing! Don't think that's the case - for example, xarray only uses nans instead of numpy arrays, and I did successful contourf plots with that if I remember correctly ๐Ÿ‘