Metadata-Version: 2.4
Name: nc2
Version: 2.0.0
Summary: Lightweight NetCDF viewer with detached plot windows, GIF export, and full matplotlib customization.
Home-page: https://github.com/rhettadam/NC2
Author: Rhett R. Adam
Author-email: rhettadambusiness@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26.4
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: netCDF4>=1.6.2
Requires-Dist: cartopy>=0.23.0
Requires-Dist: ttkbootstrap>=1.10.1
Requires-Dist: Pillow>=10.2.0
Requires-Dist: imageio>=2.33.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

<p align="center">
  <img src="docs/logo.png" alt="NC2" width="140">
</p>

<p align="center">
Fast, versatile NetCDF viewer built for scientists.<br>
Replaces ncview and Panoply with a lightweight, offline-capable tool that runs anywhere Python does.
</p>

<p align="center">
  <a href="https://pypi.org/project/nc2/"><img src="https://img.shields.io/pypi/v/nc2" alt="PyPI"></a>
  <a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="License"></a>
</p>

<p align="center">
  <img src="docs/gui.png" alt="NC2 interface" width="800">
</p>

## 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.
