Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When retrieving curated data, v10 now returns TimeSeries objects.

For example,

ts = WeatherData["KP60", "Temperature", {{2013, 7, 1}, {2013, 9, 30}}]

DateListPlot[ts]

What is the most convenient way to extract a range from this temporal data, for example for plotting purposes? E.g. only plot the first two weeks of August from this data.

I know I can simply convert it to a list using Normal and then use e.g. Select to filter. Is there anything better?

share|improve this question
    
Congratulations on being our foremost question poster! –  Mr.Wizard Jul 27 at 15:45

1 Answer 1

up vote 12 down vote accepted

One of the new operations on TimeSeries objects is TimeSeriesWindow. I think it does what you need.

ts = WeatherData["KP60", "Temperature", {{2013, 7, 1}, {2013, 9, 30}}];
DateListPlot[TimeSeriesWindow[ts, {{2013, 8, 1}, {2013, 8, 14}}]]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.