Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test routing config to alleviate pydantic errors #654

Merged
merged 7 commits into from
Sep 26, 2023
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
Binary file modified test/data/routing/gauge_01073000.gpkg
Binary file not shown.
50 changes: 35 additions & 15 deletions test/data/routing/ngen_routing_config_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,25 @@ network_topology_parameters:
#----------
supernetwork_parameters:
#----------
geo_file_type: HYFeaturesNetwork
# geo_file_type: HYFeaturesNetwork
geo_file_path: ./test/data/routing/gauge_01073000.gpkg
mask_file_path: # domain/unit_test_noRS/coastal_subset.txt
columns:
key: 'id'
downstream: 'toid'
dx: 'lengthkm'
n: 'n'
ncc: 'nCC'
s0: 'So'
bw: 'BtmWdth'
waterbody: 'rl_NHDWaterbodyComID'
gages: 'rl_gages'
tw: 'TopWdth'
twcc: 'TopWdthCC'
musk: 'MusK'
musx: 'MusX'
cs: 'ChSlp'
alt: 'alt'
synthetic_wb_segments:
#- 4800002
#- 4800004
Expand All @@ -22,13 +38,8 @@ network_topology_parameters:
level_pool:
#----------
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
#reservoir_rfc_forecasts : False
#reservoir_rfc_forecasts_time_series_path: rfc_TimeSeries/
#reservoir_rfc_forecasts_lookback_hours : 48
# reservoir_parameter_file : ./test/data/routing/gauge_01073000.gpkg

#--------------------------------------------------------------------------------
compute_parameters:
#----------
Expand Down Expand Up @@ -60,8 +71,8 @@ compute_parameters:
dt : 300 # [sec]
qlat_input_folder : ./test/data/routing/
qlat_file_pattern_filter : "nex-*"
nexus_input_folder : ./test/data/routing/
nexus_file_pattern_filter : "nex-*" #OR "*NEXOUT.parquet" OR "nex-*"
# 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-*"
#coastal_boundary_input_file : channel_forcing/schout_1.nc
nts : 8640 #288 for 1day
Expand All @@ -81,11 +92,20 @@ compute_parameters:
# crosswalk_segID_field : # 'link'
# wrf_hydro_lastobs_file :
# lastobs_output_folder : lastobs/
# reservoir_da:
# #----------
# reservoir_persistence_usgs : False
# reservoir_persistence_usace : False
# gage_lakeID_crosswalk_file : # domain/reservoir_index_AnA.nc

# Needed to prevent AttributeError
reservoir_da:
#----------
reservoir_persistence_da:
reservoir_persistence_usgs : False
reservoir_persistence_usace : False
# gage_lakeID_crosswalk_file : # domain/reservoir_index_AnA.nc
reservoir_rfc_da:
#----------
#reservoir_parameter_file : domain/reservoir_index_AnA.nc
reservoir_rfc_forecasts : False
#reservoir_rfc_forecasts_time_series_path: rfc_TimeSeries/
#reservoir_rfc_forecasts_lookback_hours : 48
#--------------------------------------------------------------------------------
output_parameters:
#----------
Expand Down
20 changes: 9 additions & 11 deletions test/geopackage/SQLite_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST_F(SQLite_Test, sqlite_query_test)
}

// user provides a query
const std::string query = "SELECT * FROM gpkg_contents LIMIT 1";
const std::string query = "SELECT * FROM gpkg_contents WHERE table_name = 'flowpaths' LIMIT 1";
sqlite_iter iter = db.query(query);

EXPECT_EQ(iter.num_columns(), 10);
Expand All @@ -69,23 +69,21 @@ TEST_F(SQLite_Test, sqlite_query_test)
EXPECT_EQ(iter.get<std::string>(1), "features");
EXPECT_EQ(iter.get<std::string>(2), "flowpaths");
EXPECT_EQ(iter.get<std::string>(3), "");
EXPECT_EQ(iter.get<std::string>(4), "2022-10-25T14:33:51.668Z");
EXPECT_EQ(iter.get<double>(5), 1995218.564876059);
EXPECT_EQ(iter.get<double>(6), 2502240.321178956);
EXPECT_EQ(iter.get<double>(7), 2002525.992495368);
EXPECT_EQ(iter.get<double>(8), 2508383.058762011);
EXPECT_NEAR(iter.get<double>(5), 1995219.0, 1e2);
EXPECT_NEAR(iter.get<double>(6), 2502240.0, 1e2);
EXPECT_NEAR(iter.get<double>(7), 2002526.0, 1e2);
EXPECT_NEAR(iter.get<double>(8), 2508383.0, 1e2);
EXPECT_EQ(iter.get<int>(9), 5070);

// using column_names
EXPECT_EQ(iter.get<std::string>("table_name"), "flowpaths");
EXPECT_EQ(iter.get<std::string>("data_type"), "features");
EXPECT_EQ(iter.get<std::string>("identifier"), "flowpaths");
EXPECT_EQ(iter.get<std::string>("description"), "");
EXPECT_EQ(iter.get<std::string>("last_change"), "2022-10-25T14:33:51.668Z");
EXPECT_EQ(iter.get<double>("min_x"), 1995218.564876059);
EXPECT_EQ(iter.get<double>("min_y"), 2502240.321178956);
EXPECT_EQ(iter.get<double>("max_x"), 2002525.992495368);
EXPECT_EQ(iter.get<double>("max_y"), 2508383.058762011);
EXPECT_NEAR(iter.get<double>(5), 1995219.0, 1e2);
EXPECT_NEAR(iter.get<double>(6), 2502240.0, 1e2);
EXPECT_NEAR(iter.get<double>(7), 2002526.0, 1e2);
EXPECT_NEAR(iter.get<double>(8), 2508383.0, 1e2);
EXPECT_EQ(iter.get<int>("srs_id"), 5070);

// reiteration
Expand Down