ncview is a legacy, light-weight netcdf viewer that is still in wide use in the geosciences community.
One of the weak points of ncview is its colormaps (e.g. jet), in particular the lack of scientific (aka perceptually uniform) colormaps.
ncmap adds scientific colormaps to the configuration path of ncview, so that your data can be displayed using viridis, inferno, cmocean, and more.
Examples
Viridis (Matplotlib)
Thermal (cmocean)
Oslo (cmcrameri)
Installation
There are two ways for getting ncview to use the scientific colormaps:
Option 1: (recommended, easiest)
git clone this repo somewhere in your HOME;
Define (export) a shell environment variable to the sub-directory ncmaps/: export NCVIEWBASE=</path/to/local/ncmaps/copy>/ncmaps/.
Copy ncmaps/.ncviewrc to your HOME: cp </path/to/local/ncmaps/copy>/ncmaps/.ncviewrc ${HOME}.
For example: export NCVIEWBASE=/home/tomlav/software/ncmaps/ncmaps/ (note ncmaps twice) and cp /home/tomlav/software/ncmaps/ncmaps/.ncviewrc /home/tomlav/.
You should add the export to your .profile.
Option 2: (for developers)
Fetch this repo from github;
Run python3 write_ncmaps in the terminal;
Define (export) a shell environment variable: export NCVIEWBASE=${HOME}/.ncmaps;
Copy ${HOME}/.ncmaps/.ncviewrc to your HOME: cp ${HOME}/.ncmaps/.ncviewrc ${HOME}/.
Here again, you should put the export command in your .profile.
In both cases, new colormaps should be available next time you run ncview.
Supported colormaps
ncmaps harvests scientific colormaps from the following python modules:
If you choose Option 2 above, these modules must be installed and accessible to your your python implementation
(e.g. via pip or conda) before running write_ncmaps. This might require activating a virtualenv.
Installing the colormaps modules is not required if you choose Option 1 above.
Notes about ncview
The most widely available version of ncview(Ncview 2.1.8 David W. Pierce 8 March 2017) has a bug in the way
it loads the colormaps. This bug limits the number of colormaps we can prepare to a maximum of 79.
When triggered, the bug results in ncview refusing to launch with Error, too many colormaps -- max is 200.
Should this happen to you, try to: delete your .ncviewrc file (in your HOME). If it persists, fetch a new version of this repo.
This bug is the reason why we do not support additional colormaps (e.g. cmasher).
ncview offers a way to enable, disable, and re-order the colormaps (see button Opts). The configuration is saved into the
.ncviewrc file in your HOME. The .ncviewrc file we provide in this package a) disables all the “legacy” colormaps of ncview and
b) orders the colormaps by name (alphabetic). Using our .ncviewrc file will overwrite your own preferences. You can start from our
.ncviewrc file and further customize your colormaps.
Authors
Thomas Lavergne, Norwegian Meteorological Institute
Sam Hatfield, European Centre for Medium-Range Weather Forecasts
ncmaps
ncmaps brings scientific colormaps to ncview.
ncview is a legacy, light-weight netcdf viewer that is still in wide use in the geosciences community.
One of the weak points of ncview is its colormaps (e.g. jet), in particular the lack of scientific (aka perceptually uniform) colormaps.
ncmap adds scientific colormaps to the configuration path of ncview, so that your data can be displayed using viridis, inferno, cmocean, and more.
Examples
Viridis (Matplotlib)
Thermal (cmocean)
Oslo (cmcrameri)
Installation
There are two ways for getting
ncviewto use the scientific colormaps:Option 1: (recommended, easiest)
git clonethis repo somewhere in your HOME;ncmaps/:export NCVIEWBASE=</path/to/local/ncmaps/copy>/ncmaps/.ncmaps/.ncviewrcto your HOME:cp </path/to/local/ncmaps/copy>/ncmaps/.ncviewrc ${HOME}.For example:
export NCVIEWBASE=/home/tomlav/software/ncmaps/ncmaps/(notencmapstwice) andcp /home/tomlav/software/ncmaps/ncmaps/.ncviewrc /home/tomlav/. You should add the export to your.profile.Option 2: (for developers)
python3 write_ncmapsin the terminal;export NCVIEWBASE=${HOME}/.ncmaps;${HOME}/.ncmaps/.ncviewrcto your HOME:cp ${HOME}/.ncmaps/.ncviewrc ${HOME}/.Here again, you should put the
exportcommand in your.profile.In both cases, new colormaps should be available next time you run
ncview.Supported colormaps
ncmaps harvests scientific colormaps from the following python modules:
If you choose Option 2 above, these modules must be installed and accessible to your your python implementation (e.g. via pip or conda) before running
write_ncmaps. This might require activating a virtualenv.Installing the colormaps modules is not required if you choose Option 1 above.
Notes about ncview
The most widely available version of
ncview(Ncview 2.1.8 David W. Pierce 8 March 2017) has a bug in the way it loads the colormaps. This bug limits the number of colormaps we can prepare to a maximum of 79. When triggered, the bug results in ncview refusing to launch withError, too many colormaps -- max is 200. Should this happen to you, try to: delete your.ncviewrcfile (in your HOME). If it persists, fetch a new version of this repo. This bug is the reason why we do not support additional colormaps (e.g.cmasher).ncviewoffers a way to enable, disable, and re-order the colormaps (see buttonOpts). The configuration is saved into the.ncviewrcfile in your HOME. The.ncviewrcfile we provide in this package a) disables all the “legacy” colormaps ofncviewand b) orders the colormaps by name (alphabetic). Using our.ncviewrcfile will overwrite your own preferences. You can start from our.ncviewrcfile and further customize your colormaps.Authors
Thomas Lavergne, Norwegian Meteorological Institute
Sam Hatfield, European Centre for Medium-Range Weather Forecasts
(ncmaps expands https://github.com/samhatfield/ncview-scientific-colour-maps)