Git Product home page Git Product logo

Comments (11)

finitespace avatar finitespace commented on July 21, 2024

It returns altitude so I am not sure why you are suggesting the change in name.

from bme280.

coelner avatar coelner commented on July 21, 2024

Maybe I understand that completely wrong, but the Altitude at SeaLevel is 0.
But we need a function to get a SeaLevel correlated Pressure. So far I read the code, you calculate this.
( https://de.wikipedia.org/wiki/Barometrische_H%C3%B6henformel#Internationale_H.C3.B6henformel )
(You need a SeaLevelAltitude while converting between different geodetic reference systems)

from bme280.

jirkaptr avatar jirkaptr commented on July 21, 2024

Hi, Tyler, it seems you have caught yourself in the trap of misleading name. The function sealevelAlitude really calculates the sea-level pressure which we know from meteorological reports.
To the formula itself:

  • I recommend to check the formula because it is not exactly the same as in the common sources (Wikipedia, NOAA). The speech is about presence of (0.0065 * A) in the denominator of the calculation formula.
  • The formula does not respect air humidity.

I recommend the comparison with http://drkfs.net/correctiontosealevel.htm.

from bme280.

finitespace avatar finitespace commented on July 21, 2024

Alright all, good data. I should have required more documentation on the pull request. Let me try to clean this up.

from bme280.

jirkaptr avatar jirkaptr commented on July 21, 2024

from bme280.

rpaskowitz avatar rpaskowitz commented on July 21, 2024

I believe some renaming is in order. The readme claims that altitude is returned, but the source paints a more confusing picture:

  /// Convert current pressure to sea-level pressure, returns
  /// Altitude (in meters), temperature in Celsius
  /// return the equivalent pressure at sea level.

It says that it is converting pressures, then says it returns altitude in meters (and temperature), and then says it returns pressure at sea level. A simple test shows that it returns values that as much more in the range of pressure in Pa than altitude in m. It seems much more correct to say it accepts pressure (in Pa), Altitude (in meters) and Temperature (in Celsius), and returns pressure (in Pa). The returns on the first line of the comment seems erroneous and if left out, the comment as written makes far more sense (name of the method notwithstanding)

For example, a current reading from my BMP280 has a pressure of 101425 Pa, and the sealevel calculation returns 102105 Pa. Note that this is using a known-good altitude, and not the altitude as derived from the Altitude() method, which returns a significantly different value, but is computed with a default sealevel altitude of 101325 Pa as defined in the header

Given that this method seems to return a value in Pa, and that sealevel altitude should be pretty relatively constant, one might wonder what use this method has? For me, it seems to be for calibration of the Altitude(). When using the 101325 sealevel pressure, my altitude is about 70m from reality, so instead, using my known-good altitude, and obtaining the 102105 Pa pressure from the method, it seems I can use this value in place of the default sea-level pressure in Altitude() to get calibrated altitudes.

from bme280.

finitespace avatar finitespace commented on July 21, 2024

Here is the original pull request: #22

Looks like it was originally written to calculate equivalent sea level pressure in mb. When I refactored the code my analysis showed it was unit independent code. So, using Pa would not impact the calculation.

@guruathwal can you shed some light on the situation.

from bme280.

rpaskowitz avatar rpaskowitz commented on July 21, 2024

I'd have to give it a more careful read, but that sounds correct. There winds up being a ratio of sealevel pressure to atmospheric pressure, and since the conversions between various units of pressure are linear, you should be able to pass in pressure in any unit, and get the adjusted pressure back out in the same unit.

It will just be pressure that it converted though, the temperature/altitude are fixed and used to determine the sealevel pressure.

from bme280.

finitespace avatar finitespace commented on July 21, 2024

Alright, a change is in order:

  • The function will be renamed equivalentSeaLevelPressure.
  • Documentation will be updated.
  • New/more functions can be added as mentioned above.

from bme280.

finitespace avatar finitespace commented on July 21, 2024

Completed: #49

from bme280.

guruathwal avatar guruathwal commented on July 21, 2024

Hi.. there should not be any confusion..
You input your current altitude in "Meters", Current Pressure in "mb" and current temperature in "celcius"
The function will return equivalent Sea Level Pressure in "mb"

from bme280.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.