Re: Re: ut_inv_calendar

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon, 07 Jul 2008 18:05:37 -0600

Mary, ut_calendar takes a floating point number, not an integer, as
input. (This is divergent from the original topic.) The
association with the internal Udunits routine is not visible to NCL
end users.

Options +2/-2 through +4/-4 must involve some kind of rounding or
truncation in cases where the input time value is not the exact
floating point representation of a certain date, with zero residue
and zero roundoff error.

For example, suppose date = 1.9, type double, date_at_units = "days
since 1980-1-1 0:0:0", and option = 3 (YYYYMMDD type double). I
could see three possible results for ut_calendar(date,3):

   19800102.000 - because the result is truncated
   19800102.900 - because the fractional part is included
   19800103.000 - because result is rounded to the nearest integer

I suggest only that this be clarified in the documentation. The
current documentation is explicit on this issue for options 4 and
-5, and sufficiently implicit for option 0.

Thanks for your consideration.

--Dave

Mary Haley wrote:
>
> The year, month, day, and hour values returned by the internal Udunits
> routine are all integers to start with, so there's no rounding or
> truncating going on at the NCL end of things. Only the "seconds"
> values are returned as float.
>
> Now that I think about it, maybe this option '5' should be '-5',
> since the other negative options return integers...
>
> --Mary
>
>
> On Mon, 7 Jul 2008, Dave Allured wrote:
>
>> Reading the documentation for ut_calendar, I see that there already
>> are several other options for specialized result formats. In light of
>> this and the symmetry issue with ut_inv_calendar, I think it's
>> reasonable to add option 5 for integers. I would use this option if
>> available. Thanks to NCL for adding this one.
>>
>> For options +2/-2 through +4/-4, YYYYMM etc. as type double or
>> integer, are the time values rounded or truncated? I suggest that
>> this be added to the documentation.
>>
>> --Dave

<snip>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 07 2008 - 18:05:37 MDT

This archive was generated by hypermail 2.2.0 : Thu Jul 10 2008 - 06:04:07 MDT