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 |
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 |
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. |
|
Add an input file to the step (but not necessarily to the MPAS model). |
|
Add the output file that must be produced by this step and may be made available as an input to steps, perhaps in other tasks. |
|
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. |
|
|
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 PIO namelist 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 the namelist so the number of PIO tasks and the stride between them consistent with the number of nodes and cores (one PIO task per node). |
|
|
Partition the domain for the requested number of tasks |
components
Get a list of components, which in turn contain lists tasks |
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 |
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. |
|
Fix permissions on the databases where files were downloaded so everyone in the group can read/write to them |
job
|
|
|
Get Slurm options |
|
Clean up whitespace after jinja templating |
logging
|
Log the module path and file path of a call to a method, e.g.. |
mesh
|
Compute number of grid cells in each direction for the uniform, hexagonal planar mesh with the given physical sizes and resolution. |
|
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. |
model_step
|
Make a graph file from the MPAS mesh for use in the Metis graph partitioning software |
mpas
|
Get the appropriate area (on cells, vertices or edges) for the given field |
|
Determine the time index closest to the target time |
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 |
parallel
|
Get the number of total cores and nodes available for running steps |
|
If the system has Slurm, find out the |
|
Run a subprocess with the given command-line arguments and resources |
|
Run a subprocess with the given command-line arguments and resources |
provenance
|
Write a file with provenance, such as the git version, conda packages, command, and tasks, to the work directory |
remap
|
A step for creating a mapping file between grids |
|
Set the source grid from an MPAS mesh file |
|
Set the destination grid from an MPAS mesh file |
|
Set the source grid from a file with a longitude-latitude grid. |
|
Set the destination grid from a file with a longitude-latitude grid. |
|
Set the destination grid from a file with a longitude-latitude grid. |
|
Set the source grid from a file with a projection grid. |
|
Set the destination grid from a file with a projection grid. |
|
Set the destination grid from a file with a collection of points. |
Get the remapper for this step. |
|
Create a remapper and set the command-line arguments |
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 |
viz
Use the Polaris matplotlib style file |
|
|
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 |