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

Contents 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.1 - (show annotations) (download)
Mon Nov 8 19:46:01 2010 UTC (14 years, 8 months ago) by gforget
Branch: MAIN
- MITprof_load.m same as MITprof_read.m but different...
- MITprof_concat.m concatenate two MITprof objects in memory.
- MITprof_subset.m extracts a subset of MITprof.
- MITprof_bin.m bin averages MITprof to a grid.
- MITprof_stats.m does a few stats over MITprof.

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
6 MITprof=MITprof1;
7 fldNames=fieldnames(MITprof);
8
9 %check that the vertical grids of MITprof1 and MITprof2 are the same:
10 %--------------------------------------------------------------------
11 tmp1=MITprof1.prof_depth; tmp2=MITprof2.prof_depth;
12 if length(tmp1)~=length(tmp2);
13 error('vertical grids differ => cannot concatenate');
14 else;
15 if sum(tmp1~=tmp2)>0;
16 error('vertical grids differ => cannot concatenate');
17 end;
18 end;
19
20 %concatenate:
21 %------------
22 for iFld=1:length(fldNames);
23 eval(['tmp1=MITprof1.' fldNames{iFld} ';']);
24 eval(['tmp2=MITprof2.' fldNames{iFld} ';']);
25 if ~strcmp(fldNames{iFld},'prof_depth');
26 tmp1=[tmp1;tmp2];
27 end;
28 eval(['MITprof.' fldNames{iFld} '=tmp1;']);
29 end;
30
31 %add a couple things:
32 %--------------------
33 MITprof.np=length(MITprof.prof_lon);
34 MITprof.nr=length(MITprof.prof_depth);
35

  ViewVC Help
Powered by ViewVC 1.1.22