Skip to content

Commit

Permalink
Merge pull request #492 from xylar/fix_sci_viz_colormaps
Browse files Browse the repository at this point in the history
Fix reading of SciVisColor colormaps
  • Loading branch information
xylar authored Feb 13, 2023
2 parents da03486 + d36f7ab commit d9b0032
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions conda_package/docs/versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Documentation On GitHub
`v0.15.0`_ `0.15.0`_
`v0.16.0`_ `0.16.0`_
`v0.17.0`_ `0.17.0`_
`v0.18.0`_ `0.18.0`_
================ ===============

.. _`stable`: ../stable/index.html
Expand Down Expand Up @@ -80,3 +81,5 @@ Documentation On GitHub
.. _`0.16.0`: https://github.com/MPAS-Dev/MPAS-Tools/tree/0.16.0
.. _`v0.17.0`: ../0.17.0/index.html
.. _`0.17.0`: https://github.com/MPAS-Dev/MPAS-Tools/tree/0.17.0
.. _`v0.18.0`: ../0.18.0/index.html
.. _`0.18.0`: https://github.com/MPAS-Dev/MPAS-Tools/tree/0.18.0
2 changes: 1 addition & 1 deletion conda_package/mpas_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = (0, 17, 0)
__version_info__ = (0, 18, 0)
__version__ = '.'.join(str(vi) for vi in __version_info__)
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
2 changes: 1 addition & 1 deletion conda_package/recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "mpas_tools" %}
{% set version = "0.17.0" %}
{% set version = "0.18.0" %}

package:
name: {{ name|lower }}
Expand Down

0 comments on commit d9b0032

Please sign in to comment.