Metadata-Version: 2.1
Name: ncCompare
Version: 0.2.5
Summary: netCDF Comparison Tool
Author: Antonio Mariani
Author-email: antonio.mariani@cmcc.it
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: netcdf4 (>=1.7.1,<2.0.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: rich (>=13.7.1,<14.0.0)
Requires-Dist: xarray (>=2024.6.0,<2025.0.0)
Description-Content-Type: text/markdown

# netCDF Diff Comparison tool - ncpare

`ncpare` is a tool for comparing netCDF files, providing a detailed diff of their contents. It is designed to help users
identify differences between datasets stored in netCDF format.

![Python](https://img.shields.io/badge/Python->3.10-blue.svg)
[![Anaconda](https://img.shields.io/badge/conda->22.11.1-green.svg)](https://anaconda.org/)
[![Pip](https://img.shields.io/badge/pip->19.0.3-brown.svg)](https://pypi.org/project/pip/)
[![netcdf4](https://img.shields.io/badge/netcdf4-1.7.1.post1-brown.svg)](https://pypi.org/project/pip/)
[![xarray](https://img.shields.io/badge/xarray-2024.6.0-brown.svg)](https://pypi.org/project/pip/)
[![rich](https://img.shields.io/badge/rich-13.7.1-brown.svg)](https://github.com/Textualize/rich?tab=readme-ov-file)
![Tests](https://img.shields.io/badge/coverage-0%25-red)

![Output](https://github.com/anto6715/ncCompare/raw/master/docs/output.png)

## Installation

### Via PIP

```shell
pip install nccompare
```

## Usage

```shell
ncpare [-h] [-f--filter FILTER_NAME] [--common_pattern COMMON_PATTERN] [--variables VARIABLES [VARIABLES ...]] [--last_time_step] [-V] folder1 folder2

netCDF Comparison Tool

positional arguments:
  folder1               Path of first folder to compare
  folder2               Path of second folder to compare

options:
  -h, --help            show this help message and exit
  -f--filter FILTER_NAME
                        Filter to select files to compare. Examples: *.nc, *_grid_*
  --common_pattern COMMON_PATTERN
                        Common file pattern in two files to compareEs mfsX_date.nc and expX_date.nc -> date.nc is the common part
  -v, --variables VARIABLES [VARIABLES ...]
                        Variable to compare
  --last_time_step      If True, compare only the last time step available in each file
  -V, --version         Print version and exit

```

### Select Variables

It is possible to choose which parameter to compare:

```shell
ncpare folder1 folder2 -v "votemper" "vosaline"
```

![Variables](https://github.com/anto6715/ncCompare/raw/master/docs/variables.png)


### Filter files

As default **ncpare** read iterate over all files in **folder1** and expect to find them in **folder2**. Using filters,
it is possible to select only a subset of input files. For example:

```shell
ncpare folder1 folder2 -f "*_grid_T.nc"
```

### Compare files with different filenames

It is possible to compare two files also if the filenames are slightly different if they have a common pattern.
For example, if we have:

* `a/my-simu_19820101_grid_T.nc`
* `b/another-exp_19820101_grid_T.nc`

It is still possible to compare the file with:
```shell
ncpare folder1 folder2 --commom-pattern ".+_19820101_grid_T.nc"
```

Notice the regex syntax `.+` to match any pattern before `_19820101`

## Author

- Antonio Mariani (antonio.mariani@cmcc.it)

## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

## Contact
For any questions or suggestions, please open an issue on the project's GitHub repository.

