Skip to content

Commit

Permalink
Fix reading of SciVisColor colormaps
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Feb 12, 2023
1 parent 73e90fa commit d36f7ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Empty file.
11 changes: 7 additions & 4 deletions conda_package/mpas_tools/viz/colormaps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import xml.etree.ElementTree as ET
import pkg_resources
try:
from importlib.resources import files as imp_res_files
except ImportError:
# python<=3.8
from importlib_resources import files as imp_res_files
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.pyplot as plt

Expand All @@ -14,9 +18,8 @@ def register_sci_viz_colormaps():
'green-7', 'green-8', 'orange-5', 'orange-6',
'orange-green-blue-gray', 'purple-7', 'purple-8', 'red-1',
'red-3', 'red-4', 'yellow-1', 'yellow-7']:

xmlFile = pkg_resources.resource_filename(
__name__, 'SciVisColorColormaps/{}.xml'.format(mapName))
xmlFile = str(imp_res_files('mpas_tools.viz.SciVisColorColormaps') /
f'{mapName}.xml')
_read_xml_colormap(xmlFile, mapName)


Expand Down

0 comments on commit d36f7ab

Please sign in to comment.