snowfake
Make Gravner-Griffeath "snowfakes"! This code implements:
Janko Gravner, David Griffeath (2008). Modeling snow crystal growth II: A mesoscopic lattice map with plausible dynamics. Physica D: Nonlinear Phenomena 237 (3), p 385-404. DOI: 10.1016/j.physd.2007.09.008.
Installation
You can install this package with pip (be careful not to type "snowflake"):
pip install snowfake
Installing scikit-image allows you to use a different affine transformation, but I haven't figured out yet if it's better or not.
pip install snowfake[skimage]
Documentation
Read the documentation
Example
You can produce a random snowfake with:
import snowfake
s = snowfake.random()
Alternatively, this code produces the crystal in Figure 5b of the Gravner & Griffeath (2008):
from snowfake import Snowfake
params = {
'ρ': 0.35, # or 'rho': 0.35 if you prefer...
'β': 1.4,
'α': 0.001,
'θ': 0.015,
'κ': 0.05,
'μ': 0.015,
'γ': 0.01,
'σ': 0.00005,
'random': False,
}
s = Snowfake(size=801, **params)
Now you're ready to grow and plot the snowfake:
s.grow()
s.plot()
The various physical parameter arrays are available as s.a (attachment flag), s.b (boundary mass), s.c (the crystal itself) and s.d (the vapour). The arrays exist on hexgrids; you can rectify them with, for example, s.rectify('c').
The parameter σ (note that you can also spell out sigma if you prefer) can be a 1D array with one sample per epoch. This will vary the vapour density ρ through time. The parameter ρ can be a 2D array of shape (size, size); this will vary the initial vapour density through space.
Testing
You can run the tests (requires pytest and pytest-cov) with
python run_tests.py
Building
This repo uses PEP 517-style packaging. Read more about this and about Python packaging in general.
Building the project requires build, so first:
pip install build
Then to build snowfake locally:
python -m build
The builds both .tar.gz and .whl files, either of which you can install with pip.
Continuous integration
This repo has two GitHub 'workflows' or 'actions':
- Push to
main: Run all tests on all version of Python. This is the Run tests workflow. - Publish a new release: Build and upload to PyPI. This is the Publish to PyPI workflow. Publish using the GitHub interface, for example (read more
Metadata
Release files for snowfake 0.2.6
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 |
|---|---|---|---|---|
| snowfake-0.2.6.tar.gz | 1.8 MB | Without provenance | Details for snowfake-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snowfake-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for snowfake-0.2.6-py3-none-any.whl |
Total release size: 1.8 MB
Release files / snowfake-0.2.6.tar.gz
| Download URL | snowfake-0.2.6.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c938af6b80a89d6a5848307bd595434aa4ee8f8634747b12bc9fd5cd48c9011c
|
|
BLAKE2b-256 checksum How to use checksums |
bb82003cdc27007d121c2210aafb8cc771c65fd5bc272d799ed255cb48e6f4cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / snowfake-0.2.6-py3-none-any.whl
| Download URL | snowfake-0.2.6-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfa707c0e56ed774c2573c22c2e1c9ed6fdac295cb304c5a7daa9c68a0da9b86
|
|
BLAKE2b-256 checksum How to use checksums |
5956764cdc13867b6137262ad7498f8a6b93aac0dab0e7daa1edd130098b0606
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for snowfake 0.2.6
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.