-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a step for writing reconstruction coefficients
The coefficients are used to construct 3D Cartesian as well as zonal and meridional components of a field at cell centers from the normal component of the field at edges.
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
compass/ocean/tests/global_ocean/files_for_e3sm/write_coeffs_reconstruct/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
|
||
from compass.io import symlink | ||
from compass.ocean.tests.global_ocean.files_for_e3sm.files_for_e3sm_step import ( # noqa: E501 | ||
FilesForE3SMStep, | ||
) | ||
from compass.ocean.tests.global_ocean.forward import ForwardStep | ||
|
||
|
||
class WriteCoeffsReconstruct(ForwardStep, FilesForE3SMStep): | ||
""" | ||
A step for writing out ``coeffs_reconstruct`` for a given MPAS mesh | ||
""" | ||
|
||
def __init__(self, test_case, mesh, init): | ||
""" | ||
Create a new step | ||
Parameters | ||
---------- | ||
test_case : compass.TestCase | ||
The test case this step belongs to | ||
mesh : compass.ocean.tests.global_ocean.mesh.Mesh | ||
The test case that produces the mesh for this run | ||
init : compass.ocean.tests.global_ocean.init.Init | ||
The test case that produces the initial condition for this run | ||
""" | ||
super().__init__(test_case=test_case, mesh=mesh, init=init, | ||
time_integrator='split_explicit', | ||
name='write_coeffs_reconstruct') | ||
|
||
package = 'compass.ocean.tests.global_ocean.files_for_e3sm.' \ | ||
'write_coeffs_reconstruct' | ||
|
||
self.add_namelist_file(package, 'namelist.reconstruct') | ||
self.add_streams_file(package, 'streams.reconstruct') | ||
|
||
def run(self): | ||
""" | ||
Run this step of the testcase | ||
""" | ||
super().run() | ||
|
||
reconstruct_dir = \ | ||
'../assembled_files/diagnostics/mpas_analysis/reconstruct' | ||
try: | ||
os.makedirs(reconstruct_dir) | ||
except FileExistsError: | ||
pass | ||
|
||
reconstruct_filename = f'{self.mesh_short_name}_coeffs_reconstruct.nc' | ||
# make links in diagnostics directory | ||
symlink(os.path.abspath('coeffs_reconstruct.nc'), | ||
f'{reconstruct_dir}/{reconstruct_filename}') |
1 change: 1 addition & 0 deletions
1
...ass/ocean/tests/global_ocean/files_for_e3sm/write_coeffs_reconstruct/namelist.reconstruct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config_run_duration = '0000_00:00:01' |
13 changes: 13 additions & 0 deletions
13
compass/ocean/tests/global_ocean/files_for_e3sm/write_coeffs_reconstruct/streams.reconstruct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<streams> | ||
|
||
<stream name="coeffs_reconstruct" | ||
type="output" | ||
filename_template="coeffs_reconstruct.nc" | ||
output_interval="0000_00:00:01" | ||
reference_time="0001-01-01_00:00:00" | ||
clobber_mode="truncate"> | ||
|
||
<var name="coeffs_reconstruct"/> | ||
</stream> | ||
|
||
</streams> |