1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
clear all; delete ('test_simulate.nc') lati = linspace(0,1600*0.3,1600); long = linspace(0,1600*0.3,1600);
SineMid = sin(2*pi/10*long);
SinewaveM = repmat(SineMid,[1600,1]); imagesc(SinewaveM) Angle = 10; Irot = imrotate(SinewaveM, Angle, 'loose', 'bilinear');
Start = floor(size(Irot,1)/4); Stop = 3*Start;
Icrop = Irot(Start:Stop,Start:Stop); L_x=length(Icrop);
temp=Icrop;
ssh_wave = temp+0.1*rand(L_x,L_x); imagesc(ssh_wave)
nccreate('test_simulate.nc','lat','Dimensions',{'lat' L_x});
ncwriteatt('test_simulate.nc', 'lat', 'standard_name', 'lat'); ncwriteatt('test_simulate.nc', 'lat', 'long_name', 'lat'); ncwriteatt('test_simulate.nc', 'lat', 'units', 'meter'); ncwriteatt('test_simulate.nc', 'lat', '_CoordinateAxisType', 'Lat');
nccreate('test_simulate.nc','lon','Dimensions',{'lon' L_x}); ncwriteatt('test_simulate.nc', 'lon', 'standard_name', 'lon'); ncwriteatt('test_simulate.nc', 'lon', 'long_name', 'lon'); ncwriteatt('test_simulate.nc', 'lon', 'units', 'meter'); ncwriteatt('test_simulate.nc', 'lon', '_CoordinateAxisType', 'Lon');
nccreate('test_simulate.nc','Q','datatype','double','Dimensions',{'lat' L_x 'lon' L_x}); ncwriteatt('test_simulate.nc', 'Q', 'standard_name', 'ssh'); ncwriteatt('test_simulate.nc', 'Q', 'long_name', 'sea surface height'); ncwriteatt('test_simulate.nc', 'Q', 'units', 'm');
ncwrite('test_simulate.nc','lat',lati(1:L_x)); ncwrite('test_simulate.nc','lon',long(1:L_x));
ncwrite('test_simulate.nc','Q',ssh_wave);
ncdisp('test_simulate.nc');
|