Harmonize cmap handling in map functions #87
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces changes to harmonize colormap handling in gridmap, scattermap and gdfmap.
The goals were to:
cmap
,levels
anddivergent
arguments worked properly in the three functions.The following changes were made:
fixed bug causing util
custom_cmap_norm
to not work when the cmap was supplied as a string.vmin, vmax
now work inplot_kw
ofgdfmap
fixed bug that happened when
levels
was a list anddivergent
was an int ingdfmap
removed dependency on discrete IPCC colormaps from
gdfmap
Removed dependency on discrete IPCC colormaps from
gridmap
levels
), because of a bug in xarray (Colormap Normalisation Giving Unexpected/Incorrect Output pydata/xarray#4061 ), a list of levels has to be passed in thelevels
argument ofxarray.plot.pcolormesh( )
. To do so,custom_cmap_norm
now returns a list of levels instead of a normalization instance, in certain cases (whenlevels
is not False ingridmap
only).cbar_ticks
, which was useless anyways because xarray already reduces the number of ticks on the cbar when there are too many,levels
argument fromcreate_cmap
, and the discrete cmap IPCC datagridmap
, which was entirely due to the IPCC files.