%% in Matlab
clear
load ECV_LY1
ECV_LY1=flipdim(ECV_LY1,2);
[nlon, nlat, nt]=size(ECV_LY1);
ncid = netcdf.create('ECV_LY1.nc', 'CLOBBER');
lon_dimid = netcdf.defDim(ncid,'longitude',nlon);
lat_dimid = netcdf.defDim(ncid,'latitude',nlat);
time_dimid = netcdf.defDim(ncid,'time',nt);
varid = netcdf.defVar(ncid,'swvl1','double',[lon_dimid,lat_dimid,time_dimid]);
netcdf.endDef(ncid)
netcdf.putVar(ncid,varid,ECV_LY1);
%
clear
load ECV_LY2
ECV_LY2=flipdim(ECV_LY2,2);
[nlon, nlat, nt]=size(ECV_LY2);
ncid = netcdf.create('ECV_LY2.nc', 'CLOBBER');
lon_dimid = netcdf.defDim(ncid,'longitude',nlon);
lat_dimid = netcdf.defDim(ncid,'latitude',nlat);
time_dimid = netcdf.defDim(ncid,'time',nt);
varid = netcdf.defVar(ncid,'swvl1','double',[lon_dimid,lat_dimid,time_dimid]);
netcdf.endDef(ncid)
netcdf.putVar(ncid,varid,ECV_LY2);
%
clear
load ECV_LY3
ECV_LY3=flipdim(ECV_LY3,2);
[nlon, nlat, nt]=size(ECV_LY3);
ncid = netcdf.create('ECV_LY3.nc', 'CLOBBER');
lon_dimid = netcdf.defDim(ncid,'longitude',nlon);
lat_dimid = netcdf.defDim(ncid,'latitude',nlat);
time_dimid = netcdf.defDim(ncid,'time',nt);
varid = netcdf.defVar(ncid,'swvl1','double',[lon_dimid,lat_dimid,time_dimid]);
netcdf.endDef(ncid)
netcdf.putVar(ncid,varid,ECV_LY3);
%
clear
load ECV_LY4
ECV_LY4=flipdim(ECV_LY4,2);
[nlon, nlat, nt]=size(ECV_LY4);
ncid = netcdf.create('ECV_LY4.nc', 'CLOBBER');
lon_dimid = netcdf.defDim(ncid,'longitude',nlon);
lat_dimid = netcdf.defDim(ncid,'latitude',nlat);
time_dimid = netcdf.defDim(ncid,'time',nt);
varid = netcdf.defVar(ncid,'swvl1','double',[lon_dimid,lat_dimid,time_dimid]);
netcdf.endDef(ncid)
netcdf.putVar(ncid,varid,ECV_LY4);
%% in Linux
% layer 1
cdo replace Interim_SWVL1_1981-2010.nc ECV_LY1.nc temp.nc
rm -f ECV_LY1.nc
cdo chname,swvl1,ECV_LY1 temp.nc ECV_LY1.nc
rm -f temp.nc
% layer 2
cdo replace Interim_SWVL1_1981-2010.nc ECV_LY2.nc temp.nc
rm -f ECV_LY2.nc
cdo chname,swvl1,ECV_LY2 temp.nc ECV_LY2.nc
rm -f temp.nc
% layer 3
cdo replace Interim_SWVL1_1981-2010.nc ECV_LY3.nc temp.nc
rm -f ECV_LY3.nc
cdo chname,swvl1,ECV_LY3 temp.nc ECV_LY3.nc
rm -f temp.nc
% layer 4
cdo replace Interim_SWVL1_1981-2010.nc ECV_LY4.nc temp.nc
rm -f ECV_LY4.nc
cdo chname,swvl1,ECV_LY4 temp.nc ECV_LY4.nc
rm -f temp.nc
https://blog.sciencenet.cn/blog-569118-622240.html
上一篇:
plotting in grads下一篇:
estimating PDF with kernels