public Wind(string direction, string speed, string gusts, string unit) { if (direction == "VRB") { this.direction = Double.MaxValue; } else { try { this.direction = Convert.ToDouble(direction); } catch { this.direction = -1; } } try { this.speed = Convert.ToDouble(speed); } catch { this.speed = -1; } if (gusts != String.Empty) { try { this.gusts = Convert.ToInt32(gusts); } catch { this.gusts = -1; } } switch (unit) { case "KT": this.unit = WindSpeedUnits.Knots; break; case "MPS": this.unit = WindSpeedUnits.MetersPerSecond; break; case "KPH": this.unit = WindSpeedUnits.KilometersPerHour; break; default: this.unit = WindSpeedUnits.Unknown; break; } }
public Wind (string direction, string speed, string gusts, string unit) { if (direction == "VRB") this.direction = Double.MaxValue; else { try { this.direction = Convert.ToDouble (direction); } catch { this.direction = -1; } } try { this.speed = Convert.ToDouble (speed); } catch { this.speed = -1; } if (gusts != String.Empty) { try { this.gusts = Convert.ToInt32 (gusts); } catch { this.gusts = -1; } } switch (unit) { case "KT": this.unit = WindSpeedUnits.Knots; break; case "MPS": this.unit = WindSpeedUnits.MetersPerSecond; break; case "KPH": this.unit = WindSpeedUnits.KilometersPerHour; break; default: this.unit = WindSpeedUnits.Unknown; break; } }
public WindSpeed(double?observed, double?observedGust, WindSpeedUnits unit) { Observed = observed; ObservedGust = observedGust; Unit = unit.ToString(); }