I am working with tmy3 files, and I have csv hourly data for a whole year. I need to get the maximum of a certain value for each month and plot them and also performing addition to another value for each day and getting the max and min day?
2 views (last 30 days)
Show older comments
I am working with tmy3 (csv) (8762*68) files, and I have hourly data for a whole year.
I need to get the maximum of a certain column for each month and plot them together (12 points) and also to perform addition to another column for each day and getting the max and min day for this addition.
I have been struggling with both issues for a while as I am not so good with Matlab, any help would be appreciated. If this is easier in Python I am open to help in it as well.
Attached the full tmy3 (8762*68) file that you can see to start helping me.
1 Comment
Rik
on 23 Mar 2019
What have you tried so far? Have a read here (or here for more general advice). It will greatly improve your chances of getting an answer.
Accepted Answer
darova
on 23 Mar 2019
I've imported 8th column (3:end rows) to MATLAB and found max value of each month
plot(DNIWm2)
days = [0 31 28 31 30 31 30 31 31 30 31 30 31];
[maxValue, maxHour] = deal(zeros(12,1));
hour = 0;
hold on
for i = 1:12;
hour = hour + days(i)*24;
data = DNIWm2( hour+1 : hour+days(i+1)*24 ); % extracting data of a current month
[maxValue(i), H] = max( data ); % local max value and hour
maxHour(i) = H + hour; % hour in data
plot([hour hour], [0 1000],'-ok') % plot first/last hour of a month
end
plot(maxHour,maxValue,'-or')
hold off
8 Comments
darova
on 23 Mar 2019
days = [0 31 28 31 30 31 30 31 31 30 31 30 31];
month_data = zeros(12,1);
for i = 1:12;
hour = hour + days(i)*24;
data = DNIWm2( hour+1 : hour+days(i+1)*24 ); % extracting data of a current month
month_data(i) = sum(data); % or mean()
end
bar(month_data)
More Answers (0)
See Also
Categories
Find more on Dates and Time 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!