HI there, when requesting the daily forecast via the WeatherKit REST API, I found out that under certain circumstances the moon phase full is skipped. Example from Japan (working): { forecastDaily: { name: DailyForecast, metadata: { attributionURL: https://developer.apple.com/weatherkit/data-source-attribution/, expireTime: 2024-10-21T15:16:10Z, latitude: 35.650, longitude: 139.840, readTime: 2024-10-21T14:16:10Z, reportedTime: 2024-10-21T12:00:37Z, units: m, version: 1, sourceType: modeled }, days: [ ..., { forecastStart: 2024-10-16T15:00:00Z, forecastEnd: 2024-10-17T15:00:00Z, conditionCode: MostlyCloudy, maxUvIndex: 4, moonPhase: waxingGibbous, moonrise: 2024-10-17T07:47:26Z, moonset: 2024-10-16T20:09:01Z, precipitationAmount: 0.09, precipitationChance: 0.43, precipitationType: rain, ... windSpeedMax: 16.03, }, { forecastStart: 2024-10-17T15:00:00Z, forecastEnd: 2024-10-18T15:00:00Z, conditionCode: Rain, maxUvIndex: 4, moonPhase: full, moonrise: 2024-10-18T08:20:34Z, moonset: 2024-10-17T21:24:49Z,
precipitationAmount
17 results found
Post
Replies
Boosts
Views
Activity
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 sno
I've received a forecast with non-zero precipitationChance and zero precipitationIntensity. Is this expected? How should I interpret the data? { forecastStart: 2023-09-02T02:00:00Z, cloudCover: 0.55, conditionCode: PartlyCloudy, daylight: false, humidity: 0.92, precipitationAmount: 0, precipitationIntensity: 0, precipitationChance: 0.31, precipitationType: clear, pressure: 1017.56, pressureTrend: steady, snowfallIntensity: 0, snowfallAmount: 0, temperature: 12.56, temperatureApparent: 12.22, temperatureDewPoint: 11.26, uvIndex: 0, visibility: 23505.2, windDirection: 233, windGust: 6.17, windSpeed: 2.82 }
I don't think Apple uses kph for precipitation intensity, at least not currently / anymore. I ran a 240h hourly API request and the precipitation amount ranges from 0 to 1.9. The precipitation intensity is identical to the precipitation amount. Since it's hourly granularity, the unit of speed is definitely not per second so not m/s. also K/h is implausible because 1.9 kph = 75000 inches per hour. I would venture to guess that precipitation is cm and precipitation intensity is cm/h Has anyone found explicit confirmation of the units? I don't see it anywhere in Apple's documentation. cloudCover: % daylight: T/F humidity: % precipitationAmount: cm ? precipitationIntensity: cm/h ? precipitationChance:% pressure: hPa ? snowfallIntensity: cm/h snowfallAmount: cm temperature: C temperatureApparent: C temperatureDewPoint: C uvIndex: 0-10? visibility: m? windDirection: degrees ? windGust: m/s ? windSpeed: m/s ?
daytimeForecast: { forecastStart: 2023-04-03T11:00:00Z, forecastEnd: 2023-04-03T23:00:00Z, cloudCover: 0.9, conditionCode: Cloudy, humidity: 0.55, precipitationAmount: 0, precipitationAmountByType: {}, precipitationChance: 0, precipitationType: clear, snowfallAmount: 0, windDirection: 172, windSpeed: 8.91 }, overnightForecast: { forecastStart: 2023-04-03T23:00:00Z, forecastEnd: 2023-04-04T11:00:00Z, cloudCover: 0.49, conditionCode: WintryMix, humidity: 0.8, precipitationAmount: 0, precipitationAmountByType: {}, precipitationChance: 0.36, precipitationType: mixed, snowfallAmount: 0, windDirection: 185, windSpeed: 8.87 }, restOfDayForecast: { forecastStart: 2023-04-04T00:12:12Z, forecastEnd: 2023-04-04T04:00:00Z, cloudCover: 0.8, conditionCode: MostlyCloudy, humidity: 0.73, precipitationAmount: 0, precipitationAmountByType: {}, precipitationChance: 0, precipitationType: clear, snowfallAmount: 0, windDirection: 178, windSpeed: 10.86 } }
At the moment (8:30 PM), for a number of counties in my area, WeatherKit is indicating a conditionCode of WintryMix for overnightForecast. The low is above freezing, and according to the iPhone weather app there is zero percent chance of precipitation overnight. WeatherKit shows a 0.36 (36%) chance of precipitation but 0 precipitationAmount and 0 snowfallAmount. No other weather data I can find indicates any precipitation overnight in this area. In fact it's supposed to be clear overnight. For now, as an immediate fix, I'm using the restOfDayForecast to get me to midnight, as it seems to be correct. However this is extremely concerning, and my users are very concerned (we're in a fairly southern area) because of this totally false WintryMix conditionCode. I'm really not sure what to do about this. Maybe ignore the condition code if it indicates precipitation but with a 0 precipitationAmount? I'd also like to know why the iPhone weather widget is correct but this WeatherKit data is not. There
Just to clarify, I see https://developer.apple.com/weatherkit/get-started/ says that precipAccumulation from Dark Sky maps to precipitationAmount in WeatherKit. Is that correct, or are they describing different things? (I'm trying to map WeatherKit into a Dark Sky compatible format, so I want to make sure I'm using the most appropriate data point.) Thank you!
snowfallAmount gives the amount of precipitation that falls as snow measured as the depth of snow crystals with no melting, as opposed to precipitationAmount which is the amount of precipitation measured as depth of water after melting. The difference is usually around a factor of 10. Snow is mostly empty space, and how much empty space is in the snow--how fluffy it is--is partially a function of temperature. The snowfallAmount gives depth of snow if it were to fall on the ground with no melting, no change in its temperature, and no compression as layers of snow accumulate. precipitationAmount gives the depth water you would have if you let all the precipitation fall and then melted it with no evaporation. snowfallAmount may be greater than the observed snow accumulation since snow that falls on warm ground will melt rather than accumulate.
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.
I'm in Changsha, China. get my current location from Apple Maps. but the WeatherKit result is not same with Weather App. request: GET /api/v1/weather/zh-CN/28.212151/112.955606?countryCode=cn&timeZone=Asia%2FShanghai&dataSets=forecastHourly&hourlyStart=2022-12-12T22%3A19%3A05Z&hourlyEnd=2022-12-17T22%3A19%3A05Z host: weatherkit.apple.com response: { forecastStart: 2022-12-17T22:00:00Z, cloudCover: 0.01, conditionCode: Clear, daylight: false, humidity: 0.65, precipitationAmount: 0.0, precipitationIntensity: 0.0, precipitationChance: 0.0, precipitationType: clear, pressure: 1036.48, pressureTrend: falling, snowfallIntensity: 0.0, snowfallAmount: 0.0, /// this is -2.83°C temperature: -2.83, temperatureApparent: -3.64, temperatureDewPoint: -8.47, uvIndex: 0, visibility: 18656.25, windDirection: 318, windGust: 9.61, windSpeed: 4.08 } Weather App temperature is 2°C
In XCode 14.1 beta 3, the HourWeather item precipitationAmount is missing. Is this a bug that will be fixed or a planned change? Without precipitationAmount, the API is almost unusable.
Hi, i've been playing with WeatherKit for the first 3 betas but each time I try to get the UV Index of a forecast I've got 0 as value. For example the hourly forecast of San Francisco at the time of writing is the following : Optional(WeatherKit.HourWeather(date: 2022-07-06 14:00:00 +0000, cloudCover: 0.98, condition: Drizzle, symbolName: cloud.moon.rain, dewPoint: 21.87 °C, humidity: 0.95, isDaylight: false, precipitation: rain, precipitationChance: 0.44, precipitationAmount: 0.44 mm, snowfallAmount: 0.0 mm, pressure: 1000.93 mbar, pressureTrend: Steady, temperature: 22.67 °C, apparentTemperature: 24.89 °C, uvIndex: WeatherKit.UVIndex(value: 0, category: Low), visibility: 8977.97 m, wind: WeatherKit.Wind(compassDirection: South Southeast, direction: 151.0 °, speed: 32.34 km/h, gust: Optional(48.66 km/h)))) While the UV Index at the time from The Weather Network is supposed to be 4. I've got this issue since beta 1 and it's happening on every location I try. Is this happening as well to other people
woot! Looks like with got precipitationAmount in beta 3 :)
I've been getting at the precipitationAmount data using this hack from another thread. I've often found that the precip amount is 0mm for every hour of the day. Every entry for today has the same precipAmount of 0mm: HourWeather(date: 2022-06-27 22:00:00 +0000, cloudCover: 0.15, condition: Mostly Clear, symbolName: sun.max, dewPoint: 12.43 °C, humidity: 0.78, isDaylight: true, precipitation: , precipitationChance: 0.0, precipitationAmount: 0.0 mm However the iOS 16 beta 2 weather app is showing precip data for today at the same location. Is the iOS 16 Weather App using the same WeatherKit as I am? I'm finding the data in weatherkit to be pretty different than the data in the weather app.
So I've solved my own issue for now. It may not be pretty (haven't used strings much), but by defining this function I was able to extract the precipitation amount as a Measurement, just like other elements of the HourWeather struct. // Function to get precipitationAmount as a measurement from one instance of HourWeather // Written by Neil Gordon, 14 June 2022 - pending inclusion of precipitationAmount in the // WeatherKit definition of the Structure for HourWeather func precipitationAmount(hourWeatherElement: HourWeather) -> Measurement { var contents : String = var answer = Measurement(value: -9.9, unit: UnitLength.millimeters) // Default if problems print (hourWeatherElement, to: &contents) // Get the contents of the instance as a string if let firstRange = contents.range(of: precipitationAmount: ) { // Find where precip amount should be let startIndex = firstRange.upperBound // Drop everything before that contents = String(contents[startIndex...]) // Find posit