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

Definition for pH #99

Open
carlo-quinonez opened this issue Oct 15, 2019 · 4 comments
Open

Definition for pH #99

carlo-quinonez opened this issue Oct 15, 2019 · 4 comments

Comments

@carlo-quinonez
Copy link

I created a PR #98 that adds a unit for pH. It's not a standard SI unit, but it's very commonly used instead of using the hydrogen ion concentration so I wanted to add it for the sake of completeness.

Is it possible to convert from pH to H+ concentration (moles/ml) using this library? I wouldn't mind writing a PR for doing this conversion if I could get a pointer on where to add the code.

@apascualm
Copy link

The unit is very common, I would appreciate it if @gentooboontoo accepted this PR.

I going to do a folk, to add a new unit (water hardness). It is a great library and it must to grow with new units.

@gentooboontoo
Copy link
Owner

Unfortunately, I currently have 2 objections to this proposal :

  • First, a pH unit would conflict with the unit picoHenry of the electrical inductance (3 pH))
  • Second, pH is not a physical quantity but a scale. It actually has no units.

To overcome the first problem, another unit symbol (different than pH) would have to be chosen.
For the second problem, the pH measurement would have to be defined as a concentration but it will not be accurate.

Have you some suggestions?

@carlo-quinonez
Copy link
Author

I agree with your first point and don't see an obvious resolution.
About your second point, I'd disagree that it doesn't have units because it's definitely not a unitless number like a simple ratio. pH can be used to estimate the H+ concentration, but it's not just a simple log-10 transformation. After reading up on this, it's not clear to me there's even a standard definition of pH.

I'm thinking that pH isn't appropriate to include in js-quantities after all. But that doesn't solve my issue - we ask that our partners specify a "unit" whenever they send us numerical data. Since js-quantities also allows for each, count etc as a valid unit, validating the unit they sent us was easy. I suppose we can just treat pH as an edge case and validate that unit outside of js-quantitites.

@gentooboontoo
Copy link
Owner

Thanks for your feedback @carlo-quinonez. I am not opposed to include pH as a concentration measure (it will just have to be documented somewhere in the library). Perhaps we could wrap the unit inside square brackets to distinguish it from picoHenry or something like that ([pH])...

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

No branches or pull requests

3 participants