Plotting a map by extracting data in time intervals from a netcdf file

My netcdf file has longitude, latitude, month, and monthly mean temperature. Data are for 10 years. I have to get the average for each month (ie mean for all January months over 10 years, mean for all February months over 10 years, etc). Data file sizes are 180 for latitude, 360 for longitude, 120 for month and monthly mean temperatures. Size of the final answer should be 360 x 180 x12.
Then I need to get the standard deviation and make a plot of it.
Please help me with this.

1 个评论

If you ncread() the monthly mean temperature, is the result an array that is (number of longitude) by (number of latitude) by (12) by (number of years) ? Something else?
Data file sizes are 180 for latitude, 360 for longitude, 120 for month and monthly mean temperatures.
So when you ncread() the monthly mean temperature, the result is 360 x 180 x 120 ? Please verify this explicitly: it would be common in netcdf files to instead find that the data was 180 x 360 x 120 .

请先登录,再进行评论。

 采纳的回答

data_by_year = reshape(YourData, size(YourData,1), size(YourData,2), 12, []);
mean_by_month_over_years = mean(data_by_year, 4);
std_by_month_over_years = std(data_by_year, [], 4);

2 个评论

Thanks a lot.
Could you also help me plotting "std_by_month_over_years" on a global map? I can get the map as follows.
worldmap('world')
load coastlines
plotm(coastlat,coastlon)
Well you have a problem that you have 2d data for each of 12 months
contourm(Data_lat, Data_lon, std_by_month_over_years(:,:,MonthNumber))

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by