Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[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


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690