-
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.
Merge pull request #717 from xylar/add-step-for-reconstruction-coeffs
Add step for reconstruction coeffs
- Loading branch information
Showing
8 changed files
with
108 additions
and
5 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
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
67 changes: 67 additions & 0 deletions
67
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,67 @@ | ||
import os | ||
|
||
from mpas_tools.logging import check_call | ||
|
||
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() | ||
|
||
# perform a test reconstruction to make sure things are working | ||
args = ['vector_reconstruct', | ||
'-i', 'restart.nc', | ||
'-o', 'velocity_components.nc', | ||
'-w', 'coeffs_reconstruct.nc', | ||
'-v', 'normalVelocity', | ||
'--out_variables', 'velocity'] | ||
check_call(args=args, logger=self.logger) | ||
|
||
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> |
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
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
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