Skip to content
Snippets Groups Projects
Commit a5706aee authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyic_fig.py: Allow for cmocean colormaps.

parent 6583c3f9
No related branches found
No related tags found
No related merge requests found
Pipeline #65372 failed
......@@ -83,7 +83,7 @@ parser.add_argument('--time', type=str, default='none',
help='Time string \'yyyy-mm-dd\' wich should be plotted (if specified overwrites \'it\').')
# --- args for color / limits and settings
parser.add_argument('--cmap', type=str, default='auto',
help='Colormap used for plot.')
help='Colormap used for plot. Use "cmo.name" for cmocean colormaps.')
parser.add_argument('--clim', type=str, default='auto',
help='Color limits of the plot. Either specify one or two values.If one value is specified color limits are taken symetrically around zero. If \'auto\' is specified color limits are derived automatically.')
parser.add_argument('--cincr', type=float, default=-1.0,
......
......@@ -75,7 +75,7 @@ parser.add_argument('--time', type=str, default='none',
help='Time string \'yyyy-mm-dd\' wich should be plotted (if specified overwrites \'it\').')
# --- args for color / limits and settings
parser.add_argument('--cmap', type=str, default='auto',
help='Colormap used for plot.')
help='Colormap used for plot. Use "cmo.name" for cmocean colormaps.')
parser.add_argument('--clim', type=str, default='auto',
help='Color limits of the plot. Either specify one or two values.If one value is specified color limits are taken symetrically around zero. If \'auto\' is specified color limits are derived automatically.')
parser.add_argument('--cincr', type=float, default=-1.0,
......@@ -175,6 +175,10 @@ def str_to_array(string):
array = np.array(string.split(','), dtype=float)
return array
if iopts.cmap.startswith('cmo.'):
import cmocean
iopts.cmap = getattr(cmocean.cm, iopts.cmap.split('.')[1])
# --- limits
if iopts.clim!='auto':
iopts.clim = str_to_array(iopts.clim)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment