This repository contains functions written in Python for reading and writing files in support of the Transport Matrix Method (TMM). They are translations of the original Matlab code and, for the most part, work identically (but adhere to Python conventions such as 0-based indexing).
IMPORTANT: Please do NOT post this code on your own github or other website. See LICENSE.txt for licensing information.
Feel free to email if you have any questions: samkat6@gmail.com
Installation
pip install pytmmutils
(This should automatically install any required modules, including my pyioutils package.)
Usage
The various functions for manipulating TMM-related data, such as mapping "matrix" to "grid" (and vice versa), depend on configuration, grid, box geometry and forcing data from the underlying general circulation model from which the transport matrices (TMs) were extracted. These data as well as the TMs are distributed as Matlab .mat files. To use them in Python you will first need to convert the underlying Matlab data to a Python-compatible format. The function convertmat2dict does this for you by translating the variables in the .mat file to Python datatypes and placing them in a dictionary. In particular, because these data are used by most functions, it is recommended that you convert config_data.mat, grid.mat, boxes.mat and profile_data.mat into dictionaries and save them to files and place them in the same corresponding locations as the .mat files. See examples/example1.py for how to perform the conversion and save the resulting dictionary in a HDF5 file.
Note that the above translation also changes the data orientation to be compatible with Python conventions (e.g., a Matlab 3-d array oriented as (longitude, latitude, depth) is permuted into a 3-d NumPy array oriented as (depth, latitude, longitude)).
The various examples in the examples directory illustrate different functionality which should enable you to replicate the Matlab workflow in TMM scripts such as make_input_files...m entirely in Python. To facilitate running these examples, the TestData directory contains translated data for the MIT_Matrix_Global_2.8deg configuration.
Metadata
Release files for pytmmutils 1.0.0
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 |
|---|---|---|---|---|
| pytmmutils-1.0.0.tar.gz | 11.8 kB | Without provenance | Details for pytmmutils-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytmmutils-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pytmmutils-1.0.0-py3-none-any.whl |
Total release size: 24.3 kB
Release files / pytmmutils-1.0.0.tar.gz
| Download URL | pytmmutils-1.0.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fb5f92d7dc21894d4b471952602083fff3452b60beb4ca7719975b7b26ebf4e
|
|
BLAKE2b-256 checksum How to use checksums |
48e71837d306bdc02a6e9a3ebaec86dedeb42b500ec2910d5b2f931f1d0b1b6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.6
|
Release files / pytmmutils-1.0.0-py3-none-any.whl
| Download URL | pytmmutils-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88d018211491e77bf17c9e71c98e972883dddefec06f0ae8397901327840db74
|
|
BLAKE2b-256 checksum How to use checksums |
777b375f985a963c335a08505d0f980f1a780ced0cb64bfcfa86e30672131a2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.6
|
Security for pytmmutils 1.0.0
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.