Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ endif()
# Find dependencies.
find_package(Python3 REQUIRED COMPONENTS Interpreter)

# JEDI Dependendencies
find_package( fv3jedi REQUIRED )
find_package( soca REQUIRED )

# Include ecbuild_bundle macro
include( ecbuild_bundle )

Expand All @@ -36,6 +40,9 @@ option(BUILD_GDASBUNDLE "Build GDAS Bundle" ON)
option(CLONE_JCSDADATA "Clone JCSDA test data repositories" OFF)
option(WORKFLOW_TESTS "Include global-workflow dependent tests" OFF)

# Build executables
add_subdirectory( mains )

# Install utility scripts.
add_subdirectory(ush)

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ set -x
if [[ $BUILD_JCSDA == 'YES' ]]; then
make -j ${BUILD_JOBS:-6} VERBOSE=$BUILD_VERBOSE
else
builddirs="fv3-jedi soca iodaconv land-imsproc land-jediincr gdas-utils"
builddirs="gdas iodaconv land-imsproc land-jediincr gdas-utils"
for b in $builddirs; do
cd $b
make -j ${BUILD_JOBS:-6} VERBOSE=$BUILD_VERBOSE
Expand Down
9 changes: 9 additions & 0 deletions mains/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ecbuild_add_executable( TARGET gdas_fv3jedi.x
SOURCES gdas_fv3jedi.cc
LIBS fv3jedi
)

ecbuild_add_executable( TARGET gdas_soca.x
SOURCES gdas_soca.cc
LIBS soca
)
62 changes: 62 additions & 0 deletions mains/gdas_fv3jedi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* (C) Copyright 2017- 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 <functional>
#include <map>

#include "fv3jedi/Utilities/Traits.h"

#include "oops/generic/instantiateModelFactory.h"
#include "saber/oops/instantiateCovarFactory.h"
#include "ufo/instantiateObsErrorFactory.h"
#include "ufo/instantiateObsFilterFactory.h"
#include "ufo/ObsTraits.h"

#include "oops/runs/HofX4D.h"
#include "oops/runs/Run.h"
#include "oops/runs/Variational.h"

int main(int argc, char ** argv) {
// Get the program to be run
std::string program = argv[1];

// The first argument is the program to be run, so remove and shift before passing to OOPS
argv[1] = argv[0]; // Move the executable name to the first position
argv++; // Shift the pointer to exclude the first element (original argv[0])
argc--; // Decrement count to reflect the shift

// Create the Run object
oops::Run run(argc, argv);

// Instantiate the factories
saber::instantiateCovarFactory<fv3jedi::Traits>();
ufo::instantiateObsErrorFactory();
ufo::instantiateObsFilterFactory();
oops::instantiateModelFactory<fv3jedi::Traits>();

// Application pointer
std::unique_ptr<oops::Application> app;

// Define a map from program names to lambda functions that create unique_ptr to Applications
std::map<std::string, std::function<std::unique_ptr<oops::Application>()>> apps;

apps["variational"] = []() {
return std::make_unique<oops::Variational<fv3jedi::Traits, ufo::ObsTraits>>();
};
apps["hofx"] = []() {
return std::make_unique<oops::HofX4D<fv3jedi::Traits, ufo::ObsTraits>>();
};

// Create application object and point to it
auto it = apps.find(program);

// Check if the program is recognized
ASSERT_MSG(it != apps.end(), "Program choice for gdas_fv3jedi not recognized: " + program);

// Run the application
return run.execute(*(it->second()));
}
63 changes: 63 additions & 0 deletions mains/gdas_soca.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* (C) Copyright 2017- 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 <functional>
#include <map>

#include "soca/Traits.h"

#include "oops/generic/instantiateModelFactory.h"
#include "saber/oops/instantiateCovarFactory.h"
#include "ufo/instantiateObsErrorFactory.h"
#include "ufo/instantiateObsFilterFactory.h"
#include "ufo/ObsTraits.h"

#include "oops/runs/HofX4D.h"
#include "oops/runs/Run.h"
#include "oops/runs/Variational.h"


int main(int argc, char ** argv) {
// Get the program to be run
std::string program = argv[1];

// The first argument is the program to be run, so remove and shift before passing to OOPS
argv[1] = argv[0]; // Move the executable name to the first position
argv++; // Shift the pointer to exclude the first element (original argv[0])
argc--; // Decrement count to reflect the shift

// Create the Run object
oops::Run run(argc, argv);

// Instantiate the factories
saber::instantiateCovarFactory<soca::Traits>();
ufo::instantiateObsErrorFactory();
ufo::instantiateObsFilterFactory();
oops::instantiateModelFactory<soca::Traits>();

// Application pointer
std::unique_ptr<oops::Application> app;

// Define a map from program names to lambda functions that create unique_ptr to Applications
std::map<std::string, std::function<std::unique_ptr<oops::Application>()>> apps;

apps["variational"] = []() {
return std::make_unique<oops::Variational<soca::Traits, ufo::ObsTraits>>();
};
apps["hofx"] = []() {
return std::make_unique<oops::HofX4D<soca::Traits, ufo::ObsTraits>>();
};

// Create application object and point to it
auto it = apps.find(program);

// Check if the program is recognized
ASSERT_MSG(it != apps.end(), "Program choice for gdas_soca not recognized: " + program);

// Run the application
return run.execute(*(it->second()));
}