[Sea-mat] Re: Possible bug in carter.m

Michael Meredith mmm at bas.ac.uk
Thu Feb 22 00:57:21 EST 2007


Hi Val

Glad you found the Carter code useful; thanks for getting in touch about
this.

Im actually on my travels at the moment, so can't shake down the code
very easily right now - but from a quick scan it does look like the
extra equals sign might help in the specific circumstance you mention.
I'll let you know more once Ive looked in detail.

Good spot; if you find any more bug fixes, do please flag them up, they
are much appreciated.

Best wishes
Mike


***********************************************
Dr. Mike Meredith
Head of Atmosphere and Ocean Group
British Antarctic Survey
High Cross
Madingley Road
Cambridge CB3 0ET
United Kingdom

http://www.antarctica.ac.uk/staff-profiles/template.php?user=mmm

>>> Val Schmidt <vschmidt at ccom.unh.edu> 02/21/07 8:51 PM >>>
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




--  
This message (and any attachments) is for the recipient only.  NERC is subject
to the Freedom of Information Act 2000 and the contents of this email and any
reply you make may be disclosed by NERC unless it is exempt from release under
the Act.  Any material supplied to NERC may be stored in an electronic
records management system.



More information about the Sea-mat mailing list