diff --git a/data/forcing/forcings-engine/.gitignore b/data/forcing/forcings-engine/.gitignore deleted file mode 100644 index 476f008f8a..0000000000 --- a/data/forcing/forcings-engine/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -gfs/**/*.grib2 - -# Temp directory used by the forcings engine instances -scratch/* -!scratch/.keep - -# Cropped GRIB files -!gfs/gfs.20240117/00/atmos/gfs.t00z.sfluxgrbf*.grib2 diff --git a/data/forcing/forcings-engine/config_aorc.yml b/data/forcing/forcings-engine/config_aorc.yml.in similarity index 92% rename from data/forcing/forcings-engine/config_aorc.yml rename to data/forcing/forcings-engine/config_aorc.yml.in index 93250b2955..ca1b1cb71e 100644 --- a/data/forcing/forcings-engine/config_aorc.yml +++ b/data/forcing/forcings-engine/config_aorc.yml.in @@ -9,7 +9,7 @@ InputMandatory: [1] OutputFrequency: 60 SubOutputHour: 0 SubOutFreq: 0 -ScratchDir: "data/forcing/forcings-engine/scratch" +ScratchDir: "@FORCINGS_ENGINE_SCRATCH_DIR@" Output: 1 compressOutput: 0 floatOutput: 0 @@ -47,7 +47,7 @@ ShortwaveDownscaling: [0] PressureDownscaling: [0] PrecipDownscaling: [0] HumidityDownscaling: [0] -DownscalingParamDirs: ["data/forcing/forcings-engine/scratch"] +DownscalingParamDirs: ["@FORCINGS_ENGINE_SCRATCH_DIR@"] SuppPcp: [] SuppPcpForcingTypes: '' SuppPcpDirectories: '' diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fc07337e52..0520cf4e91 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -194,6 +194,18 @@ ngen_add_test( NGEN_WITH_PYTHON ) +if(TARGET test_forcings_engine) + set(FORCINGS_ENGINE_SCRATCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/forcings_engine_scratch") + file(MAKE_DIRECTORY "${FORCINGS_ENGINE_SCRATCH_DIR}") + configure_file( + "${CMAKE_CURRENT_LIST_DIR}/../data/forcing/forcings-engine/config_aorc.yml.in" # Input + "${CMAKE_CURRENT_BINARY_DIR}/config_aorc.yml" + ) + target_compile_definitions(test_forcings_engine + PUBLIC + -DNGEN_LUMPED_CONFIG_PATH="${CMAKE_CURRENT_BINARY_DIR}/config_aorc.yml") +endif() + ########################## Series Unit Tests ngen_add_test( test_mdarray diff --git a/test/forcing/ForcingsEngineLumpedDataProvider_Test.cpp b/test/forcing/ForcingsEngineLumpedDataProvider_Test.cpp index bb6e0293ea..65dd3d6c58 100644 --- a/test/forcing/ForcingsEngineLumpedDataProvider_Test.cpp +++ b/test/forcing/ForcingsEngineLumpedDataProvider_Test.cpp @@ -1,5 +1,9 @@ #include +#ifndef NGEN_LUMPED_CONFIG_PATH +#error "Lumped config file path not defined! Set `-DNGEN_LUMPED_CONFIG_PATH`" +#endif + #include #if NGEN_WITH_MPI #include @@ -24,7 +28,7 @@ struct ForcingsEngineLumpedDataProviderTest #endif } - static constexpr const char* config_file = "data/forcing/forcings-engine/config_aorc.yml"; + static constexpr const char* config_file = NGEN_LUMPED_CONFIG_PATH; static const std::time_t time_start; static const std::time_t time_end; static std::shared_ptr gil_;