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

[UDUNITS #JLQ-522131]: udunits2 and utScan, utIsTime



Sue,

> Sorry for the trouble in advance:
> 
> Units that are CF compliant for time like the
> entire string "seconds since 1970-01-01T00:00:00Z"
> is going to fail to produce in a true  in the following line.
> 
> if (ut_are_convertible(unit, ut_get_unit_by_name(system, "second")) {
> ...
> }
> 
> So if testing units is the only way to detect a time coordinate variable,
> I dont see how it can be done.

Then test for convertibility against a timestamp unit:

    ut_system system = ut_read_xml(NULL);
    ut_unit timestampUnit = ut_offset_by_time(ut_get_by_name(system, "second"), 
0);
    ut_testUnit = ...
    if (ut_are_convertible(testUnit, timestampUnit)) {
        ...
    }
Regards,
Steve Emmerson

Ticket Details
===================
Ticket ID: JLQ-522131
Department: Support UDUNITS
Priority: Normal
Status: Closed