필터 지우기
필터 지우기

merge multiple netCDF files into one netCDF file and read for lat, lon

조회 수: 6 (최근 30일)
Damith
Damith 2014년 6월 16일
댓글: Jeffrey Marak 2018년 6월 13일
Hi,
I have multiple folders from 1998 to 2012 in each folder there are 365 .nc files. File names in each folder appear like this 3B42_daily.1998.01.01.7.SUB.nc except for the year in different folders. How can I merge 365 files in each folder to one .nc file.
Then from each merged file, I need to extract variable r for 378 lat, lon locations?
I have the following code to read from each file but it does not merge.
myVarName = 'r';
for yr=1998:2012
inFile = strcat('cantho_trmm_daily_',num2str(yr),'.nc');
nc=netcdf.open(inFile,'NC_NOWRITE');
netcdf.close(nc)
end
inVar1 = ncread(inFile,myVarName);
Can somebody help me to figure this out?
Thanks in advance.
  댓글 수: 1
Jeffrey Marak
Jeffrey Marak 2018년 6월 13일
As far as Im aware theres no such function to merge ncdf files in matlab but you can use raster package in R which has stack() function to make a raster stack from separate netcdf files. see this link https://rpubs.com/markpayne/358146

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2018년 6월 13일
YOu need to know only 3 to 4 functions. REad about ncread, ncwrite.

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by