How to get monthly average temperature data from daily temperature data in new columns at the end by month name?

4 views (last 30 days)
I have a yearly mean temperature data from 1989 to 2019, the table headers are named Day_1 to Day_365, I want to get monthly data in new column with month name and automate the process to get for all years from 1989 to 2019.
Please Help.
  2 Comments
Akira Agata
Akira Agata on 25 Jun 2020
You mean, you have a temperature data like the following:
Year Day_1 Day_2 ... Day_365 Day_366
---- ----- ----- ... ------- -------
1989 10 20 ... 20 nan
... ... ... ... ... ...
1992 10 20 ... 20 15
... ... ... ... ... ...
And want to add 12 new columns representing monthly average for each year, like the following ?
Year Day_1 Day_2 ... Day_365 Day_366 Avg_Jan ... Avg_Dec
---- ----- ----- ... ------- ------- ------- ... ------
1989 10 20 ... 20 nan 15.1 ... 11.1
... ... ... ... ... ... ... ... ...
1992 10 20 ... 20 15 15.3 ... 11.3
... ... ... ... ... ... ... ... ...
Saranga Bordoloi
Saranga Bordoloi on 25 Jun 2020
Lat Long Day_1 Day_2 ... Day_365 Day_366
---- ----- ----- ----- ... ------- -------
26.5 97.5 10 20 ... 20 nan
... ... ... ... ... ...
27.5 98.5 10 20 ... 20 15
... ... ... ... ... ... ...
And want to add 12 new columns representing monthly average for each points in a new table
Lat Long Day_1 Day_2 ... Day_365 Day_366 Avg_Jan ... Avg_Dec
---- ----- ----- ... ------- ------- ------- ... ------
26.5 98.5 10 20 ... 20 nan 15.1 ... 11.1
... ... ... ... ... ... ... ... ...
27.5 98.5 10 20 ... 20 15 15.3 ... 11.3
... ... ... ... ... ... ... ... ...
But for rainfall data i need the total rainfall(jan 1+...Jan 31) of the month not the average
Lat Long Day_1 Day_2 ... Day_365 Day_366 total_Jan ... total_Dec
---- ----- ----- ... ------- ------- ------- ... ------
26.5 98.5 10 20 ... 20 nan 50 ... 80
... ... ... ... ... ... ... ... ...
27.5 98.5 10 20 ... 20 15 75 ... 140
... ... ... ... ... ... ... ... ...
I have this kind of data from year 1989 to 2019
After taking out the Monthly averages(temperatures) & rainfall (total);
i want to again calculate the average of January 1989, January 1990,...January 2019; and but this time average of rainfall of january 1989 to january 2019.
Lat Long jan Feb ... Nov Dec
---- ----- ----- ... ------- -------
26.5 98.5 10 20 ... 20
... ... ... ... ... ...
27.5 98.5 10 20 ... 20
... ... ... ... ...

Sign in to comment.

Answers (0)

Categories

Find more on Language Fundamentals 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!