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 @@ -80,6 +80,11 @@ ecbuild_add_executable( TARGET soca_convertstate.x
LIBS soca
)

ecbuild_add_executable( TARGET soca_converttostructuredgrid.x
SOURCES ConvertToStructuredGrid.cc
LIBS soca
)

ecbuild_add_executable( TARGET soca_addincrement.x
SOURCES AddIncrement.cc
LIBS soca
Expand Down
18 changes: 18 additions & 0 deletions src/mains/ConvertToStructuredGrid.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* (C) Copyright 2017-2024 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/ConvertToStructuredGrid.h"
#include "oops/runs/Run.h"
#include "soca/Traits.h"

int main(int argc, char ** argv) {
oops::Run run(argc, argv);
oops::ConvertToStructuredGrid<soca::Traits> converttostructuredgrid;
return run.execute(converttostructuredgrid);
}

7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set( soca_test_input
testinput/convertstate_changevar.yml
testinput/convertstate_soca2cice.yml
testinput/convertstate.yml
testinput/converttogauss.yml
testinput/diffstates.yml
testinput/dirac_diffusion.yml
testinput/dirac_diffusion_lowres.yml
Expand Down Expand Up @@ -120,6 +121,7 @@ set( soca_test_ref
testref/convertstate_changevar.test
testref/convertstate_soca2cice.test
testref/convertstate.test
testref/converttogauss.test
testref/diffstates.test
testref/dirac_diffusion.test
testref/dirac_parametric_ocean_stddev.test
Expand Down Expand Up @@ -536,6 +538,11 @@ soca_add_test( NAME convertstate
# NOTRAPFPE
TEST_DEPENDS test_soca_gridgen )

# Convert to Gaussian grid
soca_add_test( NAME converttogauss
EXE soca_converttostructuredgrid.x
TEST_DEPENDS test_soca_gridgen )

# Apply a nonlinear change of variable to an ensemble of states
soca_add_test( NAME convertstate_changevar
EXE soca_convertstate.x
Expand Down
40 changes: 40 additions & 0 deletions test/testinput/converttogauss.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
states to structured grid:
- state 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

state:
read_from_file: 1
basename: data_static/72x35x25/restarts/
ocn_filename: MOM.res.nc
ice_filename: cice.res.nc
sfc_filename: sfc.res.nc
date: &bkg_date 2018-04-15T00:00:00Z
state variables:
- sea_surface_height_above_geoid
- sea_water_potential_temperature
- sea_water_salinity
- sea_water_cell_thickness
- sea_ice_area_fraction
- sea_water_depth

structured grid interpolation:
grid type: regular gaussian
local interpolator type: atlas interpolator
interpolation method:
type: finite-element
number of latitude gridpoints: 12
variables to output:
- sea_surface_height_above_geoid
- sea_water_potential_temperature
- sea_water_salinity
- sea_ice_area_fraction
all model levels: true
bottom model level: false
datapath: data_output/
prefix: converttogauss
test:
reference filename: testref/converttogauss.test
test output filename: testoutput/converttogauss.test
float relative tolerance: 1.0e-3
4 changes: 4 additions & 0 deletions test/testref/converttogauss.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StructuredGridWriter::<SOCA>
Grid Resolution: 12
Variables: 4 variables: sea_surface_height_above_geoid, sea_water_potential_temperature, sea_water_salinity, sea_ice_area_fraction
Output on Levels: All Model Levels