Warning, /utils/matlab/cs_grid/read_cs/read_cs.txt is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 76bd70de on 2007-02-07 17:10:43 UTC
b75ad9d212 Dimi*0001 % readbin : generic routine for reading binary files
0002 % read_cs_bin : read in cube sphere binary output
0003 % read_cs_face : read in a cube sphere face
0004 % read_cs_ifjk : read in specific indices for cube sphere configuration
0005 % read_cs_index : read in horizontal-slice indices for cube sphere configuration
76bd70de68 Dimi*0006 % writebin : write N-D binary field
0007 % ts2dte : convert model time step to a date
0008
0009
0010 % The following are examples of using the read* routines
0011 % to read cube-sphere model output. The following five examples produce
b75ad9d212 Dimi*0012 % identical results, but execution time and memory requirements differ.
0013
0014
0015 % input parameters
0016 fnam='THETA.0000374688.data'; % file name
0017 ix=125:3:145; % x-indices
0018 face=3; % cube face index
0019 jx=400:5:420; % y-indices
0020 kx=[1 10 20]; % vertical indices
0021 prec='real*8'; % precision
0022 cx=510; % cube face size
0023
0024 % compute cube sphere horizontal-slice indices
0025 tmp=reshape(1:(cx*6*cx),cx,6,cx);
0026 ij_indices=tmp(ix,face,jx);
0027 ij_indices=ij_indices(:);
0028
0029 % 1. example using readbin
0030 tmp=readbin(fnam,[cx 6 cx 50],1,prec);
0031 fld1=tmp(ix,face,jx,kx);
0032
0033 % 2. example using read_cs_bin
0034 tmp=read_cs_bin(fnam,kx,prec,cx);
0035 fld2=tmp(ix,face,jx,:);
0036
0037 % 3. example using read_cs_bin
0038 tmp=read_cs_face(fnam,face,kx,prec,cx);
0039 fld3=tmp(ix,jx,:);
0040
0041 % 4. example using read_cs_ifjk
0042 fld4=read_cs_ifjk(fnam,ix,face,jx,kx,prec,cx);
0043
0044 % 5. example using read_cs_index
0045 fld5=read_cs_index(fnam,ij_indices,kx,prec,cx);