{"id":21053,"library":"cmweather","title":"cmweather","description":"cmweather provides colormaps for weather and climate data visualization, with many color vision deficiency (CVD) friendly options. Current version 0.3.2, requires Python >=3.6. Release cadence is irregular, typically a few releases per year.","status":"active","version":"0.3.2","language":"python","source_language":"en","source_url":"https://github.com/openradar/cmweather","tags":["colormaps","weather","climate","visualization","colorblind-friendly"],"install":[{"cmd":"pip install cmweather","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"All colormaps are matplotlib-compatible","package":"matplotlib","optional":false},{"reason":"Used internally for color data manipulation","package":"numpy","optional":true}],"imports":[{"note":"Import the module to register colormaps with matplotlib; no main class.","wrong":null,"symbol":"cmweather","correct":"import cmweather"},{"note":"Colormaps are accessed via cm module, not a Colormap class.","wrong":"from cmweather import Colormap","symbol":"cmweather.cm","correct":"from cmweather import cm"}],"quickstart":{"code":"import matplotlib.pyplot as plt\nimport numpy as np\nimport cmweather\n\n# Generate sample data\nx = np.linspace(0, 10, 100)\ny = np.linspace(0, 10, 100)\nX, Y = np.meshgrid(x, y)\nZ = np.sin(X) * np.cos(Y)\n\n# Use a CVD-friendly colormap\nplt.contourf(X, Y, Z, cmap='cmweather.viridis')\nplt.colorbar()\nplt.show()","lang":"python","description":"Basic usage: import cmweather to register colormaps, then use them as 'cmweather.<name>'."},"warnings":[{"fix":"Use plt.cm.cmweather.viridis or specify cmap='cmweather.viridis'.","message":"Colormap names must be prefixed with 'cmweather.' when used in matplotlib (e.g., 'cmweather.viridis'). Omitting the prefix will fall back to matplotlib's default.","severity":"gotcha","affected_versions":"all"},{"fix":"Use from cmweather import cm; cm.viridis or cmap='cmweather.viridis'.","message":"The old direct access via cmweather.colormaps (e.g., cmweather.colormaps['viridis']) is deprecated and may be removed.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Ensure 'import cmweather' is called before plotting. If issues, use 'from cmweather import cm'.","message":"In v0.2.0, the colormap registration mechanism changed from automatic on import to requiring an explicit import. Code that only did 'import cmweather' before may not register colormaps.","severity":"breaking","affected_versions":"0.2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add 'import cmweather' at the top of your script. Use 'plt.get_cmap(\"cmweather.viridis\")'.","cause":"Colormap not registered because cmweather was not imported, or colormap name is incorrect.","error":"KeyError: 'viridis'"},{"fix":"Upgrade matplotlib: 'pip install matplotlib --upgrade'. Reinstall cmweather: 'pip install cmweather --upgrade'.","cause":"Matplotlib version too old (<2.0) or cmweather not properly installed.","error":"ValueError: Colormap 'cmweather.viridis' is not of known type"},{"fix":"Use 'from cmweather import cm' instead.","cause":"Trying to import a class that doesn't exist.","error":"ImportError: cannot import name 'Colormap' from 'cmweather'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}