/[MITgcm]/MITgcm/verification/lab_sea/matlab/readbin.m
ViewVC logotype

Contents of /MITgcm/verification/lab_sea/matlab/readbin.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Thu Dec 5 08:43:03 2002 UTC (21 years, 3 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint62v, checkpoint47e_post, checkpoint57m_post, checkpoint52l_pre, checkpoint62u, checkpoint57g_pre, checkpoint47c_post, checkpoint62t, checkpoint50c_post, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint52d_pre, checkpoint57g_post, checkpoint48e_post, checkpoint56b_post, checkpoint50c_pre, checkpoint57y_post, checkpoint52j_pre, checkpoint51o_pre, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint54d_post, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint54e_post, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint51l_post, checkpoint48i_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint50d_pre, checkpoint52k_post, checkpoint59, checkpoint58, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint51, checkpoint50, checkpoint53, checkpoint52, checkpoint50d_post, checkpoint58f_post, checkpoint52f_post, checkpoint57n_post, checkpoint58d_post, checkpoint62s, checkpoint58a_post, checkpoint62r, checkpoint62q, checkpoint50b_pre, checkpoint62p, checkpoint57z_post, checkpoint54f_post, checkpoint51f_post, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint48b_post, checkpoint51d_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint51t_post, checkpoint58t_post, checkpoint51n_post, checkpoint55i_post, checkpoint58m_post, checkpoint57l_post, checkpoint52i_pre, checkpoint51s_post, checkpoint57t_post, checkpoint55c_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint63g, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, checkpoint53d_post, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint57a_post, checkpoint48d_post, checkpoint57h_pre, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint48f_post, checkpoint52b_pre, checkpoint54b_post, checkpoint58w_post, checkpoint57h_post, checkpoint51l_pre, checkpoint52m_post, checkpoint57y_pre, checkpoint55g_post, checkpoint48h_post, checkpoint51q_post, checkpoint51b_pre, checkpoint47g_post, checkpoint52b_post, checkpoint52c_post, checkpoint51h_pre, checkpoint58o_post, checkpoint48a_post, checkpoint57c_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint58p_post, checkpoint58q_post, checkpoint52f_pre, checkpoint55d_post, checkpoint58e_post, checkpoint47j_post, checkpoint54a_pre, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint53c_post, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint55d_pre, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, branch-exfmods-tag, branchpoint-genmake2, checkpoint54a_post, checkpoint55h_post, checkpoint58n_post, checkpoint51r_post, checkpoint48c_post, checkpoint51i_post, checkpoint57e_post, checkpoint55b_post, checkpoint51b_post, checkpoint51c_post, checkpoint53a_post, checkpoint65o, checkpoint47b_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint52d_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint50g_post, checkpoint57q_post, eckpoint57e_pre, checkpoint58k_post, checkpoint52a_pre, checkpoint62b, checkpoint58v_post, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint52h_pre, checkpoint56a_post, checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint53f_post, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint57h_done, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, checkpoint57j_post, checkpoint57f_pre, checkpoint61f, checkpoint58g_post, branch-netcdf, checkpoint52l_post, checkpoint58x_post, checkpoint61n, checkpoint52n_post, checkpoint53b_pre, checkpoint59j, checkpoint58h_post, checkpoint56c_post, checkpoint58j_post, checkpoint51e_post, checkpoint57a_pre, checkpoint55a_post, checkpoint48, checkpoint49, checkpoint57o_post, checkpoint51o_post, checkpoint61q, checkpoint57k_post, checkpoint51f_pre, checkpoint48g_post, checkpoint53b_post, checkpoint47h_post, checkpoint52a_post, checkpoint57w_post, checkpoint61e, checkpoint58i_post, checkpoint51g_post, ecco_c52_e35, checkpoint57x_post, checkpoint50b_post, checkpoint58c_post, checkpoint58u_post, checkpoint51m_post, checkpoint53d_pre, checkpoint58s_post, checkpoint55e_post, checkpoint61g, checkpoint61d, checkpoint54c_post, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint51a_post, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint51p_post, checkpoint61z, checkpoint61x, checkpoint61y, checkpoint51u_post, HEAD
Branch point for: branch-exfmods-curt, branch-genmake2, branch-nonh, tg2-branch, ecco-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.1: +65 -0 lines
checkpoint47b_post
Merging from release1_p9:
o pkg/seaice
  - removed GOTO's and added taf directives
  - double precision constants to reduce the g77 (Linux)
    to F77 (SGI) differences reported in release1_p8
o tools/genmake
  - added SGI options
o verification/testscript
  - updated to that of checkpoint47a_post
o verification/global_ocean.90x40x15/input/eedata
  - modified for SGI f77 compatibility
o verification/lab_sea
  - added description of sea-ice model
  - added missing matlab routines
  - added test of thermodynamics parallelization
Modified Files:
   doc/tag-index pkg/seaice/SEAICE_FFIELDS.h
   pkg/seaice/SEAICE_PARAMS.h pkg/seaice/adi.F
   pkg/seaice/advect.F pkg/seaice/budget.F pkg/seaice/diffus.F
   pkg/seaice/dynsolver.F pkg/seaice/groatb.F pkg/seaice/growth.F
   pkg/seaice/lsr.F pkg/seaice/ostres.F
   pkg/seaice/seaice_do_diags.F pkg/seaice/seaice_get_forcing.F
   pkg/seaice/seaice_init.F pkg/seaice/seaice_model.F
   pkg/seaice/seaice_readparms.F tools/genmake
   verification/global_ocean.90x40x15/input/eedata
   verification/lab_sea/README
   verification/lab_sea/matlab/lookat_exp1.m
   verification/lab_sea/matlab/lookat_exp2.m
   verification/lab_sea/matlab/lookat_exp3.m
   verification/lab_sea/matlab/lookat_exp4.m
   verification/lab_sea/matlab/lookat_exp5.m
   verification/lab_sea/matlab/lookat_exp6.m
   verification/lab_sea/results/AREAtave.0000000010.data
   verification/lab_sea/results/HEFFtave.0000000010.data
   verification/lab_sea/results/UICEtave.0000000010.data
   verification/lab_sea/results/VICEtave.0000000010.data
   verification/lab_sea/results/output.txt
Added Files:
   verification/lab_sea/seaice.ps
   verification/lab_sea/matlab/lookat_exp7.m
   verification/lab_sea/matlab/mmax.m
   verification/lab_sea/matlab/mypcolor.m
   verification/lab_sea/matlab/myquiver.m
   verification/lab_sea/matlab/readbin.m
   verification/lab_sea/matlab/wysiwyg.m
Removed Files:
   verification/lab_sea/code/KPP_OPTIONS.h

1 function fld=readbin(fnam,siz,typ,prec,skip)
2
3 % Function fld=readbin(fnam,siz,typ,prec,skip)
4 % read in N-D binary field
5 %
6 % INPUTS
7 % fnam input path and file name
8 % siz grid dimension (default [360 224 46])
9 % typ 0: sequential FORTRAN (default); 1: plain binary
10 % prec numeric precision (default 'real*4')
11 % skip records to skip before reading (default 0)
12 %
13 % OUTPUTS
14 % fld output array of dimension siz
15 %
16 % SEE ALSO
17 % writebin
18
19 if nargin < 5, skip=0; end
20 if nargin < 4, prec='real*4'; end
21 if nargin < 3, typ=0; end
22 if nargin < 2, siz=[360 224 46]; end
23 if nargin < 1, t=1; end
24 if nargin < 0, error('please specify input file name'); end
25
26 fid=fopen(fnam,'r','ieee-be');
27
28 if skip>0
29 if typ==0
30 error('feature not implemented yet');
31 else
32 switch prec
33 case {'int8','integer*1'}
34 reclength=prod(siz);
35 case {'int16','integer*2','uint16','integer*2'}
36 reclength=2*prod(siz);
37 case {'int32','integer*4','uint32','single','real*4','float32'}
38 reclength=4*prod(siz);
39 case {'int64','integer*8','uint64','double','real*8','float64'}
40 reclength=8*prod(siz);
41 end
42 end
43 fseek(fid,skip*reclength,'bof');
44 end
45
46 switch typ
47 case 0
48 tmp=read_record(fid,prec);
49 case 1
50 tmp=fread(fid,[siz(1),prod(siz(2:length(siz)))],prec);
51 end
52 fid=fclose(fid);
53
54 switch length(siz)
55 case 2
56 fld=reshape(tmp,siz(1),siz(2));
57 case 3
58 fld=reshape(tmp,siz(1),siz(2),siz(3));
59 case 4
60 fld=reshape(tmp,siz(1),siz(2),siz(3),siz(4));
61 case 5
62 fld=reshape(tmp,siz(1),siz(2),siz(3),siz(4),siz(5));
63 otherwise
64 fld=tmp;
65 end

  ViewVC Help
Powered by ViewVC 1.1.22