Private/Convert-Daily.ps1
filter Convert-Daily([TimeSpan]$TimeZoneOffset = [TimeSpan]::Zero) { $DateTimeUtc = Get-Date -UnixTimeSeconds $_.dt -AsUTC $SunRiseUtc = Get-Date -UnixTimeSeconds $_.sunrise -AsUTC $SunsetUtc = Get-Date -UnixTimeSeconds $_.sunset -AsUTC $MoonriseUtc = Get-Date -UnixTimeSeconds $_.moonrise -AsUTC $MoonsetUtc = Get-Date -UnixTimeSeconds $_.moonset -AsUTC [PSCustomObject]@{ PSTypeName = 'UncommonSense.Weather.Daily' DateTimeUtc = $DateTimeUtc DateTime = $DateTimeUtc.Add($TimeZoneOffset) SunriseUtc = $SunRiseUtc Sunrise = $SunRiseUtc.Add($TimeZoneOffset) SunsetUtc = $SunsetUtc Sunset = $SunsetUtc.Add($TimeZoneOffset) MoonriseUtc = $MoonriseUtc Moonrise = $MoonRiseUtc.Add($TimeZoneOffset) MoonsetUtc = $MoonsetUtc Moonset = $MoonsetUtc.Add($TimeZoneOffset) MoonPhase = $_.moon_phase MoonPhaseDescription = Convert-MoonPhase -MoonPhase $_.moon_phase MorningTemperature = $_.temp.morn MorningFeelsLike = $_.feels_like.morn DayTemperature = $_.temp.day DayFeelsLike = $_.feels_like.day EveningTemperature = $_.temp.eve EveningFeelsLike = $_.feels_like.eve NightTemperature = $_.temp.night NightFeelsLike = $_.feels_like.night MinDailyTemperature = $_.temp.min MaxDailyTemperature = $_.temp.max Pressure = $_.pressure Humidity = $_.humidity DewPoint = $_.dew_point WindSpeed = $_.wind_speed WindGust = $_.wind_gust WindDirection = $_.wind_deg CloudinessPercent = $_.clouds UVIndex = $_.uvi ProbabilityOfPrecipitation = $_.pop RainVolume = $_.rain SnowVolume = $_.snow Weather = $_.weather | Convert-Weather } } |