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 |
Config
A "meta" config parser that keeps a dictionary of config parsers and their sources to combine when needed. |
|
|
Add a the contents of a user config file to the parser. |
|
Add the contents of a config file to the parser. |
|
Add the contents of a config file to the parser. |
|
Get an option value for a given section. |
|
Get an option integer value for a given section. |
|
Get an option float value for a given section. |
|
Get an option boolean value for a given section. |
|
Get an option value as a list for a given section. |
|
Get an option as an expression (typically a list, though tuples and dicts are also available). |
|
Whether the given section is part of the config |
|
Whether the given section has the given option |
|
Set the value of the given option in the given section. The file from |
|
Write the config options to the given file pointer. |
Get a deep copy of the config parser |
|
|
Get get the config options for a given section. |
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 |
CIME constants
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 |
|
Plot images of the given variables on the given transects. |
|
Plots an inset map showing the location of a transect or polygon. |
Sea-ice Tools
|
Add a field |
|
A low-level function for writing a SCRIP file for the given MPAS-Seaice mesh |
|
Write a SCRIP file for the given 2D grid |
|
Write a SCRIP file for cel quantities on the given MPAS-Seaice mesh |
Write a SCRIP file for vertex quantities on the given MPAS-Seaice mesh |
|
Generate graph partition(s) for the given MPAS-Seaice mesh and the given number(s) of processors and a file defining regions that each processor should own part of (typically a polar region and an equatorial region) |
An entry point for performing preparatory work for making seaice partitions |
|
An entry point for creating sea-ice partitions |
|
|
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 |
|
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 |