Python package for reading/writing data in support of the Transport Matrix Method (TMM)
Project description
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.
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 pytmmutils-1.0.0.tar.gz.
File metadata
- Download URL: pytmmutils-1.0.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb5f92d7dc21894d4b471952602083fff3452b60beb4ca7719975b7b26ebf4e
|
|
| MD5 |
9f63367c30e2571f10056420bddae7c3
|
|
| BLAKE2b-256 |
48e71837d306bdc02a6e9a3ebaec86dedeb42b500ec2910d5b2f931f1d0b1b6e
|
File details
Details for the file pytmmutils-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pytmmutils-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88d018211491e77bf17c9e71c98e972883dddefec06f0ae8397901327840db74
|
|
| MD5 |
3e33982a3d312de0dcd83edaa47b0cdd
|
|
| BLAKE2b-256 |
777b375f985a963c335a08505d0f980f1a780ced0cb64bfcfa86e30672131a2f
|