Skip to content

Commit

Permalink
fix path handling for routing test
Browse files Browse the repository at this point in the history
  • Loading branch information
hellkite500 committed Apr 26, 2023
1 parent 8d41dd3 commit ce0ce46
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ if(NGEN_ACTIVATE_ROUTING)
test_routing_pybind
1
routing/Routing_Py_Bind_Test.cpp
NGen::core # for filechecker utility
NGen::routing
pybind11::embed
)
Expand Down
16 changes: 8 additions & 8 deletions test/data/routing/ngen_routing_config_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ network_topology_parameters:
supernetwork_parameters:
#----------
geo_file_type: HYFeaturesNetwork
geo_file_path: ./test/data/routing/gauge_01073000.gpkg
geo_file_path: ../../test/data/routing/gauge_01073000.gpkg
mask_file_path: # domain/unit_test_noRS/coastal_subset.txt
synthetic_wb_segments:
#- 4800002
Expand All @@ -21,8 +21,8 @@ network_topology_parameters:
break_network_at_waterbodies: False
level_pool:
#----------
level_pool_waterbody_parameter_file_path: ./test/data/routing/gauge_01073000.gpkg
reservoir_parameter_file : ./test/data/routing/gauge_01073000.gpkg
level_pool_waterbody_parameter_file_path: ../../test/data/routing/gauge_01073000.gpkg
reservoir_parameter_file : ../../test/data/routing/gauge_01073000.gpkg
#rfc:
#----------
#reservoir_parameter_file : domain/reservoir_index_AnA.nc
Expand Down Expand Up @@ -58,11 +58,11 @@ compute_parameters:
#----------
qts_subdivisions : 12
dt : 300 # [sec]
qlat_input_folder : ./test/data/routing/
qlat_input_folder : ../../test/data/routing/
qlat_file_pattern_filter : "nex-*"
nexus_input_folder : ./test/data/routing/
nexus_input_folder : ../../test/data/routing/
nexus_file_pattern_filter : "nex-*" #OR "*NEXOUT.parquet" OR "nex-*"
binary_nexus_file_folder : ./test/data/routing/ # this is required if nexus_file_pattern_filter="nex-*"
binary_nexus_file_folder : ../../test/data/routing/ # this is required if nexus_file_pattern_filter="nex-*"
#coastal_boundary_input_file : channel_forcing/schout_1.nc
nts : 8640 #288 for 1day
max_loop_size : 720 # [hr]
Expand Down Expand Up @@ -98,6 +98,6 @@ output_parameters:
#wrf_hydro_channel_output_source_folder: ./
chanobs_output:
#----------
chanobs_output_directory: ./test/data/routing/
chanobs_output_directory: ../../test/data/routing/
chanobs_filepath : Chanobs.nc
lakeout_output: ./test/data/routing/
lakeout_output: ../../test/data/routing/
9 changes: 7 additions & 2 deletions test/routing/Routing_Py_Bind_Test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifdef ROUTING_PYBIND_TESTS_ACTIVE
#include "gtest/gtest.h"
#include "Routing_Py_Adapter.hpp"
#include "FileChecker.h"
#include <string>
#include <pybind11/embed.h>
#include <pybind11/stl.h>
Expand Down Expand Up @@ -33,8 +34,12 @@ TEST_F(RoutingPyBindTest, TestRoutingPyBind)
//std::vector<double> nexus_values_vec{1.1, 2.2, 3.3, 4.4, 5.5};

//SET THESE AS INPUTS
std::string t_route_config_file_with_path = "./test/data/routing/ngen_routing_config_unit_test.yaml";

std::vector<std::string> paths = {
"./test/data/routing/ngen_routing_config_unit_test.yaml",
"../test/data/routing/ngen_routing_config_unit_test.yaml",
"../../test/data/routing/ngen_routing_config_unit_test.yaml"
};
std::string t_route_config_file_with_path = utils::FileChecker::find_first_readable(paths);
//Note: Currently, delta_time is set in the t-route yaml configuration file, and the
//number_of_timesteps is determined from the total number of nexus outputs in t-rout
//It is recommended to still pass these values to the routing_py_adapter object in
Expand Down

0 comments on commit ce0ce46

Please sign in to comment.