Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/mains/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ ecbuild_add_executable( TARGET soca_enspert.x
ecbuild_add_executable( TARGET soca_sqrtvertloc.x
SOURCES SqrtOfVertLoc.cc
LIBS soca
)

ecbuild_add_executable( TARGET soca_ensmeanandvariance.x
SOURCES EnsMeanAndVariance.cc
LIBS soca
)

ecbuild_add_executable( TARGET soca_ensvariance.x
Expand Down
17 changes: 17 additions & 0 deletions src/mains/EnsMeanAndVariance.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* (C) Copyright 2023-2023 UCAR.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*/


#include "oops/runs/EnsMeanAndVariance.h"
#include "oops/runs/Run.h"
#include "soca/Traits.h"

int main(int argc, char ** argv) {
oops::Run run(argc, argv);
oops::EnsMeanAndVariance<soca::Traits> ens_moments;
return run.execute(ens_moments);
}
6 changes: 6 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set( soca_test_input
testinput/enshofx_3.yml
testinput/enshofx.yml
testinput/enspert.yml
testinput/ensmeanandvariance.yml
testinput/ensrecenter.yml
testinput/ensvariance.yml
testinput/errorcovariance.yml
Expand Down Expand Up @@ -104,6 +105,7 @@ set( soca_test_ref
testref/dirac_socahyb_cov.test
testref/enshofx.test
testref/enspert.test
testref/ensmeanandvariance.test
testref/ensrecenter.test
testref/ensvariance.test
testref/forecast_identity.test
Expand Down Expand Up @@ -516,6 +518,10 @@ soca_add_test( NAME ensvariance
EXE soca_ensvariance.x
TEST_DEPENDS test_soca_gridgen )

soca_add_test( NAME ensmeanandvariance
EXE soca_ensmeanandvariance.x
TEST_DEPENDS test_soca_gridgen )

soca_add_test( NAME parametric_stddev
EXE soca_convertincrement.x
# NOTRAPFPE
Expand Down
49 changes: 49 additions & 0 deletions test/testinput/ensmeanandvariance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
geometry:
geom_grid_file: data_generated/gridgen/soca_gridspec.72x35x25.nc
mom6_input_nml: data_static/72x35x25/input.nml
fields metadata: data_static/fields_metadata.yml

_file: &_file
read_from_file: 1
date: &date_bkg 2018-04-15T00:00:00Z
basename: data_static/72x35x25/
remap_filename: data_static/72x35x25/restarts/MOM.res.nc
state variables: &soca_vars [cicen, hicen, socn, tocn, uocn, vocn, ssh, hocn, mld, layer_depth]

ensemble:
members:
- <<: *_file
ocn_filename: restarts_ens/ocn.enspert.ens.1.2018-04-15T00:00:00Z.PT0S.nc
ice_filename: restarts_ens/ice.enspert.ens.1.2018-04-15T00:00:00Z.PT0S.nc
- <<: *_file
ocn_filename: restarts_ens/ocn.enspert.ens.2.2018-04-15T00:00:00Z.PT0S.nc
ice_filename: restarts_ens/ice.enspert.ens.2.2018-04-15T00:00:00Z.PT0S.nc
- <<: *_file
ocn_filename: restarts_ens/ocn.enspert.ens.3.2018-04-15T00:00:00Z.PT0S.nc
ice_filename: restarts_ens/ice.enspert.ens.3.2018-04-15T00:00:00Z.PT0S.nc
- <<: *_file
ocn_filename: restarts_ens/ocn.enspert.ens.4.2018-04-15T00:00:00Z.PT0S.nc
ice_filename: restarts_ens/ice.enspert.ens.4.2018-04-15T00:00:00Z.PT0S.nc

variance output:
datadir: data_generated/ensmeanandvariance
exp: variance
type: fc
date: *date_bkg

standard deviation output:
datadir: data_generated/ensmeanandvariance
exp: stddev
type: fc
date: *date_bkg

mean output:
datadir: data_generated/ensmeanandvariance
exp: mean
type: fc
date: *date_bkg

test:
reference filename: testref/ensmeanandvariance.test
test output filename: testoutput/ensmeanandvariance.test
float relative tolerance: 1e-3
39 changes: 39 additions & 0 deletions test/testref/ensmeanandvariance.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Mean:

Valid time: 2018-04-15T00:00:00Z
cicen min=-0.0112418992909670 max=1.0059927218502691 mean=0.1167546754700448
hicen min=-0.4958783724376303 max=4.2383578169684073 mean=0.4805869113091976
socn min=10.7210460395083924 max=40.4416591897031168 mean=34.5259571688728570
tocn min=-2.2178953281423013 max=31.7266785987746971 mean=6.0563441383075780
uocn min=-0.8609011929693486 max=0.7010172866364175 mean=-0.0002754308521962
vocn min=-0.7677450905884780 max=1.4343611949404274 mean=0.0022063509463340
ssh min=-1.9007772322014664 max=0.9358744928741816 mean=-0.2723291754400941
hocn min=0.0009999999999977 max=1345.6400000000003274 mean=128.6280642065023017
mld min=2.2854716757984130 max=1489.4958726595266398 mean=73.4264756536763770
layer_depth min=2.2854716757984130 max=5658.3057467114012979 mean=1200.5229536158392420
Variance:

Valid time: 2018-04-15T00:00:00Z
cicen min=0.0000005644776545 max=0.0002974978151066 mean=0.0000536688167423
hicen min=0.0010403766863014 max=0.8862874166279114 mean=0.1280217297454454
socn min=0.0000000000000000 max=1.8239276341677120 mean=0.0465030040856202
tocn min=0.0000000000000000 max=8.8471590101181157 mean=0.2647814800037333
uocn min=0.0000000000000000 max=0.0001185072930010 mean=0.0000014279991402
vocn min=0.0000000000000000 max=0.0000980437165757 mean=0.0000006838626020
ssh min=0.0000000000000000 max=0.0705741193924168 mean=0.0033870718852192
hocn min=0.0000000000000000 max=0.0000000000000000 mean=0.0000000000000000
mld min=0.0000000000000000 max=3877611.9844329962506890 mean=44171.1704577814380173
layer_depth min=0.0000000000000000 max=0.0000000000000000 mean=0.0000000000000000
Standard Deviation:

Valid time: 2018-04-15T00:00:00Z
cicen min=0.0007513172795469 max=0.0172481249736482 mean=0.0067083304987286
hicen min=0.0322548707376331 max=0.9414283916623247 mean=0.3259939720215398
socn min=0.0000000000000000 max=1.3505286498877809 mean=0.1076038359083887
tocn min=0.0000000000000000 max=2.9744174236509098 mean=0.3115436058297192
uocn min=0.0000000021547212 max=0.0108861055020160 mean=0.0007636727940453
vocn min=0.0000000000000000 max=0.0099017027109353 mean=0.0005165467426367
ssh min=0.0000000000000000 max=0.2656578991718800 mean=0.0426079948983130
hocn min=0.0000000000000000 max=0.0000000000000000 mean=0.0000000000000000
mld min=0.0000000000000000 max=1969.1653014495752814 mean=69.4140123086108929
layer_depth min=0.0000000000000000 max=0.0000000000000000 mean=0.0000000000000000