Skip to content

Commit f181e31

Browse files
authored
Merge pull request #303 from xylar/reorg-tasks
Reorganize tasks in `polaris.tasks.{component}`
2 parents 5f6d36e + f735393 commit f181e31

File tree

187 files changed

+605
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+605
-605
lines changed

docs/developers_guide/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ seaice/api
190190
### components
191191

192192
```{eval-rst}
193-
.. currentmodule:: polaris.components
193+
.. currentmodule:: polaris.tasks
194194
195195
.. autosummary::
196196
:toctree: generated/

docs/developers_guide/docs.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For examples, see:
2121
- {ref}`dev-ocean` in the Developer's Guide
2222
- {ref}`dev-ocean-baroclinic-channel` tasks in the Developer's Guide
2323

24-
Documentation for each component in the User's guide should include a label
24+
Documentation for each component in the User's guide should include a label
2525
with the name of the component:
2626

2727
```markdown
@@ -42,8 +42,8 @@ In the Developer's Guide, labels have `dev-` prepended to them:
4242

4343
Each category of tasks (e.g. baroclinic channel) should have its own page in
4444
the `tasks` subdirectory of the component. The label for the page should have
45-
have the component name prepended (to make sure it's unique), and each task
46-
(if explicitly labeled) should have the component and category of tasks
45+
have the component name prepended (to make sure it's unique), and each task
46+
(if explicitly labeled) should have the component and category of tasks
4747
prepended to it. Thus, in the User's guide, we have:
4848

4949
```markdown
@@ -84,7 +84,7 @@ case, including:
8484

8585
- A page for each category of tasks with a section for each task:
8686

87-
- A citation or link where the test case that is the basis for the tasks is
87+
- A citation or link where the test case that is the basis for the tasks is
8888
defined (if any)
8989
- A brief overview of the common characteristics of the tasks
9090
- An image showing typical output from one of the tasks
@@ -93,14 +93,14 @@ case, including:
9393
- The following sections as described in the template: description, mesh,
9494
vertical grid, initial conditions, forcing, time step, config, and cores
9595

96-
- A description of any common framework within the component that the test
96+
- A description of any common framework within the component that the test
9797
group or task pages may need to refer to. This should only include
98-
framework that users may need to be aware of, e.g. because of
98+
framework that users may need to be aware of, e.g. because of
9999
{ref}`config-files` or namelist options they may wish to edit.
100100

101101
- A description of each suite, including which tasks are included
102102

103-
A template is available for documenting groups of related tasks in the User's
103+
A template is available for documenting groups of related tasks in the User's
104104
Guide: {ref}`ocean-category-of-task`
105105

106106
The Developer's guide for each component should contain:
@@ -113,22 +113,22 @@ The Developer's guide for each component should contain:
113113
this category
114114
- A description of shared config, namelist and streams files
115115
- A description of shared steps
116-
- A description of any other shared framework code shared between the tasks
116+
- A description of any other shared framework code shared between the tasks
117117
in that category
118118
- A description of each task and its steps
119119

120120
- Technical details on the shared framework for the component
121121

122122
Finally, all functions in the tasks and their shared framework that are part of
123-
the public API (i.e. all functions that don't start with an underscore) should
123+
the public API (i.e. all functions that don't start with an underscore) should
124124
be added to `docs/<component>/api.md`:
125125

126126
````markdown
127127

128128
### baroclinic_channel
129129

130130
```{eval-rst}
131-
.. currentmodule:: polaris.ocean.tasks.baroclinic_channel
131+
.. currentmodule:: polaris.tasks.ocean.baroclinic_channel
132132

133133
.. autosummary::
134134
:toctree: generated/

docs/developers_guide/framework/config.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The {py:meth}`mpas_tools.config.MpasConfigParser.add_from_package()` method can
2222
be used to add the contents of a config file within a package to the config
2323
options. Examples of this can be found in many tasks as well as in the
2424
`polaris.setup` module. Here is a typical example from
25-
{py:class}`polaris.ocean.tasks.inertial_gravity_wave.InertialGravityWave`:
25+
{py:class}`polaris.tasks.ocean.inertial_gravity_wave.InertialGravityWave`:
2626

2727
```python
2828
from polaris import Task
@@ -33,11 +33,11 @@ class InertialGravityWave(Task):
3333
name = 'inertial_gravity_wave'
3434
subdir = f'planar/{name}'
3535
super().__init__(component=component, name=name, subdir=subdir)
36-
36+
3737
...
3838

3939
self.config.add_from_package(
40-
'polaris.ocean.tasks.inertial_gravity_wave',
40+
'polaris.tasks.ocean.inertial_gravity_wave',
4141
'inertial_gravity_wave.cfg')
4242
```
4343

@@ -48,8 +48,8 @@ the file is in the path `polaris/ocean/tasks/baroclinic_channel`
4848
that the config file should always exist, so we would like the code to raise
4949
an exception (`exception=True`) if the file is not found. This is the
5050
default behavior. In some cases, you would like the code to add the config
51-
options if the config file exists and do nothing if it does not. In this
52-
example from {py:func}`polaris.setup.setup_task()`, there may not be a config
51+
options if the config file exists and do nothing if it does not. In this
52+
example from {py:func}`polaris.setup.setup_task()`, there may not be a config
5353
file for the particular machine we're on, and that's fine:
5454

5555
```python
@@ -81,30 +81,30 @@ of functions (`range()`, {py:meth}`numpy.linspace()`,
8181

8282
## Shared config files
8383

84-
Often, it makes sense for many tasks and steps to share the same config
84+
Often, it makes sense for many tasks and steps to share the same config
8585
options. The default behavior is for a task and its "owned" steps to share
86-
a config file in the task's work directory called `{task.name}.cfg` and
86+
a config file in the task's work directory called `{task.name}.cfg` and
8787
symlinks with that same name in each step's work directory. The default for
8888
a shared step is to have its own `{step.name}.cfg` in its work directory.
8989

9090
Developers can create shared config parsers that define the location of the
9191
shared config file and add them to tasks and steps using
92-
{py:meth}`polaris.Task.set_shared_config()` and
92+
{py:meth}`polaris.Task.set_shared_config()` and
9393
{py:meth}`polaris.Step.set_shared_config()`. The location of the shared
9494
config file should be intuitive to users but local symlinks will also make
9595
it easy to modify the shared config options from within any of the tasks and
9696
steps that use them.
9797

98-
As an example, the baroclinic channel tasks share a single
98+
As an example, the baroclinic channel tasks share a single
9999
`baroclinic_channel.cfg` config file for each resolution that resides in the
100100
resolution's work directory:
101101

102102
```python
103103
from polaris.config import PolarisConfigParser
104104
from polaris.ocean.resolution import resolution_to_subdir
105-
from polaris.ocean.tasks.baroclinic_channel.default import Default
106-
from polaris.ocean.tasks.baroclinic_channel.init import Init
107-
from polaris.ocean.tasks.baroclinic_channel.rpe import Rpe
105+
from polaris.tasks.ocean.baroclinic_channel.default import Default
106+
from polaris.tasks.ocean.baroclinic_channel.init import Init
107+
from polaris.tasks.ocean.baroclinic_channel.rpe import Rpe
108108

109109

110110
def add_baroclinic_channel_tasks(component):
@@ -114,7 +114,7 @@ def add_baroclinic_channel_tasks(component):
114114

115115
config_filename = 'baroclinic_channel.cfg'
116116
config = PolarisConfigParser(filepath=f'{resdir}/{config_filename}')
117-
config.add_from_package('polaris.ocean.tasks.baroclinic_channel',
117+
config.add_from_package('polaris.tasks.ocean.baroclinic_channel',
118118
'baroclinic_channel.cfg')
119119

120120
init = Init(component=component, resolution=resolution, indir=resdir)
@@ -126,7 +126,7 @@ def add_baroclinic_channel_tasks(component):
126126
component.add_task(default)
127127

128128
...
129-
129+
130130
component.add_task(Rpe(component=component, resolution=resolution,
131131
indir=resdir, init=init, config=config))
132132
```
@@ -140,8 +140,8 @@ added as follows:
140140

141141
```python
142142
from polaris import Task
143-
from polaris.ocean.tasks.baroclinic_channel.forward import Forward
144-
from polaris.ocean.tasks.baroclinic_channel.rpe.analysis import Analysis
143+
from polaris.tasks.ocean.baroclinic_channel.forward import Forward
144+
from polaris.tasks.ocean.baroclinic_channel.rpe.analysis import Analysis
145145

146146

147147
class Rpe(Task):
@@ -171,7 +171,7 @@ class Rpe(Task):
171171
resolution=resolution, nu=nu)
172172

173173
step.add_yaml_file(
174-
'polaris.ocean.tasks.baroclinic_channel.rpe',
174+
'polaris.tasks.ocean.baroclinic_channel.rpe',
175175
'forward.yaml')
176176
self.add_step(step)
177177

docs/developers_guide/framework/io.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ from polaris.io import symlink
2222

2323
def configure(task, config):
2424
...
25-
with path('polaris.ocean.tasks.global_ocean.files_for_e3sm', 'README') as \
25+
with path('polaris.tasks.ocean.global_ocean.files_for_e3sm', 'README') as \
2626
target:
2727
symlink(str(target), '{}/README'.format(task['work_dir']))
2828
```

docs/developers_guide/framework/model.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ is located and the name of the input yaml file within that package
105105
as arguments to {py:meth}`polaris.ModelStep.add_yaml_file()`:
106106

107107
```python
108-
self.add_yaml_file('polaris.ocean.tasks.global_convergence.cosine_bell',
108+
self.add_yaml_file('polaris.tasks.ocean.global_convergence.cosine_bell',
109109
'forward.yaml')
110110
```
111111

@@ -147,7 +147,7 @@ is located and the name of the input namelist file within that package
147147
as arguments to {py:meth}`polaris.ModelStep.add_namelist_file()`:
148148

149149
```python
150-
self.add_namelist_file('polaris.ocean.tasks.baroclinic_channel',
150+
self.add_namelist_file('polaris.tasks.ocean.baroclinic_channel',
151151
'namelist.forward')
152152
```
153153

@@ -182,7 +182,7 @@ if nu is not None:
182182
# make sure output is double precision
183183
self.add_yaml_file('polaris.ocean.config', 'output.yaml')
184184
185-
self.add_yaml_file('polaris.ocean.tasks.baroclinic_channel',
185+
self.add_yaml_file('polaris.tasks.ocean.baroclinic_channel',
186186
'forward.yaml')
187187
188188
```
@@ -310,7 +310,7 @@ A typical streams file is added by calling
310310
file is located and the name of the input streams file within that package:
311311

312312
```python
313-
self.add_streams_file('polaris.ocean.tasks.baroclinic_channel',
313+
self.add_streams_file('polaris.tasks.ocean.baroclinic_channel',
314314
'streams.forward')
315315
```
316316

@@ -365,7 +365,7 @@ add_streams_file(step, module, 'streams.template',
365365
```
366366

367367
In this example, taken from
368-
{py:class}`polaris.ocean.tasks.global_ocean.mesh.qu240.dynamic_adjustement.QU240DynamicAdjustment`,
368+
{py:class}`polaris.tasks.ocean.global_ocean.mesh.qu240.dynamic_adjustement.QU240DynamicAdjustment`,
369369
we are creating a series of steps that will be used to perform dynamic
370370
adjustment of the ocean model, each of which might have different durations and
371371
restart intervals. Rather than creating a streams file for each step of the

docs/developers_guide/ocean/api.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ocean
22

33
```{eval-rst}
4-
.. currentmodule:: polaris.ocean
4+
.. currentmodule:: polaris.tasks.ocean
55
66
.. autosummary::
77
:toctree: generated/
@@ -14,7 +14,7 @@
1414
### baroclinic_channel
1515

1616
```{eval-rst}
17-
.. currentmodule:: polaris.ocean.tasks.baroclinic_channel
17+
.. currentmodule:: polaris.tasks.ocean.baroclinic_channel
1818
1919
.. autosummary::
2020
:toctree: generated/
@@ -56,7 +56,7 @@
5656
### barotropic_gyre
5757

5858
```{eval-rst}
59-
.. currentmodule:: polaris.ocean.tasks.barotropic_gyre
59+
.. currentmodule:: polaris.tasks.ocean.barotropic_gyre
6060
6161
.. autosummary::
6262
:toctree: generated/
@@ -84,7 +84,7 @@
8484
### cosine_bell
8585

8686
```{eval-rst}
87-
.. currentmodule:: polaris.ocean.tasks.cosine_bell
87+
.. currentmodule:: polaris.tasks.ocean.cosine_bell
8888
8989
.. autosummary::
9090
:toctree: generated/
@@ -121,7 +121,7 @@
121121
### geostrophic
122122

123123
```{eval-rst}
124-
.. currentmodule:: polaris.ocean.tasks.geostrophic
124+
.. currentmodule:: polaris.tasks.ocean.geostrophic
125125
126126
.. autosummary::
127127
:toctree: generated/
@@ -147,7 +147,7 @@
147147
### ice_shelf_2d
148148

149149
```{eval-rst}
150-
.. currentmodule:: polaris.ocean.tasks.ice_shelf_2d
150+
.. currentmodule:: polaris.tasks.ocean.ice_shelf_2d
151151
152152
.. autosummary::
153153
:toctree: generated/
@@ -173,7 +173,7 @@
173173
### inertial_gravity_wave
174174

175175
```{eval-rst}
176-
.. currentmodule:: polaris.ocean.tasks.inertial_gravity_wave
176+
.. currentmodule:: polaris.tasks.ocean.inertial_gravity_wave
177177
178178
.. autosummary::
179179
:toctree: generated/
@@ -202,7 +202,7 @@
202202
### internal_wave
203203

204204
```{eval-rst}
205-
.. currentmodule:: polaris.ocean.tasks.internal_wave
205+
.. currentmodule:: polaris.tasks.ocean.internal_wave
206206
207207
.. autosummary::
208208
:toctree: generated/
@@ -231,7 +231,7 @@
231231
### manufactured_solution
232232

233233
```{eval-rst}
234-
.. currentmodule:: polaris.ocean.tasks.manufactured_solution
234+
.. currentmodule:: polaris.tasks.ocean.manufactured_solution
235235
236236
.. autosummary::
237237
:toctree: generated/
@@ -261,7 +261,7 @@
261261
### single_column
262262

263263
```{eval-rst}
264-
.. currentmodule:: polaris.ocean.tasks.single_column
264+
.. currentmodule:: polaris.tasks.ocean.single_column
265265
266266
.. autosummary::
267267
:toctree: generated/
@@ -284,7 +284,7 @@
284284
### sphere_transport
285285

286286
```{eval-rst}
287-
.. currentmodule:: polaris.ocean.tasks.sphere_transport
287+
.. currentmodule:: polaris.tasks.ocean.sphere_transport
288288
289289
.. autosummary::
290290
:toctree: generated/

docs/developers_guide/ocean/framework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def add_cosine_bell_tasks(component):
327327
'convergence.cfg')
328328
config.add_from_package('polaris.ocean.convergence.spherical',
329329
'spherical.cfg')
330-
config.add_from_package('polaris.ocean.tasks.cosine_bell',
330+
config.add_from_package('polaris.tasks.ocean.cosine_bell',
331331
'cosine_bell.cfg')
332332
```
333333

@@ -381,7 +381,7 @@ class Forward(SphericalConvergenceForward):
381381
refinement_factor : float
382382
The factor by which to scale space, time or both
383383
"""
384-
package = 'polaris.ocean.tasks.cosine_bell'
384+
package = 'polaris.tasks.ocean.cosine_bell'
385385
validate_vars = ['normalVelocity', 'tracer1']
386386
super().__init__(component=component, name=name, subdir=subdir,
387387
resolution=resolution, mesh=mesh,
@@ -505,7 +505,7 @@ The `polaris.ocean.ice_shelf` module provides support for ice shelf tasks.
505505

506506
The {py:class}`polaris.ocean.ice_shelf.IceShelf` class can serve as a parent
507507
class for ice shelf tests, such as
508-
{py:class}`polaris.ocean.tasks.ice_shelf_2d.IceShelf2d`.
508+
{py:class}`polaris.tasks.ocean.ice_shelf_2d.IceShelf2d`.
509509

510510
The {py:meth}`polaris.ocean.ice_shelf.IceShelf.setup_ssh_adjustment_steps()`
511511
sets up `ssh_forward` and `ssh_adjustment` steps from the classes

0 commit comments

Comments
 (0)