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

precip_rate now computed using the right unit of temperature #389

Merged
merged 7 commits into from
Mar 9, 2022
144 changes: 72 additions & 72 deletions data/forcing/cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv

Large diffs are not rendered by default.

142 changes: 71 additions & 71 deletions data/forcing/cat-52_2015-12-01 00_00_00_2015-12-30 23_00_00.csv

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions data/forcing/cat-67_2015-12-01 00_00_00_2015-12-30 23_00_00.csv

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions test/realizations/catchments/Bmi_C_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "gtest/gtest.h"
#include <iostream>
#include <vector>
#include <regex>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include "FileChecker.h"
Expand Down Expand Up @@ -275,7 +276,7 @@ TEST_F(Bmi_C_Formulation_Test, GetResponse_0_b) {
for (int i = 0; i < 39; i++) {
response = formulation.get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -305,7 +306,8 @@ TEST_F(Bmi_C_Formulation_Test, GetOutputLineForTimestep_0_a) {

formulation.get_response(0, 3600);
std::string output = formulation.get_output_line_for_timestep(0, ",");
ASSERT_EQ(output, "0.000000,0.000000");
std::regex expected ("(-?)0.000000,(-?)0.000000");
ASSERT_TRUE(std::regex_match(output, expected));
}

/** Simple test of output with modified variables. */
Expand All @@ -321,7 +323,8 @@ TEST_F(Bmi_C_Formulation_Test, GetOutputLineForTimestep_1_a) {
// OUTPUT_VAR_1 first.
formulation.get_response(0, 3600);
std::string output = formulation.get_output_line_for_timestep(0, ",");
ASSERT_EQ(output, "0.000000,0.000000");
std::regex expected ("(-?)0.000000,(-?)0.000000");
ASSERT_TRUE(std::regex_match(output, expected));
}

/** Simple test of output with modified variables, picking time step when there was non-zero rain rate. */
Expand All @@ -336,7 +339,8 @@ TEST_F(Bmi_C_Formulation_Test, GetOutputLineForTimestep_1_b) {
formulation.get_response(i++, 3600);
formulation.get_response(i, 3600);
std::string output = formulation.get_output_line_for_timestep(i, ",");
ASSERT_EQ(output, "0.000000,0.000002");
std::regex expected ("(-?)0.000000,0.000001");
ASSERT_TRUE(std::regex_match(output, expected));
}

TEST_F(Bmi_C_Formulation_Test, determine_model_time_offset_0_a) {
Expand Down
4 changes: 2 additions & 2 deletions test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ TEST_F(Bmi_Cpp_Formulation_Test, GetResponse_0_b) {
for (int i = 0; i < 39; i++) {
response = formulation.get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -335,7 +335,7 @@ TEST_F(Bmi_Cpp_Formulation_Test, GetOutputLineForTimestep_1_b) {
formulation.get_response(i++, 3600);
formulation.get_response(i, 3600);
std::string output = formulation.get_output_line_for_timestep(i, ",");
ASSERT_EQ(output, "0.000000,0.000002");
ASSERT_EQ(output, "0.000000,0.000001");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be kind of surprised if the -0 thing only happens on C and not C++ ... but we can keep an eye on it.

}

TEST_F(Bmi_Cpp_Formulation_Test, determine_model_time_offset_0_a) {
Expand Down
4 changes: 2 additions & 2 deletions test/realizations/catchments/Bmi_Fortran_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ TEST_F(Bmi_Fortran_Formulation_Test, GetResponse_0_b) {
for (int i = 0; i < 39; i++) {
response = formulation.get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -346,7 +346,7 @@ TEST_F(Bmi_Fortran_Formulation_Test, GetOutputLineForTimestep_1_b) {
double response = formulation.get_response(i, 3600);
std::string output = formulation.get_output_line_for_timestep(i, ",");
//NOTE these answers are dependent on the INPUT vars selected and the data in the forcing file
ASSERT_EQ(output, "0.025400,0.000002,0.000000");
ASSERT_EQ(output, "0.025400,0.000001,0.000000");
}

TEST_F(Bmi_Fortran_Formulation_Test, determine_model_time_offset_0_a) {
Expand Down
8 changes: 4 additions & 4 deletions test/realizations/catchments/Bmi_Multi_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ TEST_F(Bmi_Multi_Formulation_Test, GetResponse_0_b) {
for (int i = 0; i < 39; i++) {
response = formulation.get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -463,7 +463,7 @@ TEST_F(Bmi_Multi_Formulation_Test, GetResponse_1_b) {
for (int i = 0; i < 39; i++) {
response = formulation.get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -495,7 +495,7 @@ TEST_F(Bmi_Multi_Formulation_Test, GetOutputLineForTimestep_0_b) {
formulation.get_response(i++, 3600);
formulation.get_response(i, 3600);
std::string output = formulation.get_output_line_for_timestep(i, ",");
ASSERT_EQ(output, "0.000002,199280.000000");
ASSERT_EQ(output, "0.000001,199280.000000");
}

/**
Expand Down Expand Up @@ -526,7 +526,7 @@ TEST_F(Bmi_Multi_Formulation_Test, GetOutputLineForTimestep_1_b) {
formulation.get_response(i++, 3600);
formulation.get_response(i, 3600);
std::string output = formulation.get_output_line_for_timestep(i, ",");
ASSERT_EQ(output, "0.000002,199280.000000,543.000000");
ASSERT_EQ(output, "0.000001,199280.000000,543.000000");
}

#endif // NGEN_BMI_C_LIB_ACTIVE || NGEN_BMI_FORTRAN_ACTIVE || ACTIVATE_PYTHON
Expand Down
4 changes: 2 additions & 2 deletions test/realizations/catchments/Bmi_Py_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ TEST_F(Bmi_Py_Formulation_Test, get_response_0_b) {
for (int i = 0; i < 39; i++) {
response = examples[ex_index].formulation->get_response(i, 3600);
}
double expected = 4.866464273262429e-08;
double expected = 2.7809780039160068e-08;
ASSERT_EQ(expected, response);
}

Expand Down Expand Up @@ -447,7 +447,7 @@ TEST_F(Bmi_Py_Formulation_Test, GetOutputLineForTimestep_0_b) {

double response = examples[ex_index].formulation->get_response(543, 3600);
std::string output = examples[ex_index].formulation->get_output_line_for_timestep(543, ",");
std::regex expected ("0.000002,(-?)0.000000,544.000000");
std::regex expected ("0.000001,(-?)0.000000,544.000000");
ASSERT_TRUE(std::regex_match(output, expected));
}

Expand Down