From 7e4af9dcb0e331fa3100206b901cb85d5b690731 Mon Sep 17 00:00:00 2001 From: Sam Gardner Date: Thu, 11 Apr 2024 13:54:47 -0500 Subject: [PATCH] add bgyp colormap --- cmweather/__init__.py | 1 + cmweather/_cm_colorblind.py | 5 +- cmweather/bgyp-rgb.txt | 100 ++++++++++++++++++++++++++++++++++++ cmweather/cm_colorblind.py | 1 + tests/test_cm_colorblind.py | 6 +++ 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 cmweather/bgyp-rgb.txt diff --git a/cmweather/__init__.py b/cmweather/__init__.py index 4e9f831..e7e9130 100644 --- a/cmweather/__init__.py +++ b/cmweather/__init__.py @@ -57,6 +57,7 @@ * CM_depol * CM_rhohv * plasmidis + * bgyp * turbone """ diff --git a/cmweather/_cm_colorblind.py b/cmweather/_cm_colorblind.py index de25c6d..1567850 100644 --- a/cmweather/_cm_colorblind.py +++ b/cmweather/_cm_colorblind.py @@ -50,9 +50,11 @@ def yuv_rainbow_24(nc): spectral_ext_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'spectral-extended-rgb.txt')) # Plasmidis colormap for radar correlation coefficient - plasmidis_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'plasmidis-rgb.txt')) +# bgyp colormap for radar correlation coefficient +bgyp_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'bgyp-rgb.txt')) + # Turbone colormap for radar differential reflectivity turbone_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'turbone-rgb.txt')) @@ -73,6 +75,7 @@ def yuv_rainbow_24(nc): 'ChaseSpectral': chase_spectral_rgb_vals, 'SpectralExtended': spectral_ext_rgb_vals, 'plasmidis': plasmidis_rgb_vals, + 'bgyp': bgyp_rgb_vals, 'turbone': turbone_rgb_vals, 'CM_depol': cm_oleron_depol_vals, 'CM_rhohv': cm_roma_rhohv_vals, diff --git a/cmweather/bgyp-rgb.txt b/cmweather/bgyp-rgb.txt new file mode 100644 index 0000000..94e90db --- /dev/null +++ b/cmweather/bgyp-rgb.txt @@ -0,0 +1,100 @@ +1.011764705882352983e-02 3.015686274509803977e-01 5.069019607843137099e-01 +1.631372549019607932e-02 3.050980392156862897e-01 5.000784313725489261e-01 +2.250980392156862533e-02 3.086274509803921817e-01 4.932549019607841978e-01 +2.870588235294117482e-02 3.121568627450980182e-01 4.864313725490195806e-01 +3.490196078431372778e-02 3.156862745098039102e-01 4.796078431372549078e-01 +4.109803921568627033e-02 3.192156862745098023e-01 4.727843137254901795e-01 +4.729411764705882676e-02 3.227450980392156943e-01 4.659607843137254513e-01 +5.349019607843136931e-02 3.262745098039215308e-01 4.591372549019607230e-01 +5.968627450980391880e-02 3.298039215686274783e-01 4.523137254901960502e-01 +6.588235294117647523e-02 3.333333333333333703e-01 4.454901960784313220e-01 +7.207843137254901777e-02 3.368627450980392068e-01 4.386666666666666492e-01 +7.827450980392156032e-02 3.403921568627450989e-01 4.318431372549019209e-01 +8.447058823529411675e-02 3.439215686274509354e-01 4.250196078431372482e-01 +9.066666666666667318e-02 3.474509803921568274e-01 4.181960784313725199e-01 +9.686274509803921573e-02 3.509803921568627194e-01 4.113725490196077916e-01 +1.030588235294117583e-01 3.545098039215686114e-01 4.045490196078430634e-01 +1.092549019607843147e-01 3.580392156862745034e-01 3.977254901960783906e-01 +1.154509803921568573e-01 3.615686274509803955e-01 3.909019607843137178e-01 +1.216470588235294137e-01 3.650980392156862875e-01 3.840784313725489896e-01 +1.278431372549019562e-01 3.686274509803921795e-01 3.772549019607842613e-01 +1.340392156862744988e-01 3.721568627450980715e-01 3.704313725490196441e-01 +1.402352941176470413e-01 3.756862745098039635e-01 3.636078431372549158e-01 +1.464313725490196116e-01 3.792156862745098556e-01 3.567843137254901875e-01 +1.526274509803921542e-01 3.827450980392156366e-01 3.499607843137254592e-01 +1.588235294117646967e-01 3.862745098039215286e-01 3.431372549019607865e-01 +1.650196078431372670e-01 3.898039215686274206e-01 3.363137254901960582e-01 +1.712156862745098374e-01 3.933333333333333126e-01 3.294901960784313300e-01 +1.774117647058823521e-01 3.968627450980392046e-01 3.226666666666666572e-01 +1.836078431372548947e-01 4.003921568627450966e-01 3.158431372549019844e-01 +1.898039215686274372e-01 4.039215686274509332e-01 3.090196078431372562e-01 +1.960000000000000075e-01 4.074509803921568252e-01 3.021960784313725279e-01 +2.021960784313725501e-01 4.109803921568627172e-01 2.953725490196078551e-01 +2.083921568627450926e-01 4.145098039215686092e-01 2.885490196078431269e-01 +2.145882352941176630e-01 4.180392156862745012e-01 2.817254901960783986e-01 +2.207843137254901777e-01 4.215686274509803377e-01 2.749019607843137258e-01 +2.269803921568627203e-01 4.250980392156862298e-01 2.680784313725490531e-01 +2.331764705882352906e-01 4.286274509803921218e-01 2.612549019607842693e-01 +2.393725490196078332e-01 4.321568627450980693e-01 2.544313725490195965e-01 +2.455686274509804035e-01 4.356862745098039058e-01 2.476078431372548683e-01 +2.517647058823529460e-01 4.392156862745097978e-01 2.407843137254901400e-01 +2.579607843137254886e-01 4.427450980392156898e-01 2.339607843137254950e-01 +2.641568627450979756e-01 4.462745098039215819e-01 2.271372549019607945e-01 +2.703529411764705737e-01 4.498039215686274739e-01 2.203137254901960662e-01 +2.765490196078431162e-01 4.533333333333333104e-01 2.134901960784313379e-01 +2.827450980392156588e-01 4.568627450980392024e-01 2.066666666666666652e-01 +2.889411764705882568e-01 4.603921568627450944e-01 1.998431372549019369e-01 +2.951372549019607439e-01 4.639215686274509309e-01 1.930196078431372642e-01 +3.013333333333332864e-01 4.674509803921568230e-01 1.861960784313725359e-01 +3.075294117647058845e-01 4.709803921568627150e-01 1.793725490196078631e-01 +3.137254901960784270e-01 4.745098039215686070e-01 1.725490196078431349e-01 +3.232352941176470096e-01 4.765686274509803311e-01 1.690196078431372706e-01 +3.327450980392157032e-01 4.786274509803921107e-01 1.654901960784313508e-01 +3.422549019607843412e-01 4.806862745098038903e-01 1.619607843137254866e-01 +3.517647058823529238e-01 4.827450980392157254e-01 1.584313725490196223e-01 +3.612745098039216174e-01 4.848039215686273939e-01 1.549019607843137303e-01 +3.707843137254902000e-01 4.868627450980391735e-01 1.513725490196078383e-01 +3.802941176470587825e-01 4.889215686274509531e-01 1.478431372549019462e-01 +3.898039215686274206e-01 4.909803921568627882e-01 1.443137254901960820e-01 +3.993137254901960587e-01 4.930392156862745123e-01 1.407843137254901900e-01 +4.088235294117646967e-01 4.950980392156862364e-01 1.372549019607842979e-01 +4.183333333333333348e-01 4.971568627450980715e-01 1.337254901960784337e-01 +4.278431372549019174e-01 4.992156862745097401e-01 1.301960784313725417e-01 +4.373529411764706110e-01 5.012745098039216307e-01 1.266666666666666774e-01 +4.468627450980391935e-01 5.033333333333332993e-01 1.231372549019607854e-01 +4.563725490196077761e-01 5.053921568627450789e-01 1.196078431372549072e-01 +4.658823529411764697e-01 5.074509803921568585e-01 1.160784313725490291e-01 +4.753921568627450522e-01 5.095098039215686381e-01 1.125490196078431371e-01 +4.849019607843138013e-01 5.115686274509804177e-01 1.090196078431372589e-01 +4.944117647058823284e-01 5.136274509803921973e-01 1.054901960784313808e-01 +5.039215686274509665e-01 5.156862745098038658e-01 1.019607843137254888e-01 +5.134313725490196045e-01 5.177450980392156454e-01 9.843137254901959676e-02 +5.229411764705882426e-01 5.198039215686274250e-01 9.490196078431371862e-02 +5.324509803921568807e-01 5.218627450980392046e-01 9.137254901960784048e-02 +5.419607843137255188e-01 5.239215686274509842e-01 8.784313725490194846e-02 +5.514705882352941568e-01 5.259803921568626528e-01 8.431372549019607032e-02 +5.609803921568626839e-01 5.280392156862745434e-01 8.078431372549019218e-02 +5.704901960784314330e-01 5.300980392156862120e-01 7.725490196078430016e-02 +5.799999999999999600e-01 5.321568627450979916e-01 7.372549019607843590e-02 +5.895098039215685981e-01 5.342156862745097712e-01 7.019607843137254388e-02 +5.990196078431371252e-01 5.362745098039215508e-01 6.666666666666666574e-02 +6.085294117647058743e-01 5.383333333333333304e-01 6.313725490196078760e-02 +6.180392156862745123e-01 5.403921568627451100e-01 5.960784313725489558e-02 +6.275490196078431504e-01 5.424509803921568896e-01 5.607843137254902438e-02 +6.370588235294117885e-01 5.445098039215686692e-01 5.254901960784313930e-02 +6.465686274509803155e-01 5.465686274509804488e-01 4.901960784313725422e-02 +6.560784313725490646e-01 5.486274509803922284e-01 4.549019607843136914e-02 +6.655882352941177027e-01 5.506862745098038969e-01 4.196078431372548406e-02 +6.750980392156862298e-01 5.527450980392157875e-01 3.843137254901961286e-02 +6.846078431372548678e-01 5.548039215686274561e-01 3.490196078431372778e-02 +6.941176470588235059e-01 5.568627450980392357e-01 3.137254901960784270e-02 +7.235294117647059764e-01 5.596078431372549788e-01 1.274509803921568818e-01 +7.529411764705882248e-01 5.623529411764707220e-01 2.235294117647059209e-01 +7.823529411764704733e-01 5.650980392156862431e-01 3.196078431372549322e-01 +8.117647058823529438e-01 5.678431372549019862e-01 4.156862745098039436e-01 +8.411764705882353033e-01 5.705882352941176183e-01 5.117647058823528994e-01 +8.705882352941176627e-01 5.733333333333333615e-01 6.078431372549020217e-01 +9.000000000000000222e-01 5.760784313725489936e-01 7.039215686274509221e-01 +9.294117647058823817e-01 5.788235294117647367e-01 8.000000000000000444e-01 +9.588235294117648522e-01 5.815686274509803688e-01 8.960784313725490557e-01 +9.882352941176471006e-01 5.843137254901961120e-01 9.921568627450980671e-01 diff --git a/cmweather/cm_colorblind.py b/cmweather/cm_colorblind.py index 892ed64..561f74a 100644 --- a/cmweather/cm_colorblind.py +++ b/cmweather/cm_colorblind.py @@ -11,6 +11,7 @@ * CM_depol * CM_rhohv * plasmidis + * bgyp * turbone CM_dopol and CM_rhohv are based on the work by: diff --git a/tests/test_cm_colorblind.py b/tests/test_cm_colorblind.py index 17d2d76..224c358 100644 --- a/tests/test_cm_colorblind.py +++ b/tests/test_cm_colorblind.py @@ -68,6 +68,12 @@ def test_colormaps_registered(): cmap = matplotlib.colormaps.get_cmap('plasmidis_r') assert isinstance(cmap, matplotlib.colors.Colormap) + cmap = matplotlib.colormaps.get_cmap('bgyp') + assert isinstance(cmap, matplotlib.colors.Colormap) + + cmap = matplotlib.colormaps.get_cmap('bgyp_r') + assert isinstance(cmap, matplotlib.colors.Colormap) + cmap = matplotlib.colormaps.get_cmap('turbone') assert isinstance(cmap, matplotlib.colors.Colormap)