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

make_planar_hex_mesh(nx, ny, dc, …[, …])

Builds an MPAS periodic, planar hexagonal mesh with the requested dimensions, optionally saving it to a file, and returs it as an xarray.Dataset.

translate(mesh[, xOffset, yOffset])

Translates the coordinate system of the planar MPAS mesh by an arbirary shift in x and/or y

build_mesh.build_spherical_mesh(cellWidth, …)

Build an MPAS mesh using JIGSAW with the given cell sizes as a function of latitude and longitude.

build_mesh.build_planar_mesh(cellWidth, x, …)

Build a planar MPAS mesh

jigsaw_driver.jigsaw_driver(cellWidth, x, y)

A function for building a jigsaw mesh

jigsaw_to_netcdf.jigsaw_to_netcdf(…)

Converts mesh data defined in triangle format to NetCDF

mesh_definition_tools.mergeCellWidthVsLat(…)

mergeCellWidthVsLat: combine two cell width distributions using a tanh function.

mesh_definition_tools.EC_CellWidthVsLat(lat)

Create Eddy Closure spacing as a function of lat.

mesh_definition_tools.RRS_CellWidthVsLat(…)

RRS_CellWidthVsLat - Create Rossby Radius Scaling as a function of lat.

mesh_definition_tools.AtlanticPacificGrid(…)

AtlanticPacificGrid: combine two cell width distributions using a tanh function.

mpas_to_triangle.mpas_to_triangle(mpasfile, …)

open_msh.readmsh(fname)

Reads JIGSAW msh structure and produces a dictionary with values.

signed_distance.signed_distance_from_geojson(fc, …)

Get the distance for each point on a lon/lat grid from the closest point on the boundary of the geojson regions.

signed_distance.mask_from_geojson(fc, …)

Make a rasterized mask on a lon/lat grid from shapes (geojson multipolygon data).

signed_distance.distance_from_geojson(fc, …)

Get the distance for each point on a lon/lat grid from the closest point on the boundary of the geojson regions.

triangle_to_netcdf.triangle_to_netcdf(node, …)

Converts mesh data defined in triangle format to NetCDF

convert(dsIn[, graphInfoFileName, logger])

Use MpasMeshConverter.x to convert an input mesh to a valid MPAS mesh that is fully compliant with the MPAS mesh specification.

cull(dsIn[, dsMask, dsInverse, dsPreserve, …])

Use MpasCellCuller.x to cull cells from a mesh based on the cullCell field in the input file or DataSet and/or the provided masks.

mask(dsMesh[, fcMask, fcSeed, positiveLon, …])

Use MpasMaskCreator.x to create a set of region masks either from mask feature collecitons or from seed points to be used to flood fill

merge_grids([infile1, infile2, outfile, runner])

Merges two MPAS non-contiguous meshes together into a single file

split_grids([infile, outfile1, outfile2, …])

Split two previously merged MPAS non-contiguous meshes together into separate files.

write_netcdf(ds, fileName[, fillValues, format])

Write an xarray Dataset with NetCDF4 fill values where needed

scrip_from_mpas(mpasFile, scripFile[, …])

Create a SCRIP file from an MPAS mesh

Ocean Tools

add_critical_land_blockages(dsMask, dsBlockages)

param dsMask

The mask to which critical blockages should be added

widen_transect_edge_masks(dsMask, dsMesh[, …])

param dsMask

The mask to which critical blockages should be added

make_moc_basins_and_transects(gf, …[, …])

Builds features defining the ocean basins and southern transects used in computing the meridional overturning circulation (MOC) :param gf: An object that knows how to download and read geometric featuers :type gf: GeometricFeatures :param mesh_filename: A file with MPAS mesh information :type mesh_filename: str :param mask_and_transect_filename: A file to write the MOC region masks and southern-boundary transects to :type mask_and_transect_filename: str :param geojson_filename: A file to write MOC regions to :type geojson_filename: str, optional :param mask_filename: A file to write MOC region masks to :type mask_filename: str, optional :param logger: A logger for the output if not stdout :type logger: logging.Logger, optional

build_moc_basins(gf[, logger])

Builds features defining the ocean basins used in computing the meridional overturning circulation (MOC) :param gf: An object that knows how to download and read geometric featuers :type gf: GeometricFeatures :param logger: A logger for the output if not stdout :type logger: logging.Logger, optional

coastal_refined_mesh(params[, cell_width, …])

create_background_mesh(grd_box, ddeg, …[, …])

extract_coastlines(nc_file, nc_vars, region_box)

distance_to_coast(coastlines, lon_grd, …)

compute_cell_width(D, cell_width, lon, lat, …)

save_matfile(cell_width, lon, lat)

CPP_projection(lon, lat, origin)

smooth_coastline(x, y, window)

get_data_inside_box(lon, lat, data, box[, idx])

get_indices_inside_quad(lon, lat, box[, grid])

get_convex_hull_coordinates(box)

plot_coarse_coast(ax, plot_box)

plot_region_box(box, color)

inject_bathymetry(mesh_file)

inject_meshDensity_from_file(cw_filename, …)

Add a meshDensity field into an MPAS mesh. The mesh density is defined as: meshDensity = (minCellWidth / cellWidth)**4.

inject_spherical_meshDensity(cellWidth, lon, …)

Add a meshDensity field into a spherical MPAS mesh. The mesh density is defined as: meshDensity = (minCellWidth / cellWidth)**4.

inject_planar_meshDensity(cellWidth, x, y, …)

Add a meshDensity field into a planar MPAS mesh. The mesh density is defined as: meshDensity = (minCellWidth / cellWidth)**4.

inject_preserve_floodplain(mesh_file, …)

Visualization

extract_vtk(filename_pattern[, …])

Extract fields from a time series of NetCDF files as VTK files for plotting in paraview.