-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlapdog.m
More file actions
129 lines (93 loc) · 3.31 KB
/
lapdog.m
File metadata and controls
129 lines (93 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
% main -- LAP Dataset Overview and Geometry (lapdog) main file
%
% LAP DERIVED ARCHIVE GENERATION
% anders.eriksson@irfu.se 2012-03-29
% frejon@irfu.se 2014-05-07
%
%For batch mode execution via script, to execute local execution in Matlab, see main.m
%
%
% Quick description
% 1. The program is designed to be called by a script, and somewhat controlled in batch_control.m, with no other user
% input necessary
% 2. preamble defines some variables used everywhere in the script
% 3. indexgen reads every .LBL file in the archive (50% of all files) as
% specified from the index.dat file in outputs it into a useful "index"
% variable
% 4. some post-processing of the index is needed in indexcorr to split files
% exactly at midnight, OBS some files created in temp/ folder,
% 5. generates daily geometry files
% 6. Seperates all files into macro operation blocks, each block terminated
% by midnight or new macroid
% 7. process reads all data, and mills it into new, condensed files
% information of each new file is stored in "tabindex" variable
% 8. an_IV analyses sweeps, wave snapshots (spectra), and downsamples data for
% quick-look plots and stores them in files
% information of each new file is stored in "an_tabindex" variable
% 9. createLBL produces .LBL files for each generated file (PDS archive
% specific file type)
%
% ARGUMENTS
% =========
% archpath : Path to CALIB1 data set.
% arhcID : Mission phase abbreviation, e.g. ESC1, 1601.
% missioncalendar : pds' mission calendar.
function [] = lapdog(archpath, archID, missioncalendar)
fprintf(1,'LAPDOG - LAP Data Overview and Geometry \n')
% fprintf(1,'lapdog: Reading pds.conf\r ')
batch_control;
% Set up PDS keywords etc:
fprintf(1,'lapdog: calling preamble...\n')
preamble;
% Load or, if not defined, generate index:
% fprintf(1,'lapdog: load indices if existing...')
dynampath= mfilename('fullpath'); % find path & remove "/lapdog" from string.
dynampath = dynampath(1:end-7);
fprintf(1,'lapdog: %s\n',dynampath)
indexversion = '2'; %index updated with new variable 17Dec 2014
indexfile = sprintf('%s/index/index_%s_v%s.mat',dynampath,archiveid,indexversion);
%fp = fopen(indexfile,'r');
%if(fp > 0)
% fclose(fp);
% load(indexfile);
%else
fprintf(1,'lapdog: calling indexgen\n')
indexgen;
fprintf(1,'lapdog: splitting files at midnight..\n')
indexcorr;
folder= sprintf('%s/index',dynampath);
if exist(folder,'dir')~=7
mkdir(folder);
end
save(indexfile, 'index');
%end
% Generate daily geometry files:
if(do_geom)
fprintf(1,'lapdog: calling geometry...\n')
geometry;
end
% Generate block list file:
fprintf(1,'lapdog: calling opsblocks...\n')
opsblocks;
tabindexfile = sprintf('%s/tabindex/tabindex_%s.mat',dynampath,archiveid);
% fp = fopen(tabindexfile,'r');
% if(fp > 0)
% fclose(fp);
% load(tabindexfile);
% fprintf(1,'lapdog: successfully loaded tabfiles...\n')
% else
fprintf(1,'lapdog: calling process...\n')
process;
folder= sprintf('%s/tabindex',dynampath);
if exist(folder,'dir')~=7
mkdir(folder);
end
save(tabindexfile,'tabindex');
%end
save_Lapdog_state(derivedpath, true, 'pre-analysis')
analysis;
fprintf(1,'lapdog: generate LBL files....\n')
createLBL(0,1)
fprintf(1,'lapdog: DONE!\n')
end
% End of main.m