フィルターのクリア

Reading 3-dimensional netcdf data

6 ビュー (過去 30 日間)
Gokhan Kayan
Gokhan Kayan 2020 年 6 月 18 日
コメント済み: Gokhan Kayan 2020 年 6 月 18 日
I downloaded precipitation data from SIM2RAIN. It is 3 dimensional and temporal resolution is 1 day. For example for year 2005, my file size is 365(days)*1440(long)*720(lat). I want to show precipitation data for each day in matrix (1440,720). So, It means ı will have 365 files. My file name is CCI_SM2RAIN_2005_BC.nc. I can do it by using Arcmap but it is very time consuming. How can I do this in matlab ? Thanks for help.

採用された回答

KSSV
KSSV 2020 年 6 月 18 日
編集済み: KSSV 2020 年 6 月 18 日
You can read your nc file like shown below....Change the variables in the below to your variables naming converntion in your file.
ncfile='CCI_SM2RAIN_2005_BC.nc'
lon = ncread(ncfile,'Longitude') ; nx = length(lon) ;
lat = ncread(ncfile,'Latitude') ; ny = length(lat) ;
time = ncread(ncfile,'Time') ;
for i = 1:length(time)
z = ncread(ncfile,'Rainfall',[i 1 1 ],[1, nx ny]) ;
z = squeeze(z) ;
pcolor(lon,lat,z') ;
title(sprintf("Time step = %d",i)) ;
shading interp
drawnow
end
  9 件のコメント
KSSV
KSSV 2020 年 6 月 18 日
編集済み: KSSV 2020 年 6 月 18 日
Also you can read the entire data into MATLAB workspace using:
z = ncread(ncfile.'Rainfall') ;
for i = 1:length(time)
R = squeeze(z(i,:,:)) ;
pcolor(lon,lat,R')
shading interp
drawnow
end
I have edited the original answer again.....now it will work..check it.
Gokhan Kayan
Gokhan Kayan 2020 年 6 月 18 日
Thanks. You are great, It worked perfectly :)

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

その他の回答 (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