Merge netCDF files to have sequence of daily precipitation of several weather stations

1 次查看(过去 30 天)
Please, I posted this question long time ago and I didn't get any help. Please, I appreciate any help and suggestions! The question posted here: https://www.mathworks.com/matlabcentral/answers/343582-merge-netcdf-files-to-have-sequence-of-daily-precipitation-of-several-weather-stations
Thanks, Majid
  6 个评论
KSSV
KSSV 2017-7-12
Dear friend....you need to have a look into nc files....that code is trying to read date, time, precipitation from the nc file. Your nc files doesn't have that information....
Majid Mohamod
Majid Mohamod 2017-7-12
编辑:Majid Mohamod 2017-7-12
I tried to enlarge the study area and now I am getting results " the script works".
You had helped me someday to export the array as excel worksheets as shown below:
files = dir('*.nc') ;
nfiles = length(files) ;
P = cell(nfiles,1) ; % precipitation of all files
date = cell(nfiles,2) ;
time = cell(nfiles,2) ;
for i = 1:nfiles
%%Read dat
date{i,1} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.BeginDate') ;
date{i,2} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.EndDate') ;
%%Read time
time{i,1} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.BeginTime') ;
time{i,2} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.EndTime') ;
%%REad precipitation
P{i} = ncread(files(i).name,'precipitation') ;
end
myfile = 'myfile.xlsx' ;
for i = 1:nfiles
xlswrite(myfile,P{i},i)
end
Could you change the part of exporting from worksheet to excel file individually. Which mean each nc file will be excel file instead excel sheet?
I appreciate it man!
Majid

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by