API reference
This page provides an auto-generated summary of the polaris API. For more details and examples, refer to the relevant sections in the main part of the documentation.
Components
polaris framework
Command-line interface
Entry point for the main script |
list
|
List the available tasks |
|
setup
|
Set up one or more tasks |
|
Set up one or more tasks |
suite
|
Set up a suite of tasks |
run
|
Unpickle the suite |
|
Set up the config object from the config file |
|
Load each dependency from its pickle file to pick up changes that may have happened since it ran |
|
Write a file to indicate that the step has completed. |
|
Run the given suite or task |
|
Used by the framework to run a step when |
|
The outcome of running a task as part of a suite |
|
Write the machine-readable results of a suite run |
cache
|
Cache one or more polaris output files for use in a cached variant of the test case or step |
mpas_to_yaml
Base Classes
Component
|
The base class for housing all the tasks for a given component, such as ocean, landice, or seaice |
|
Add a task to the component |
|
Add a step to the component |
|
Remove the given step from this component |
|
Add a shared config to the component |
|
Get a shared config from the component if it exists, otherwise build and add it. |
|
Configure the component |
Whether this component has a model executable, and therefore whether options like the path to that executable apply to it. |
|
|
Build the model for this component. |
|
Check that the model this component will run is compatible with this version of polaris. |
|
Get a shared step from the component if it exists, otherwise create and add it. |
|
Construct and store the active parallel system for this component |
|
Get available resources from the active parallel system |
|
Run a command using the active parallel system |
Task
|
The base class for tasks---such as a decomposition, threading or restart test---that are made up of one or more steps |
Modify the configuration options for this task. |
|
|
Add a step to the task and component (if not already present) |
|
Remove the given step from this task and the component |
|
Replace the task's config parser with the shared config parser |
Step
|
The base class for a step of a tasks, such as setting up a mesh, creating an initial condition, or running the component forward in time. |
|
Update the resources for the subtask. |
|
Constrain |
Set up the task in the work directory, including downloading any dependencies. |
|
Update attributes of the step at runtime before calling the |
|
|
Run the step. |
|
Get the absolute path to a file or directory in the step's work directory |
|
Add an input file to the step (but not necessarily to the MPAS model). |
|
Add the output file to the step |
|
Add a single conservation comparison for an output file |
|
Add step as a dependency of this step (i.e. this step can't run until the dependency has finished). |
Compare variables between output files in this step and in the same step from a baseline run if one was provided. |
|
Check conservation properties of the output files of this step. |
|
|
Replace the step's config parser with the shared config parser |
ModelStep
|
|
Setup the command-line arguments |
|
|
Update the resources for the step. |
|
Add the replacement model config options to be parsed when generating a namelist or yaml file if and when the step gets set up. |
|
Add a file with updates to yaml config options to the step to be parsed when generating a complete yaml file if and when the step gets set up. |
|
A mapping between model config options from different models. |
|
A mapping between model config options from different models. |
|
A mapping from yaml model config options to namelist options. |
|
Add a file with updates to namelist options to the step to be parsed when generating a complete namelist file if and when the step gets set up. |
|
Add a streams file to the step to be parsed when generating a complete streams file if and when the step gets set up. |
|
Add model config options, namelist, streams and yaml files using config options or template replacements that need to be set both during step setup and at runtime |
Update IO task model config options, make graph file, and partition graph file (if any of these are requested) |
|
Process the model as an input, then call the parent class' version |
|
|
Modify model config options so the number of IO tasks and the stride between them are consistent with how MPI tasks are distributed across nodes (one IO task per node). |
|
Partition the domain for the requested number of tasks |
analysis
analysis.manifest
|
One published product: a plot, the data behind it, and the facets that identify it |
Get the product as a dictionary ready to be written to JSON |
|
|
Build a product from a dictionary read back from JSON |
|
The products one step made, written beside its outputs so that a collector can find them without knowing how the work was divided into steps |
|
Describe one product this step has just made |
|
Write the fragment describing everything this step made |
|
Get the zero-padded range of years a product covers, if it covers one |
|
Read one manifest fragment written by a step |
analysis.publish
|
Publish every product the fragments describe into the staging tree |
|
Get the name one of a product's files is published under |
|
Write the merged manifest that defines the published set |
analysis.thumbnail
|
Render the thumbnail for one plot, unless it is already up to date |
|
Get the name of the thumbnail for a published file |
|
Get the size of an image in pixels |
analysis.site
|
Generate the static site over the products that have been published |
|
Get the name of the page holding one gallery |
attrs
|
Replace the attributes of |
component_graph
|
Get the components referenced by the given tasks: the component of each task, of each step in those tasks and, recursively, of each step dependency. |
|
Get the steps in the given tasks and in their dependencies, grouped by the component that owns each step. |
config
|
A "meta" config parser that keeps a dictionary of config parsers and their sources to combine when needed. |
A method that can be overridden to add config options during polaris setup |
coriolis
|
Add Coriolis fields to a mesh dataset based on the |
|
Add beta-plane Coriolis fields to a horizontal mesh dataset. |
|
Add constant Coriolis fields to a horizontal mesh dataset. |
|
Add Coriolis fields for a sphere rotated by angle |
|
Add Coriolis fields for the Earth's rotation axis. |
|
Add zero-valued Coriolis fields to a horizontal mesh dataset. |
io
|
Download a file from a URL to the given path or path name |
|
From https://stackoverflow.com/a/55742015/7728169 Create a symbolic link named link_name pointing to target. |
job
|
logging
|
Log the module path and file path of a call to a method, e.g.. |
constants
|
Get constants from the Physical Constants Dictionary (PCD) if available, otherwise from the temporary dictionary of constants. |
constants.pcd
|
Get a constant from the Physical Constants Dictionary (PCD). |
Get the PCD version from Polaris' packaged |
|
|
Get the PCD version from a |
|
Check that the PCD version in Polaris matches the version in a branch. |
mesh
|
Whether an MPAS mesh is planar, based on the |
|
Whether an MPAS mesh is on a sphere, based on the |
|
Compute number of grid cells in each direction for the uniform, hexagonal planar mesh with the given physical sizes and resolution. |
|
Find, for each local edge of each cell, whether the neighboring cell across that edge and across the next and previous edges around the same cell belong to the domain. |
|
Count the active edges of each cell. |
|
Find the cells with at least one active vertex, meaning a vertex all of whose surrounding cells are in the domain. |
|
Find the active edges across which a B-grid can move sea ice. |
|
Find the cells of the domain that are connected to at least one seed cell. |
|
Find the cells nearest to a set of seed points. |
|
Get the Cartesian coordinates of the mesh elements at a given location as a single array |
Compute the normal vector for each edge in a mesh |
|
Compute the weights and stencil indices needed for reconstruction a edge normal vector field at cell or vertex centers |
|
Add vector-reconstruction stencil and weight fields to a mesh dataset. |
|
Reconstruct a tangential vector field from an edge-normal vector field. |
|
Convert a vector field from Cartesian coordinates to local geographic coordinates (zonal, meridional, radial) at the reconstruction point. |
|
Get the variables in a reconstruction-weights file that should be compared against a baseline |
|
Variables in an MPAS mesh file to compare against a baseline. |
|
Variables in a lon/lat cell-width file to compare against a baseline |
|
|
A base class for steps that create a JIGSAW spherical mesh |
Add output files |
|
Finish up the step. |
|
Save the cell width field on a lon/lat grid to |
|
|
A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. |
Add JIGSAW options based on config options |
|
Run this step of the task |
|
A function for creating cell width array for this mesh on a regular latitude-longitude grid. |
|
Build the JIGSAW mesh. |
|
|
A step for creating an icosahedral JIGSAW mesh |
Add JIGSAW options based on config options |
|
Run this step of the task |
|
Make the JIGSAW mesh. |
|
A function for creating cell width array for this mesh on a regular latitude-longitude grid. |
|
|
Find the number of subdivisions of an icosahedron to achieve a resolution as close as possible to |
|
Get the approximate cell width for an icosahedral mesh given either a number of subdivisions of the icosahedron. |
|
|
|
|
|
Compute the local east and north vectors at a given point on the sphere |
Check MPAS cell polygons for nearly duplicate or collinear vertices. |
Spherical Base Meshes
Read-only proxy of a mapping. |
|
|
Immutable metadata for one supported simple base mesh. |
|
Add one supported spherical base mesh step to a component. |
|
Get metadata for one supported simple base mesh. |
Get the supported simple base-mesh names in registration order. |
|
Get a list of supported base mesh steps from the mesh component |
|
|
|
|
A step for creating Rossby Radius Scaled (RRS) variable resolution meshes |
Create cell width array for this mesh on a regular latitude-longitude grid |
|
|
A step for creating Southern Ocean (SO) regionally refined meshes |
Create cell width array for this mesh on a regular latitude-longitude grid |
|
Build a Southern Ocean background field on a regular lat-lon grid. |
Coastlines and Critical Transects
Built-in immutable sequence. |
|
variables in a coastline file to compare against a baseline |
|
|
Build coastline datasets from combined topography. |
|
Build a coastline dataset for one coastline convention. |
|
Compute the signed distance to the coastline of an ocean mask. |
Rasterize critical land blockages and passages onto a lat-lon grid. |
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
|
Default critical transect collections shared across mesh workflows. |
Load the default critical transects from |
Unified Meshes
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
|
Load default, generic workflow and per-mesh unified-mesh configs. |
|
Get the unified-mesh family object for a combined mesh config. |
Get a representative background ocean cell width from unified config. |
|
|
Get the finest configured cell width from unified mesh settings. |
|
A unified spherical mesh step with direct retained-river geometry input. |
Link retained-river products in addition to the sizing field. |
|
Read the cell width, lon, and lat directly from sizing_field.nc. |
|
|
Build the JIGSAW mesh with river polylines added to the geometry. |
|
|
The default unified-mesh family for built-in ocean backgrounds. |
|
Build a 2D ocean-background field in km from the default family modes. |
|
The Southern Ocean unified-mesh family. |
|
Build the effective ocean mask by emulating the MPAS cull. |
|
Block-average a 2D field by an integer factor in both dimensions. |
|
Box-average a fraction over a local window of |
|
Dilate rasterized passage lines to a swath proportional to the local ocean background cell width. |
|
Keep the connected components of a mask that contain seed points. |
|
Grow a flood-filled ocean mask into connected regions whose fraction is at least |
|
Compute great-circle distance in meters. |
|
Read a GeoJSON file into a dictionary. |
|
Write a GeoJSON feature collection. |
model_step
|
Make a graph file from the MPAS mesh for use in the Metis graph partitioning software |
build
|
Build MPAS-Ocean on the current machine. |
|
Make a shell script for checking out MPAS-Ocean and its submodules and building MPAS-Ocean. |
|
Build Omega on the current machine. |
|
Make a shell script for checking out Omega and its submodules and building Omega. |
|
Read the record of the source that Polaris built a model from. |
mpas
|
Get the appropriate area (on cells, vertices or edges) for the given field |
|
Convert a cell mask to edge mask using mesh connectivity information |
|
Determine the time index closest to the target time |
parallel
|
Set the active parallel system on every component referenced by the task and step graph. |
Check that the installed mache can confine a launch to part of an allocation. |
namelist
|
Parse the replacement namelist options from the given file |
|
Read the defaults file |
|
Replace entries in the namelist using the replacements dict |
|
Write the namelist out |
provenance
|
Write a file with provenance, such as the git version, conda packages, command, and tasks, to the work directory. |
|
Get a short provenance of the Polaris that is running |
remap
|
A step for creating a mapping file between grids |
Create the mappping file |
resolution
|
Convert a resolution to a subdirectory name (e.g. '240km', '30m', '0.1cm'). |
|
Convert a resolution to a string and its units |
streams
|
Parse the given streams file |
|
write the streams XML data to the file |
|
Update a stream or its children (sub-stream, var, etc.) starting from the defaults or add it if it's new. |
|
Parse the given streams file |
validate
|
compare variables in the two files |
|
Merge one diff summary into another in place, keeping the largest l_infinity difference found for each variable |
viz
|
Add a title to a figure, sized so that it fits across the figure |
Identify the variable prefix and time variable for MPAS datasets |
|
|
Return a Cartopy projection by string name. |
Return the whole dictionary of MPAS variables and default viz properties |
|
|
A context manager that applies the Polaris matplotlib style for the duration of a plot and restores the previous settings afterwards |
|
Plot a horizontal field from a planar domain using x,y coordinates at a single time and depth slice. |
|
Plots a data set as a longitude-latitude map |
|
Plots a data set as a longitude-latitude map |
yaml
A class for reading writing and combining config files in yaml format (e.g. as used in Omega). |
|
|
Add config options from a yaml file |
|
Add config options from a dictionary |
|
Write config options to a yaml file |
|
Add config options from a yaml file |
|
Add config options from a yaml file |