[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20050324: decoders (3.0.9): buoy2nc bug uncovered + patch



thanks for the bug report, fix has been made.

robb...


On Thu, 24 Mar 2005, Unidata Support wrote:

>
> ------- Forwarded Message
>
> >To: address@hidden
> >From: Rob Cermak <address@hidden>
> >Subject: decoders (3.0.9): buoy2nc bug uncovered + patch
> >Organization: UCAR/Unidata
> >Keywords: 200503241737.j2OHbkv2020554
>
> Hi,
>
> Found a bug in the buoy2nc decoder.  I've been tracking down this error
> via the LDM log:
>
> Mar 24 17:12:11 ak pqact[17186]: child 23072 exited with status 255
> Mar 24 17:12:12 ak pqact[17186]: child 23074 exited with status 255
> Mar 24 17:12:12 ak pqact[17186]: child 23076 exited with status 255
>
> Traced to the buoy2nc decoder (v3.0.9).   The error:
>
> cat buoyLog.23111.log
> Opening ./2005032401_buoy.nc with ncid 3
> Minute '60' out of range 0..59 at /home/ldm/decoders/bin/buoy2nc line 1290
>
> Line 1290 points to a timegm function.   Looks like a minute of 60 is no
> longer support (if it ever was?).
>
> Just a little ways back is the culprit: $min = 60;
>
> Here is a patch that I think will work.   Oh... fixing that allows more
> stuff to be decoded.   See if the logic is right, seems right.
>
> --- buoy2nc.orig        2005-03-24 08:30:31.287793264 -0900
> +++ buoy2nc     2005-03-24 08:32:27.529121896 -0900
> @@ -1262,7 +1262,7 @@
>
>  sub theTime
>  {
> -my( $when, $min, $hour, $mday, $mon, $year ) ;
> +my( $when, $min, $hour, $mday, $mon, $year, $t_adj ) ;
>
>  ( $when ) = @_ ;
>
> @@ -1270,6 +1270,7 @@
>  $mday = $rday ;
>  $mon = $rmonth ;
>  $year = $ryear ;
> +$t_adj = 0 ;
>  if( $when eq "obs" ) {
>         $min = $rmin ;
>  } elsif( $when eq "pos" ) {
> @@ -1282,12 +1283,13 @@
>         if( $rmin > 14 && $rmin < 45 ) {
>                 $min = $rmin ;
>         } elsif( $rmin > 44 ) {
> -               $min = 60 ;
> +               # round up to the next minute
> +               $min = 0 ; $t_adj = (60 * 60);
>         } else {
>                 $min = 0 ;
>         }
>  }
> -$time = timegm(0, $min, $hour, $mday, $mon -1, $year, 0, 0, 0) ;
> +$time = timegm(0, $min, $hour, $mday, $mon -1, $year, 0, 0, 0) + $t_adj;
>  return $time ;
>
>  } # end theTime
>
> --
> Rob Cermak : 907-474-7948/7092 : FAX 907-474-7204 : PGP = 0x75869A6E
> Software and Systems Engineer : Information Systems and Data Management
> School of Fisheries and Ocean Sciences : University of Alaska Fairbanks
> address@hidden : address@hidden : address@hidden
>
> --
> NOTE: All email exchanges with Unidata User Support are recorded in the
> Unidata inquiry tracking system and then made publicly available
> through the web.  If you do not want to have your interactions made
> available in this way, you must let us know in each email you send to us.
>
> ------- End of Forwarded Message
>

===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================