[Sea-mat] Possible bug in carter.m

Val Schmidt vschmidt at ccom.unh.edu
Wed Feb 21 15:51:09 EST 2007


Mike,

First, thanks so much for your carter.m matlab routine for accessing  
Carter's tables. It has been tremendously helpful.

In the course of my work, I think I found a small bug in the code. In  
these lines:

-------snip---------
% now scan through longitudes to find correction area

for i = 1:length(lon_file)-1;
     if lon_use >= lon_file(i) & lon_use < lon_file(i+1);
         correction_area(ii) = area(i);
     elseif lon_use > lon_file(end);
         correction_area(ii) = area(end); % if is on last record in  
group
     end;
end;
----------snip---------

...it turns out that if "lon_use", (the longitude for which one would  
like a correction) happens to be equal to the "lon_file(end)", (the  
last value in the list of area longitude boundaries), then no area is  
selected (i.e. area_correction is not set) and subsequent lines of  
code fail.

A simple (and I *think* proper) fix is to modify the second elseif  
statement to the following:

      elseif lon_use >= lon_file(end);

[Note the added "=".]

I am not entirely sure this is correct and I defer to your judgement.

The copy of carter.m I have was borrowed from the USGS - SEA-MAT site:
http://woodshole.er.usgs.gov/operations/sea-mat/.

I have cc'd their mailing list.

Cheers,

-Val

------------------------------------------------------
Val Schmidt
CCOM/JHC
University of New Hampshire
Chase Ocean Engineering Lab
24 Colovos Road
Durham, NH 03824
e: vschmidt [AT] ccom.unh.edu
m: 614.286.3726


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.whoi.edu/pipermail/sea-mat/attachments/20070221/19583720/attachment.htm


More information about the Sea-mat mailing list