1 function time_bounds=subset_detection_time(red,p)
3 min_det_time=p.time(1);
4 max_det_time=p.time(end);
7 print_time_bounds(red,'Simulation',red.start_datenum,red.end_datenum)
8 print_time_bounds(red,'Detections',min_det_time,max_det_time)
9 b1=max(red.min_tign,min_det_time);
10 b2=min(red.max_tign,max_det_time);
13 default_time_bounds{1}=[b1,b2];
14 default_time_bounds{2}=[b1,b1+0.3*bd];
15 default_time_bounds{3}=[b1,b1+0.5*bd];
16 default_time_bounds{4}=[ba-0.2*bd,ba+0.2*bd];
17 for i=1:length(default_time_bounds)
18 str=sprintf('bounds %i',i);
19 print_time_bounds(red,str,default_time_bounds{i}(1),default_time_bounds{i}(2))
21 time_bounds=input_num('bounds [min_time max_time] as datenum, or number of bounds above',3);
22 if length(time_bounds)==1,
23 time_bounds=default_time_bounds{time_bounds};
25 print_time_bounds(red,'Using bounds',time_bounds(1),time_bounds(2))
27 time_bounds(4)=input_num('perimeter time ',time_bounds(2));
28 aa=input_num('Spinup period (h)',12);
29 time_bounds(3)=input_num('restart time ',rounddatenum2hours(time_bounds(4)-aa/24));
31 print_time_bounds(red,'Spinup from restart to perimeter time',time_bounds(3),time_bounds(4))
35 function r=rounddatenum2hours(t)
36 % input t time in datenum format (days)
37 % output b rounded to whole hours