如何用matlab建立NetCDF文件

如何用matlab建立NetCDF文件,第1张

我是经常读netcdf文件,在matlab里面

你可以看看netcdf帮助,其实很详轿乎销细的

%An example to generate an nc file

% ---------------------------- DEFINE THE FILE --------------------------- %

ncquiet % No NetCDF warnings.

nc = netcdf('ncexample.nc', 'clobber') % Create NetCDF file,输入文件名.

nc.description = '闭游NetCDF Example' % Global attributes,基本信息.

nc.author = 'Dr. Charles R. Denham'

nc.date = 'June 9, 1997'

nc('latitude') = 10% Define dimensions,数组维数.

nc('longitude') = 10

nc{'latitude'} = 'latitude'% Define variables,定义变量.

nc{'longitude'} = 'longitude'

nc{'depth'} = {'顷卜latitude', 'longitude'}

nc{'latitude'}.units = 'degrees' % Attributes,单位信息.

nc{'longitude'}.units = 'degrees'

nc{'depth'}.units = 'meters'

% ---------------------------- STORE THE DATA ---------------------------- %

latitude = % Matlab data,变量数值.

longitude =

depth = rand(length(latitude), length(longitude))

nc{'latitude'}(:) = latitude % Put all the data,对nc文件赋各变量的值.

nc{'longitude'}(:) = longitude

nc{'depth'}(:) = depth

nc = close(nc) % Close the file,关闭文件.

% ---------------------------- RECALL THE DATA ---------------------------%读文件

nc = netcdf('ncexample.nc', 'nowrite') % Open NetCDF file.

description = nc.description(:) % Global attribute.

variables = var(nc)% Get variable data.

for i = 1:length(variables)

disp(), disp(' ')

disp(variables{i}(:))

end

nc = close(nc) % Close the file.

% --------------------------------- DONE --------------------------------- %

1、打开arcgis的一个空图层

2、在搜索中输入netcdf,选择创建灶培岩netcdf栅格图层,点击它,出现了 *** 作框,在【输入netCDF文件】里面打开刚刚下载的文件,在【变量】选择SST。地理信息系统(GeographicInformationSystem或Geo-Informationsystem,中并GIS)有时又称为地学隐御信息系统。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/8223594.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存