Skip to main content

xdownscale

xdownscale logo

Project Status: Active PyPI version License: MIT PyPI Downloads

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 PyPI, we recommend using a conda environment

conda create -n xdownscale python=3.10
conda activate xdownscale
conda install -c conda-forge pytorch cudatoolkit=11.8 cudnn
pip install xdownscale

To install from source:

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

Or install from a zipped archive:

unzip xdownscale_package.zip
cd xdownscale
pip install .

Usage

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, srresnet, 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.

Metadata

Release files for xdownscale 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xdownscale 1.0.2
File Size Uploaded Provenance Actions
xdownscale-1.0.2.tar.gz 5.6 MB With provenance Details for xdownscale-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xdownscale 1.0.2
File Interpreter ABI Platform Actions
xdownscale-1.0.2-py3-none-any.whl Python 3 none any Details for xdownscale-1.0.2-py3-none-any.whl

Total release size: 5.6 MB

Release files / xdownscale-1.0.2.tar.gz

Download URL xdownscale-1.0.2.tar.gz
Size 5.6 MB
Tags Source
SHA-256 checksum
How to use checksums
4773a9502e8628e618860ed22b874898526295da32f7801cbe67bcb7904102bf
BLAKE2b-256 checksum
How to use checksums
635a8ab2955fec6044b8925e928ca30a66d2b41141b52158fd716782f59fceb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2025.

Transparency log

Release files / xdownscale-1.0.2-py3-none-any.whl

Download URL xdownscale-1.0.2-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3948f1b92f81ef840816c76b1c951fed01a703e7c03271cf48e241ee77668a9
BLAKE2b-256 checksum
How to use checksums
b380522d7b88597f5fc4c36a4a3c01150eaec552fda0729d5ec8f7def6ac315e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2025.

Transparency log

Security for xdownscale 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xdownscale-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page