-
Notifications
You must be signed in to change notification settings - Fork 386
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
Determine BaseUnits of Prefix-Unit #1233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this looks interesting. Some comments below.
So just thinking about this - wouldn't the base units just be the same as the ones without the prefixes? Per your example:
|
I have never used base units in UnitsNet for anything myself, but my understanding of the use case for defining base units is that it makes it easier for an application developer to let the user choose what SI base units to use, then all quantities will automatically be shown in compatible units where possible. For example, if user selects Centimeter as the SI base unit for Length, then all quantities would be represented using centimeters, such as Area cm², Volume cm³ and so on. It may not be able to find a unit for quantities not based on length, such as Angle. Since I haven't used this in any practical application myself, it all is a bit theoretical for me at this point and not so easy to reason about. Personally, if I were to offer unit preferences in an application, I would probably create a custom mapping between SI base units and units in the quantities I care about. However, since we do have base units and maybe it does add some value, then I still think this PR seems worthwhile to merge. |
@bdbonazz Sorry this took a long time. Please revert/undo these changes then re-generate codeAmountOfSubstance.json They add new units, and this should be a separate pull request from determining base units of prefix units. Tip for next timeCreate a new branch on your fork instead of committing on your |
f2963ae
to
439c143
Compare
@bdbonazz Seems you closed this without creating a new pull request. Do you still intend to complete this? |
I am sorry |
@bdbonazz I fully understand time is hard to come by, no pressure from my end. The tests that stopped working was probably a broken change in If you could update your feature branch to take in the latest changes, I believe you should be good to go. If you push your branch and create a pull request for it, then you have some UI buttons to help update the branch by either rebase or merge. I'm happy to help if you need assistance. |
I found a way to determine come BaseUnits of Units added dinamically by prefix.
The main change is to file "CodeGen\Generators\QuantityJsonFilesParser.cs"
New to Open-Source, Open to criticism.