Skip to content

Commit

Permalink
add variance and standard deviation error types
Browse files Browse the repository at this point in the history
  • Loading branch information
twsearle committed Aug 29, 2024
1 parent 02e0994 commit a6df55c
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 64 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ state :
date: # ISO8601 datetime
state variables: # list of the model state variables matching the `name` field above
nemo field file: # input background data
variance field file: # input error data
nemo error field file: # input error data
```
## Help
Expand Down
2 changes: 1 addition & 1 deletion examples/hofx3d_nc_orca1_checker_ice_mpi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ state :
date: 2021-06-29T12:00:00Z
state variables: [ ice_area_fraction ]
nemo field file: your_example_data/orca1_sic.nc
variance field file: your_example_data/orca1_sic_err.nc
nemo error field file: your_example_data/orca1_sic_err.nc
observations:
observers:
- obs space:
Expand Down
4 changes: 2 additions & 2 deletions examples/hofx3d_odb_prof_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ geometry :
- name: sea_water_temperature_background_error
nemo field name: t_tot_var
model space: volume
variable type: background variance
variable type: background standard deviation
grid name: eORCA12_T
number levels: 75
state :
date: 2021-08-21T00:00:00Z
state variables: [ sea_water_temperature, sea_water_temperature_background_error, depth ]
nemo field file: your_example_data/eorca12_20210630.nc
variance field file: your_example_data/eorca12_err_20210630.nc
nemo error field file: your_example_data/eorca12_err_20210630.nc
time window:
begin: 2021-08-20T00:00:00Z
length: P2D
Expand Down
10 changes: 5 additions & 5 deletions examples/hofx_nc_ice_mpi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ geometry:
- name: ice_area_fraction_background_error
nemo field name: seaice_tot_var
model space: surface
variable type: background variance
variable type: background standard deviation
grid name: eORCA12_T
source mesh halo: 0
number levels: 2
Expand All @@ -24,23 +24,23 @@ initial condition :
date: 2021-06-28T23:00:00Z
state variables: [ ice_area_fraction, ice_area_fraction_background_error ]
nemo field file: your_example_data/eorca12_20210630.nc
variance field file: your_example_data/eorca12_err_20210630.nc
nemo error field file: your_example_data/eorca12_err_20210630.nc
model :
name: PseudoModel
tstep: P1D
state variables: [ ice_area_fraction ]
states:
- date: 2021-06-28T23:00:00Z
nemo field file: your_example_data/eorca12_20210630.nc
variance field file: your_example_data/eorca12_err_20210630.nc
nemo error field file: your_example_data/eorca12_err_20210630.nc
state variables: [ ice_area_fraction ]
- date: 2021-06-29T23:00:00Z
nemo field file: your_example_data/eorca12_20210630.nc
variance field file: your_example_data/eorca12_err_20210630.nc
nemo error field file: your_example_data/eorca12_err_20210630.nc
state variables: [ ice_area_fraction ]
- date: 2021-07-01T23:00:00Z
nemo field file: your_example_data/eorca12_20210630.nc
variance field file: your_example_data/eorca12_err_20210630.nc
nemo error field file: your_example_data/eorca12_err_20210630.nc
state variables: [ ice_area_fraction ]
observations:
observers:
Expand Down
2 changes: 1 addition & 1 deletion src/orca-jedi/geometry/Geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const oops::Variables & Geometry::variables() const {
}

/// \brief Check if a variable's data is a member of a type (e.g if it can be
/// sourced from the background file, variance file, or MDT file).
/// sourced from the background file, error file, or MDT file).
/// \param[in] variable_name Name of variable.
/// \param[in] variable_type Type of variable.
/// \return Boolean for membership.
Expand Down
4 changes: 3 additions & 1 deletion src/orca-jedi/geometry/GeometryParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class NemoFieldParameters : public oops::Parameters {
oops::RequiredParameter<std::string> nemoName {"nemo field name", this};
oops::RequiredParameter<std::string> modelSpace {"model space", this};
oops::Parameter<std::string> variableType {"variable type",
"type of variable (default is 'background' other option is 'background variance')",
"type of variable (default is 'background' other options are 'background variance' and"
"'background standard deviation' both are included for clarity, but both variables are"
" read from the error file",
"background",
this};
oops::Parameter<FieldDType> fieldPrecision{"field precision",
Expand Down
4 changes: 3 additions & 1 deletion src/orca-jedi/state/State.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ State::State(const Geometry & geom,
nemo_file_name = params.nemoFieldFile.value();
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background",
stateFields_);
nemo_file_name = params.varianceFieldFile.value().value_or("");
nemo_file_name = params.ErrorFieldFile.value().value_or("");
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background standard deviation",
stateFields_);
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance",
stateFields_);
}
Expand Down
4 changes: 2 additions & 2 deletions src/orca-jedi/state/StateParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class OrcaStateParameters : public oops::Parameters {

public:
oops::RequiredParameter<std::string> nemoFieldFile{"nemo field file", this};
oops::OptionalParameter<std::string> varianceFieldFile{
"variance field file", "", this};
oops::OptionalParameter<std::string> ErrorFieldFile{
"nemo error field file", "", this};
oops::OptionalParameter<bool> analyticInit{"analytic initialisation", this};
oops::OptionalParameter<std::string> outputNemoFieldFile{
"output nemo field file", "", this};
Expand Down
6 changes: 3 additions & 3 deletions src/tests/orca-jedi/test_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CASE("test basic geometry") {
nemo_var_mappings[1].set("name", "sea_ice_area_fraction_error")
.set("nemo field name", "sic_tot_var")
.set("model space", "surface")
.set("variable type", "background variance");
.set("variable type", "background standard deviation");
nemo_var_mappings[2].set("name", "sea_surface_foundation_temperature")
.set("nemo field name", "votemper")
.set("model space", "surface");
Expand All @@ -52,11 +52,11 @@ CASE("test basic geometry") {
EXPECT(geometry.variable_in_variable_type("sea_ice_area_fraction",
"background"));
EXPECT(geometry.variable_in_variable_type("sea_ice_area_fraction_error",
"background variance"));
"background standard deviation"));
EXPECT(!geometry.variable_in_variable_type("sea_ice_area_fraction_error",
"background"));
EXPECT(!geometry.variable_in_variable_type("sea_ice_area_fraction",
"background variance"));
"background standard deviation"));
}

SECTION("test geometry variable sizes") {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/orca-jedi/test_interpolator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CASE("test interpolator") {
nemo_var_mappings[1].set("name", "sea_ice_area_fraction_error")
.set("nemo field name", "sic_tot_var")
.set("model space", "surface")
.set("variable type", "background variance");
.set("variable type", "background standard deviation");
nemo_var_mappings[2].set("name", "sea_surface_foundation_temperature")
.set("nemo field name", "votemper")
.set("model space", "surface");
Expand All @@ -85,7 +85,7 @@ CASE("test interpolator") {
settings_map["ORCA2_T"].state_config.set("state variables", state_variables);
settings_map["ORCA2_T"].state_config.set("date", "2021-06-30T00:00:00Z");
settings_map["ORCA2_T"].state_config.set("nemo field file", "../Data/orca2_t_nemo.nc");
settings_map["ORCA2_T"].state_config.set("variance field file", "../Data/orca2_t_bkg_var.nc");
settings_map["ORCA2_T"].state_config.set("nemo error field file", "../Data/orca2_t_bkg_var.nc");

settings_map["ORCA2_T"].lons = std::vector<double>{0, 120, 270};
settings_map["ORCA2_T"].lats = std::vector<double>{88, 0, 30};
Expand Down Expand Up @@ -135,7 +135,7 @@ CASE("test interpolator") {
settings_map["AMM1"].state_config.set("state variables", state_variables);
settings_map["AMM1"].state_config.set("date", "2021-06-30T00:00:00Z");
settings_map["AMM1"].state_config.set("nemo field file", "../Data/amm1_nemo.nc");
settings_map["AMM1"].state_config.set("variance field file", "../Data/amm1_nemo.nc");
settings_map["AMM1"].state_config.set("nemo error field file", "../Data/amm1_nemo.nc");

settings_map["AMM1"].lons = std::vector<double>{-17.5, -6.78, -16.1};
settings_map["AMM1"].lats = std::vector<double>{58.16, 58.91, 63.55};
Expand Down
8 changes: 4 additions & 4 deletions src/tests/orca-jedi/test_interpolator_parallel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CASE("test serial interpolator") {
nemo_var_mappings[1].set("name", "sea_surface_height_anomaly_error")
.set("nemo field name", "ssh_tot_std")
.set("model space", "surface")
.set("variable type", "background variance");
.set("variable type", "background standard deviation");
nemo_var_mappings[2].set("name", "sea_surface_foundation_temperature")
.set("nemo field name", "votemper")
.set("model space", "surface");
Expand Down Expand Up @@ -103,7 +103,7 @@ CASE("test serial interpolator") {
state_config.set("date", "2021-06-30T00:00:00Z");
state_config.set("analytic initialisation", true);
state_config.set("nemo field file", "../Data/orca2_t_nemo.nc");
state_config.set("variance field file", "../Data/orca2_t_bkg_var.nc");
state_config.set("nemo error field file", "../Data/orca2_t_bkg_var.nc");
OrcaStateParameters stateParams;
stateParams.validateAndDeserialize(state_config);
State state(geometry, stateParams);
Expand Down Expand Up @@ -194,7 +194,7 @@ CASE("test checkerboard interpolator") {
nemo_var_mappings[1].set("name", "sea_surface_height_anomaly_error")
.set("nemo field name", "ssh_tot_std")
.set("model space", "surface")
.set("variable type", "background variance");
.set("variable type", "background standard deviation");
nemo_var_mappings[2].set("name", "sea_surface_foundation_temperature")
.set("nemo field name", "votemper")
.set("model space", "surface");
Expand Down Expand Up @@ -249,7 +249,7 @@ CASE("test checkerboard interpolator") {
state_config.set("date", "2021-06-30T00:00:00Z");
state_config.set("analytic initialisation", true);
state_config.set("nemo field file", "../Data/orca2_t_nemo.nc");
state_config.set("variance field file", "../Data/orca2_t_bkg_var.nc");
state_config.set("nemo error field file", "../Data/orca2_t_bkg_var.nc");
OrcaStateParameters stateParams;
stateParams.validateAndDeserialize(state_config);
State state(geometry, stateParams);
Expand Down
10 changes: 5 additions & 5 deletions src/tests/orca-jedi/test_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CASE("test basic state") {
.set("field precision", "double")
.set("nemo field name", "sic_tot_var")
.set("model space", "surface")
.set("variable type", "background variance");
.set("variable type", "background standard deviation");
nemo_var_mappings[2].set("name", "sea_surface_foundation_temperature")
.set("field precision", "double")
.set("nemo field name", "votemper")
Expand All @@ -61,12 +61,12 @@ CASE("test basic state") {

SECTION("test state parameters") {
state_config.set("nemo field file", "../Data/orca2_t_nemo.nc");
state_config.set("variance field file", "../Data/orca2_t_bkg_var.nc");
state_config.set("nemo error field file", "../Data/orca2_t_bkg_var.nc");
params.validateAndDeserialize(state_config);
EXPECT(params.nemoFieldFile.value() ==
state_config.getString("nemo field file"));
EXPECT(params.varianceFieldFile.value() ==
state_config.getString("variance field file"));
EXPECT(params.standardDeviationFieldFile.value() ==
state_config.getString("nemo error field file"));
EXPECT(params.analyticInit.value().value_or(true));
auto datetime = static_cast<util::DateTime>(state_config.getString("date"));
EXPECT(params.date.value() == datetime);
Expand Down Expand Up @@ -105,7 +105,7 @@ CASE("test basic state") {
}

state_config.set("nemo field file", "../Data/orca2_t_nemo.nc");
state_config.set("variance field file", "../Data/orca2_t_bkg_var.nc");
state_config.set("nemo error field file", "../Data/orca2_t_bkg_var.nc");
state_config.set("output nemo field file", "../testoutput/orca2_t_output.nc");
params.validateAndDeserialize(state_config);
State state(geometry, params);
Expand Down
4 changes: 2 additions & 2 deletions src/tests/testinput/hofx3d_nc_potm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ geometry :
- name: sea_water_potential_temperature_background_error
nemo field name: t_tot_var
model space: volume
variable type: background variance
variable type: background standard deviation
grid name: ORCA2_T
number levels: 3
state :
date: 2021-06-30T00:00:00Z
state variables: [ sea_water_potential_temperature, sea_water_potential_temperature_background_error, depth ]
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
time window:
begin: 2021-06-29T12:00:00Z
length: P1D
Expand Down
4 changes: 2 additions & 2 deletions src/tests/testinput/hofx3d_nc_prof_2vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ geometry :
- name: salinity_background_error
nemo field name: t_tot_var
model space: volume
variable type: background variance
variable type: background standard deviation
grid name: ORCA2_T
number levels: 3
state :
Expand All @@ -30,7 +30,7 @@ state :
- salinity
- salinity_background_error
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
time window:
begin: 2021-06-29T12:00:00Z
length: P1D
Expand Down
4 changes: 2 additions & 2 deletions src/tests/testinput/hofx3d_nc_ssh_amm1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ geometry :
- name: sea_surface_height_anomaly_background_error
nemo field name: sossheig
model space: surface
variable type: background variance
variable type: background standard deviation
grid name: Data/amm1_atlas_grid_spec.yaml
number levels: 1
partitioner: serial
Expand All @@ -22,7 +22,7 @@ state :
- sea_surface_height_anomaly
- sea_surface_height_anomaly_background_error
nemo field file: &field_file Data/amm1_nemo.nc
variance field file: *field_file
nemo error field file: *field_file
observations:
observers:
- obs space:
Expand Down
4 changes: 2 additions & 2 deletions src/tests/testinput/hofx3d_nc_sst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ geometry :
- name: sea_surface_temperature_background_error
nemo field name: t_tot_var
model space: surface
variable type: background variance
variable type: background standard deviation
grid name: ORCA2_T
number levels: 1
state :
date: 2021-06-30T00:00:00Z
state variables: [ sea_surface_temperature, sea_surface_temperature_background_error ]
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
time window:
begin: 2021-06-29T12:00:00Z
length: P1D
Expand Down
6 changes: 3 additions & 3 deletions src/tests/testinput/hofx_nc_ice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ initial condition :
state variables: [ ice_area_fraction, ice_area_fraction_background_error ]
#analytic_init: zeroed state
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
model :
name: PseudoModel
tstep: P1D
states:
- date: 2021-06-29T23:00:00Z
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
state variables: [ ice_area_fraction ]
- date: 2021-06-30T23:00:00Z
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
state variables: [ ice_area_fraction ]
observations:
observers:
Expand Down
8 changes: 4 additions & 4 deletions src/tests/testinput/hofx_nc_ssh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ geometry :
- name: sea_surface_height_anomaly_background_error
nemo field name: ssh_tot_std
model space: surface
variable type: background variance
variable type: background standard deviation
grid name: ORCA2_T
number levels: 1
partitioner: serial
Expand All @@ -22,18 +22,18 @@ initial condition :
- sea_surface_height_anomaly
- sea_surface_height_anomaly_background_error
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
model :
name: PseudoModel
tstep: P1D
states:
- date: 2021-06-29T23:00:00Z
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
state variables: &state_variables [ sea_surface_height_anomaly ]
- date: 2021-06-30T23:00:00Z
nemo field file: Data/orca2_t_nemo.nc
variance field file: Data/orca2_t_bkg_var.nc
nemo error field file: Data/orca2_t_bkg_var.nc
state variables: *state_variables
observations:
observers:
Expand Down
8 changes: 4 additions & 4 deletions src/tests/testinput/hofx_nc_ssh_amm1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ geometry :
- name: sea_surface_height_anomaly_background_error
nemo field name: sossheig
model space: surface
variable type: background variance
variable type: background standard deviation
grid name: Data/amm1_atlas_grid_spec.yaml
number levels: 1
partitioner: serial
Expand All @@ -23,18 +23,18 @@ initial condition :
- sea_surface_height_anomaly
- sea_surface_height_anomaly_background_error
nemo field file: &field_file Data/amm1_nemo.nc
variance field file: *field_file
nemo error field file: *field_file
model :
name: PseudoModel
tstep: P1D
states:
- date: 2021-06-29T23:00:00Z
nemo field file: *field_file
variance field file: *field_file
nemo error field file: *field_file
state variables: &state_variables [ sea_surface_height_anomaly ]
- date: 2021-06-30T23:00:00Z
nemo field file: *field_file
variance field file: *field_file
nemo error field file: *field_file
state variables: *state_variables
observations:
observers:
Expand Down
Loading

0 comments on commit a6df55c

Please sign in to comment.