-
Notifications
You must be signed in to change notification settings - Fork 380
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
Add TemperatureGradient and deprecate LapseRate #991
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3dfe9a4
Order the quantity json files alphabetically before running CodeGen
dglozano c1aca3c
Move Obsolete attribute in the generator below the XML documentation
dglozano 456547e
Mark LapseRate as Obsolete
dglozano 04a3d21
Add TemperatureGradient Quantity
dglozano 99b8a6e
Add operators extensions to TemperatureGradient and remove duplicates…
dglozano 68e8516
Remove None Include=""
angularsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"Name": "TemperatureGradient", | ||
"BaseUnit": "KelvinPerMeter", | ||
"XmlDoc": "The rate of change of temperature with displacement in a given direction (as with increase of height)", | ||
"BaseDimensions": { | ||
"L": -1, | ||
"Θ": 1 | ||
}, | ||
"Units": [ | ||
{ | ||
"SingularName": "KelvinPerMeter", | ||
"PluralName": "KelvinsPerMeter", | ||
"BaseUnits": { | ||
"L": "Meter", | ||
"Θ": "Kelvin" | ||
}, | ||
"FromUnitToBaseFunc": "x", | ||
"FromBaseToUnitFunc": "x", | ||
"Localization": [ | ||
{ | ||
"Culture": "en-US", | ||
"Abbreviations": [ "∆°K/m" ] | ||
} | ||
] | ||
}, | ||
{ | ||
"SingularName": "DegreeCelsiusPerMeter", | ||
"PluralName": "DegreesCelciusPerMeter", | ||
"BaseUnits": { | ||
"L": "Meter", | ||
"Θ": "DegreeCelsius" | ||
}, | ||
"FromUnitToBaseFunc": "x", | ||
"FromBaseToUnitFunc": "x", | ||
"Localization": [ | ||
{ | ||
"Culture": "en-US", | ||
"Abbreviations": [ "∆°C/m" ] | ||
} | ||
] | ||
}, | ||
{ | ||
"SingularName": "DegreeFahrenheitPerFoot", | ||
"PluralName": "DegreesFahrenheitPerFoot", | ||
"BaseUnits": { | ||
"L": "Foot", | ||
"Θ": "DegreeFahrenheit" | ||
}, | ||
"FromUnitToBaseFunc": "(x / 0.3048) * 5/9", | ||
"FromBaseToUnitFunc": "(x * 0.3048) * 9/5", | ||
"Localization": [ | ||
{ | ||
"Culture": "en-US", | ||
"Abbreviations": [ "∆°F/ft" ] | ||
} | ||
] | ||
}, | ||
{ | ||
"SingularName": "DegreeCelsiusPerKilometer", | ||
"PluralName": "DegreesCelciusPerKilometer", | ||
"BaseUnits": { | ||
"L": "Kilometer", | ||
"Θ": "DegreeCelsius" | ||
}, | ||
"FromUnitToBaseFunc": "x / 1e3", | ||
"FromBaseToUnitFunc": "x * 1e3", | ||
"Localization": [ | ||
{ | ||
"Culture": "en-US", | ||
"Abbreviations": [ "∆°C/km" ] | ||
} | ||
] | ||
} | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToTemperatureGradientExtensionsTest.g.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
UnitsNet.NumberExtensions/GeneratedCode/NumberToTemperatureGradientExtensions.g.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by \generate-code.bat. | ||
// | ||
// Changes to this file will be lost when the code is regenerated. | ||
// The build server regenerates the code before each build and a pre-build | ||
// step will regenerate the code on each local build. | ||
// | ||
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. | ||
// | ||
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. | ||
// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. | ||
// | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
// Licensed under MIT No Attribution, see LICENSE file at the root. | ||
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. | ||
|
||
using System; | ||
using Xunit; | ||
|
||
namespace UnitsNet.Tests.CustomCode | ||
{ | ||
public class TemperatureGradientTests : TemperatureGradientTestsBase | ||
{ | ||
protected override bool SupportsSIUnitSystem => true; | ||
|
||
protected override double DegreesCelciusPerKilometerInOneKelvinPerMeter => 1000; | ||
|
||
protected override double DegreesCelciusPerMeterInOneKelvinPerMeter => 1; | ||
|
||
protected override double DegreesFahrenheitPerFootInOneKelvinPerMeter => 0.54864; | ||
|
||
protected override double KelvinsPerMeterInOneKelvinPerMeter => 1; | ||
|
||
[Fact] | ||
public void TemperatureDeltaDividedByTemperatureGradientEqualsLength() | ||
{ | ||
Length length = TemperatureDelta.FromDegreesCelsius(50) / TemperatureGradient.FromDegreesCelciusPerKilometer(5); | ||
Assert.Equal(length, Length.FromKilometers(10)); | ||
} | ||
|
||
[Fact] | ||
public void TemperatureDeltaDividedByLengthEqualsTemperatureGradient() | ||
{ | ||
TemperatureGradient lapseRate = TemperatureDelta.FromDegreesCelsius(50) / Length.FromKilometers(10); | ||
angularsen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Assert.Equal(lapseRate, TemperatureGradient.FromDegreesCelciusPerKilometer(5)); | ||
} | ||
|
||
[Fact] | ||
public void LengthMultipliedByTemperatureGradientEqualsTemperatureDelta() | ||
{ | ||
TemperatureDelta temperatureDelta = Length.FromKilometers(10) * TemperatureGradient.FromDegreesCelciusPerKilometer(5); | ||
Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); | ||
} | ||
|
||
[Fact] | ||
public void TemperatureGradientMultipliedByLengthEqualsTemperatureDelta() | ||
{ | ||
TemperatureDelta temperatureDelta = TemperatureGradient.FromDegreesCelciusPerKilometer(5) * Length.FromKilometers(10); | ||
Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Verified
https://unitconverterapp.com/quantity/temperature%20interval%20per%20length
https://www.calculand.com/unit-converter/?gruppe=Temperature+gradient