diff --git a/src/mains/CMakeLists.txt b/src/mains/CMakeLists.txt index 9f7ad63..348ba47 100644 --- a/src/mains/CMakeLists.txt +++ b/src/mains/CMakeLists.txt @@ -42,5 +42,5 @@ ecbuild_add_executable( TARGET orcamodel_ErrorCovarianceToolbox.x oops_output_json_schema( "orcamodel_hofx.x" ) oops_output_json_schema( "orcamodel_hofx3D.x" ) -oops_output_json_schema( "orcamodel_3DVar.x" ) -oops_output_json_schema( "orcamodel_ErrorCovarianceToolbox.x" ) +#oops_output_json_schema( "orcamodel_3DVar.x" ) +#oops_output_json_schema( "orcamodel_ErrorCovarianceToolbox.x" ) diff --git a/src/orca-jedi/state/State.cc b/src/orca-jedi/state/State.cc index 4a8486b..3d5c0bf 100644 --- a/src/orca-jedi/state/State.cc +++ b/src/orca-jedi/state/State.cc @@ -83,8 +83,9 @@ State::State(const Geometry & geom, readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background", stateFields_); nemo_file_name = params.varianceFieldFile.value().value_or(""); - readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance", - stateFields_); + if (nemo_file_name != "") { + readFieldsFromFile(nemo_file_name, *geom_, validTime(), "background variance", + stateFields_); } } geom_->log_status(); oops::Log::trace() << "State(ORCA)::State created." << std::endl; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 47da01a..9e1c625 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -78,3 +78,13 @@ ecbuild_add_test( TARGET test_orcamodel_hofx3D_prof_2var OMP 1 ARGS testinput/hofx3d_nc_prof_2vars.yaml COMMAND orcamodel_hofx3D.x ) + +ecbuild_add_test( TARGET test_orcamodel_3DVar_ice + OMP 1 + ARGS testinput/3dvar_ice_obs.yaml + COMMAND orcamodel_3DVar.x ) + +ecbuild_add_test( TARGET test_orcamodel_Dirac + OMP 1 + ARGS testinput/dirac.yaml + COMMAND orcamodel_ErrorCovarianceToolbox.x ) diff --git a/src/tests/Data/CMakeLists.txt b/src/tests/Data/CMakeLists.txt index 5cc20f9..5d6b92c 100644 --- a/src/tests/Data/CMakeLists.txt +++ b/src/tests/Data/CMakeLists.txt @@ -24,6 +24,7 @@ amm1_coords.nc amm1_nemo.nc amm1_atlas_grid_spec.yaml amm_ssh_obs.nc +sic_obs_ideal.nc ) foreach(FILENAME ${orcajedi_test_data}) diff --git a/src/tests/Data/sic_obs_ideal.nc b/src/tests/Data/sic_obs_ideal.nc new file mode 100644 index 0000000..fd58d8c --- /dev/null +++ b/src/tests/Data/sic_obs_ideal.nc @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f04618a2934a648e4289450471e75f999168b4f6dae663ca45c72baa870a0ba +size 16702 diff --git a/src/tests/testinput/3dvar_ice_obs.yaml b/src/tests/testinput/3dvar_ice_obs.yaml new file mode 100644 index 0000000..6aaec66 --- /dev/null +++ b/src/tests/testinput/3dvar_ice_obs.yaml @@ -0,0 +1,122 @@ +cost function: + cost type: 3D-Var + time window: + begin: '2021-06-29T00:00:00Z' + length: P1D + analysis variables: [ice_area_fraction] + background error: + covariance model: SABER + saber central block: + saber block name: ID + saber outer blocks: + - saber block name: BUMP_StdDev + read: + general: + testing: true + io: + data directory: Data + files prefix: test + drivers: + compute variance: true + variance: + explicit stddev: true + stddev: + - variables: + - ice_area_fraction + value: 1 + geometry : + nemo variables: + - name: ice_area_fraction + nemo field name: iiceconc + model space: surface + field precision: double + - name: sea_surface_temperature + nemo field name: votemper + model space: surface + field precision: double + - name: sea_water_potential_temperature + nemo field name: votemper + model space: volume + field precision: double + - name: ice_area_fraction_background_error + nemo field name: sic_tot_var + model space: surface + variable type: background variance + field precision: double + grid name: ORCA2_T + number levels: 10 + background : + date: 2021-06-29T12:00:00Z + state variables: [ ice_area_fraction ] + nemo field file: Data/orca2_t_nemo.nc + observations: + observers: + - obs space: + name: Sea Ice + obsdatain: + engine: + type: H5File + obsfile: Data/sic_obs_ideal.nc + obsdataout: + engine: + type: H5File + obsfile: testoutput/test_3dvar.nc + simulated variables: [ice_area_fraction] + get values: + time interpolation: linear + atlas-interpolator: + type: unstructured-bilinear-lonlat + non_linear: missing-if-all-missing + max_fraction_elems_to_try: 0.0 +# adjoint: true + obs operator: + name: Composite + components: + - name: Identity + obs error: + covariance model: diagonal +variational: + minimizer: + algorithm: DRIPCG + iterations: + - ninner: 1 + gradient norm reduction: 1e-30 + geometry : + nemo variables: + - name: ice_area_fraction + nemo field name: iiceconc + model space: surface + - name: sea_surface_temperature + nemo field name: votemper + model space: surface + - name: sea_water_potential_temperature + nemo field name: votemper + model space: volume + - name: ice_area_fraction_background_error + nemo field name: sic_tot_var + model space: surface + variable type: background variance + grid name: ORCA2_T + number levels: 10 + test: on + online diagnostics: + write increment: true + increment: + state component: + datadir: Data + output path: testoutput/increments_ice + date: 2021-06-30T00:00:00Z + exp: 3dvar.iter1 + type: in +final: + diagnostics: + departures: oman +output: + date: 2021-06-30T00:00:00Z + state variables: [ ice_area_fraction ] + nemo field file: testoutput/3dvar_ice +# exp: 3dvar +# steps: ["2021-06-29T12:00:00Z"] # state write not implemented + +#test: +# reference filename: testoutput/test_3dvar_ice_obs.ref diff --git a/src/tests/testinput/CMakeLists.txt b/src/tests/testinput/CMakeLists.txt index ca1ee29..9c97d46 100644 --- a/src/tests/testinput/CMakeLists.txt +++ b/src/tests/testinput/CMakeLists.txt @@ -17,6 +17,8 @@ list( APPEND orcajedi_test_input odb_ice_query.yaml odb_ice_mapping.yaml test_name_map.yaml + dirac.yaml + 3dvar_ice_obs.yaml ) foreach(FILENAME ${orcajedi_test_input}) diff --git a/src/tests/testinput/dirac.yaml b/src/tests/testinput/dirac.yaml new file mode 100644 index 0000000..a9837cb --- /dev/null +++ b/src/tests/testinput/dirac.yaml @@ -0,0 +1,56 @@ +background error: + covariance model: SABER + saber central block: + saber block name: ID + saber outer blocks: + - saber block name: BUMP_StdDev + read: + general: + testing: true + io: + data directory: Data + files prefix: test + drivers: + compute variance: true + variance: + explicit stddev: true + stddev: + - variables: + - ice_area_fraction + value: 1 + +dirac: + x indices: [20] + y indices: [10] + z indices: [1] + +geometry: + nemo variables: + - name: ice_area_fraction + nemo field name: iiceconc + model space: surface + field precision: double + - name: sea_surface_temperature + nemo field name: votemper + model space: surface + field precision: double + - name: sea_water_potential_temperature + nemo field name: votemper + model space: volume + field precision: double + - name: ice_area_fraction_background_error + nemo field name: sic_tot_var + model space: surface + variable type: background variance + field precision: double + grid name: ORCA2_T + number levels: 10 +background: + date: 2021-06-30T12:00:00Z + state variables: [ ice_area_fraction ] + nemo field file: Data/orca2_t_nemo.nc +output dirac: + output path: testoutput/dirac_cov_%id% + +#test: +# reference filename: testoutput/test_dirac.ref