-
Notifications
You must be signed in to change notification settings - Fork 38
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 #411 from xylar/test_time_series_stats_monthly
Add monthly output test and update daily output test to match
- Loading branch information
Showing
5 changed files
with
117 additions
and
4 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
64 changes: 64 additions & 0 deletions
64
compass/ocean/tests/global_ocean/monthly_output_test/__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,64 @@ | ||
from compass.validate import compare_variables | ||
from compass.ocean.tests.global_ocean.forward import ForwardTestCase, \ | ||
ForwardStep | ||
|
||
|
||
class MonthlyOutputTest(ForwardTestCase): | ||
""" | ||
A test case to test the output for the TimeSeriesStatMonthly analysis | ||
member in E3SM. | ||
""" | ||
|
||
def __init__(self, test_group, mesh, init, time_integrator): | ||
""" | ||
Create test case | ||
Parameters | ||
---------- | ||
test_group : compass.ocean.tests.global_ocean.GlobalOcean | ||
The global ocean test group that this test case 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 | ||
time_integrator : {'split_explicit', 'RK4'} | ||
The time integrator to use for the forward run | ||
""" | ||
super().__init__(test_group=test_group, mesh=mesh, init=init, | ||
time_integrator=time_integrator, | ||
name='monthly_output_test') | ||
|
||
step = ForwardStep(test_case=self, mesh=mesh, init=init, | ||
time_integrator=time_integrator, cores=4, | ||
threads=1) | ||
|
||
module = self.__module__ | ||
step.add_output_file(filename='output.nc') | ||
step.add_output_file( | ||
filename='analysis_members/' | ||
'mpaso.hist.am.timeSeriesStatsMonthly.0001-01-01.nc') | ||
step.add_namelist_file(module, 'namelist.forward') | ||
if mesh.mesh_name in ['QU240', 'QUwISC240']: | ||
# a shorter time step is needed to prevent crashes | ||
step.add_namelist_options(dict(config_dt='00:30:00')) | ||
step.add_streams_file(module, 'streams.forward') | ||
self.add_step(step) | ||
|
||
def validate(self): | ||
""" | ||
Test cases can override this method to perform validation of variables | ||
and timers | ||
""" | ||
variables = [ | ||
'timeMonthly_avg_activeTracers_temperature', | ||
'timeMonthly_avg_activeTracers_salinity', | ||
'timeMonthly_avg_layerThickness', 'timeMonthly_avg_normalVelocity', | ||
'timeMonthly_avg_ssh'] | ||
|
||
compare_variables( | ||
test_case=self, variables=variables, | ||
filename1='forward/analysis_members/' | ||
'mpaso.hist.am.timeSeriesStatsMonthly.0001-01-01.nc') |
3 changes: 3 additions & 0 deletions
3
compass/ocean/tests/global_ocean/monthly_output_test/namelist.forward
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,3 @@ | ||
config_run_duration = '0000-01-00_00:00:00' | ||
config_AM_timeSeriesStatsMonthly_enable = .true. | ||
config_AM_timeSeriesStatsMonthly_restart_stream = 'none' |
11 changes: 11 additions & 0 deletions
11
compass/ocean/tests/global_ocean/monthly_output_test/streams.forward
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,11 @@ | ||
<streams> | ||
|
||
<stream name="timeSeriesStatsMonthlyOutput" | ||
type="output" | ||
precision="double" | ||
filename_template="analysis_members/mpaso.hist.am.timeSeriesStatsMonthly.$Y-$M-$D.nc" | ||
output_interval="00-01-00_00:00:00" | ||
clobber_mode="truncate"> | ||
</stream> | ||
|
||
</streams> |