Timestamp creation for netCDF files
2 views (last 30 days)
Show older comments
Hello all
I have a small question concerning timestamps and netCDF, I written the process although I do not get a timestamp written in the final netCDF file that is humanly readable I have followed this process
T=1:1:length(Data);
start_date = datenum('01-Jan-2010 00:00');
end_date = datenum('01-Jan-2010 02:00'); % the final timestamp is one less that the actual length of the Data
interval = 1; % Interval of recording
start_date = datenum([start_date]);
end_date = datenum([end_date]);
tstep = interval/24; % timestep set
date = datestr(start_date:tstep:end_date);
T=datenum(date);
% create netCDF
ncid = netcdf.create('myfile.nc','netcdf4');
dimidT = netcdf.defDim(ncid,'Time',length(T))
varid3 = netcdf.defVar(ncid,'Time','double',dimidT)
netcdf.close(ncid)
I have tried and omitted the final convection of
T=datenum(date);
But then the netCDF cannot write the the file
First how can i produce timestamp that are humanly readable for netCDF content Secondly is there a way to use the original T (length of Data variable) to generate a timestamp based on that length and an initial time?
Any suggestions welcome Thank you
0 Comments
Answers (0)
See Also
Categories
Find more on NetCDF in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!