private static INullableQueryTable <T> TempMath <T>(INullableQueryTable <T> sourceTable, string temperatureName,
                                                     string humidityName, string dewPointName, Func <TemperatureMath, double> valueSelector) where T : struct
 {
     return(sourceTable.ToNewTable((o, n) =>
     {
         n.AddSerie(sourceTable.TryGetSerie(temperatureName)
                    .Zip(sourceTable.TryGetSerie(humidityName), dewPointName,
                         (t, h) =>
         {
             if (!t.HasValue || !h.HasValue)
             {
                 return null;
             }
             var tempMath = new TemperatureMath(Convert.ToDouble(t.Value), Convert.ToDouble(h.Value));
             return (T)Convert.ChangeType(valueSelector(tempMath), typeof(T));
         }));
     }));
 }
 private static INullableQueryTable <T> CalcLine <T>(INullableQueryTable <T> sourceTable, string temperatureName,
                                                     string humidityName, string resultName, float dewPoint, float stationAltitude) where T : struct
 {
     return(sourceTable.ToNewTable((o, n) =>
     {
         n.AddSerie(sourceTable.TryGetSerie(temperatureName)
                    .Zip(sourceTable.TryGetSerie(humidityName), resultName,
                         (t, h) =>
         {
             if (t.HasValue == false || h.HasValue == false)
             {
                 return null;
             }
             T?snowTemp = CalcSnowingTemperature(dewPoint, h);
             var altititude = stationAltitude + (t.ToFloat() - snowTemp.ToFloat()) * 160;
             return altititude.ToType <T>();
         }));
     }));
 }
 /// <summary>
 ///     Calculates the current temperature where percipitation will fall as snow
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sourceTable"></param>
 /// <param name="humidityName"></param>
 /// <param name="resultName"></param>
 /// <param name="dewPoint">0°C for snow, 0.8°C for sleet</param>
 /// <returns></returns>
 public static INullableQueryTable <T> SnowingTemperature <T>(this INullableQueryTable <T> sourceTable,
                                                              string humidityName, string resultName = "Snowing Temperature", float dewPoint = 0.8f) where T : struct
 {
     return
         (sourceTable.ToNewTable(
              (o, n) =>
     {
         n.AddSerie(
             sourceTable.TryGetSerie(humidityName)
             .CalcValue(humidity => CalcSnowingTemperature(dewPoint, humidity), resultName));
     }));
 }