Metadata-Version: 2.4
Name: xdownscale
Version: 1.0.1
Summary: A PyTorch-based tool to downscale spatiotemporal data
Home-page: https://github.com/manmeet3591/xdownscale
Author: Manmeet Singh, Naveen Sudharsan
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.rst
Requires-Dist: torch
Requires-Dist: xarray
Requires-Dist: numpy
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# xdownscale
<p align="center"><img src="xdownscale.png" alt="xdownscale logo" width="400"/></p>
xdownscale is a Python package for super-resolution downscaling of gridded datasets using deep learning. It supports a wide range of applications, including satellite observations, reanalysis data, and climate model outputs. Built with PyTorch and xarray, it enables efficient mapping from coarse-to-fine-resolution grids in just a few lines of code.

---

## Installation

To install from source:

```bash
git clone https://github.com/manmeet3591/xdownscale.git
cd xdownscale
pip install .
```

Or install from a zipped archive:

```bash
unzip xdownscale_package.zip
cd xdownscale
pip install .
```

---

## Usage

```python
import xarray as xr
import numpy as np
from xdownscale import Downscaler

# Create dummy coarse-resolution input and fine-resolution target
x = np.random.rand(128, 128).astype(np.float32)
y = (x + np.random.normal(0, 0.01, size=x.shape)).astype(np.float32)

input_da = xr.DataArray(x, dims=["lat", "lon"])
target_da = xr.DataArray(y, dims=["lat", "long"])

# Initialize the downscaler
ds = Downscaler(input_da, target_da, model_name="fsrcnn")

# Predict high-resolution output
result = ds.predict(input_da)
result.plot()
```

**Available models**:  
`srcnn`, `fsrcnn`, `lapsr`, `carnm`, `falsra`, `falsrb`, `ssresnet`, `carn`, `oisrrk2`, `mdsr`, `san`, `rcan`, `unet`, `dlgsanet`, `dpmn`, `safmn`, `dpt`, `distgssr`, `swin`

---

## Description

xdownscale performs patch-wise training using PyTorch’s `DataLoader` and returns predictions as `xarray.DataArray` objects. It is designed to work with any gridded dataset and provides a flexible interface for model selection, training, and inference.

---

## Sample Data

Sample input and target data are provided in the `data/` directory for testing and demonstrations.

---

## Development

To extend or customize the package:

- Modify model architectures in `xdownscale/model.py`
- Add training logic in `xdownscale/core.py`
- Customize patch extraction and utilities in `xdownscale/utils.py`

---

## License

This project is licensed under the MIT License.
