Skip to content

Commit

Permalink
Fixup docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Jan 11, 2024
1 parent a3d3b14 commit d017f7b
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 24 deletions.
45 changes: 43 additions & 2 deletions polaris/ocean/ice_shelf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@
class IceShelfTask(Task):

"""
shared_steps : dict of dict of polaris.Steps
The shared steps to include as symlinks
A class for tasks with domains containing ice shelves
Attributes
----------
sshdir : string
The directory to put the ssh_adjustment steps in
component : polaris.ocean.Ocean
The ocean component that this task belongs to
resolution : float
The resolution of the test case in km
"""
def __init__(self, component, resolution, name, subdir, sshdir=None):
"""
"""
if sshdir is None:
sshdir = subdir
super().__init__(component=component, name=name, subdir=subdir)
Expand All @@ -24,6 +36,35 @@ def setup_ssh_adjustment_steps(self, init, config, config_filename,
yaml_filename='ssh_forward.yaml',
yaml_replacements=None):

"""
Parameters
----------
init : polaris.Step
the step that produced the initial condition
config : polaris.config.PolarisConfigParser
The configuration for this task
config_filename : str
the configuration filename
package : Package
The package name or module object that contains ``namelist``
from which ssh_forward steps will derive their configuration
yaml_filename : str, optional
the yaml filename used for ssh_forward steps
yaml_replacements : Dict, optional
key, string combinations for templated replacements in the yaml
file
Returns
-------
shared_step : polaris.Step
the final ssh_adjustment step that produces the input to the next
forward step
"""
resolution = self.resolution
component = self.component
indir = self.sshdir
Expand Down
18 changes: 13 additions & 5 deletions polaris/ocean/ice_shelf/ssh_adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ def __init__(self, component, resolution, init, forward, indir=None,
Parameters
----------
component : polaris.ocean.Ocean
The ocean component that this task belongs to
resolution : float
The resolution of the test case in m
coord_type: str
The coordinate type (e.g., 'z-star', 'single_layer', etc.)
init : polaris.Step
the step that produced the initial condition
forward: polaris.Step
the step that produced the state which will be adjusted
iteration : int, optional
the iteration number
indir : str, optional
the directory the step is in, to which ``name`` will be appended
name : str, optional
the name of this step
"""
self.resolution = resolution

Expand All @@ -46,7 +55,6 @@ def run(self):
"""
Adjust the sea surface height or land-ice pressure to be dynamically
consistent with one another.
"""
logger = self.logger
config = self.config
Expand Down
32 changes: 26 additions & 6 deletions polaris/ocean/ice_shelf/ssh_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ class SshForward(OceanModelStep):
resolution : float
The resolution of the task in km
dt : float
The model time step in seconds
package : Package
The package name or module object that contains ``namelist``
btr_dt : float
The model barotropic time step in seconds
yaml_filename : str, optional
the yaml filename used for ssh_forward steps
yaml_replacements : Dict, optional
key, string combinations for templated replacements in the yaml
file
"""
def __init__(self, component, resolution, mesh, init,
name='ssh_forward', subdir=None,
Expand All @@ -37,16 +41,32 @@ def __init__(self, component, resolution, mesh, init,
name : str
the name of the task
mesh: polaris.Step
The step used to produce the mesh
init: polaris.Step
The step used to produce the initial condition
subdir : str, optional
the subdirectory for the step. If neither this nor ``indir``
are provided, the directory is the ``name``
indir : str, optional
the directory the step is in, to which ``name`` will be appended
package : str, optional
where ssh_forward steps will derive their configuration
yaml_filename : str, optional
the yaml filename used for ssh_forward steps
yaml_replacements : Dict, optional
key, string combinations for templated replacements in the yaml
file
iteration : int, optional
the iteration number
indir : str, optional
the directory the step is in, to which ``name`` will be appended
ntasks : int, optional
the number of tasks the step would ideally use. If fewer tasks
are available on the system, the step will run on all available
Expand Down
15 changes: 10 additions & 5 deletions polaris/ocean/tasks/ice_shelf_2d/default/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
class Default(IceShelfTask):
"""
The default ice shelf 2d test case simply creates the mesh and
initial condition, then performs a short forward run.
initial condition, then performs a short forward run. Optionally,
tidal forcing can be added or visualization and restart steps.
Attributes
----------
include_viz : bool
Include Viz step
"""

def __init__(self, component, resolution, indir, init, config,
Expand All @@ -33,10 +32,16 @@ def __init__(self, component, resolution, indir, init, config,
The directory the task is in, to which the test case name will be
added
include_viz : bool
config : polaris.config.PolarisConfigParser
The configuration for this task
include_viz : bool, optional
Include VizMap and Viz steps for each resolution
include_tides: bool
include_restart : bool, optional
Include restart and validation steps to test restart capabilities
include_tides : bool, optional
Include tidal forcing in the forward step
"""
if include_tides and include_restart:
Expand Down
14 changes: 13 additions & 1 deletion polaris/ocean/tasks/ice_shelf_2d/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ def __init__(self, component, resolution, mesh, init,
resolution : km
The resolution of the task in km
name : str
mesh: polaris.Step
The step used to produce the mesh
init: polaris.Step
The step used to produce the initial condition
name : str, optional
the name of the task
subdir : str, optional
Expand All @@ -50,6 +56,12 @@ def __init__(self, component, resolution, mesh, init,
openmp_threads : int, optional
the number of OpenMP threads the step will use
do_restart : bool, optional
if true, the step is restart from another forward run
tidal_forcing : bool, optional
if true, apply tidal forcing in the forward step
"""
if do_restart:
name = 'restart'
Expand Down
7 changes: 4 additions & 3 deletions polaris/ocean/tasks/ice_shelf_2d/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Validate(Step):
Attributes
----------
step_subdirs : list of str
The number of processors used in each run
The steps to be compared (full run and restart run)
"""
def __init__(self, component, step_subdirs, indir):
"""
Expand All @@ -21,10 +21,11 @@ def __init__(self, component, step_subdirs, indir):
The component the step belongs to
step_subdirs : list of str
The number of processors used in each run
The steps to be compared (full run and restart run)
indir : str
the directory the step is in, to which ``name`` will be appended
the directory the step is in, to which ``validate`` will be
appended
"""
super().__init__(component=component, name='validate', indir=indir)

Expand Down
14 changes: 12 additions & 2 deletions polaris/ocean/tasks/ice_shelf_2d/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ def __init__(self, component, indir, mesh, init):
Parameters
----------
test_case : compass.TestCase
The test case this step belongs to
component : polaris.Component
The component the step belongs to
indir : str, optional
the directory the step is in, to which ``viz`` will be appended
mesh: polaris.Step
The step used to produce the mesh
init: polaris.Step
The step used to produce the initial condition
"""
super().__init__(component=component, name='viz', indir=indir)
self.add_input_file(
Expand Down

0 comments on commit d017f7b

Please sign in to comment.