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

Conversation

hellkite500
Copy link
Member

@hellkite500 hellkite500 commented Mar 9, 2022

Discovered a bug in the script used to generate the example forcing files. The density of water is computed using the following function:

 def rho(temp):
     """
         Calculate water density at temperature (degrees C)
     """
     return 999.99399 + 0.04216485*temp - 0.007097451*(temp**2) + 0.00003509571*(temp**3) - 9.    9037785E-8*(temp**4)

But the AORC temperature variable is in kelvin, and was being passed without converting to celsius.

Fixed this in the script and regenerated the example forcing data files to get correct precip_rate (in m/s)

Changes

  • There example forcing data files with corrected precip_rate column

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

@hellkite500 hellkite500 requested a review from mattw-nws March 9, 2022 14:32
@mattw-nws mattw-nws changed the title percip_rate now computed using the right unit of temperature precip_rate now computed using the right unit of temperature Mar 9, 2022
@mattw-nws
Copy link
Contributor

Looks like the Fortran tests--maybe others--have expected result values based on the old incorrect precip_rate data. I was afraid of that when we found the issue, since I was about to base an updated test on the same values.

@hellkite500
Copy link
Member Author

Looks like the Fortran tests--maybe others--have expected result values based on the old incorrect precip_rate data. I was afraid of that when we found the issue, since I was about to base an updated test on the same values.

I'm updating those now...

@hellkite500 hellkite500 force-pushed the fix-forcing-example branch from 168f33d to b7d6108 Compare March 9, 2022 16:20
@hellkite500 hellkite500 force-pushed the fix-forcing-example branch from b7d6108 to 4983cb4 Compare March 9, 2022 16:21
@@ -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.

@mattw-nws mattw-nws merged commit f957ca3 into NOAA-OWP:master Mar 9, 2022
@hellkite500 hellkite500 deleted the fix-forcing-example branch March 15, 2022 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants