Skip to content

Conversation

DInozemtsev
Copy link
Contributor

No description provided.

Dmitriy Inozemtsev and others added 23 commits September 14, 2017 14:11
…angularsen-master

# Conflicts:
#	Common/UnitDefinitions/Energy.json
#	Common/UnitDefinitions/Mass.json
#	Common/UnitDefinitions/Power.json
#	Common/UnitDefinitions/Volume.json
#	UnitsNet.Tests/CustomCode/EnergyTests.cs
#	UnitsNet.Tests/CustomCode/FlowTests.cs
#	UnitsNet.Tests/CustomCode/MassFlowTests.cs
#	UnitsNet.Tests/CustomCode/MassTests.cs
#	UnitsNet.Tests/CustomCode/PowerTests.cs
#	UnitsNet.Tests/CustomCode/VolumeTests.cs
#	UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs
#	UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs
#	UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs
#	UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs
#	UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs
#	UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs
#	UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs
#	UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs
#	UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs
#	UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs
#	UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs
#	UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/Power.g.cs
#	UnitsNet/GeneratedCode/UnitClasses/Volume.g.cs
#	UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
#	UnitsNet/UnitDefinitions/Flow.json
#	UnitsNet/UnitDefinitions/MassFlow.json
@codecov-io
Copy link

Codecov Report

Merging #779 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #779      +/-   ##
==========================================
+ Coverage   63.82%   63.84%   +0.02%     
==========================================
  Files         278      278              
  Lines       41477    41507      +30     
==========================================
+ Hits        26471    26501      +30     
  Misses      15006    15006              
Impacted Files Coverage Δ
UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs 100.00% <ø> (ø)
...nsions/GeneratedCode/NumberToVolumeExtensions.g.cs 100.00% <100.00%> (ø)
UnitsNet/GeneratedCode/Quantities/Volume.g.cs 76.98% <100.00%> (+0.81%) ⬆️
UnitsNet/GeneratedCode/UnitConverter.g.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bff108c...b83b8d2. Read the comment docs.

@angularsen
Copy link
Owner

Hi, thanks for contributing.

I have to ask though, are you sure these units are actually widely used?

I can't seem to find much on Google and it seems a bit weird to me that metric prefixes (deci, kilo, deca) etc are used for US units.

It would be great to see some URLs pointing to references or actual usage of these units before merging this as I suspect it is maybe not used much. Do you use these units yourself? In what domain/context?

Best,
Andreas

@DInozemtsev
Copy link
Contributor Author

DInozemtsev commented Apr 27, 2020

Hi, @angularsen

First of all, thank you so much for creation of such amazing library! I can not express well enough how much I love it.

2nd, I work as an developer on Energy and Utility Management system that targets US market. A plenty of US utility companies use 'cGal'/'100 Gal' and 'kGal'/'1000 Gal' units in theirs reports and DBs for utility types as 'Water', 'Diesel Fuel', 'Oil' and so on.

More than that, Google seems to be aware of this units and looks like people search for such conversions on regular basis.

1GalConv

100Gal

1000Gal

However I totally agree that 'DecaGallon' it rather something exotic, so plz let me know if you would like to remove it and I'll get rid of this in no time.

Copy link
Owner

@angularsen angularsen left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the references, very helpful. I'm sold then :-) Hecto-unit can stay, I don't mind since it is so close to deca and deci.

Looks good to me. I'll wait for your reply before merging this.

"FromUnitToBaseFunc": "x*0.00378541",
"FromBaseToUnitFunc": "x/0.00378541",
"Prefixes": [ "Kilo", "Mega" ],
"Prefixes": [ "Deca", "Deci", "Hecto", "Kilo", "Mega" ],
Copy link
Owner

@angularsen angularsen Apr 27, 2020

Choose a reason for hiding this comment

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

You mentioned reports using 'cGal'/'100 Gal' and 'kGal'/'1000 Gal'.

Please note:

  1. The abbreviations used by ToString() will in this PR be dgal (U.S.) and hgal (U.S.) etc.
  2. Volume.Parse("5 cGal (U.S.)") will throw an exception, because parsing is currently case sensitive.

If you really want ToString() and Parse() to support using uppercase Gal, then you need to add that Gal (U.S.) abbreviation to the end of the Abbreviations array below. It would still need the (U.S.) suffix to be consistent with our naming conventions though..

To use a specific abbreviation in ToString(), take a look at custom string formatting.

If you are fine with the existing lowercase gal (U.S.) abbreviation, then I recommend not adding Gal (U.S.) unless it will actually be used.

Copy link
Owner

Choose a reason for hiding this comment

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

#781 is now merged, so this is point is no longer relevant :-) This PR is then good to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@angularsen Sorry for delay with my reply. You see, in our system exists a few different names for the same unit. First company names it "kGal", the second - "100 Gal", the third - "Hundred Gallons" and so on. Thus I don't think that there is any standard name of those units in the States, and if there is actually one, looks like no one really respects it. So I would leave it as it is now. :-)

@angularsen
Copy link
Owner

I've had this nagging in the back of my mind for some time, so I finally got a PR out to support case insensitive parsing that I mentioned above. If that is merged, then it should be able to parse cGal (U.S.) without having to add that variant explicitly in the JSON file.

#781

@angularsen angularsen merged commit 3882aa6 into angularsen:master Apr 28, 2020
@angularsen
Copy link
Owner

Nuget is on the way out.
Release UnitsNet/4.59.0 · angularsen/UnitsNet

@angularsen
Copy link
Owner

angularsen commented Apr 28, 2020 via email

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.

3 participants