Skip to content
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

Ignore sea level pressures with inaccurate/missing GPS elevation #1833

Open
Pandapip1 opened this issue Jun 29, 2023 · 6 comments
Open

Ignore sea level pressures with inaccurate/missing GPS elevation #1833

Pandapip1 opened this issue Jun 29, 2023 · 6 comments
Labels

Comments

@Pandapip1
Copy link

Pandapip1 commented Jun 29, 2023

Pretty simple. I work in a pretty tall building. Every morning, I get a storm alert due to the 5 hPa pressure drop, which is annoying since it also messes with stotm detection in general. I suggest that the weather detection use sea level pressure.

@kylecorry31 kylecorry31 added the question Further information is requested label Jun 29, 2023
@kylecorry31
Copy link
Owner

kylecorry31 commented Jun 29, 2023

Hello, can you provide the following information:

  1. What version of Trail Sense are you using? Trail Sense Settings > Version
  2. Provide me the following values from Trail Sense Settings > Sensors > Barometer
    a. Is "Sea level pressure" enabled
    b. What value are you using for "Smoothing"

By default Trail Sense converts pressures to sea level using GPS elevation. This is meant for outdoor use only, since GPS is not going to get a good reading (if any) from indoors. Unfortunately, if your settings look good, there's not much else I can do to improve the weather forecast in this case since indoor usage is not supported by Trail Sense - both from a technical (GPS does not work well in buildings) and use case (Trail Sense is only designed to support hiking / outdoor use) perspective.

I'm going to change this issue to be ignoring readings with bad GPS data, which may help in this situation and potentially other times when the GPS reading is bad. I'll play around with its accuracy and see if it should be configurable via a setting or on by default. In the meantime, my recommendation is to disable the weather monitor while in that building, and re-enable it when you go on a hike, etc.

Notes to self

  • Treat GPS timeout as missing data
  • Ignore readings with missing data or very inaccurate elevation

@kylecorry31 kylecorry31 changed the title Weather: correct pressure using GPS height Storm alert while in a building (unsupported use case) Jun 29, 2023
@kylecorry31 kylecorry31 changed the title Storm alert while in a building (unsupported use case) Ignore sea level pressures with inaccurate/missing GPS elevation Jun 29, 2023
@kylecorry31 kylecorry31 added tool-weather p3 Priority 3 and removed question Further information is requested labels Jun 29, 2023
@Pandapip1
Copy link
Author

Pandapip1 commented Jun 30, 2023

  1. The latest F-Droid version: 5.0.0
  2. Here you go:
    a. Sea level pressure: Enabled
    b. Smoothing: 0% (changed from default value)

In terms of GPS/Compass accuracy, you're definitely right about the inaccuracy. I didn't bother to check, but the readings are:

  • GPS: Stale (Maybe cell tower geolocation should be supported? I have full bars)
  • Compass: Poor (Nonetheless seems to work perfectly fine; although this will likely be of limited use to this particular issue. There is another bug that seems to randomly set compass accuracy to poor even when it isn't - LMK if I should submit a bug report here or if this is an OS bug).

Finally, maybe it might make sense to add "inside building" detection, maybe by integrating with a map program? It might cause more harm than good though - I used to work in a different building (in a different state, also somewhat high-rise) but all trail sense features, including storm warnings/weather, worked perfectly. Also, it seems to work perfectly well at home, even when indoors, likely because ΔP tends to become 0 very quickly.

There's probably a way to make this work.

@kylecorry31
Copy link
Owner

kylecorry31 commented Jun 30, 2023

Thank you for the details.

  • Unfortunately, cell tower location will not help with elevation detection, that only provides a rough location in terms of latitude and longitude.
  • As for the compass, yes please log an issue for that with details to help me reproduce the issue. The compass accuracy is directly reported by Android, so there might not be much I can do unfortunately.
  • I don't plan on adding inside building detection since that is beyond the supported use cases of Trail Sense - but I believe the adjustments I make as part of this issue will help. Supported use cases can be found here.

For reference, while not officially supported I've found that GPS elevation does work well enough inside a house or small building (especially when near the windows). This is sufficient for Trail Sense's official use cases, which may include entering a small hut or a cabin while backpacking. The cause of your issue is because when Trail Sense can't get a new GPS reading, it falls back to the last known location/elevation. In most cases this is fine, since it is rare to happen outdoors and the elevation likely won't change much. In your case, the building is large and likely does not get a GPS signal (and if it did the elevation would be way off). To Trail Sense, the elevation has not changed and but the pressure did which indicates a low pressure system moving in.

I agree there's probably a way to make weather prediction better while in a building, but that use case is not supported by Trail Sense. In case another developer is building a barometer app meant for everyday use and comes across this issue, I would recommend interpreting rapid changes in pressure as elevation changes if the GPS times out or the reported elevation suddenly becomes very inaccurate. This may not always be correct, so use with caution.

@michaelblyons
Copy link

I also get a daily storm notification on my commute, although mine is a lat/long change, not straight up in an elevator.

  • Sea level enabled
  • Smoothing 15%

If I should change some setting to filter the storm alerts, please let me know.

@kylecorry31
Copy link
Owner

kylecorry31 commented Jul 8, 2023

@michaelblyons I believe this is a similar scenario, just a different way to get there. GPS elevation accuracy decreases with speed and proximity to buildings (depending on where your commute takes you), therefore I imagine the elevations are inaccurate while converting to sea level, and if they are consistently inaccurate it may interfere with the smoothing. Also, depending on how far your commute is, the sea level pressure may actually be different - in that case, Trail Sense isn't able to distinguish that from a storm since it looks identical. In the future #1427 and #1491 may help.

Other than the filtering of inaccurate readings, this scenario falls outside of the official use cases of Trail Sense, so I won't likely add special handling for it.

You may see some success modifying the sensitivity of the storm alert to Low (Settings > Weather > Storm sensitivity), which requires a more rapid change in pressure to trigger the notification.

If you want, I can take a look at the data to confirm this is a case of inaccurate elevations. Within 48 hours of this occurring, you can generate a weather export under Settings > Weather > Export weather readings. This produces a CSV file with times, pressure, elevation, elevation accuracy, temperature, and humidity - it does not include GPS coordinates. If you would like to provide that, feel free to upload it here or send it to me at [email protected]

@kylecorry31
Copy link
Owner

@michaelblyons after some more thought (and forgetting to turn off backtrack myself), I'm going to make a slight change which may help ignore the invalid readings while driving. #1858 and #1859

The rationale for this within Trail Sense's use cases is that you may record a hike and forget to turn off backtrack (or weather monitor). As for the weather monitor, a valid use case would be that you use it at two different hikes that requires travel in between - in that case, you wouldn't want to assume that the weather is the same at each location and therefore the weather forecast should restart at the new location (I may experiment with a distance / time based threshold since if the places are close in distance/time, they may still have the same weather).

I believe that will resolve your issue of the storm alerts appearing while driving - I don't expect it to impact the original issue here about it not working properly in buildings, though it could help a little.

@kylecorry31 kylecorry31 added p2 Priority 2 and removed p3 Priority 3 labels Jun 6, 2024
@kylecorry31 kylecorry31 added this to the 6.2.0 milestone Jun 7, 2024
@kylecorry31 kylecorry31 added p3 Priority 3 and removed p2 Priority 2 labels Jun 23, 2024
@kylecorry31 kylecorry31 removed this from the 6.2.0 milestone Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants