CryoGrid-pyTools
Tools to read in CryoGrid MATLAB data to Python, includes forcing, outputs, DEMs, etc.
Feel free to use, modify, and distribute as you see fit.
Installation
pip install cryogrid_pytools
# OR for the very latest bleeeeding edge version
pip install "cryogrid-pytools[data,viz] @ git+https://github.com/lukegre/CryoGrid-pyTools.git"
However, I recommend using uv to manage your Python environments. This would be
uv add cryogrid-pytools[data,viz]
# OR
uv add "cryogrid-pytools[data,viz] @ git+https://github.com/lukegre/CryoGrid-pyTools.git"
Usage
This package can read in
- CryoGrid output (from
OUT_regridded_FCI2) - simple MATLAB struct files (not
run_info.mat) - ERA5 forcing
- excel run configuration files (experimental)
Basic examples are shown below for the first two items, but see demo.ipynb for more comprehensive examples.
Reading single CryoGrid output files
Currently, only output files from the calss OUT_regridded_FCI2 are supported.
However, the majority of files you'll use follow this format.
import cryogrid_pytools as cgt
# a single file that should look something like this
fname = "results_from_RUN_SIMPLE/<project_name>_<YYYYMMDD>.mat"
# currently the only output from OUT_regridded_FCI2 is supported
dataset = cgt.read_OUT_regridded_FCI2_file(fname)
Reading multiple CryoGrid output files
If you're working with RUN_SPATIAL_SPINUP_CLUSTERING, you can read in multiple files at once. The data are returned as an xarray.Dataset with the dimensions: [gridcell, depth, time]
# path contains wildcards where cluster ID and date are respectively
fname = "results_from_RUN_SPATIAL_SPINUP_CLUSTERING/project_name_*_*.mat"
# deepest_point is the deepest point in the saved files
dataset = cgt.read_OUT_regridded_FCI2_clusters(fname, deepest_point=-5)
Reading struct files from MATLAB
MATLAB, You need to add the `CryoGrid/source` directory to the MATLAB path before the file can be loaded properly. Note that run_info.mat cannot be read as it contains special classes that are not supported by scipy.io.loadmat. To save parts of run_info, use the following code in MATLAB:
run_info_spatial = run_info.SPATIAL.STATVAR
save "run_info_spatial.mat" run_info_spatial
Then, in Python:
fname = 'path_to_file/run_spatial_statvar.mat'
spatial = cgt.read_mat_struct_as_dataset(fname, index=['Y', 'X'])
Metadata
Release files for cryogrid_pytools 0.3.20
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 | |
|---|---|---|---|---|
| cryogrid_pytools-0.3.20.tar.gz | 43.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cryogrid_pytools-0.3.20-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.6 kB
Release files / cryogrid_pytools-0.3.20.tar.gz
| Download URL | cryogrid_pytools-0.3.20.tar.gz |
|---|---|
| Size | 43.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59287d7e8b894343280b736b9ba3e823d2d36542b76aa07db303802ee35c0a7b
|
|
BLAKE2b-256 checksum How to use checksums |
b39b07e4e476f725d5236d5a31da1090f99c98f385ee0d17c29a9dde4a68f623
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Release files / cryogrid_pytools-0.3.20-py3-none-any.whl
| Download URL | cryogrid_pytools-0.3.20-py3-none-any.whl |
|---|---|
| Size | 53.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
428148246be2b1d88a37558a8af9b5570a2e59516d5640e630ba1e66183e0ab2
|
|
BLAKE2b-256 checksum How to use checksums |
14f9dcad2e395987d8dd9fb708de81e008ee0f4854300b0c41cabd2b5a8ac257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Security for cryogrid_pytools 0.3.20
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.