[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Dec 6 08:25:38 PST 2016


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/9e0bb4605c6a/
Changeset:   9e0bb4605c6a
Branch:      yt
User:        ngoldbaum
Date:        2016-11-18 16:21:00+00:00
Summary:     Add colormaps from cmocean if it's installed
Affected #:  1 file

diff -r 5084dbec0f1d46f3ea3782908daad4890a6adf68 -r 9e0bb4605c6ab52575dd6d187d3714eef19fdb2d yt/visualization/color_maps.py
--- a/yt/visualization/color_maps.py
+++ b/yt/visualization/color_maps.py
@@ -17,6 +17,11 @@
 from . import _colormap_data as _cm
 from yt.extern.six import string_types
 
+try:
+    import cmocean
+except ImportError:
+    cmocean = None
+
 def is_colormap(cmap):
     return isinstance(cmap,cc.Colormap)
 
@@ -152,6 +157,22 @@
 
 add_cmap("cubehelix", _cubehelix_data)
 
+# Add colormaps from cmocean, if it's installed
+if cmocean is not None:
+    for cmname in cmocean.cm.cmapnames:
+        cm = getattr(cmocean.cm, cmname)
+        # cmocean has a colormap named 'algae', so let's avoid overwriting
+        # yt's algae or any other colormap we've already added
+        if cmname in yt_colormaps:
+            cmname = cmname + '_cmocean'
+        yt_colormaps[cmname] = cm
+        try:
+            mcm.register_cmap(cmname, yt_colormaps[cmname])
+        except AttributeError:
+            # for old versions of matplotlib this won't work, so we avoid
+            # erroring out but don't worry about registering with matplotlib
+            pass
+
 # Add colormaps in _colormap_data.py that weren't defined here
 _vs = np.linspace(0,1,256)
 for k,v in list(_cm.color_map_luts.items()):


https://bitbucket.org/yt_analysis/yt/commits/e2ad139f3f32/
Changeset:   e2ad139f3f32
Branch:      yt
User:        ngoldbaum
Date:        2016-11-18 16:30:26+00:00
Summary:     Add documentation on cmocean colormaps
Affected #:  1 file

diff -r 9e0bb4605c6ab52575dd6d187d3714eef19fdb2d -r e2ad139f3f32280ec8123c7fe686e581a0b85c43 doc/source/visualizing/colormaps/index.rst
--- a/doc/source/visualizing/colormaps/index.rst
+++ b/doc/source/visualizing/colormaps/index.rst
@@ -50,6 +50,25 @@
 colorblind/printer/grayscale-friendly plots. For more information, visit
 `http://colorbrewer2.org <http://colorbrewer2.org>`_.
 
+.. _cmocean-cmaps:
+
+Colormaps from cmocean
+~~~~~~~~~~~~~~~~~~~~~~
+
+In addition to ``palettable``, yt will also import colormaps defined in the
+`cmocean <http://matplotlib.org/cmocean>`_ package. These colormaps are
+`perceptually uniform <http://bids.github.io/colormap/>`_ and were originally
+designed for oceanography applications, but can be used for any kind of plots.
+
+Since ``cmocean`` is not installed as a dependency of yt by default, it must be
+installed separately to access the ``cmocean`` colormaps with yt. The easiest
+way to install ``cmocean`` is via ``pip``: ``pip install cmocean``.  To access
+the colormaps in yt, simply specify the name of the ``cmocean`` colormap in any
+context where you would specify a colormap. One caveat is the ``cmocean``
+colormap ``algae``. Since yt already defines a colormap named ``algae``, the
+``cmocean`` version of ``algae`` must be specified with the name
+``algae_cmocean``.
+
 .. _custom-colormaps:
 
 Making and Viewing Custom Colormaps


https://bitbucket.org/yt_analysis/yt/commits/0207316331dd/
Changeset:   0207316331dd
Branch:      yt
User:        xarthisius
Date:        2016-12-06 16:25:10+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2439)

Add colormaps from cmocean if it's installed
Affected #:  2 files

diff -r 68cdeca5910d377f023631ecf6dbcae1d0794dc3 -r 0207316331dd33da804a692a6c8de656b40173cb doc/source/visualizing/colormaps/index.rst
--- a/doc/source/visualizing/colormaps/index.rst
+++ b/doc/source/visualizing/colormaps/index.rst
@@ -50,6 +50,25 @@
 colorblind/printer/grayscale-friendly plots. For more information, visit
 `http://colorbrewer2.org <http://colorbrewer2.org>`_.
 
+.. _cmocean-cmaps:
+
+Colormaps from cmocean
+~~~~~~~~~~~~~~~~~~~~~~
+
+In addition to ``palettable``, yt will also import colormaps defined in the
+`cmocean <http://matplotlib.org/cmocean>`_ package. These colormaps are
+`perceptually uniform <http://bids.github.io/colormap/>`_ and were originally
+designed for oceanography applications, but can be used for any kind of plots.
+
+Since ``cmocean`` is not installed as a dependency of yt by default, it must be
+installed separately to access the ``cmocean`` colormaps with yt. The easiest
+way to install ``cmocean`` is via ``pip``: ``pip install cmocean``.  To access
+the colormaps in yt, simply specify the name of the ``cmocean`` colormap in any
+context where you would specify a colormap. One caveat is the ``cmocean``
+colormap ``algae``. Since yt already defines a colormap named ``algae``, the
+``cmocean`` version of ``algae`` must be specified with the name
+``algae_cmocean``.
+
 .. _custom-colormaps:
 
 Making and Viewing Custom Colormaps

diff -r 68cdeca5910d377f023631ecf6dbcae1d0794dc3 -r 0207316331dd33da804a692a6c8de656b40173cb yt/visualization/color_maps.py
--- a/yt/visualization/color_maps.py
+++ b/yt/visualization/color_maps.py
@@ -17,6 +17,11 @@
 from . import _colormap_data as _cm
 from yt.extern.six import string_types
 
+try:
+    import cmocean
+except ImportError:
+    cmocean = None
+
 def is_colormap(cmap):
     return isinstance(cmap,cc.Colormap)
 
@@ -152,6 +157,22 @@
 
 add_cmap("cubehelix", _cubehelix_data)
 
+# Add colormaps from cmocean, if it's installed
+if cmocean is not None:
+    for cmname in cmocean.cm.cmapnames:
+        cm = getattr(cmocean.cm, cmname)
+        # cmocean has a colormap named 'algae', so let's avoid overwriting
+        # yt's algae or any other colormap we've already added
+        if cmname in yt_colormaps:
+            cmname = cmname + '_cmocean'
+        yt_colormaps[cmname] = cm
+        try:
+            mcm.register_cmap(cmname, yt_colormaps[cmname])
+        except AttributeError:
+            # for old versions of matplotlib this won't work, so we avoid
+            # erroring out but don't worry about registering with matplotlib
+            pass
+
 # Add colormaps in _colormap_data.py that weren't defined here
 _vs = np.linspace(0,1,256)
 for k,v in list(_cm.color_map_luts.items()):

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list