/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/MITprof_concat.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/MITprof_concat.m

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


Revision 1.2 - (hide annotations) (download)
Thu Jan 27 05:10:42 2011 UTC (14 years, 5 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.1: +3 -0 lines
- add list of instruments (list_descr) and the number
  of instruments (nd) to MITprof structure.
- add option to MITprof_subset.m (list of profiles).

1 gforget 1.1 function [MITprof]=MITprof_concat(MITprof1,MITprof2);
2     % [MITprof]=MITprof_concat(MITprof1,MITprof2);
3     % concatenates MITprof1 and MITprof2, which mut
4     % have the same vertical grid
5 gforget 1.2 %
6 gforget 1.1
7     MITprof=MITprof1;
8     fldNames=fieldnames(MITprof);
9    
10     %check that the vertical grids of MITprof1 and MITprof2 are the same:
11     %--------------------------------------------------------------------
12     tmp1=MITprof1.prof_depth; tmp2=MITprof2.prof_depth;
13     if length(tmp1)~=length(tmp2);
14     error('vertical grids differ => cannot concatenate');
15     else;
16     if sum(tmp1~=tmp2)>0;
17     error('vertical grids differ => cannot concatenate');
18     end;
19     end;
20    
21     %concatenate:
22     %------------
23     for iFld=1:length(fldNames);
24     eval(['tmp1=MITprof1.' fldNames{iFld} ';']);
25     eval(['tmp2=MITprof2.' fldNames{iFld} ';']);
26     if ~strcmp(fldNames{iFld},'prof_depth');
27     tmp1=[tmp1;tmp2];
28     end;
29     eval(['MITprof.' fldNames{iFld} '=tmp1;']);
30     end;
31    
32     %add a couple things:
33     %--------------------
34     MITprof.np=length(MITprof.prof_lon);
35     MITprof.nr=length(MITprof.prof_depth);
36 gforget 1.2 MITprof.list_descr=unique(MITprof.prof_descr);
37     MITprof.nd=length(MITprof.list_descr);
38 gforget 1.1

  ViewVC Help
Powered by ViewVC 1.1.22