r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
175 stars 28 forks source link

mH2O #207

Closed ghost closed 5 years ago

ghost commented 5 years ago

Why I can not convert kgf/m^2 to mH2O? Or ftH2O to mH2O?

a<- 2 unit(a)<- "kgf/m^2" units(a) <- with(ud_units,mH2O) Error: cannot convert kgf/m^2 into mH2O

Enchufa2 commented 5 years ago

Because the conversion is wrong. You are missing an "m" in the denominator: it's "kgf/m^3".

ghost commented 5 years ago

Sorry, I want to convert pressure units. See, kgf/cm² to cmH2O or ftH2O works fine:

> p<- set_units(1,kgf/cm^2)
> p
1 [kgf/cm^2]
> units(p)<-"cmH2O"
> p
1000 [cmH2O]
> units(p)<-"ftH2O"
> p
32.8084 [ftH2O]
> units(p)<-"mH2O"
Error: cannot convert ftH2O into mH2O

Does mH2O means meter of water head? @Enchufa2

Enchufa2 commented 5 years ago

mH2O means milli-H2O, and H2O, according to the database, specifies the acceleration at the Earth's surface of a substance with the density of water.

ghost commented 5 years ago

How can I add manually meH20 (meters) like cmH20 (centimeters) on database? Is it possible @Enchufa2 ?

Enchufa2 commented 5 years ago

This is not a unit, but a product of units, so I recommend to treat that accordingly. These versions work fine:

set_units(set_units(1, "cm H2O"), "m H2O")
set_units(set_units(1, "cm*H2O"), "m*H2O")
ghost commented 5 years ago

OK, but see at valid_udunits. We also have cmH2O at database so I can use cmH2O as symbolic. I would like to use meH2O (meters) as symbolic too. Of course If I use m*H2O works fine or cm*H2O.

image

Enchufa2 commented 5 years ago

Then, see ?install_conversion_constant:

install_conversion_constant("cmH2O", "meH2O", 0.01)
ghost commented 5 years ago

Thank you for the support! That's what I would like to do.

ghost commented 5 years ago

I suggest to include meH2O in the next package version, It's a very common unit used in hydraulics.

edzer commented 5 years ago

@ArturIndio that should be done at udunits-2, not in this R package.

ghost commented 5 years ago

Hi @edzer, what I should be done? Opened the issue here or suggested the meH2O?Or both?

edzer commented 5 years ago

If you want to add a unit to udunits, don't add it to this R package but to the udunits-2 library it interfaces. We are not the only users of that library.

Enchufa2 commented 5 years ago

In other words, @ArturIndio, you should open an issue in the udunits-2 repo to propose that change.

ghost commented 5 years ago

OK, I understood. Thanks.

On Mon, May 20, 2019, 14:37 Iñaki Ucar notifications@github.com wrote:

In other words, @ArturIndio https://github.com/ArturIndio, you should open an issue in the udunits-2 repo to propose that change.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/r-quantities/units/issues/207?email_source=notifications&email_token=ACJSLXSALMSCOO5AUFVC3U3PWLOWHA5CNFSM4HN5NE3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVZRUCQ#issuecomment-494082570, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJSLXTOAXI4WBVFA2UQNPLPWLOWHANCNFSM4HN5NE3A .