Skip to main content

Functional tests Pylint codecov Documentation PyPI Python License: CC0-1.0

OCSMesh

OCSMesh is a Python package for processing DEM data into georeferenced unstructured meshes using different meshing engine libraries (Gmsh, Triangle). It builds the domain geometry and the mesh size function from any number of DEM tiles, applies refinements (contours, channels, depth bands, flow limiters, patches, line features) and constraints, and runs the mesh engine. Size functions can be computed serially, on all cores of a node or with MPI across nodes.

Documentation: https://noaa-ocs-modeling.github.io/OCSMesh/

Installation

Two ways of installing OCSMesh are described below:

Using conda

The recommended way to setup the environment for installing OCSMesh is to use conda with the environment.yml file provided in the repo to install required libraries.

You need to make sure you've installed the mesh engine you'd like to use (e.g., Triangle or Gmsh).

First you need to download the environment.yml file.

wget https://raw.githubusercontent.com/noaa-ocs-modeling/OCSMesh/main/environment.yml

conda env create -f environment.yml -n your-env-name
conda activate your-env-name

pip install ocsmesh

From GitHub repo

You need to make sure you've installed the mesh engine you'd like to use (e.g., Triangle or Gmsh).

OCSMesh can be installed from the GitHub repository as follows:

git clone https://github.com/noaa-ocs-modeling/ocsmesh
cd ocsmesh
pip install .[all]

MPI (optional)

MPI execution needs mpi4py built against the MPI library of your machine. environment.yml installs it from conda-forge; on an HPC system, prefer the system MPI (e.g. module load the MPI, then pip install --no-binary mpi4py mpi4py), or pip install ocsmesh[mpi].

Requirements

  • 3.10 <= Python < 3.14
  • CMake
  • C/C++ compilers

Quick start

import ocsmesh

dems = ["tile_1.tif", "tile_2.tif"]       # later inputs take priority
domain = ocsmesh.Geom(dems, zmax=10)      # everything below 10 m

hfun = ocsmesh.Hfun(dems, hmin=50, hmax=3000, method="exact",
                    nprocs=8, execution_mode="parallel")
hfun.add_contour(level=0, expansion_rate=0.01, target_size=100)
hfun.add_constant_value(value=500, lower_bound=-20, upper_bound=0)

mesh = ocsmesh.MeshDriver(domain, hfun, engine_name="gmsh").run()
mesh.write("mesh.2dm", format="2dm", overwrite=True)

Execution modes

execution_mode runs on use it for
"serial" (default) this process small domains, debugging
"parallel" a pool of nprocs processes on one node a workstation or one HPC node
"mpi" MPI ranks under mpiexec/srun, one tile per rank many tiles, several nodes

All modes give the same size function. With MPI every rank runs the script and calls hfun.meshdata(); the result is returned on rank 0. Temporary files go to $TMPDIR, which must be on a shared filesystem for multi-node runs. See Parallel and MPI execution for details.

Contributing

Bug reports and pull requests are welcome; see CONTRIBUTING.md. Changes are listed in CHANGELOG.md.

How to Cite

Title : OCSMesh and an automated creek-to-ocean mesh generation workflow
Personal Author(s) : Cassalho, Felicio;Mani, Soroosh;Moghimi, Saeed;Ye, Fei;Zhang, Y. Joseph;
Journal: Ocean Modelling
Published Date : August 2026
DOI : http://dx.doi.org/10.1016/j.ocemod.2026.102774
Title : OCSMesh: a data-driven automated unstructured mesh generation software for coastal ocean modeling
Personal Author(s) : Mani, Soroosh;Calzada, Jaime R.;Moghimi, Saeed;Zhang, Y. Joseph;Myers, Edward;Pe’eri, Shachak;
Corporate Authors(s) : Coast Survey Development Laboratory (U.S.)
Published Date : 2021
Series : NOAA Technical Memorandum NOS CS ; 47
DOI : https://doi.org/10.25923/csba-m072

Disclaimer

This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.

Metadata

Release files for ocsmesh 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocsmesh 3.1.0
File Size Uploaded Provenance Actions
ocsmesh-3.1.0.tar.gz 2.9 MB Without provenance Details for ocsmesh-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocsmesh 3.1.0
File Interpreter ABI Platform Actions
ocsmesh-3.1.0-py3-none-any.whl Python 3 none any Details for ocsmesh-3.1.0-py3-none-any.whl

Total release size: 5.8 MB

Release files / ocsmesh-3.1.0.tar.gz

Download URL ocsmesh-3.1.0.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
f72429109e1a7df0cd88433df71160a7eec323f54314aa37cf164309d6e4ae78
BLAKE2b-256 checksum
How to use checksums
4fc1b179aa90222dba6be2c6c78c3fbe74ed52e661710bd83a284e1cbe259877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ocsmesh-3.1.0-py3-none-any.whl

Download URL ocsmesh-3.1.0-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fc4a0a307a95134fbfc15b7040f7328e495ddde633d77afe298bd94bd919ccbe
BLAKE2b-256 checksum
How to use checksums
74a0ccd02ee47c317736db54e9f3adc34a8fad9d2b45efb777b10bbe1a6795df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ocsmesh 3.1.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.

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page