Skip to content

Added a weather helper to make temperature, humidity and pressure calculations - #783

Merged
joperezr merged 138 commits into
dotnet:masterfrom
MarkCiliaVincenti:WeatherHelper
Apr 18, 2020
Merged

joperezr merged 138 commits into
dotnet:masterfrom
MarkCiliaVincenti:WeatherHelper

Conversation

@MarkCiliaVincenti

@MarkCiliaVincenti MarkCiliaVincenti commented Oct 9, 2019 •

Copy link
Copy Markdown
Contributor

Covers the remainder of #752.

Streamlined multiple samples.

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

I also have some Unit tests but I'm not sure where to put them.

        [Test]
        public void Test_HeatIndex()
        {
            var heatIndex = WeatherHelper.HeatIndex(Temperature.FromCelsius(30), 70);
            Assert.AreEqual(Math.Round(heatIndex.Celsius), 35);
        }

        [Test]
        public void Test_SummerSimmerIndex()
        {
            var summerSimmerIndex = WeatherHelper.SummerSimmerIndex(Temperature.FromFahrenheit(10), 8);
            Assert.AreEqual(Math.Round(summerSimmerIndex.Fahrenheit, 2), 11.06);
        }

        [Test]
        public void Test_SaturatedVaporPressure()
        {
            var saturatedVaporPressure = WeatherHelper.SaturatedVaporPressure(Temperature.FromCelsius(30));
            Assert.AreEqual(Math.Round(saturatedVaporPressure.Pascal, 0), 4232);
        }

        [Test]
        public void Test_ActualVaporPressure()
        {
            var actualVaporPressure = WeatherHelper.ActualVaporPressure(Temperature.FromCelsius(30), 25);
            Assert.AreEqual(Math.Round(actualVaporPressure.Pascal, 0), 1058);
        }

        [Test]
        public void Test_DewPoint()
        {
            var dewPoint = WeatherHelper.DewPoint(Temperature.FromFahrenheit(100), 50);
            Assert.AreEqual(Math.Round(dewPoint.Fahrenheit, 0), 78);
        }

        [Test]
        public void Test_AbsoluteHumidity()
        {
            var absoluteHumidity = WeatherHelper.AbsoluteHumidity(Temperature.FromFahrenheit(100), 50);
            Assert.AreEqual(Math.Round(absoluteHumidity, 1), 22.7);
        }

@krwq

krwq commented Oct 9, 2019

Copy link
Copy Markdown
Member

Comment thread README.md Resolved
@krwq

krwq commented Oct 10, 2019

Copy link
Copy Markdown
Member

@MarkCiliaVincenti LGTM after fixing test comments

@MarkCiliaVincenti

MarkCiliaVincenti commented Oct 11, 2019 •

Copy link
Copy Markdown
Contributor Author

Note to self: I need to add methods to get the pressure from given sea-level pressure, temperature and altitude with overloaded methods (mean sea-level pressure of 1013.25 hPa and temperature of 15 C). This is used in Bmp180. Similarly we can get temperature from known altitude, pressure and sea-level pressure.

@MarkCiliaVincenti MarkCiliaVincenti changed the title Added a weather helper to make temperature and humidity calculations Added a weather helper to make temperature, humidity and pressure calculations Oct 11, 2019
@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

Note to self: I need to add methods to get the pressure from given sea-level pressure, temperature and altitude with overloaded methods (mean sea-level pressure of 1013.25 hPa and temperature of 15 C). This is used in Bmp180. Similarly we can get temperature from known altitude, pressure and sea-level pressure.

Done.

@MarkCiliaVincenti

MarkCiliaVincenti commented Oct 14, 2019 •

Copy link
Copy Markdown
Contributor Author

Dependency on #789. I made a test that should fail, but it's not failing. Until that fails we can't be sure that all unit tests are working.

@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor Author

I confirm all tests are passing now. From my end you can go ahead and merge to master, @krwq

@krwq

krwq commented Oct 15, 2019

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@krwq

krwq commented Oct 15, 2019

Copy link
Copy Markdown
Member

(restarted CI)

Comment thread src/devices/Bmp180/Bmp180.cs Resolved
@pgrawehr pgrawehr mentioned this pull request Apr 12, 2020
@joperezr

Copy link
Copy Markdown
Member

I have now pushed the changes on PR #1041 by @pgrawehr

@MarkCiliaVincenti
MarkCiliaVincenti requested a review from krwq April 18, 2020 16:16
@MarkCiliaVincenti

MarkCiliaVincenti commented Apr 18, 2020 •

Copy link
Copy Markdown
Contributor Author

I have now pushed the changes on PR #1041 by @pgrawehr

Great, are we ready to merge to master now?
I saw that the changes by @pgrawehr has removed the Summer Simmer Index. I have privately messaged @krwq with the LinkedIn account of the author of this formula, hoping that you guys could get his official permission to include this formula here. But let it not slow down the process; we could add it in as a new PR.

Edit: Sorry, closed PR by mistake.

@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can't remember if we discussed the fact of not having this project here and instead just have the *cs files and compile them in the projects we need them in, like the rest of Common. That said, I can address that in a separate PR to no longer block this one.

@joperezr
joperezr merged commit d67f974 into dotnet:master Apr 18, 2020
@joperezr

Copy link
Copy Markdown
Member

Thanks a lot to both @MarkCiliaVincenti and @pgrawehr for your hard work and getting this done.

@github-actions github-actions Bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants