Skip to main content

Lightweight NetCDF viewer with detached plot windows, GIF export, and full matplotlib customization.

Project description

NC2

Fast, versatile NetCDF viewer built for scientists.
Replaces ncview and Panoply with a lightweight, offline-capable tool that runs anywhere Python does.

PyPI License

NC2 interface

Install

pip install nc2

Requires Python 3.8+. Cartopy is needed for map projections (optional for non-geographic data).

Usage

nc2                          # launch empty, open file from menu
nc2 data.nc                  # open a file directly
python -m nc2 data.nc4       # alternate invocation

Features

  • Spatial plots -- pcolormesh, contourf, contour, imshow, quiver, streamplot
  • Vertical sections -- depth vs. lat/lon cross-sections
  • Timeseries -- click any point to extract temporal evolution
  • Depth profiles -- vertical structure at a point
  • GIF export -- animate over time with configurable FPS and frame range
  • Full matplotlib API -- normalization (log, symlog, power), interpolation, alpha, colorbar controls, contour styling, quiver/streamplot parameters
  • 182 colormaps -- every registered matplotlib colormap at runtime
  • Cartopy projections -- PlateCarree, Mercator, Robinson, Orthographic, and more
  • Flexible dimensions -- auto-detects time/depth/lat/lon, manual override for non-standard files
  • Extra dimensions -- unassigned dims get their own sliders automatically
  • Playback -- animate through time with loop/bounce/once modes and speed control
  • Detached windows -- each plot is an independent matplotlib window with toolbar
  • Batch export -- export all frames as individual images
  • Performance -- LRU slice cache, lazy coordinate loading, threaded I/O

Architecture

nc2/
  __main__.py      Entry point
  app.py           Control panel (tkinter + ttkbootstrap)
  dataset.py       NetCDF wrapper, dimension classification
  slicer.py        Data extraction with caching
  cache.py         Thread-safe LRU cache
  playback.py      Animation controller
  export.py        GIF/image/batch export
  constants.py     Configuration defaults, heuristics
  widgets.py       Custom widgets and dialogs
  plots/
    config.py      PlotConfig dataclass
    manager.py     Window lifecycle management
    spatial.py     2D map/field plots
    section.py     Cross-section plots
    series.py      Timeseries and depth profiles

Dependencies

Package Purpose
numpy Array operations
matplotlib Plotting engine
netCDF4 File I/O
cartopy Map projections and features
ttkbootstrap GUI styling
Pillow Image handling
imageio GIF assembly

License

GPL-3.0. Copyright (c) 2024 Rhett R. Adam.

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

nc2-2.0.0.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nc2-2.0.0-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

Details for the file nc2-2.0.0.tar.gz.

File metadata

  • Download URL: nc2-2.0.0.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for nc2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8f5e5f7f440be2908e8bd19b5c587add5c3880b065d46a1b5fdc78162a227a19
MD5 a714ab6ab17baaa39c7ad66967bbb040
BLAKE2b-256 7e7f632ed223c460631a1e9be76f602c4c098b346470f308e03deee24490a000

See more details on using hashes here.

File details

Details for the file nc2-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: nc2-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 81.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for nc2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e57094d10ec17e625dfacb4ef44ea5ac605f561d2192da39a93b9c0a29299df
MD5 a8989a2d49869c5567440eb2fb781165
BLAKE2b-256 ebd6b6a82b74f47e9b1caa7a11f425d4be416ae15c6d72c2e8c9c91f6912a20b

See more details on using hashes here.

Supported by

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