A PyTorch-based tool to downscale spatiotemporal data
Project description
xdownscale
Installation
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, 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xdownscale-1.0.1.tar.gz.
File metadata
- Download URL: xdownscale-1.0.1.tar.gz
- Upload date:
- Size: 5.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73aebf422f165bece960fed83ff42b962f9f56676885dc095e04d4c4ddbadc9c
|
|
| MD5 |
d62642dcc6d81edfa83b3b05e662104d
|
|
| BLAKE2b-256 |
e9ede52bcc32cef28f73ff092597fd4f6b59cd4bae58ea50f72ab7026504d416
|
Provenance
The following attestation bundles were made for xdownscale-1.0.1.tar.gz:
Publisher:
publish.yml on manmeet3591/xdownscale
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xdownscale-1.0.1.tar.gz -
Subject digest:
73aebf422f165bece960fed83ff42b962f9f56676885dc095e04d4c4ddbadc9c - Sigstore transparency entry: 233671489
- Sigstore integration time:
-
Permalink:
manmeet3591/xdownscale@ccc2cf48d4eb1ba055935471c006085e3e614c48 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/manmeet3591
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ccc2cf48d4eb1ba055935471c006085e3e614c48 -
Trigger Event:
release
-
Statement type:
File details
Details for the file xdownscale-1.0.1-py3-none-any.whl.
File metadata
- Download URL: xdownscale-1.0.1-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
927fce49f1ecca0d498de66f46c78e8248a8744af979714d0ddac61d76fef906
|
|
| MD5 |
d5640b7658a7c7b353d9ace4ee58d136
|
|
| BLAKE2b-256 |
d40447ab7271382e5a9ac587c9eafb5971eea873f44c9876569cc9f6198aecaf
|
Provenance
The following attestation bundles were made for xdownscale-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on manmeet3591/xdownscale
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xdownscale-1.0.1-py3-none-any.whl -
Subject digest:
927fce49f1ecca0d498de66f46c78e8248a8744af979714d0ddac61d76fef906 - Sigstore transparency entry: 233671496
- Sigstore integration time:
-
Permalink:
manmeet3591/xdownscale@ccc2cf48d4eb1ba055935471c006085e3e614c48 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/manmeet3591
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ccc2cf48d4eb1ba055935471c006085e3e614c48 -
Trigger Event:
release
-
Statement type: