Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spectral-like colormaps based on pyart#1320 #1325

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion examples/plotting/plot_choose_a_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def plot_color_gradients(cmap_category, cmap_list):
# These colormaps are the most inclusive, and should be used where
# possible.

plot_color_gradients("Colorblind Friendly", ["LangRainbow12", "HomeyerRainbow", "balance"])
plot_color_gradients(
"Colorblind Friendly",
["LangRainbow12", "HomeyerRainbow", "balance", "ChaseSpectral", "SpectralExtended"]
)

######################################
# **Perceptually Uniform Colormaps**
Expand Down
2 changes: 2 additions & 0 deletions pyart/graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* LangRainbow12
* HomeyerRainbow
* balance
* ChaseSpectral
* SpectralExtended

"""

Expand Down
18 changes: 14 additions & 4 deletions pyart/graph/_cm_colorblind.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@ def yuv_rainbow_24(nc):
# Thyng, K. M., Greene, C. A., Hetland, R. D., Zimmerle, H. M., & DiMarco, S. F. (2016).
# True colors of oceanography. Oceanography, 29(3), 10.

# HomeyerRainbow developed by Cameron Homeyer with assistance from Bobby Jackson


data_dir = os.path.split(__file__)[0]
bal_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'balance-rgb.txt'))


# "Spectral"-like colormaps for radar reflectivity
# ChaseSpectral developed by Randy Chase with assistance from Sam Gardner and Jonathan Thielen
# SpectralExtended developed by Jonathan Thielen based on ChaseSpectral

chase_spectral_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'chase-spectral-rgb.txt'))
spectral_ext_rgb_vals = np.genfromtxt(os.path.join(data_dir, 'spectral-extended-rgb.txt'))


# HomeyerRainbow developed by Cameron Homeyer with assistance from Bobby Jackson

datad = {'HomeyerRainbow': yuv_rainbow_24(15),
'balance': bal_rgb_vals}
'balance': bal_rgb_vals,
'ChaseSpectral': chase_spectral_rgb_vals,
'SpectralExtended': spectral_ext_rgb_vals}
180 changes: 180 additions & 0 deletions pyart/graph/chase-spectral-rgb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
2.491587318630544227e-03 0.000000000000000000e+00 1.238497574313402773e-02
1.921773759405308313e-02 1.328624481639428985e-02 3.231025819473654775e-02
3.658093634274969114e-02 2.805423983363999896e-02 5.381675386098778296e-02
5.294470009390365300e-02 4.244028154055207863e-02 7.213062231236241906e-02
6.658209706708043130e-02 5.494952540396814272e-02 8.788848915960603692e-02
7.828532464084167475e-02 6.569663206458462024e-02 1.019133473263799106e-01
8.774627903391646333e-02 7.532763064627764904e-02 1.160366283830516765e-01
9.608542813730694410e-02 8.388232266148029637e-02 1.305319484336847080e-01
1.051990600061633307e-01 9.139766310160754581e-02 1.453366611350159210e-01
1.143925332853241994e-01 9.895719929230178957e-02 1.603565455412020724e-01
1.236459743440020964e-01 1.065867695949899718e-01 1.755810433757895583e-01
1.329594056770956323e-01 1.142846467839237490e-01 1.910026176979827961e-01
1.423326780515855872e-01 1.220491880997151557e-01 2.066143053850765243e-01
1.517655114876109712e-01 1.298788305108602437e-01 2.224096588254607099e-01
1.612575264712807765e-01 1.377720860108199441e-01 2.383826936302203547e-01
1.708082679545429305e-01 1.457275370563173578e-01 2.545278421651003264e-01
1.804172239592328475e-01 1.537438322082816111e-01 2.708399124412158576e-01
1.900838400977104548e-01 1.618196820080670395e-01 2.873140518120346765e-01
1.998075309712657455e-01 1.699538551029381450e-01 3.039457149186380325e-01
2.095876891591502700e-01 1.781451746228690791e-01 3.207306353596305337e-01
2.194236923329696554e-01 1.863925148032264389e-01 3.376648006126894974e-01
2.293149089017260112e-01 1.946947978433819226e-01 3.547444297895380738e-01
2.392607024975815788e-01 2.030509909887441289e-01 3.719659538591549297e-01
2.492604355416123130e-01 2.114601038224409590e-01 3.893259980226194128e-01
2.593134720756320455e-01 2.199211857524749347e-01 4.068213659661921167e-01
2.694191800058509667e-01 2.284333236803017253e-01 4.244490257569572544e-01
2.795769328732853332e-01 2.369956398372606854e-01 4.422060971779609995e-01
2.897861112420852536e-01 2.456072897759570273e-01 4.600898403277725035e-01
3.000461037784800111e-01 2.542674605044711322e-01 4.780976453333534715e-01
3.103563080786291284e-01 2.629753687521054761e-01 4.962270230455848030e-01
3.207161312923115792e-01 2.717302593562054835e-01 5.144755966042726669e-01
3.311249905804125038e-01 2.805314037604059729e-01 5.328410937743832676e-01
3.415823584034797800e-01 2.893781878355812243e-01 5.513208663517170649e-01
3.520864698846795648e-01 2.982709895139585288e-01 5.699100705078143925e-01
3.626292452733528293e-01 3.072149700795872573e-01 5.885931009906794076e-01
3.731725126883799759e-01 3.162349022923335307e-01 6.073166391422907262e-01
3.835684996112458944e-01 3.254178172965314642e-01 6.259301309289746484e-01
3.933843749267976198e-01 3.349944088647703877e-01 6.441067607805428530e-01
4.016713180922427684e-01 3.454222331875328456e-01 6.613179588797127861e-01
4.069156093882402847e-01 3.573463785025636219e-01 6.769567442797975731e-01
4.074599054729932113e-01 3.713274293086404332e-01 6.905909806936888495e-01
4.022968399432315101e-01 3.874670617414102125e-01 7.021598000653095362e-01
3.916190272313544996e-01 4.052882310067690286e-01 7.119412504953325227e-01
3.766076548944487512e-01 4.240177096535736601e-01 7.203375941837565355e-01
3.586879168051679834e-01 4.429805325403826655e-01 7.276780477656282775e-01
3.389684950526641316e-01 4.617722727676918937e-01 7.341484532598764323e-01
3.182701330608626034e-01 4.801975992804505267e-01 7.397743004894358210e-01
2.975380777560406309e-01 4.981643586862719020e-01 7.443189423745032451e-01
2.782356343097356355e-01 5.156450695105297966e-01 7.470997393591877200e-01
2.624369809124530439e-01 5.326711207928083169e-01 7.469866546910617355e-01
2.523316670179955312e-01 5.493025406502458630e-01 7.428566828712679371e-01
2.491179225414517084e-01 5.655840527839965937e-01 7.343172939531251719e-01
2.522199829625308976e-01 5.815309105792504374e-01 7.220388721983573843e-01
2.597984989666126121e-01 5.971520290969289935e-01 7.073314124740867070e-01
2.699418598131884117e-01 6.124761563034991640e-01 6.913968891923087945e-01
2.813751612175088845e-01 6.275493875453178605e-01 6.749240519450622200e-01
2.935126820811935766e-01 6.424053926032058381e-01 6.582127371770206681e-01
3.063185037098662411e-01 6.570224289209322110e-01 6.415967764035395149e-01
3.202520046229441197e-01 6.712877289433464290e-01 6.258365919199179173e-01
3.361767323789121020e-01 6.850088089981186679e-01 6.121319301833816340e-01
3.549770745820060580e-01 6.979979864067664685e-01 6.015997055370958524e-01
3.769746644442351635e-01 7.101849199617357167e-01 5.945972934672992816e-01
4.016592555188410740e-01 7.216625973555056417e-01 5.905427889573091615e-01
4.279927783460485413e-01 7.326300747025513704e-01 5.883846980218587763e-01
4.549589537484718949e-01 7.432906607111362529e-01 5.872050838318993993e-01
4.819169604718663291e-01 7.537845486656257199e-01 5.864561680492161866e-01
5.086265718380801326e-01 7.641818771945083633e-01 5.858423203908765808e-01
5.350793431627743901e-01 7.745114539811094323e-01 5.851363495209892518e-01
5.613104434757932859e-01 7.847933147539455367e-01 5.840978366506985875e-01
5.872849105771840161e-01 7.950573993163035924e-01 5.825078415106638152e-01
6.128844828768119646e-01 8.053428878825712456e-01 5.802646269966033055e-01
6.379939021096188156e-01 8.156801806857338910e-01 5.774330409641608153e-01
6.626184816022165913e-01 8.260702180199759326e-01 5.741685512701821814e-01
6.869079831407115533e-01 8.364827703370800727e-01 5.705948745714631842e-01
7.110428610159712504e-01 8.468792024067447466e-01 5.667905704270348455e-01
7.350865447037018274e-01 8.572398237629603734e-01 5.629180508629930690e-01
7.589321151074746030e-01 8.675724108554083713e-01 5.593878412660627797e-01
7.823504956513493980e-01 8.779001029436256376e-01 5.569777403249801528e-01
8.050554698778819018e-01 8.882474809582021624e-01 5.568616413755242966e-01
8.267512092510692634e-01 8.986387786400020783e-01 5.604108141197535753e-01
8.472095149843594797e-01 9.091006838255575317e-01 5.686604283247991276e-01
8.663811145860760288e-01 9.196556199980889801e-01 5.817274532333130965e-01
8.844526825034170203e-01 9.303074257189875018e-01 5.987181648235022635e-01
9.017752049790235258e-01 9.410357991358145879e-01 6.182485505649488733e-01
9.187153956842156743e-01 9.518062481845422917e-01 6.390932676023294290e-01
9.355553305055087643e-01 9.625851523600569282e-01 6.604473764758707066e-01
9.524981387722576409e-01 9.733495708555574000e-01 6.817314683792630170e-01
9.697427075190795387e-01 9.840891707348572437e-01 7.022161781556218729e-01
9.875564727577291757e-01 9.947988126567285372e-01 7.208193646517077058e-01
9.980407582045668358e-01 9.973360522701887332e-01 7.285604345804711501e-01
9.901081341662908430e-01 9.805280486371984461e-01 7.139421557523695228e-01
9.832921183557173928e-01 9.636719697773511450e-01 6.953632580311194245e-01
9.773247105504668797e-01 9.467720315871103187e-01 6.736725338087442561e-01
9.718012632191853628e-01 9.298537865135397817e-01 6.500943381243378116e-01
9.663890021662356888e-01 9.129414783025250335e-01 6.256850968508929078e-01
9.609540913422064401e-01 8.960319858754917099e-01 6.010808973083388018e-01
9.555703321549603446e-01 8.790785433496510759e-01 5.765990298015855053e-01
9.504686901658377929e-01 8.619848588841476644e-01 5.524940776715514534e-01
9.459565461927416097e-01 8.446168450986671905e-01 5.291397436626922302e-01
9.422938604457962164e-01 8.268438187355671154e-01 5.070074252916694224e-01
9.395729615486616559e-01 8.085927166950097611e-01 4.864503172310807311e-01
9.376981768110149718e-01 7.898713125314273942e-01 4.674718760614883784e-01
9.364676752058403997e-01 7.707444542112941166e-01 4.497070119696764956e-01
9.356527829986327482e-01 7.512973497424082492e-01 4.326419511471316093e-01
9.350195740872602190e-01 7.316173915660021398e-01 4.158722656183817534e-01
9.343573494980812466e-01 7.117791695881325875e-01 3.992230218226498484e-01
9.335648756142448379e-01 6.918074664813864683e-01 3.827490810251897857e-01
9.327101603754452963e-01 6.716444449334502131e-01 3.667140568017910884e-01
9.319595477552291563e-01 6.511713889089448815e-01 3.515520705284561620e-01
9.314169854435215834e-01 6.302839565213184114e-01 3.377209433706351849e-01
9.310296827682809084e-01 6.089545159356072324e-01 3.254539980932857901e-01
9.306432638093524723e-01 5.872242187691005810e-01 3.145970957378831923e-01
9.301245783303129233e-01 5.651424372654756390e-01 3.046934957439262348e-01
9.294267649644918361e-01 5.427160958250945022e-01 2.952352339035276829e-01
9.285558487843162956e-01 5.199094507764837614e-01 2.858706783655494132e-01
9.274643902597414780e-01 4.967005378030532881e-01 2.764880193747087933e-01
9.259240389407737970e-01 4.731756982138288214e-01 2.672639230506010932e-01
9.234711163596823758e-01 4.496035876395663711e-01 2.587467580210295326e-01
9.195129965638397795e-01 4.264099494946080315e-01 2.518593801540759958e-01
9.135736866352892616e-01 4.040267237927211430e-01 2.475981287011050358e-01
9.055280333993521724e-01 3.826919211952165556e-01 2.464654113583631956e-01
8.956528296047865378e-01 3.623437102019935185e-01 2.480965004984162503e-01
8.844577644744280320e-01 3.426902787839808950e-01 2.514863799218179929e-01
8.724404890113568456e-01 3.233794743789056847e-01 2.555998932478791286e-01
8.599410549929589198e-01 3.041242778043479200e-01 2.598006529424506383e-01
8.471298230752026814e-01 2.847363627062785008e-01 2.638605711868699522e-01
8.340532096652387706e-01 2.651172313043368978e-01 2.677304454377096854e-01
8.206709470780187976e-01 2.452608083507071268e-01 2.713113994435089049e-01
8.068823812198757661e-01 2.252642569365564396e-01 2.743528736776507659e-01
7.925681574071996582e-01 2.052990065432801492e-01 2.765327557716383833e-01
7.776437086548244615e-01 1.855231800585573354e-01 2.776620930726645953e-01
7.620881787474551583e-01 1.659938811053616181e-01 2.778098473048807304e-01
7.459252040529300576e-01 1.466621507519489664e-01 2.772148588299371275e-01
7.291837579643043465e-01 1.274402995743348366e-01 2.760954516834964734e-01
7.118643606327572648e-01 1.082736208210070550e-01 2.746220501928834379e-01
6.939114128763002043e-01 8.917323459852671830e-02 2.731619874805619186e-01
6.751925157681596401e-01 7.018975339513075506e-02 2.726604632714438869e-01
6.555544703778218851e-01 5.112188655540585852e-02 2.747104787145964733e-01
6.350589782820527107e-01 3.082192500319925338e-02 2.807508245877506359e-01
6.143394151378338552e-01 9.946609770185134772e-03 2.905377427866415174e-01
6.096174471715584131e-01 1.689067352390654503e-02 3.132536812924263114e-01
6.304362302694949127e-01 6.415999880604145167e-02 3.523023872285024338e-01
6.545332720619715383e-01 9.240290591553368404e-02 3.867931688005283863e-01
6.816771386719749914e-01 1.121795130427629683e-01 4.165734585630757048e-01
7.106931461283616525e-01 1.285922649813384111e-01 4.432172748824148578e-01
7.401742431623169471e-01 1.447501537429476681e-01 4.684441576756514514e-01
7.687478120884442268e-01 1.630208970332134855e-01 4.933201793214440634e-01
7.950315753590273538e-01 1.853358302944488334e-01 5.182632140904128715e-01
8.177791370615994371e-01 2.127627953382852377e-01 5.432386337435157753e-01
8.362698416153079295e-01 2.450086989067829513e-01 5.678838319976026172e-01
8.505563725418664456e-01 2.806737230285537565e-01 5.916628811036308555e-01
8.613070089309564636e-01 3.180749603252363000e-01 6.141010127652497541e-01
8.694116302737093793e-01 3.558810711006659688e-01 6.350145273064313756e-01
8.757161388545896541e-01 3.932313368152108302e-01 6.546177707919846878e-01
8.809154887212219398e-01 4.296236382495501882e-01 6.735307717661165317e-01
8.853268404597925967e-01 4.649163816409356831e-01 6.927624045682388987e-01
8.884310704284409388e-01 4.994546810769878165e-01 7.137490323869131181e-01
8.887111971501618912e-01 5.339646188625030154e-01 7.383284867848654009e-01
8.846323716875585941e-01 5.689236616662907142e-01 7.682007948833130540e-01
8.767267275991816877e-01 6.037553329925489098e-01 8.037105842040241921e-01
8.463768910989423189e-01 6.154197987084349952e-01 8.207155904920702127e-01
7.884451339599858333e-01 5.910998057946171835e-01 8.040760682356380418e-01
7.414676382011815559e-01 5.625639310187692255e-01 7.851649477259431409e-01
7.050881789462218885e-01 5.302805297690829089e-01 7.636124721626524892e-01
6.762693114550958340e-01 4.953415569730459933e-01 7.404207375243810896e-01
6.517912360501287861e-01 4.587593976723408074e-01 7.166589548313024860e-01
6.294171674813368034e-01 4.212253612177472295e-01 6.928095728598714365e-01
6.077882060069819126e-01 3.831868627309770736e-01 6.688349720194523007e-01
5.860059395082031219e-01 3.449961231831933373e-01 6.444254002678728721e-01
5.633019127215219690e-01 3.070716971501701309e-01 6.191087573569722391e-01
5.388922630410429848e-01 2.700276638574735100e-01 5.923009006765995732e-01
5.121182005529967274e-01 2.346165576727894941e-01 5.634752525056647698e-01
4.827461836049378729e-01 2.014304616321936914e-01 5.324428187371255117e-01
4.511233066836186079e-01 1.705617177957048647e-01 4.995004888153025679e-01
4.180000933862609291e-01 1.415324018359887526e-01 4.652975085785351905e-01
3.841911983452363510e-01 1.134918877382977420e-01 4.305617096124739196e-01
3.503684772212236065e-01 8.531603060917344883e-02 3.959457343993016964e-01
3.170584348590873569e-01 5.515718708797005126e-02 3.620573876341695585e-01
2.846879783788356377e-01 2.120036336828947862e-02 3.295099346165862864e-01
2.535503873992720481e-01 0.000000000000000000e+00 2.988424429514020542e-01
3 changes: 3 additions & 0 deletions pyart/graph/cm_colorblind.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
colormaps are available within matplotlib with names pyart_COLORMAP':

* HomeyerRainbow
* balance
* ChaseSpectral
* SpectralExtended
"""

import warnings
Expand Down
Loading