フィルターのクリア

create NETCDF file from a existing 3D array

5 ビュー (過去 30 日間)
Ana Corrochano
Ana Corrochano 2020 年 9 月 23 日
Hello, I hope someone can help me with this.
I have a NETCDF file with multiple variables. I modified all the values of one of the variables (the old variable name is v and the new one is v_rev2).
Now I have a 3D array with the new values (v_rev2)
Now I have the NETCDF file and the 3D array in matlab with new values.
How I can replace the NETCDF file that has multiple variables with my new values for that specific variable? I understand first I need to convert my 3D array into a netcdf file and then I have to replace the old values of vel with the new ones v_rev2 .
I can create a netcdf file but I don't know how to call v_rev2
The dimensions are
n_uvnode=99999; %number of element centroids
n_depth=10; %number of depth layers
nt=24; %time
nccreate('velocityrev2.nc','v_rev2',...
'Dimensions',{'n_uvnode',99999,'n_depth',10,'nt',24},...
'Format','classic')
%Write data to the variable.
ncwrite('velocityrev2.nc','v_rev2',s_rev2('v_rev2'))
%Display the contents of the NetCDF file.
ncdisp('velocityrev2.nc')
% ncdisp('velocityrev2.nc')
%Source:
% C:\modelana\velocityrev2.nc
%Format:
% classic
%Dimensions:
% n_uvnode = 99999
% n_depth = 10
% nt = 24
%Variables:
% v_rev2
% Size: 99999x10x24
% Dimensions: n_uvnode,n_depth,nt
% Datatype: double

回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by