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

20 ビュー (過去 30 日間)
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 2 月 11 日
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 .

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2023 年 2 月 11 日
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 件のコメント
Thishan Dharshana
Thishan Dharshana 2023 年 2 月 11 日
編集済み: Thishan Dharshana 2023 年 2 月 12 日
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)
Walter Roberson
Walter Roberson 2023 年 2 月 12 日
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 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by