Skip to main content

A minimal GUI for a quick view of netcdf files. Aiming to be a drop-in replacement for ncview.

Project description

A minimal GUI for a quick view of netCDF files. Aiming to be a drop-in replacement for ncview.

Zenodo DOI PyPI version License Build status

About ncvue

ncvue is a minimal GUI for a quick view of netCDF files. It is aiming to be a drop-in replacement for ncview, being slightly more general than ncview, which targets maps. If ncvue is used with maps, it supports mostly structured grids, more precisely the grids supported by cartopy.

ncvue is a Python script that can be called from within Python or as a command line tool. It is not supposed to produce publication-ready plots but rather provide a quick overview of the netcdf file.

The complete documentation for ncvue is available from:

https://mcuntz.github.io/ncvue/

Quick usage guide

ncvue can be run from the command line:

ncvue netcdf_file.nc

or from within Python:

from ncvue import ncvue
ncvue('netcdf_file.nc')

Note, ncvue uses the TkAgg backend of matplotlib. It must be called before any other call to matplotlib. This also means that you cannot launch it from within iPython if it was launched with –pylab. It can be called from within a standard iPython, though.

General layout

On opening, ncvue presents three panels for different plotting types: Scatter or Line plots, Contour plots, and Maps. This is the look in macOS light mode (higher resolution images can be found in the documentation):

Graphical documentation of ncvue layout

All three panes are organised in this fashion: the plotting canvas, the Matplotlib navigation toolbar and the pane, where one can choose the plotting variables and dimensions, as well as plotting options. You can always choose another panel on top, and open another, identical window for the same netCDF file with the button “New Window” on the top right.

Map panel

If ncvue detects latitude and longitude variables with a size greater than 1, it opens the Map panel by default. This is the Map panel in macOS dark mode, describing all buttons, sliders, entry boxes, spinboxes, and menus:

Graphical documentation of Map panel

If it happens that the detection of latitudes and longitudes did not work automatically, you can choose the correct variables manually. Or you might use the empty entries on top of the dropdown menus of the latitudes and longitudes, which uses the index and one can hence display the matrix within the netCDF file. You might want to switch of the coastlines in this case.

You might want to switch off the automatically detected “global” option sometimes if your data is on a rotated grid or excludes some regions such as below minus -60 °S.

All dimensions can be set from 0 to the size of the dimension-1, to “all”, or to any of the arithmetic operators “mean”, “std” (standard deviation), “min”, “max”, “ptp” (point-to-point amplitude, i.e. max-min), “sum”, “median”, “var” (variance).

Be aware that the underlying cartopy/matplotlib may (or may not) need a long time to plot the data (with the pseudocolor ‘mesh’ option) if you change the central longitude of the projection from the central longitude of your data, which is automatically detected if “central lon” is set to None. Setting “central lon” to the central longitude of the input data normally eliminates the problem.

Scatter/Line panel

If ncvue does not detect latitude and longitude variables with a size greater than 1, it opens the Scatter/Line panel by default. This is the Scatter/Line panel in macOS dark mode, describing all buttons, sliders, entry boxes, spinboxes, and menus:

Graphical documentation of Scatter/Line panel

The default plot is a line plot with solid lines (line style ‘ls’ is ‘-‘). One can set line style ‘ls’ to None and set a marker symbol, e.g. ‘o’ for circles, to get a scatter plot. A large variety of line styles, marker symbols and color notations are supported.

ncvue builds automatically a datetime variable from the time axis. This is correctly interpreted by the underlying Matplotlib also when zooming into or panning the axes. But it is also much slower than using the index. Selecting the empty entry on top of the dropdown menu for x uses the index for the x-axis and is very fast. Plotting a line plot with 52608 time points takes about 2.2 s on my Macbook Pro using the datetime variable and about 0.3 s using the index (i.e. empty x-variable). This is especially true if one plots multiple lines with ‘all’ entries from a specific dimension. Plotting all 10 depths of soil water content for the 52608 time points, as in the example below, takes also about 0.3 s if using the index as x-variable but more than 11.1 s when using the datetime variable.

Example of multiple lines in the Scatter/Line panel

Contour panel

The last panel provide by ncvue draws contour plots. This is the Contour panel in macOS dark mode, describing all buttons, sliders, entry boxes, spinboxes, and menus:

Graphical documentation of Contour panel

This produces also either pseudocolor plots (‘mesh’ ticked) or filled contour plots (‘mesh’ unticked) just as the Map panel but without any map projection.

Installation

The easiest way to install ncvue is via pip if you have cartopy installed already:

pip install ncvue

Cartopy can, however, be more elaborate to install. The easiest way to install Cartopy is by Conda and then installing ncvue with pip:

conda install -c conda-forge cartopy
pip install ncvue

You would need an Anaconda or Miniconda environment for this, of course.

See the installation instructions in the documentation for more information.

License

ncvue is distributed under the MIT License. See the LICENSE file for details.

Copyright (c) 2020-2021 Matthias Cuntz

The project structure is based on a template provided by Sebastian Müller.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncvue-3.1.tar.gz (75.2 MB view details)

Uploaded Source

Built Distribution

ncvue-3.1-py2.py3-none-any.whl (84.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ncvue-3.1.tar.gz.

File metadata

  • Download URL: ncvue-3.1.tar.gz
  • Upload date:
  • Size: 75.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for ncvue-3.1.tar.gz
Algorithm Hash digest
SHA256 74b707fc83138ffa3d75d41e9357895117b6f1fd3c0b2fd008d882b026272a63
MD5 46779f8f725fdadfe857d348d63ba6f5
BLAKE2b-256 0f664e40820f36324c3b000ebf50de8789fb044d60f1783d6e08b982c2d53e43

See more details on using hashes here.

File details

Details for the file ncvue-3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ncvue-3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 84.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for ncvue-3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f3ad77e8d63162080d3056a03b8e2b6164fe9176546767f5588635918b44619b
MD5 a028b212438acbd404358c1ea6bd1796
BLAKE2b-256 7cb54d00f373b3194a5f9eecc67fe3a5401d89d3ee1027fe5227863b3e74e41e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page