From 5e05e06bbbafb5966c31459d65dc96ce6a8274bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Zborek?= Date: Thu, 6 Jun 2024 20:50:18 +0200 Subject: [PATCH] Update converters --- .../CapturedResponseValidationTests.cs | 2 +- .../Series/WeatherForecast.cs | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs b/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs index 3f4f714..d10e57f 100644 --- a/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs +++ b/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs @@ -1429,7 +1429,7 @@ public async Task GetWeatherForecastAsync() Assert.That(forecast.RelativeHumidity, Is.EqualTo(99.99m)); Assert.That(forecast.WindSpeed, Is.EqualTo(6.07m)); Assert.That(forecast.AllowPrecipitation, Is.EqualTo(true)); - Assert.That(forecast.PrecipitationAmount, Is.EqualTo(42)); + Assert.That(forecast.PrecipitationAmount, Is.EqualTo(4.2m)); Assert.That(forecast.Timestamp, Is.EqualTo(new DateTime(2024, 04, 13, 12, 0, 0, DateTimeKind.Utc))); }); diff --git a/src/Aydsko.iRacingData/Series/WeatherForecast.cs b/src/Aydsko.iRacingData/Series/WeatherForecast.cs index a300443..c300d60 100644 --- a/src/Aydsko.iRacingData/Series/WeatherForecast.cs +++ b/src/Aydsko.iRacingData/Series/WeatherForecast.cs @@ -11,6 +11,9 @@ public class WeatherForecast [JsonPropertyName("time_offset"), JsonConverter(typeof(UtcOffsetToTimeSpanConverter))] public TimeSpan TimeOffset { get; set; } + /// + /// Can be ignored. Uncorrected air temperature. Used by the sim regarding relative and absolute humidity + /// [JsonPropertyName("raw_air_temp"), JsonConverter(typeof(TwoDecimalPointsValueConverter))] public decimal RawAirTemp { get; set; } @@ -21,7 +24,7 @@ public class WeatherForecast public decimal PrecipitationChance { get; set; } /// - /// Index of the forecast + /// Index of the key frame /// [JsonPropertyName("index")] public int Index { get; set; } @@ -33,13 +36,13 @@ public class WeatherForecast public bool IsSunUp { get; set; } /// - /// Pressure in hPa + /// Atmospheric pressure in hectopascals /// [JsonPropertyName("pressure"), JsonConverter(typeof(OneDecimalPointValueConverter))] public decimal Pressure { get; set; } /// - /// Wind direction in degrees + /// Wind direction in degrees (0 - 359) /// [JsonPropertyName("wind_dir")] public int WindDir { get; set; } @@ -51,11 +54,14 @@ public class WeatherForecast public WindDirection WindDirection => ConvertDegreeToDirection(WindDir); /// - /// Air temperature + /// Air temperature in Celcius corrected to be within allowed bounds /// [JsonPropertyName("air_temp"), JsonConverter(typeof(TwoDecimalPointsValueConverter))] public decimal AirTemp { get; set; } + /// + /// Can be ignore. Are there are rain statistics available for the period + /// [JsonPropertyName("valid_stats")] public bool ValidStats { get; set; } @@ -84,15 +90,15 @@ public class WeatherForecast public decimal WindSpeed { get; set; } /// - /// Is precipitation allowed + /// Is precipitation allowed to occur during the period /// [JsonPropertyName("allow_precip")] public bool AllowPrecipitation { get; set; } /// - /// Precipitation amount in millimeters + /// Precipitation amount in millimeters per hour /// - [JsonPropertyName("precip_amount")] + [JsonPropertyName("precip_amount"), JsonConverter(typeof(OneDecimalPointValueConverter))] public decimal PrecipitationAmount { get; set; } ///