王国杰的博客分享 http://blog.sciencenet.cn/u/gwangcc Be Silly

博文

write profiled satellite soil moisture into netcdf format

已有 3284 次阅读 2012-10-13 20:36 |系统分类:科研笔记| into, write

%% 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
收藏 IP: 77.250.100.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-9-3 03:25

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部