This is a static copy of a profile report

Home

sunrise (1 call, 0.066 sec)
Generated 05-Aug-2011 13:03:56 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/sunrise.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
sunUpDownfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
41
[z,sorad]=soradna1(yday(:),yr(...
10.044 s66.7%
60
smin=rem(rem(sset,1)*1440,60);
10 s0%
59
shr=fix(rem(sset,1)*24);
10 s0%
58
rmin=rem(rem(srise,1)*1440,60)...
10 s0%
57
rhr=fix(rem(srise,1)*24);
10 s0%
All other lines  0.022 s33.3%
Totals  0.066 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
soradna1function10.033 s50.0%
julianmdfunction20 s0%
Self time (built-ins, overhead, etc.)  0.033 s50.0%
Totals  0.066 s100% 
Code Analyzer results
Line numberMessage
34Use of brackets [] is unnecessary. Use parentheses to group, if needed.
43The value assigned to variable 'z' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function60
Non-code lines (comments, blank lines)36
Code lines (lines that can run)24
Code lines that did run22
Code lines that did not run2
Coverage (did run/can run)91.67 %
Function listing
   time   calls  line
1 function [rhr,rmin,shr,smin]=sunrise(mon,da,yr,lat,long)
2 % SUNRISE: computes sunrise and sunset times for specified day and location.
3 % [rhr,rmin,shr,smin] = SUNRISE(mon,da,yr,lat,long) computes the time
4 % of sunrise rhr:rmin and sunset shr:smin to the nearest minute in GMT
5 % for a calendar day(s) and a specified (scalar) position.
6 % from the University of Maine Ocean Modelling Group http://rocky.umeoce.maine.edu/hjx/courses/SMS585/my2.5/air_sea/sunrise.m
7 %
8 % INPUT: mon - month (e.g., Jan is 1)
9 % da - day (e.g., Jan 10th is 10)
10 % yr - year (e.g., 1995)
11 % lat - latitude [deg]
12 % long - longitude (west is positive) [deg]
13 %
14 % OUTPUT: rhr,rmin - sunrise in GMT hours and minutes
15 % shr,smin - sunset in GMT hours and minutes.
16
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 % 8/28/98: version 1.1 (contributed by RP)
19 % 8/5/99: version 2.0
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 % convert calender time to julian yd
1 23 j=julianmd(yr,mon,da,0);
1 24 j0=julianmd(yr,1,1,0);
1 25 yd=j(:)-j0(:);
26
27 % compute solar altitude for entire day
1 28 dt=1./2880;
29
30 % we don't want abs(long)>180...
1 31 if long<-180, long=long+360; end;
1 32 if long>180, long=long-360; end;
33
1 34 time=dt.*[0:2879]'+long/360; % have a whole day, beginning at midnight (near enough)
1 35 yday=yd(ones(1,2880),:)+time(:,ones(length(yd),1));
36
1 37 if length(yr)>1,
38 yr=yr(:,ones(1,2880))';
39 end;
40
0.04 1 41 [z,sorad]=soradna1(yday(:),yr(:),long,lat);
42
1 43 z=reshape(z,2880,length(yd));
1 44 sorad=reshape(sorad,2880,length(yd));
45
1 46 [ir,jr]=find(sorad(1:2879,:)==0 & sorad(2:2880,:)>0);
1 47 [is,js]=find(sorad(2:2880,:)==0 & sorad(1:2879,:)>0);
48
1 49 srise=zeros(length(yd),1);
50 %SO: bugfix
1 51 sset=double(any(sorad>0));
52 %sset=any(sorad>0);
53
1 54 srise(jr)=yday(ir+(jr-1)*2880);
1 55 sset(js) =yday(is+(js-1)*2880);
56
1 57 rhr=fix(rem(srise,1)*24);
1 58 rmin=rem(rem(srise,1)*1440,60);
1 59 shr=fix(rem(sset,1)*24);
1 60 smin=rem(rem(sset,1)*1440,60);

Other subfunctions in this file are not included in this listing.