Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1407c8ba

Přidáno uživatelem Alex Konig před více než 3 roky(ů)

re #8840 Finishing up Json parser

Zobrazit rozdíly:

Server/ServerApp/Parser/OutputInfo/WeatherConditions.cs
13 13
    /// Transfers lux values to weather conditions and vice versa
14 14
    /// </summary>
15 15
    /// <author>Alex Konig</author>
16
    public static class LuxToConditions
16
    public static class ValueToConditions
17 17
    {
18 18
        /// <summary>
19 19
        /// Lux to weather conditions
......
26 26
                return WeatherConditions.Sunny;
27 27

  
28 28
            if (lux > 20_000)
29
                return WeatherConditions.Overcast;
29
                return WeatherConditions.Cloudy;
30 30

  
31 31
            // TODO tohle bylo 10_000, jak mi to má vycházet, zkusit na hourly data
32 32
            if (lux != 0)
33
                return WeatherConditions.Cloudy;
33
                return WeatherConditions.Overcast;
34 34

  
35 35
            return WeatherConditions.Dark;
36 36
        }
......
43 43
        internal static double TransferConditionsToLux(WeatherConditions condition)
44 44
        {
45 45
            if (condition == WeatherConditions.Sunny)
46
                return 50_000;
46
                return 60_000;
47 47

  
48 48
            if (condition == WeatherConditions.Cloudy)
49 49
                return 30_000;
50 50

  
51 51
            if (condition == WeatherConditions.Overcast)
52
                return 15_000;
52
                return 10_000;
53 53

  
54 54
            if (condition == WeatherConditions.Dark)
55
                return 5_000;
55
                return 0;
56 56

  
57 57
            return -1;
58 58
        }
59

  
60
        internal static WeatherConditions CloudCoverToConditions(int cloudCover)
61
        {
62
            if (cloudCover >= 66)
63
                return WeatherConditions.Overcast;
64

  
65
            if (cloudCover >= 33)
66
                return WeatherConditions.Cloudy;
67

  
68
            if (cloudCover >= 0)
69
                return WeatherConditions.Sunny;
70

  
71
            return WeatherConditions.Dark;
72
        }
59 73
    }
60 74
}

Také k dispozici: Unified diff