Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions polaris/ocean/tasks/sphere_transport/sphere_transport.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ slotted_cylinders_amplitude = 1.0
# colormap
colormap_name = viridis

under_color = k
over_color = orange

# the type of norm used in the colormap
norm_type = linear

Expand Down
10 changes: 9 additions & 1 deletion polaris/viz/spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import matplotlib.colors as cols
import matplotlib.pyplot as plt
import uxarray as ux
from matplotlib import cm
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from pyremap.descriptor.utility import interp_extrap_corner

Expand Down Expand Up @@ -81,6 +82,13 @@ def plot_global_mpas_field(mesh_filename, da, out_filename, config,
projection = cartopy.crs.PlateCarree(central_longitude=central_longitude)

colormap = config.get(colormap_section, 'colormap_name')
cmap = cm.get_cmap(colormap)
if config.has_option(colormap_section, 'under_color'):
under_color = config.get(colormap_section, 'under_color')
cmap.set_under(under_color)
if config.has_option(colormap_section, 'over_color'):
over_color = config.get(colormap_section, 'over_color')
cmap.set_over(over_color)

norm_type = config.get(colormap_section, 'norm_type')
if norm_type == 'linear':
Expand All @@ -94,7 +102,7 @@ def plot_global_mpas_field(mesh_filename, da, out_filename, config,
dtype=float)

plot = gdf_data.hvplot.polygons(
c=da.name, cmap=colormap, logz=logz,
c=da.name, cmap=cmap, logz=logz,
clim=tuple(colorbar_limits),
clabel=colorbar_label,
width=1600, height=800, title=title,
Expand Down
Loading