Skip to content

Added units for Astronomy. #680

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

Merged
merged 13 commits into from
Jul 20, 2019
Merged

Added units for Astronomy. #680

merged 13 commits into from
Jul 20, 2019

Conversation

ebfortin
Copy link
Contributor

Pull request for checking problem with inches unit tests being "polluted" by new astronomy units added.

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.

This looks pretty good, some early comments.

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 18, 2019 via email

@ebfortin
Copy link
Contributor Author

Info.GetUnitInfosFor() returns an enumration. In it I get Meters (for Length) and all of my new defined units. So I guess I should remove BaseUnits as well? Not only BaseUnit?

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 18, 2019 via email

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 18, 2019 via email

@angularsen
Copy link
Owner

It's very late over here and I have to go now, will try to come back to this tomorrow.

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 18, 2019 via email

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 18, 2019 via email

@ebfortin
Copy link
Contributor Author

Regarding Luminosity, the units in Astronomy is really Watts. Can I have two quantities that resolve to the same Watts Unit? How would that work when we do calculation between units? Will the framework understands they resolve both to Watts? Or will two different Watts exist?

@angularsen
Copy link
Owner

Watts can exist in both Power and Luminosity, no problem in itself. Parse() and ToString() will work for both. We can add helper methods and properties to convert between Power and Luminosity such as Luminosity.ToPower(). This way luminosity specific units are in Luminosity. However, I am no domain expert and this comes down to what is the most intuitive to those (you) who will be using it.

@ebfortin
Copy link
Contributor Author

I will do a new Quantity then. Makes more sense and from what you say will work.

@angularsen
Copy link
Owner

angularsen commented Jul 19, 2019 via email

@ebfortin
Copy link
Contributor Author

REgarding adding new quantities, I'm stuck at the Test class. generate-code do not create the test class. And doc talks about a batch file "GenerateUnits.bat" that I can't find anywhere.

@ebfortin
Copy link
Contributor Author

Forget it, it generates the code. I had a typo somewhere so there was a filename mismatch.

DO NOT CURRENTLY COMPILE!
@ebfortin
Copy link
Contributor Author

Please look at how I've added the Luminosity Quantity. It doesn't compile. There are multiple methods with the same name generated. And my SolarLuminosity unit doesn't appears in code.

@angularsen
Copy link
Owner

Please look at how I've added the Luminosity Quantity. It doesn't compile. There are multiple methods with the same name generated. And my SolarLuminosity unit doesn't appears in code.

6778b39

It seems you have duplicate JSON files:

  • Common/UnitDefinitions/Luminosity.json
  • Common/UnitDefinitions/StellarLuminosity.json

@ebfortin
Copy link
Contributor Author

ebfortin commented Jul 20, 2019

I see there is still an error in my conversion constants for Solar mass. I maybe didn't execute generate-code after the last change. Errors are in generated code.

@angularsen
Copy link
Owner

I see there is still an error in my conversion constants for Solar mass. I maybe didn't execute generate-code after the last change. Errors are in generated code.

Ah, yes, it can be a good idea to run generate-code.bat once and see if there are any new changes and commit those. The build server will run it too, so it will still be correct, but it's good to have all changes included in the PR.

@angularsen
Copy link
Owner

Let me know when you are done making changes and I can review again.

@ebfortin
Copy link
Contributor Author

We should be good with my latest commit.

@angularsen angularsen merged commit 1c6c629 into angularsen:master Jul 20, 2019
@angularsen
Copy link
Owner

Looks good to me 🎉 Nuget on the way out.

Release UnitsNet/4.31.0 · angularsen/UnitsNet

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.

2 participants