mhm


Namemhm JSON
Version 5.13.1 PyPI version JSON
download
home_page
SummaryPython distribution of mHM with bindings.
upload_time2023-08-24 13:43:17
maintainer
docs_urlNone
author
requires_python>=3.8
licenseLGPL-3.0
keywords mhm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mHM - Python bindings

[TOC]

Python bindings to control mHM.

The wrapper (`mhm/wrapper.f90`) is just a small layer on top of the
interfaces provided by mHM to be compatible with [f2py](https://numpy.org/doc/stable/f2py/index.html).


## Installation

There is a [PyPI package](https://pypi.org/project/mhm) to install the latest release:

```bash
pip install mhm
```

Installing the mHM Python package will provide the `mhm` command to execute mHM the traditional way.

In order to compile the Python bindings from scratch you need:
1. [Python](https://www.python.org/) with version at least v3.8 and [pip](https://pip.pypa.io/)
2. a Fortran, a C and a C++ compiler (set the environment variables `FC` (and `F77`), `CC` and `CXX` accordingly).
    In case of gcc, this could look like:
    ```bash
    export FC="gfortran"
    export F77="gfortran"
    export CC="gcc"
    export CXX="g++"
    ```
3. [NetCDF-Fortran](https://github.com/Unidata/netcdf-fortran) installed in your system path

See the [Compilation](../doc/INSTALL.md) instructions for these dependencies.

You can also use a conda environment (set up with [miniforge](https://mhm-ufz.org/guides/install-unix/) for example)
to get everything:
```bash
conda install -y pip netcdf-fortran fortran-compiler c-compiler cxx-compiler
```

To compile everything after cloning/downloading, you can use pip:

```bash
pip install -v .
```

To install it directly from the git repository you can type:

```bash
pip install -v git+https://git.ufz.de/mhm/mhm.git
```

### Environment variables

The following environment variables can be used to control the compilation and installation of the python bindings for mHM:

- `SKBUILD_CMAKE_BUILD_TYPE=[Release|Debug]`: build type for the mhm library (default: `Release`)
- `MHM_BUILD_FORCES_PATH=<path>`: custom path to forces source dir (default: None)
- `MHM_BUILD_PARALLEL=[0|1]`: whether to use OpenMP with mHM (default: `0`)


## Test domain download tool

Together with the Python bindings comes a command line script to download the test domains:
```bash
mhm-download --verbose --branch develop --domain 1 --path mhm_domain/
```

You can then run mHM on this test domain with:
```bash
mhm mhm_domain/
```

You can get help on how to use this script with `mhm-download -h`:
```
$ mhm-download -h
usage: mhm-download [-h] [-V] [-v] [-b BRANCH] [-d {1,2}] [-p PATH]

Download tool to retrieve the test domains for mHM.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         display version information
  -v, --verbose         be verbose (default: False)
  -b BRANCH, --branch BRANCH
                        branch, tag, or commit of the mHM repository to take the test domain from,
                        by default tag determined from the mHM version (default: None)
  -d {1,2}, --domain {1,2}
                        test domain '1' or '2' (default: 1)
  -p PATH, --path PATH  destination path for the downloaded folder,
                        by default the original folder name in the current directory (default: None)
```

Within python scripts, you can use this tool with `mhm.download_test`. See below for examples.


## Documentation

See `mhm.tools` and `wrapper.f90` for further information on the provided routines.


## Examples

If you have cloned the repository, you can do the following to simply run mhm without optimization:

```python
import mhm

# download test domain 1
mhm.download_test(path="example_domain")
# run the downloaded example
mhm.model.init(cwd="example_domain")
mhm.model.run()
mhm.model.finalize()
```

Or you can do the following to control each timestep:
```python
import mhm

# assuming to run from the mhm repo root
mhm.model.init()
mhm.run.prepare()
ndomians = mhm.run.get_ndomains()
for i in range(1, ndomians + 1):
    mhm.run.prepare_domain(domain=i) # 0 by default
    while not mhm.run.finished():
        mhm.run.do_time_step()
        mhm.run.write_output()
    mhm.run.finalize_domain()
mhm.run.finalize()
mhm.model.finalize()
```

See also the `examples` folder.


## License

LGPLv3 (c) 2005-2023 mHM-Developers

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mhm",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mHM",
    "author": "",
    "author_email": "mHM Developers <mhm-admin@ufz.de>",
    "download_url": "https://files.pythonhosted.org/packages/d2/35/fdb0dd51e92dcc3c23926e0f5da52074df8f0a72ce560b34c442f1609ac6/mhm-5.13.1.tar.gz",
    "platform": null,
    "description": "# mHM - Python bindings\n\n[TOC]\n\nPython bindings to control mHM.\n\nThe wrapper (`mhm/wrapper.f90`) is just a small layer on top of the\ninterfaces provided by mHM to be compatible with [f2py](https://numpy.org/doc/stable/f2py/index.html).\n\n\n## Installation\n\nThere is a [PyPI package](https://pypi.org/project/mhm) to install the latest release:\n\n```bash\npip install mhm\n```\n\nInstalling the mHM Python package will provide the `mhm` command to execute mHM the traditional way.\n\nIn order to compile the Python bindings from scratch you need:\n1. [Python](https://www.python.org/) with version at least v3.8 and [pip](https://pip.pypa.io/)\n2. a Fortran, a C and a C++ compiler (set the environment variables `FC` (and `F77`), `CC` and `CXX` accordingly).\n    In case of gcc, this could look like:\n    ```bash\n    export FC=\"gfortran\"\n    export F77=\"gfortran\"\n    export CC=\"gcc\"\n    export CXX=\"g++\"\n    ```\n3. [NetCDF-Fortran](https://github.com/Unidata/netcdf-fortran) installed in your system path\n\nSee the [Compilation](../doc/INSTALL.md) instructions for these dependencies.\n\nYou can also use a conda environment (set up with [miniforge](https://mhm-ufz.org/guides/install-unix/) for example)\nto get everything:\n```bash\nconda install -y pip netcdf-fortran fortran-compiler c-compiler cxx-compiler\n```\n\nTo compile everything after cloning/downloading, you can use pip:\n\n```bash\npip install -v .\n```\n\nTo install it directly from the git repository you can type:\n\n```bash\npip install -v git+https://git.ufz.de/mhm/mhm.git\n```\n\n### Environment variables\n\nThe following environment variables can be used to control the compilation and installation of the python bindings for mHM:\n\n- `SKBUILD_CMAKE_BUILD_TYPE=[Release|Debug]`: build type for the mhm library (default: `Release`)\n- `MHM_BUILD_FORCES_PATH=<path>`: custom path to forces source dir (default: None)\n- `MHM_BUILD_PARALLEL=[0|1]`: whether to use OpenMP with mHM (default: `0`)\n\n\n## Test domain download tool\n\nTogether with the Python bindings comes a command line script to download the test domains:\n```bash\nmhm-download --verbose --branch develop --domain 1 --path mhm_domain/\n```\n\nYou can then run mHM on this test domain with:\n```bash\nmhm mhm_domain/\n```\n\nYou can get help on how to use this script with `mhm-download -h`:\n```\n$ mhm-download -h\nusage: mhm-download [-h] [-V] [-v] [-b BRANCH] [-d {1,2}] [-p PATH]\n\nDownload tool to retrieve the test domains for mHM.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -V, --version         display version information\n  -v, --verbose         be verbose (default: False)\n  -b BRANCH, --branch BRANCH\n                        branch, tag, or commit of the mHM repository to take the test domain from,\n                        by default tag determined from the mHM version (default: None)\n  -d {1,2}, --domain {1,2}\n                        test domain '1' or '2' (default: 1)\n  -p PATH, --path PATH  destination path for the downloaded folder,\n                        by default the original folder name in the current directory (default: None)\n```\n\nWithin python scripts, you can use this tool with `mhm.download_test`. See below for examples.\n\n\n## Documentation\n\nSee `mhm.tools` and `wrapper.f90` for further information on the provided routines.\n\n\n## Examples\n\nIf you have cloned the repository, you can do the following to simply run mhm without optimization:\n\n```python\nimport mhm\n\n# download test domain 1\nmhm.download_test(path=\"example_domain\")\n# run the downloaded example\nmhm.model.init(cwd=\"example_domain\")\nmhm.model.run()\nmhm.model.finalize()\n```\n\nOr you can do the following to control each timestep:\n```python\nimport mhm\n\n# assuming to run from the mhm repo root\nmhm.model.init()\nmhm.run.prepare()\nndomians = mhm.run.get_ndomains()\nfor i in range(1, ndomians + 1):\n    mhm.run.prepare_domain(domain=i) # 0 by default\n    while not mhm.run.finished():\n        mhm.run.do_time_step()\n        mhm.run.write_output()\n    mhm.run.finalize_domain()\nmhm.run.finalize()\nmhm.model.finalize()\n```\n\nSee also the `examples` folder.\n\n\n## License\n\nLGPLv3 (c) 2005-2023 mHM-Developers\n",
    "bugtrack_url": null,
    "license": "LGPL-3.0",
    "summary": "Python distribution of mHM with bindings.",
    "version": "5.13.1",
    "project_urls": {
        "Changelog": "https://www.mhm-ufz.org",
        "Conda-forge": "https://anaconda.org/conda-forge/mhm",
        "Documentation": "https://www.mhm-ufz.org",
        "Homepage": "https://www.mhm-ufz.org",
        "Source": "https://www.mhm-ufz.org",
        "Tracker": "https://www.mhm-ufz.org"
    },
    "split_keywords": [
        "mhm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad4794519329dc7e231b1153a13a141057fc9d4506e6b5e56ae7593a8cc0735d",
                "md5": "3fbb705a0c1085de14a679f083d32a02",
                "sha256": "33435a33187ffecf4b96300b8acac398aa2b8dff55f639eb59f5e18e8b89793c"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "3fbb705a0c1085de14a679f083d32a02",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 5196360,
            "upload_time": "2023-08-24T13:43:02",
            "upload_time_iso_8601": "2023-08-24T13:43:02.838244Z",
            "url": "https://files.pythonhosted.org/packages/ad/47/94519329dc7e231b1153a13a141057fc9d4506e6b5e56ae7593a8cc0735d/mhm-5.13.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1480e42889157704c1d4cfd60467bec094077d0c75a38eeaa1dc6223ef1feb3",
                "md5": "d855a04f592b0da7c3347bf642218edc",
                "sha256": "f917039d19f76c2425b9dd821a97d42f927a139895fbb7da0a16dd328360cf9c"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "d855a04f592b0da7c3347bf642218edc",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 5391583,
            "upload_time": "2023-08-24T13:43:05",
            "upload_time_iso_8601": "2023-08-24T13:43:05.225477Z",
            "url": "https://files.pythonhosted.org/packages/f1/48/0e42889157704c1d4cfd60467bec094077d0c75a38eeaa1dc6223ef1feb3/mhm-5.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce580500d3c2f80b597ff56f1a69c5a9e0db8c860fdbdb44eb81daab8f2d9642",
                "md5": "8f1572859397b181d4e24916b0f26c93",
                "sha256": "1a6521268df250bc843d12e5895ef9828e58c8c8a93a292041ba1d3aa60a0ca8"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "8f1572859397b181d4e24916b0f26c93",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 5196298,
            "upload_time": "2023-08-24T13:43:06",
            "upload_time_iso_8601": "2023-08-24T13:43:06.799473Z",
            "url": "https://files.pythonhosted.org/packages/ce/58/0500d3c2f80b597ff56f1a69c5a9e0db8c860fdbdb44eb81daab8f2d9642/mhm-5.13.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a064191daff97f4c1e356636984dbca7d42141199e9beae22f85af5c56f4c513",
                "md5": "49b6c0ed7f1d92bd0c0355658f8f102e",
                "sha256": "ed1748f468e517baa60283f2343ac44259ddcb5920b45f5e26d0bd63dca1b1aa"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "49b6c0ed7f1d92bd0c0355658f8f102e",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 5391399,
            "upload_time": "2023-08-24T13:43:08",
            "upload_time_iso_8601": "2023-08-24T13:43:08.936787Z",
            "url": "https://files.pythonhosted.org/packages/a0/64/191daff97f4c1e356636984dbca7d42141199e9beae22f85af5c56f4c513/mhm-5.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03578b53356715d3d14b172cb1e1af3181b699be3494aa13d471fae3a63f372b",
                "md5": "63fba96f10324b8c8decb3cde0f1c33f",
                "sha256": "222a962c5369b4c8d97bc451f8c962b894e19f5503ff27839fb54863772f4fae"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp38-cp38-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "63fba96f10324b8c8decb3cde0f1c33f",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 5193677,
            "upload_time": "2023-08-24T13:43:10",
            "upload_time_iso_8601": "2023-08-24T13:43:10.554673Z",
            "url": "https://files.pythonhosted.org/packages/03/57/8b53356715d3d14b172cb1e1af3181b699be3494aa13d471fae3a63f372b/mhm-5.13.1-cp38-cp38-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5835a92312a1d23507efa960acd388289943764e67c6a31b0d354c28a1e1a040",
                "md5": "61349ff543217581653194a8eb37fdec",
                "sha256": "da7010489ebc5f9c9439ecb08b91c68988d1eb8d1504d08d484ff6d90087fbb2"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "61349ff543217581653194a8eb37fdec",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 5389100,
            "upload_time": "2023-08-24T13:43:12",
            "upload_time_iso_8601": "2023-08-24T13:43:12.403005Z",
            "url": "https://files.pythonhosted.org/packages/58/35/a92312a1d23507efa960acd388289943764e67c6a31b0d354c28a1e1a040/mhm-5.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bac142451782539fd987670ad4148a564b6c91de1cf73c7bd60419b6938d501b",
                "md5": "0acd9943685a10b4b2289b21743ff738",
                "sha256": "d5214d845bfe7b7627280eb20bfd1425f38fb456c418eb471fbdf52516e78de8"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp39-cp39-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0acd9943685a10b4b2289b21743ff738",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 5195613,
            "upload_time": "2023-08-24T13:43:14",
            "upload_time_iso_8601": "2023-08-24T13:43:14.499380Z",
            "url": "https://files.pythonhosted.org/packages/ba/c1/42451782539fd987670ad4148a564b6c91de1cf73c7bd60419b6938d501b/mhm-5.13.1-cp39-cp39-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f8ad3c242212ddef8b7011c31e03e19edf0100b999105e4219b5341ac14b803e",
                "md5": "5e757b8006e432202a723cfd862ea6c7",
                "sha256": "93d91be1545c40a50d28acf37af9800d96ea8023c281a642009ac4d24c782e26"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "5e757b8006e432202a723cfd862ea6c7",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 5390968,
            "upload_time": "2023-08-24T13:43:16",
            "upload_time_iso_8601": "2023-08-24T13:43:16.036152Z",
            "url": "https://files.pythonhosted.org/packages/f8/ad/3c242212ddef8b7011c31e03e19edf0100b999105e4219b5341ac14b803e/mhm-5.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d235fdb0dd51e92dcc3c23926e0f5da52074df8f0a72ce560b34c442f1609ac6",
                "md5": "a0cdf6c334968c458eb10e96afa032d6",
                "sha256": "acd61f906a6c66b0bee71a22d14b5574ad6aa952b626d7b77e65384928823a24"
            },
            "downloads": -1,
            "filename": "mhm-5.13.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a0cdf6c334968c458eb10e96afa032d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 699704,
            "upload_time": "2023-08-24T13:43:17",
            "upload_time_iso_8601": "2023-08-24T13:43:17.568163Z",
            "url": "https://files.pythonhosted.org/packages/d2/35/fdb0dd51e92dcc3c23926e0f5da52074df8f0a72ce560b34c442f1609ac6/mhm-5.13.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-24 13:43:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mhm"
}
        
Elapsed time: 0.11925s