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

issue w/ water.density salinity calculation #98

Open
jordansread opened this issue Sep 12, 2018 · 3 comments
Open

issue w/ water.density salinity calculation #98

jordansread opened this issue Sep 12, 2018 · 3 comments

Comments

@jordansread
Copy link
Member

It seems the ^2 is missing from the source code?

image

@lawinslow
Copy link
Member

Yup, I think its missing.

Sanity check with the OCE package

> 1000 + oce::swSigma0(35,25, pressure=10.1325)
 [1] 1023.342
> rLakeAnalyzer::water.density(25, 35)
[1] 1022.768

If we fix the equation to have the S^2 at the end.

> rLakeAnalyzer::water.density(25, 35)
[1] 1023.343

Digging into OCE, we can find their implementation of this equation. It is written in a way I didn't expect, but if you expand the algebra out, you find that last Salinity term (associated with 4.8314e-4) is squared.

So I think you're right. That last term should be squared.

lawinslow added a commit to lawinslow/rLakeAnalyzer that referenced this issue Sep 13, 2018
@jordansread
Copy link
Member Author

Thanks for digging in - seems a simple fix, but an embarrassing error I made in the first place.

@lawinslow
Copy link
Member

Don't worry about it.

While I've said this before, this is why these tools should be open source.

@jread-usgs want to review and merge #99 quick?

jordansread pushed a commit that referenced this issue Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants