Package org.ka2ddo.yaac.weather
Class MADISWeatherChecker
java.lang.Object
org.ka2ddo.yaac.weather.MADISWeatherChecker
- All Implemented Interfaces:
Serializable
This class implements part of the US National Weather Service's MADIS quality checks on
weather data. For what weather parameters are available in APRS, it implements the
Level 1 (static range) checks, and some of the Level 1 (temporal consistency) checks.
Note that it uses the
SRTM elevation data
to qualify some of its checks for weather stations
that do not report their elevation, so the Level 1 static barometric pressure check may be disabled
or loosened for stations in areas without downloaded SRTM data.
Note that this class is not thread-safe, so a unique instance should be created for each thread using it. Also, all the responses for a given field should be obtained before running another check on a different field or station.
If the level 3 spatial consistency checks are to be performed, this uses the modified Shepard's method for doing the weighted checks, but still splits into 8 octants around the checked station.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
check
(WeatherEnum en, Map<Enum, Object> weatherMap, Map<Enum, Object> prevWeatherMap, StationState ss) Perform the MADIS checks on the specified weather parameter from an APRS packet with weather data in it.boolean
check
(WeatherEnum en, OpenTracMessage otm, OpenTracMessage prevOTM, StationState ss) Perform the MADIS checks on the specified weather parameter from an OpenTRAC packet with weather data in it.static float
getMinimumPressureForThisLocation
(float altitudeM, double latitude, double longitude) Compute the Level 1 static minimum barometric pressure for a given station location, based on the station's reported altitude if provided, else on the ground elevation at the station's reported latitude/longitude.static float
Compute the Level 1 static minimum barometric pressure for a given station location, based on the station's reported altitude if provided, else on the ground elevation at the station's reported latitude/longitude.void
initializeSpatialCheckEnvironment
(float maxRangeForLevel3SpatialKm) Specify that the current known set of weather stations should be used for performing level 3 spatial consistency checks.boolean
Report if the last data record was not out-of-date.
-
Constructor Details
-
MADISWeatherChecker
public MADISWeatherChecker()Create an instance of a MADISWeatherChecker.
-
-
Method Details
-
getMinimumPressureForThisLocation
Compute the Level 1 static minimum barometric pressure for a given station location, based on the station's reported altitude if provided, else on the ground elevation at the station's reported latitude/longitude.- Parameters:
ss
- StationState to obtain station location from- Returns:
- minimum sane barometric pressure for this location's elevation in tenths of millibars
-
getMinimumPressureForThisLocation
public static float getMinimumPressureForThisLocation(float altitudeM, double latitude, double longitude) Compute the Level 1 static minimum barometric pressure for a given station location, based on the station's reported altitude if provided, else on the ground elevation at the station's reported latitude/longitude.- Parameters:
altitudeM
- reported altitude in meters, or Float.NaN if not knownlatitude
- reported latitude in fractional degrees Northlongitude
- reported longitude in fractional degrees East- Returns:
- minimum sane barometric pressure for this location's elevation in tenths of millibars
-
isNotTooOld
public boolean isNotTooOld()Report if the last data record was not out-of-date.- Returns:
- boolean true if data is recent enough to be considered valid
-
initializeSpatialCheckEnvironment
public void initializeSpatialCheckEnvironment(float maxRangeForLevel3SpatialKm) Specify that the current known set of weather stations should be used for performing level 3 spatial consistency checks. Note that this should be called immediately before a chronologically "tight" set of tests so that the weather station data used for the tests is reasonably current and accurate.- Parameters:
maxRangeForLevel3SpatialKm
- the maximum range (in kilometers) from the station under test to another station for that other station to be considered as a test reference
-
check
public boolean check(WeatherEnum en, Map<Enum, Object> weatherMap, Map<Enum, Object> prevWeatherMap, StationState ss) Perform the MADIS checks on the specified weather parameter from an APRS packet with weather data in it. Once check() returns with the validity response, callisNotTooOld()
to get the age results.- Parameters:
en
- WeatherEnum to identify the weather parameter to checkweatherMap
- Map of current weather data from APRS packetprevWeatherMap
- earlier APRS packet's weather data Map from same station to use for time variation checksss
- StationState of station being checked- Returns:
- boolean true if weather parameter is invalid for some reason
-
check
Perform the MADIS checks on the specified weather parameter from an OpenTRAC packet with weather data in it. Once check() returns with the validity response, callisNotTooOld()
to get the age results.- Parameters:
en
- WeatherEnum to identify the weather parameter to checkotm
- OpenTracMessage packet to analyzeprevOTM
- earlier OpenTracMessage packet from same station to use for time variation checksss
- StationState of station being checked- Returns:
- boolean true if weather parameter is invalid for some reason
-