Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve yaml specification for variance and standard deviation error types #115

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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 error variance
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 error variance
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 error variance' and"
"'background error 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
6 changes: 4 additions & 2 deletions src/orca-jedi/state/State.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ 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("");
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance",
nemo_file_name = params.errorFieldFile.value().value_or("");
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background error standard deviation",
stateFields_);
readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background error variance",
stateFields_);
}
geom_->log_status();
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 error variance");
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 error variance"));
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 error variance"));
}

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 error variance");
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 error 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 error 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 error variance");
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.errorFieldFile.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 error variance
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
6 changes: 3 additions & 3 deletions src/tests/testinput/hofx3d_nc_prof_2vars.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 error variance
- name: salinity
nemo field name: vosaline
model space: volume
- name: salinity_background_error
nemo field name: t_tot_var
model space: volume
variable type: background variance
variable type: background error variance
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 error 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
6 changes: 3 additions & 3 deletions src/tests/testinput/hofx3d_nc_sst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ geometry :
- name: ice_area_fraction_background_error
nemo field name: sic_tot_var
model space: surface
variable type: background variance
variable type: background error variance
- name: sea_surface_temperature_background_error
nemo field name: t_tot_var
model space: surface
variable type: background variance
variable type: background error variance
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
8 changes: 4 additions & 4 deletions src/tests/testinput/hofx_nc_ice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ geometry:
- name: ice_area_fraction_background_error
nemo field name: sic_tot_var
model space: surface
variable type: background variance
variable type: background error variance
grid name: ORCA2_T
number levels: 2
initial condition :
date: 2021-06-28T23:00:00Z
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 error 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
Loading
Loading