Skip to content

CDAT 3.0 Compatibility Workarounds

Sam Fries edited this page Sep 21, 2016 · 7 revisions

With the upcoming release of CDAT 3.0, a number of changes are being made that may require changes in your code to achieve the same behavior as in 2.X and earlier. Documented here are the suggested workarounds to these problems, and the motivation for making the change.

Colormap

Default range compatibility issue

Recently, we changed the default range for colors from 16-240 to 0-256. If you find that you are having trouble with colors not displaying properly, this may be the cause.

To fix this issue, you can manually reset your default colors range:

colormap = "rainbow"
if colormap in ['AMIP',
             'NCAR',
             'bl_to_darkred',
             'bl_to_drkorang',
             'blends',
             'blue2darkorange',
             'blue2darkred',
             'blue2green',
             'blue2grey',
             'blue2orange',
             'blue2orange2red',
             'blue_to_grey',
             'blue_to_grn',
             'blue_to_orange',
             'blue_to_orgred',
             'brown2blue',
             'brown_to_blue',
             'categorical',
             'classic',
             'green2magenta',
             'grn_to_magenta',
             'inferno',
             'lightblue2darkblue',
             'ltbl_to_drkbl',
             'rainbow',
             'rainbow_no_grn',
             'rainbownogreen',
             'sequential',
             'white2blue',
             'white2green',
             'white2magenta',
             'white2red',
             'white2yellow',
             'white_to_blue',
             'white_to_green',
             'white_to_magenta', 
             'white_to_red',
             'white_to_yellow']:
         # Restore old behaviour of default colors for old colormaps
         vcs.utils.defaultColorsRange = range(16,240)

Note that if you want to use any of the new colormaps (veridis, inferno, magma, plasma), you should use the new defaults.

Clone this wiki locally