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

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

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


Revision 1.3 - (hide annotations) (download)
Thu Apr 14 20:12:07 2011 UTC (14 years, 3 months ago) by roquet
Branch: MAIN
Changes since 1.2: +38 -14 lines
- Simplification of IO interface to MITcdf netcdf format.
  MITprof_create and MITprof_read are now low-level functions that should not be used by user.
  Instead, use MITprof_write to create/update a file, and MITprof_load to load data.
- Depth levels must now be provided as an argument of MITprof_create and MITprof_struct,
  and cannot be changed once the MITprof ncfile or struct have been created.
- profiles_prep_main and profiles_prep_write_nc have been changed accordingly.

1 roquet 1.3 function [MITprof]=MITprof_struct(nProf,prof_depth,varargin);
2 gforget 1.1 % [MITprof]=MITprof_struct;
3     % create an empty struct variable using the format MITprof
4     % nProf: number of profiles
5 roquet 1.3 % prof_depth: list of depth levels
6     % list_var: specify name of created fields
7     %
8     % list of fields always created:
9     % prof_depth [nDepth x 1]
10     % prof_descr {nProf x 1}
11     % prof_date [nProf x 1]
12     % prof_YYYYMMDD [nProf x 1]
13     % prof_HHMMSS [nProf x 1]
14     % prof_lon [nProf x 1]
15     % prof_lat [nProf x 1]
16     % prof_basin [nProf x 1]
17     % prof_point [nProf x 1]
18     % np, nr, list_descr, nd
19     %
20     % list of fields created by default, if list_var not specified
21     % prof_T, prof_Tflag, prof_Terr, prof_Tweight, prof_Testim
22     % prof_S, prof_Sflag, prof_Serr, prof_Sweight, prof_Sestim
23     % array size: [nProf x nLev]
24    
25    
26     list_vars={'prof_T','prof_Tweight','prof_Testim','prof_Terr','prof_Tflag',...
27     'prof_S','prof_Sweight','prof_Sestim','prof_Serr','prof_Sflag'};
28     if nargin>2,
29     list_vars=varargin{1};
30     end
31 roquet 1.2
32 gforget 1.1
33     MITprof=[];
34 roquet 1.3
35     nLev=length(prof_depth);
36     prof_depth=reshape(prof_depth,length(prof_depth),1);
37     MITprof.prof_depth=prof_depth;
38    
39 gforget 1.1 MITprof.prof_date=zeros(nProf,1);
40     MITprof.prof_YYYYMMDD=zeros(nProf,1);
41     MITprof.prof_HHMMSS=zeros(nProf,1);
42     MITprof.prof_lon=zeros(nProf,1);
43     MITprof.prof_lat=zeros(nProf,1);
44     MITprof.prof_basin=zeros(nProf,1);
45     MITprof.prof_point=zeros(nProf,1);
46 roquet 1.3
47 gforget 1.1 MITprof.prof_descr=cell(nProf,1);
48 roquet 1.3
49     for ii=1:length(list_vars),
50     MITprof=setfield(MITprof,list_vars{ii},zeros(nProf,nLev));
51     end
52    
53 gforget 1.1 MITprof.np=nProf;
54     MITprof.nr=nLev;
55     MITprof.nd=0;
56     MITprof.list_descr={};
57    
58    
59    

  ViewVC Help
Powered by ViewVC 1.1.22