Daniel Ferreyra
Daniel Ferreyra

Reputation: 3

Timeseries Mathematica Max and Min Values

I've been using Mathemathica in order to collect wind speed data in a certain location. Mathematica gives me a TimeSeries from which I would like to know what is the maximum value and the minimum one. I've used "FindPeaks" function, but as it is not a regularly sampled time series the function does not work. Is there a way to get the maximum value?

The following is the data:

data = WindSpeedData[{19.416258, -99.719266}, {DateObject[{2016, 1, 
 1}], DateObject[{2017, 1, 2}]}]

Upvotes: 0

Views: 510

Answers (2)

Daniel Ferreyra
Daniel Ferreyra

Reputation: 3

Thanks @Bill,I used

Max[data]

It threw me ["Not available", 46.8 km/h]

I just used your code and gave me the same result but in different order [46.8 km/h, "Not available"]. I double checked the datum (46.8) by displaying the data in a grid. Thank you very much, I will use the normal function further on.

Upvotes: 0

Bill
Bill

Reputation: 3957

This

Normal[data]

will undo part of the layer of Timeseries that your actual wind speeds are wrapped up inside of.

In that you can see that what you probably want is part of the second item in each list, that appears to be the actual speed. So

Max[Map[#[[2, 1]] &, Normal[data]]]

will look at the beginning of the second part, which is your speed, and then try to find the maximum value.

For your example data that shows Max[29.0802, "NotAvailable"] and that 29.0802 is the maximum wind speed.

That trailing "NotAvailable" is still some part of their wrapping the actual data up inside layers. It is possible that there is one missing wind speed in there and Max doesn't know what to make of that.

Upvotes: 1

Related Questions