I am trying to create a list of annual maxima wind speeds. However the code I have come up with works inconsistently. i.e will produce a list for one weather station but will return Max[Missing[NotAvailable],"the max wind speed"]
for another. And the error displayed is
Max::nord2: Comparison of 44.45km/h and -[Infinity] is invalid.
I also can't just select the second value as this is part of an overall function that is meant to return a list of lists as such(I want a list of lists of 20 year maximas). Therefore I was wondering if there is a fix that won't affect the already working part.
I have also tried DeleteCases
, DeleteMissing
but as you can see the value I want is there. So any thoughts on how to extract it would be greatly appreciated!
Example of station that works:
x = (1996 + #) &;
y = (1997 + #) &;
years = {{x[#]}, {y[#]}} & /@ Range[20];
QuantityMagnitude[
UnitConvert[
Max[
WindSpeedData[
Entity["WeatherStation", "EGAA"]
, Flatten[{#, "Day"}, 1]
, UnitSystem -> "Metric"
]
]
, "Meters/Seconds"
]
] & /@ years
{12.45, 13.325, 11.6778, 11.6278, 11.6278, 12.1917, 9.00278, 10.5472, 9.61944, 11.1111, 11.8833, 12.1417, 11.2139, 11.2667, 11.4722, 10.8556, 13.2222, 10.2361, 12.0389, 10.65}
A list of maxima.
Station that does not work:
x = (1996 + #) &;
y = (1997 + #) &;
years = {{x[#]}, {y[#]}} & /@ Range[20];
QuantityMagnitude[
UnitConvert[
Max[
WindSpeedData[
Entity["WeatherStation", "EGAE"]
, Flatten[{#, "Day"}, 1]
, UnitSystem -> "Metric"
]
]
, "Meters/Seconds"
]
] & /@ years
{13.4778, 14.4556, 16.6667, 13.375, QuantityMagnitude[UnitConvert[ Max[Missing["NotAvailable"], Quantity[44.45, ("Kilometers")/("Hours")]], "Meters/Seconds"]], 13.1694, 12.7056, 12.5, 14.25, 14.9194, 15.4333, 14.2, 13.2722, 12.7056, 17.3889, 14.6111, 15.8444, 13.7361,14.8167, 13.7361}