[Sea-mat] submission of twilight.m, and fix to air_sea/sunrise.m
Daniel Sheldon
sheldon at eecs.oregonstate.edu
Fri Dec 17 15:43:00 EST 2010
Greetings,
I am not a member so this message will bounce, but perhaps the list
moderator will pick it up.
I have been using sunrise.m script from the air_sea toolbox to compute
sunrise and sunset times. I recently modified it to compute twilight
times as well (attached file) and thought it might be useful for someone
else.
In doing so, I identified a bug in sunrise.m where it fails to compute
sunset times (at least in MATLAB R2010b on Linux). The sset variable
begins life as a logical array, and hence cannot be assigned a floating
point value by subscripted assignment. The fix is to explicitly convert
it to a double array. The diff is below, and replacement file is also
attached.
-Dan Sheldon
Postdoctoral Fellow
School of EECS
Oregon State University
--- sunrise.m 2010-12-17 12:35:42.000000000 -0800
+++ sunrise.m.new 2010-12-17 12:35:42.000000000 -0800
@@ -46,7 +46,7 @@
[is,js]=find(sorad(2:2880,:)==0 & sorad(1:2879,:)>0);
srise=zeros(length(yd),1);
-sset=any(sorad>0);
+sset=double(any(sorad>0));
srise(jr)=yday(ir+(jr-1)*2880);
sset(js) =yday(is+(js-1)*2880);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twilight.m
Type: text/x-objcsrc
Size: 2264 bytes
Desc: not available
Url : http://mailman.whoi.edu/pipermail/sea-mat/attachments/20101217/46e42c2a/attachment.bin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sunrise.m.new
Url: http://mailman.whoi.edu/pipermail/sea-mat/attachments/20101217/46e42c2a/attachment.txt
More information about the Sea-mat
mailing list