Hourly precipitation amounts seem drastically low

Hello. I took a closer look at the data I'm getting back for hourly forecasts and I'm baffled by results I'm seeing.

For example, it's Dec 19, 2022 8:00am PT and I'm asking for the weather for Orchard Park NY (lat 42.766437 long -78.743855) for Dec 23, 2022. The daily forecast tells me they're expected to have 5.9" of snow. However, the hourly forecast with the most snow that day is reported as 0.071" (1.8mm). The Apple Weather app on iOS shows that hour as having 0.6".

I wrote a 'for' loop to print the results of my call to WeatherService.shared.weather.

        print(oneHour.precipitationAmount.formatted())
        print(oneHour.precipitationAmount.description)
        print(oneHour.precipitationAmount.unit)
        print(oneHour.precipitationAmount.value)

0.071 in
1.8 mm
<_NSStatic_NSUnitLength: 0x2010b0178> mm
1.8

According to the documentation for precipitationAmount (https://developer.apple.com/documentation/weatherkit/hourweather/precipitationamount/):

"This value refers to the liquid equivalent of all precipitation amounts."

A quick internet search told me that the liquid amount can vary drastically, but 10:1 (snow to water) is the usual rule of thumb. Under that assumption, the results you're getting look reasonable.

Thanks for that. Very interesting. I wonder if there's a way then that I could produce an hourly precipitation graph for snow that would have similar values to what the iOS weather app shows.

My guess is that you could make a useful but approximate snowfall report this way, but my guess is that you'd need to combine this with other sources of information (such as other kinds of precipitation?) in order to refine that assumed 10:1 ratio towards something more real, hour by hour.

I'm bumping my old thread with more info. I did a deep dive into the hourly WeatherKit data that is returned. I've been using precipitationAmount to report the snow amout, but there's actually a property returned called snowfallAmount!! And it appears to contain values that are what I have been expecting for snow.

WeatherKit.HourWeather(date: 2024-01-09 15:00:00 +0000, cloudCover: 0.98, cloudCoverLow: 0.0, cloudCoverMid: 0.0, cloudCoverHigh: 0.0, condition: Heavy Snow, symbolName: "cloud.snow", dewPoint: -0.44 °C, humidity: 0.96, isDaylight: true, precipitation: snow, precipitationChance: 0.61, precipitationAmount: 2.75 mm, snowfallAmount: 27.16 mm, pressure: 1018.33 mbar, pressureTrend: Falling, temperature: 0.16 °C, apparentTemperature: -4.72 °C, uvIndex: WeatherKit.UVIndex(value: 1, category: Low), visibility: 778.16 m, wind: WeatherKit.Wind(compassDirection: Southeast, direction: 127.0 °, speed: 17.97 km/h, gust: Optional(51.98 km/h))), 

BUT if you look at the HourWeather in SwiftUI the snowfall amount is missing. You see the precipitation, precipitationChance, and precipitationAmount that are before it in the raw data and the pressure, pressureTrend, etc that follow it.

snowFall isn't in an extension, Xcode autocomplete doesn't know about it, doesn't compile, etc.

Either this is a major omission or I'm completely misunderstanding something.

I filed FB13521886

I'm having the same issue. I found there's an element called snowfallAmount when I debug the weather response, and the data in the snowfallAmount makes total sense. But the snowfallAmount is not available to use. Apple should make this element public and available to the developers.

You can see in the debug section, the variable contains the snowfallAmount element:

But when I want to use the snowfallAmount element in my code, the compiler complains it's not available:

@shiftingsand you can add my remarks including the images to explain to Apple about this omission.

It's in the Codable JSON from HourWeather so it can be extracted from that. Perfectly normal way to extract data from an API. :P

(I've noticed changes in the WeatherKit JSON between even minor iOS releases, so make sure to get some automated unit tests or something to catch if they change it again...)

private struct SnowfallExtractor:Codable {
	let snowfallAmount: Measurement<UnitLength>
	
	static func extractSnowfall(hourWeather:HourWeather) -> Measurement<UnitLength>? {
	
		do {
			let jsonData = try JSONEncoder().encode(hourWeather)
			let snowfallExtractor = try JSONDecoder().decode(SnowfallExtractor.self, from: jsonData)
			
			return snowfallExtractor.snowfallAmount
		} catch {
			print("Error extracting snowfall:\(error)")
			return nil
		}
	}
}

FYI to anyone who might reference this thread. SnowfallAmount has been added to HourWeather in iOS 18. I can now rip out my janky code to convert the liquid amount to snowfall amount.

Thank you for addressing this.

Hourly precipitation amounts seem drastically low
 
 
Q