-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPIXGetRFromAOIName.m
More file actions
116 lines (99 loc) · 3.29 KB
/
Copy pathPIXGetRFromAOIName.m
File metadata and controls
116 lines (99 loc) · 3.29 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
function r = PIXGetRFromAOIName( station, aoifile )
% PIXGetRFromAOIName -- get the schedule collection data that produced
% the specified AOIFile.
%
% r = PIXGetRFromAOIName( station, aoifile ) returns the 'r' structure
% for the stack schedules at the station which resulted in the aoifile
% (pixel list) of that name. This function looks in the common data
% storage area for this information.
%
% 'station' is either the station name (e.g. 'argus00') or the name
% of the stack file from which parseFilename can extract the station
% name.
%
% aoifile is the name of the aoifile used to create the stack,
% including the camera identifier and .pix extension. This info
% is included in the params returned by loadStack. OR is the epoch
% time of the AOIFile as stored in the stack database under aoiEpoch.
%
global PGRFAN;
if ~isfield( PGRFAN, 'rname')
PGRFAN.rname = '';
end
if ~isfield( PGRFAN, 'r')
PGRFAN.r = [];
end
if ~ischar( station )
error('Invalid format for station');
end
if ischar( aoifile )
% ok
elseif isnumeric( aoifile )
aoifile = [ num2str(aoifile) '.' ];
else
error('Invalid format for aoifile');
end
% look for file name instead of station name
if length(station) > 10
p = parseFilename(station);
station = p.station;
end
% the name of the mat file with 'r' is the base storage area name
% (/ftp/pub) with the station appended, and then the root name of
% the aoifile. E.g. /ftp/pub/argus00/collects/987654321.mat
%
% more cleanup, for cassy, some others, no ../. Let's just take
% first part of basename of pixfile. Should be ok
base = basename(aoifile);
base = base(1:min(find(base=='.')));
if(isempty(base))
base = basename(aoifile);
end
file = ['/ftp/pub/' station '/collects/' base 'mat'];
if strcmp(file,PGRFAN.rname)
r = PGRFAN.r;
else
load(file);
% now convert to new DB format
r = DBUpdateR(r);
PGRFAN.rname = file;
PGRFAN.r = r;
end
%
%
% $Id: PIXGetRFromAOIName.m 21 2016-02-11 22:21:37Z $
%
% $Log: PIXGetRFromAOIName.m,v $
% Revision 1.5 2013/11/08 20:15:34 stanley
% added cache of r, numeric epoch input
%
% Revision 1.4 2010/02/25 20:53:38 stanley
% add call to update R from old format (DB) to new
%
% Revision 1.3 2008/08/05 00:08:56 stanley
% cleanup up handling aoifile name, strip dirs and c's
%
% Revision 1.2 1904/03/26 11:20:04 stanley
% auto insert keywords
%
%
%key pixel pixelExtract
%comment Gets schedule collection data for AOIFile
%
%
% Copyright (C) 2017 Coastal Imaging Research Network
% and Oregon State University
% This program is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation, version 3 of the
% License.
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% You should have received a copy of the GNU General Public License
% along with this program. If not, see
% <http://www.gnu.org/licenses/>.
% CIRN: https://coastal-imaging-research-network.github.io/
% CIL: http://cil-www.coas.oregonstate.edu
%