How does one create a NetCDF file?
3 次查看(过去 30 天)
显示 更早的评论
Hi there!
I am desperately trying to create a NetCDF file that would include latitude, longitude and depth, to use as a bathymetry file in Ocean Data View. Here is the script that I came up with:
my_data = [lat lon depth]';
ncid = netcdf.create('sagbathy','NOCLOBBER');
dimid = netcdf.defDim(ncid,'my_dim',size(my_data));
varid = netcdf.defVar(ncid,'my_var','NC_BYTE',dimid);
netcdf.endDef(ncid);
netcdf.putVar(ncid,varid,my_data);
netcdf.close(ncid);
For some reason, the output ends up being a single number.
Could someone help me write the appropriate script?
Thank you so much!
Louise
0 个评论
回答(1 个)
Chad Greene
2017-8-3
2 个评论
Chad Greene
2017-8-3
You're right, the procedure for writing NetCDFs is rather convoluted and unintuitive, so it's hard to diagnose the problem. I wish I could offer more help!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NetCDF 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!