Determining the hourly time series from 5 minutes and 15 minutes time series data
29 views (last 30 days)
Show older comments
Manikandan Shanmugarajasekaran on 3 Feb 2022
I'm having a time series data of rainfall (5 minutes interval) and temperature (15 minutes interval) in .csv file. I need to determine the hourly rainfall (1hour interval) ie. adding the twelve 5 minutes data together and repeating it for entire time series and save it in another .csv file. Similarly for temperature data, I need to determine the hourly temperature (1hour interval) ie. averaging the four 15 minutes data together and repeating it for entire time series and save it in another .csv file. I'm attaching the time series data in .csv format.
David Hill on 3 Feb 2022
It you were not missing data it would be an easy reshape. I think you are going to need to do datenum ranges. Convert first column to datenum values, then run loop summing the entries every hour. You might need to fill in missing data in column 2 with zero. Might take awhile to compute.
Lei Hou on 15 Feb 2022
You can use timetable to store your data, and use retime to resample your data.
rainfall = readtable('Rainfall.csv');
rainfall.DateTime = datetime(rainfall.DateTime,'InputFormat','dd-MM-uuuu HH:mm');
rainfallTT = table2timetable(rainfall);
rainfallHourly = retime(rainfallTT,'hourly','sum');
temperature = readtable('Temperature.csv');
temperature.DateTime = datetime(temperature.DateTime,'InputFormat','dd-MM-uuuu HH:mm');
temperatureTT = table2timetable(temperature);
temperatureHourly = retime(temperatureTT,'hourly','mean');
Hoping this is helpful.
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!