API reference¶
This page provides an auto-generated summary of the MPAS mesh-tools API. For more details and examples, refer to the relevant chapters in the main part of the documentation.
MPAS mesh tools¶
Mesh creation¶
|
Builds an MPAS periodic, planar hexagonal mesh with the requested dimensions, optionally saving it to a file, and returns it as an |
|
Build an MPAS mesh using JIGSAW with the given cell sizes as a function of latitude and longitude. |
|
Build a planar MPAS mesh |
|
A function for building a jigsaw mesh |
Converts mesh data defined in triangle format to NetCDF |
|
These functions are tools used to define the |
|
Combine two cell width distributions using a |
|
Create Eddy Closure spacing as a function of lat. |
|
Create Rossby Radius Scaling as a function of lat. |
|
Combine two cell width distributions using a |
|
|
Script to convert from MPAS netCDF format to the Triangle format: https://www.cs.cmu.edu/~quake/triangle.node.html https://www.cs.cmu.edu/~quake/triangle.ele.html |
Get the distance for each point on a lon/lat grid from the closest point on the boundary of the geojson regions. |
|
Make a rasterized mask on a lon/lat grid from shapes (geojson multipolygon data). |
|
Get the distance for each point on a lon/lat grid from the closest point on the boundary of the geojson regions. |
|
Converts mesh data defined in triangle format to NetCDF |
Mesh conversion¶
|
Use |
|
Use |
|
Use |
|
Use shapely and processes to create a set of masks from a feature collection made up of regions (polygons) |
|
Use shapely and processes to create a set of masks from a feature collection made up of transects (line strings) |
|
Flood fill from the given set of seed points to create a contiguous mask. |
|
Use shapely and processes to create a set of masks from a feature collection made up of regions (polygons) on a tensor lon/lat grid |
|
Merges two MPAS non-contiguous meshes together into a single file |
|
Split two previously merged MPAS non-contiguous meshes together into separate files. |
|
Translates the coordinate system of the planar MPAS mesh by an arbitrary shift in x and/or y |
|
Translates the coordinate system of the planar MPAS mesh by shifting the origin to the center of the domain |
|
Translates the coordinate system of the planar MPAS mesh by shifting the origin to the center of the domain described in a separate mesh |
|
Create a SCRIP file from an MPAS mesh |
I/O¶
|
Write an xarray.Dataset to a file with NetCDF4 fill values and the given name of the string dimension. |
Parallelism¶
|
Crate a pool for creating masks with Python multiprocessing. |
Interpolation¶
|
Perform bilinear interpolation of |
Ocean Tools¶
Add the masks associated with one or more transects to the land mask |
|
Alter critical passages at polar latitudes to be at least two cells wide, to avoid sea ice blockage |
|
Find ocean cells that are land-locked, and alter the cell mask so that they are counted as land cells. |
|
|
Builds features defining the ocean basins and southern transects used in computing the meridional overturning circulation (MOC) |
|
|
|
Build an MPAS mesh using JIGSAW with the given cell sizes as a function of latitude and longitude |
|
Build a planar MPAS mesh |
name: coastal_tools authors: Steven Brus |
|
|
Optionally create a background field of cell widths, then add a region of refined resolution to the cell widths. |
Create a background field of cell widths |
|
|
Extracts a set of coastline contours |
|
Extracts a set of coastline contours |
|
Blend cell widths from the input field with the new resolution in the refined region determined by the distance to the coastline contour. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Add a 1D depth coordinate to an MPAS-Ocean file. |
|
Add a 3D, time-independent depth coordinate to an MPAS-Ocean file. |
|
Add a 3D, time-independent depth coordinate to an MPAS-Ocean file. |
|
Computes depth and depth bounds given refBottomDepth |
|
Computes zMid given data arrays for bottomDepth, maxLevelCell and layerThickness |
|
|
Add a |
|
Add a |
|
Add a |
|
|
Construct a vertical coordinate for a transect produced by |
Interpolate a 3D ( |
|
Interpolate a 3D ( |
|
Interpolate a DataArray on the original transect grid to triangle nodes on the MPAS-Ocean transect. |
|
|
Get a set of line segments that outline the given transect |
Logging¶
|
Call the given subprocess with logging to the given logger. |
|
A context manager for creating a logger or using an existing logger |
Transects¶
|
Subdivide each segment of the transect so the horizontal resolution approximately matches the requested resolution |
|
Cartesian transect points to great-circle distance |
|
Subdivide each segment of the transect so the horizontal resolution approximately matches the requested resolution |
|
Convert from lon/lat to Cartesian x, y, z |
|
Convert from Cartesian x, y, z to lon/lat |
|
Compute angular distance between points on the sphere, following: https://en.wikipedia.org/wiki/Great-circle_distance |
|
Based on https://stackoverflow.com/a/26669130/7728169 Determine if the great circle arc from |
|
Based on https://stackoverflow.com/a/26669130/7728169 Find the intersection point between great circle arc from |
|
A class for representing Cartesian vectors with |
Visualization¶
|
Extract fields from a time series of NetCDF files as VTK files for plotting in ParaView. |
|
Construct a dataset in which each MPAS cell is divided into the triangles connecting pairs of adjacent vertices to cell centers. |
|
Make a KD-Tree for finding triangle edges that are near enough to transect segments that they might intersect |
|
Find “nodes” where the transect intersects the edges of the triangles that make up MPAS cells. |
Find “nodes” where the transect intersects the edges of the triangles that make up MPAS cells. |
Register all SciVisColor colormaps with matplotlib |
Tests¶
|
Parse relevant constants from CIME |