SNOW.py
SNOW (Solar Neural Operator for Wind) gives a steady-state 3D MHD solution for a given boundary condition of solar wind plasma. The package runs the published SNOW checkpoint, trained on AWSoM simulations in a Sun-centered inertial frame. It predicts all eight plasma fields every 10 R☉ through 250 R☉.
Install
Requires Python 3.10 or newer.
python -m pip install snow-mhd
snowpy download-checkpoint
The 3.05 GB checkpoint is downloaded from Zenodo and verified by size and SHA-256. You can skip the download command and let the first prediction fetch it automatically.
For GPU inference, install a CUDA-enabled PyTorch build for your system. For installation from this source directory, run python -m pip install .
Boundary format
Provide the eight fields at 20 R☉ as a plasma array in input.npz, with shape (8, 91, 180). The axes are field, colatitude, and longitude.
| Index | Field | Quantity | Unit |
|---|---|---|---|
| 0 | n_p |
Proton number density | cm⁻³ |
| 1 | v_r |
Outward radial velocity | km/s |
| 2 | v_theta |
Southward velocity | km/s |
| 3 | v_phi |
Velocity along increasing longitude | km/s |
| 4 | p |
Thermal pressure | nPa |
| 5 | b_r |
Outward radial magnetic field | nT |
| 6 | b_theta |
Southward magnetic field | nT |
| 7 | b_phi |
Magnetic field along increasing longitude | nT |
Use colatitude 0°, 2°, …, 180° from north to south and longitude 0°, 2°, …, 358°. Include both poles and exclude the duplicate 360° column. Express vectors in this spherical basis, with theta components positive southward. All values must be finite, and density, radial velocity, and pressure must be positive.
Stack the eight field arrays in the order above and save them as input.npz using the following example.
import numpy as np
from snowpy import write_boundary
# Each field is a (91, 180) array in the units above.
plasma = np.stack([n_p, v_r, v_theta, v_phi, p, b_r, b_theta, b_phi])
write_boundary("input.npz", plasma)
Convert original AWSoM data
snowpy prepare-awsom AwSOM_data_009.npz input.npz
This command accepts the SNOW manuscript's original CGS data as a full (8, 231, 181, 361) cube or a (8, 181, 361) shell at 20 R☉. Supply an NPY file or an NPZ containing a data array. The converter downsamples the grid, reverses the original south-to-north row order, removes the duplicate longitude column, and converts units and northward meridional components to the conventions above. NPY allows memory-mapped access to full cubes.
Run the model
snowpy predict input.npz output.npz
The default endpoint is 250 R☉. The model uses CUDA when available, otherwise CPU. To change the endpoint and device, run
snowpy predict input.npz output.npz --outer-radius 210 --device cpu
Use --device cuda:0 to select a GPU. Endpoints from 30 to 250 R☉ are supported in steps of 10 R☉.
For an existing checkpoint, add --checkpoint /path/to/SNOW.pt. Downloaded checkpoints are cached under ~/.cache/snowpy, or $XDG_CACHE_HOME/snowpy when set. Override the cache location with SNOW_CACHE_DIR or --cache-dir.
Python API
from snowpy import SNOW, read_boundary
model = SNOW(device="auto")
solution = model.predict(read_boundary("input.npz"), outer_radius=250)
solution.save("output.npz")
radial_speed_250 = solution.plasma[1, -1] # (91, 180), km/s
Output
output.npz contains the float32 plasma array with axes (field, radius, colatitude, longitude).
| Endpoint | Shape | Radial coordinates |
|---|---|---|
| 250 R☉ | (8, 24, 91, 180) |
20, 30, …, 250 R☉ |
The first shell preserves the supplied boundary in float32. Subsequent shells are predicted autoregressively. The file includes radius_rs, theta_deg, phi_deg, fields, units, and theta_direction. The saved arrays can be used for analysis and plotting.
Source checks
python -m pip install build twine
python -m pip install .
python -m unittest discover -s tests -v
SNOW_TEST_CHECKPOINT=/path/to/SNOW.pt python -m unittest discover -s tests -v
python -m build
python -m twine check dist/*
Reference
SNOW: Fast and Differentiable MHD Surrogate for Solar Wind using Neural Operator, Prateek Mayank, Enrico Camporeale, Thomas Berger, Zhenguang Huang, and Gabor Toth. Code and checkpoint on Zenodo
Metadata
Release files for snow-mhd 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snow_mhd-0.1.1.tar.gz | 20.0 kB | Without provenance | Details for snow_mhd-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snow_mhd-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for snow_mhd-0.1.1-py3-none-any.whl |
Total release size: 41.3 kB
Release files / snow_mhd-0.1.1.tar.gz
| Download URL | snow_mhd-0.1.1.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
482b30e7666432b4576ffa6f3f4e48d39a2aba9296feae4716638f284f28a2d7
|
|
BLAKE2b-256 checksum How to use checksums |
dde52ebf4f225f57f73d760c658863131d65977cdcc16fc97daeb8df9bb303b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / snow_mhd-0.1.1-py3-none-any.whl
| Download URL | snow_mhd-0.1.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df3f38255f6c430c67ac7be51c1787ea22c0f2e0db1078f7b2194969643d580e
|
|
BLAKE2b-256 checksum How to use checksums |
be9573409c07eddeb13a8c6d790bed255247d16cec2bc8392aaee31d4906b600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for snow-mhd 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.