NCPlot has one core function — view() — reachable three ways: directly from the top-level ncplot namespace, via the ncplot.xarray accessor, or from the ncplot command line tool.
Plot the contents of a netCDF file, directory, remote URL, or xarray object.
Required:
xrequiredAn xarray Dataset/DataArray, or a file path, directory, or remote (OPeNDAP/THREDDS) URL pointing to netCDF data.
Optional:
varsA variable name, or list of variable names, to plot. If omitted, every variable in x is plotted.
autoscaleWhether colour scales are set automatically from each variable's minimum and maximum values. Default True. Set to False to keep scales fixed, e.g. when comparing several plots.
outPath to save the plot to, instead of displaying it inline. Must end in .html.
coastDraw coastlines on map plots. Default False. Looks best with the optional cartopy dependency installed (see Installing).
climA (min, max) tuple fixing the colour scale range, overriding autoscale for that call.
Importing ncplot.xarray registers a .ncplot accessor on every xarray Dataset and DataArray, mirroring xarray's own .plot accessor:
import ncplot.xarray import xarray as xr ds = xr.open_dataset("example.nc") ds.ncplot.view(vars="sst", coast=True)
Dataset.ncplot.view(vars=None, **kwargs) and DataArray.ncplot.view(vars=None, **kwargs) both call view() underneath with self as x — every keyword argument documented above works here too.
Installing NCPlot adds an ncplot console command. Give it one or more existing file paths or URLs and it opens an interactive view — a single argument is passed straight to view(), multiple arguments are passed as a list:
$ ncplot example.nc $ ncplot one.nc two.nc