-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayManagerNotes
More file actions
225 lines (162 loc) · 8.78 KB
/
ArrayManagerNotes
File metadata and controls
225 lines (162 loc) · 8.78 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
*********************************************************************
ArrayManager
*********************************************************************
function [] = ArrayManager(Survey,maxSites)
Usage: [] = ArrayManager(Survey,maxSites)
Survey gives the path (relative to MTprocHome, which should be set
as an environment variable before calling) of the specfic survey
being processed (e.g., "Yellowstone"). This is the directory
which contains subdirectories data, XML, original, MT, FC, tmp, etc.
maxSites is an optional variable that is passed to dataTimes;
this is used to control how many sites are
Array Manager calls these routines (all in ArrayManager):
[DataFiles,metaData] = listFromXML(XMLdir) to generate a list of available run files
and a structure containing all associated metadata.
This is generated from the *.xml files, which ArrayManager now
assumes are in a single directory, namely XMLdir = <Survey>/XML
[NIMSinfo] = mkNIMSinfo(Survey,metaData);
[plotStart] = plotSetup(tUnits,nTunits,decFac);
[] = dataTimes(DataFiles,NIMSinfo,plotStart,maxSites);
*********************************************************************
[DataFiles,metaData] = listFromXML(XMLdir);
*********************************************************************
Generates a list of data files names (runs), and the
corresponding metadata from list of xml files in XMLdir
calls: xml_read (xml_io_tools), cleanMetaData (SS/NIMSread)
*********************************************************************
[NIMSinfo] = mkNIMSinfo(Survey,metaData)
*********************************************************************
This is a new version of makeNIMSinfo; only used for
display of what has been done (and bad record segments)
in ArrayManager. Input metaData structure is used to generate
the list of runs to check for existence of *.bin, *.sp, *.f5, *.br
files. If bad record (*.br) files exist for a run they are read,
and the list of marked segments is returned in the corresponding
NIMSinfo cell.
calls: rdBadRec (TSplot)
*********************************************************************
function dataTimes(DataFiles,NIMSinfo,plotStart,Tlims);
*********************************************************************
dataTimes initializes arrayManager interface
Inputs:
DataFiles = cell array of all data file names
NIMSinfo = cell array of information for each
data file, including metadata structure
plotStart = structure used to initialize time series
plotting
Tlims = optional argument used to allow plotting
only a fraction of the available files:
--> if Tlims is not present, display all files
--> if Tlims is a single integer, display this
many sites, starting from the first in time
--> if Tlims is a pair of real numbers,
use these as time limits (in days) for
choosing data files to display
calls: uniqueSites, sortSites, and creates callbacks to dataTimesCB
(all in ArrayManager)
if ZFILES = 1 (set inside dataTimes) a list of *.zrr files available
in ../MT is generated for each site. Not clear how useful this
now is, as clicking the site name button now opens a browse window
in dataDir/MT, listing all *.zrr files available for the site
(and easily enabling plotting)
*********************************************************************
dataTimesCB
*********************************************************************
Callback script for dataTimes interface
Calls: Routines in TSplot (readTSnims, setTSd, plotStart, plotPage,
plotTSwin (+ routines in plotTS called by these)
Routines in EMTF/matlab : apresplt (+ routines in EMTF/matlab
called by these)
Other routines in ArrayManager: shiftPlotStart,
ComputeTF, EnableButtons, uniqueSites, dataTimes
Also uses "unix" to execute programs in binDir: dnff
*********************************************************************
function [Sites] = uniqueSites(DataFiles);
*********************************************************************
Parse data file list to get a cell array containing:
--> list of unique site names
--> list of data file suffixes for each site+indices into
DataFiles list for all files associated with the site
Usage: [Sites] = uniqueSites(DataFiles);
calls: standard matlab only
*********************************************************************
function [SitesOrdered,UseSite] = sortSites(Sites,DataFiles,Tlims)
*********************************************************************
Sort sites by start time of first data file associated with that
site.
Usage: [SitesOrdered,UseSite] = sortSites(Sites,DataFiles,Tlims);
If optional third argument Tlims is present, also returns
an indicator array, with UseSite = 1 iff any segment for this
site overlaps time limits given in Tlims. If Tlims
is not input, UseSite is identically 1 for all sites
calls: standard matlab only
*********************************************************************
function [] = shiftPlotStart(data,LoadedDataFiles,options)
*********************************************************************
Extract overlapping section of array data for channels ch1, ch2
(fields in input structure "options"); intialize ShiftInfo,
a structure containing the two data channels + other information
calls: shiftPlot to plot data (and attach ShiftInfo to plot as UserData)
*********************************************************************
function [] = shiftPlot(ShiftInfo)
*********************************************************************
Using two channels of time series + shifts in ShiftInfo structure,
shift and plot time series; all variables need to be put into
structure shiftInfo before calling
Usage: shiftPlot(ShiftInfo)
calls: nothing but standard matlab functions; creates callbacks to
shiftPlotCB.m
*********************************************************************
shiftPlotCB
*********************************************************************
Callback script for ShiftPlot.
Calls: shiftRePlot.m, shiftPlotStart.m
*********************************************************************
shiftRePlot
*********************************************************************
Replots shifted data.
*********************************************************************
function [] = ComputeTF(SelectedDataFiles,Task);
*********************************************************************
Creates interface for RR, SS or MMT processing
using selected data files to initialize list of files;
Control file names are now hard-coded (but can be
edited in the interface).
calls : MakeTFoutFile
*********************************************************************
ComputeTF_CB
*********************************************************************
Callback script for ComputeTF.
Calls: Other routines in ArrayManager: ComputeTF
calls : rdBadRec, wrBadRec (in TSplot at present ...
should these be?)
Uses "unix" to execute programs in binDir: tranmtlr, multmtrn
*********************************************************************
function [outName] = MakeTFoutFile(Files,Task);
*********************************************************************
Makes output file names for transfer functions, using
list of input file names for local and remote sites.
Input argument Task defines SS, RR, MMT case
Usage : [outName] = MakeTFoutFile(Files,Task);
*********************************************************************
function [] = updateSP(Survey,metaData)
*********************************************************************
Goes through list of run files in input structure metaData,
and checks for presence of corresponding system parameter
file in directory <Survey>/SP. If not, the *.sp file is generated.
If argument metaData is not provided when calling, the metaData
structure is generated using contents of <Survey>/XML.
Calls writeSp.m (SS/NIMSread) and listFromXML (ArrayManager)
*********************************************************************
function [] = updateFC(Survey,metaData,DataFileSuffix)
*********************************************************************
Runs dnff for all data files *.bin in Survey/data for which there are
binary data (*.bin) and system parameter files (*.sp)
in Survey/daa and Survey/SP respectively. Uses the list of available
run files stored in cell array metaData. Optional argument DataFileSuffix
can be used to change data file names from default *.bin to some other
suffix (e.g., *.dbn, to run dnff on decimated files). If second argument
(metaData) is missing this generates the file list (i.e., metaData)
by calling listFromXML
Calls: listFromXML (ArrayManager)
Executes binDir/dnff through system command