Skip to main content

A numerical model of ice shelf development

Project description

MONARCHS

DOI Code style: black

MOdel of aNtARtic iCe shelf Hydrology and Stability

Code associated with the ice shelf surface hydrology model MONARCHS. Please check out the documentation at the MONARCHS website for more info on setting up and running the model, and how best to contribute.

MONARCHS was developed by Sammie Buzzard at Northumbria University and Jon Elsey at the University of Leeds (both formerly Cardiff University), in collaboration with Alex Robel and the Ice and Climate group at Georgia Tech.

It is available and open source under the GPL v3.0-or-later License. If you are planning on using it, we would very much appreciate being kept in the loop. The citation for MONARCHS is (TBD, paper under review).

If you make changes to the code, please feel free to submit a pull request to get your features added into the core model repo. Alternatively, if you have feature requests, please submit an Issue on the GitHub repo, or get in touch with one of the model developers.

The model source code is located in the src/monarchs folder.

If you have any feedback or issues, please submit via Github Issues if a problem with the code, or email Jon Elsey at Newcastle University for help setting up on HPC systems.

Todos

  • Type hints
  • Full unit test suite
  • Longer term - a MONARCHS GUI may be really handy for specifying the inputs in model_setup.
  • MPI - still WIP to get working on e.g. ARCHER2

Installation

Set up a new virtual environment and use it for MONARCHS only, to avoid dependency issues. You can do this using conda create -n monarchs python=3.13 or python -m venv monarchs.

You can install MONARCHS and its core dependencies on your system two ways. To get the latest stable release, you can do:

pip install monarchs-ice

If you want a development version of the model (i.e. one you can edit), do so by cloning this repository and from the project root folder do

python -m pip install -e .

Note that this requires an up-to-date version of pip (e.g. if you get an error related to pyproject.toml-based projects). You may first need to do

python -m pip install --upgrade pip.

If you want changes you have made to be picked up on your system, ensure that you use the -e flag when installing. See pyproject.toml for details.

Installing optional dependencies

The simplest way to install the extra MONARCHS dependencies from an existing build is doing

python -m pip install -r requirements.txt

Alternatively, you can install MONARCHS from scratch with all optional dependencies using

python -m pip install -e .[mpi,numba]

Some systems may be incompatible with certain libraries. For example. the install will fail on NumbaMinpack if you don't have a Fortran/C++ compiler.

To solve, on Windows, you need to get a Fortran compiler. See https://fortran-lang.org/compilers/ On linux, doing apt-get install gfortran build-essential will work.

Alternatively, do pip install -e ., and run with use_numba = False in all of your runscripts.

The installation will fail on mpi4py if you don't have a working MPI installation. On Windows, you need to install https://learn.microsoft.com/en-us/message-passing-interface/microsoft-mpi On Linux, apt-get install mpich should suffice. This is only suggested for advanced users running on HPC systems.

It should be re-iterated that neither NumbaMinpack nor Pyina are required to be installed for the code to run, provided that you set use_numba = False and/or use_mpi = False in your runscript (see below).

Running the model

However you install the model, you can run MONARCHS using

monarchs --input_path <path_to_runscript>

or

python run_monarchs.py --input_path <path_to_runscript>

where <path_to_runscript> is the location of a file with the model running parameters as seen in model_setup.py. You can use -i as shorthand for --input_path.

You may omit --input_path entirely if your runscript is called model_setup.py and is in the same folder you run MONARCHS from. In general, it is recommended to use a separate runscript for each run, and point to these directly.

Plotting output

To plot output, you can do this yourself by adding your relevant plotting functionality to run_monarchs.py, or there are some functions provided in /plots which can help you with this. This is WIP. Additionally, in /scripts there is a script debug_model_state which is useful for loading in a snapshot of the model state and plotting it out, e.g. for looking for the presence of melt lakes quickly.

Issues and pull requests

Please, if possible, submit problems/feature requests via GitHub Issues rather than email. We welcome pull requests from those who have solved bugs or added features themselves!

Debugging

A useful workflow for debugging runs is to re-run it from the last iteration, with optimisations (Numba and parallelism) turned off. This can be done using dump_data = True and specifying a reload_file in model_setup.py.

Testing

Tests are located in the tests folder at the root of the repository. These are separated by type, as some variables are set in model_setup.py that are akin to environment variables, in particular use_numba. They therefore require separate runscripts. See README.md in the tests folder for more info.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monarchs_ice-1.0.3.tar.gz (21.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monarchs_ice-1.0.3-py3-none-any.whl (140.1 kB view details)

Uploaded Python 3

File details

Details for the file monarchs_ice-1.0.3.tar.gz.

File metadata

  • Download URL: monarchs_ice-1.0.3.tar.gz
  • Upload date:
  • Size: 21.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for monarchs_ice-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4e339c772332931fd557ecca66e75765b94d1de1c1a752a3de65b4410a926611
MD5 8d8496e043287a00d7ec628692ae1262
BLAKE2b-256 ef86e6d2c2bcb6395367e93b614d25f00155fa175f5aee0c2431b0f103124383

See more details on using hashes here.

Provenance

The following attestation bundles were made for monarchs_ice-1.0.3.tar.gz:

Publisher: publish_pypi.yml on monarchs-ice/monarchs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file monarchs_ice-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: monarchs_ice-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 140.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for monarchs_ice-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7bd4c31d15eabd17d36264b7fe981df2cd53f510e6997c0104d2ec0d5a1ac7d
MD5 642b2ba9f70431c3028957e25999569e
BLAKE2b-256 0b091bdc11f8e5e5ec5cf86851d606a446aa65a542e61aa3caf1dc0f3a8d36b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for monarchs_ice-1.0.3-py3-none-any.whl:

Publisher: publish_pypi.yml on monarchs-ice/monarchs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page