⇐ ⇒

[CF-metadata] udunits handling of fuzzy time units

From: John Caron <caron>
Date: Mon, 14 Mar 2011 18:31:18 -0600

  because udunits converts units like months and years to a fixed number
of seconds, one cant really use things like months and years as units,
since you get things like this:

  0 months since 1930-01-01 == 1930-01-01T00:00:00Z
  1 months since 1930-01-01 == 1930-01-31T10:29:03Z
  2 months since 1930-01-01 == 1930-03-02T20:58:07Z
  3 months since 1930-01-01 == 1930-04-02T07:27:11Z
  4 months since 1930-01-01 == 1930-05-02T17:56:15Z
  5 months since 1930-01-01 == 1930-06-02T04:25:19Z
  6 months since 1930-01-01 == 1930-07-02T14:54:22Z
  7 months since 1930-01-01 == 1930-08-02T01:23:26Z
  8 months since 1930-01-01 == 1930-09-01T11:52:30Z
  9 months since 1930-01-01 == 1930-10-01T22:21:34Z
10 months since 1930-01-01 == 1930-11-01T08:50:38Z
11 months since 1930-01-01 == 1930-12-01T19:19:42Z

  0 years since 1850-01-01 == 1850-01-01T00:00:00Z
10 years since 1850-01-01 == 1860-01-01T10:07:39Z
20 years since 1850-01-01 == 1869-12-31T20:15:19Z
30 years since 1850-01-01 == 1880-01-01T06:22:59Z
40 years since 1850-01-01 == 1889-12-31T16:30:38Z
50 years since 1850-01-01 == 1900-01-01T02:38:18Z
60 years since 1850-01-01 == 1910-01-01T12:45:58Z
70 years since 1850-01-01 == 1920-01-01T22:53:38Z
80 years since 1850-01-01 == 1930-01-01T09:01:17Z
90 years since 1850-01-01 == 1940-01-01T19:08:57Z

whereas you might really want:

0 months since 1930-01-01 = 1930-01-01T00:00Z
1 months since 1930-01-01 = 1930-02-01T00:00Z
2 months since 1930-01-01 = 1930-03-01T00:00Z
3 months since 1930-01-01 = 1930-04-01T00:00Z
4 months since 1930-01-01 = 1930-05-01T00:00Z
5 months since 1930-01-01 = 1930-06-01T00:00Z
6 months since 1930-01-01 = 1930-07-01T00:00Z
7 months since 1930-01-01 = 1930-08-01T00:00Z
8 months since 1930-01-01 = 1930-09-01T00:00Z
9 months since 1930-01-01 = 1930-10-01T00:00Z
10 months since 1930-01-01 = 1930-11-01T00:00Z
11 months since 1930-01-01 = 1930-12-01T00:00Z

  0 years since 1850-01-01 = 1850-01-01T00:00Z
10 years since 1850-01-01 = 1860-01-01T00:00Z
20 years since 1850-01-01 = 1870-01-01T00:00Z
30 years since 1850-01-01 = 1880-01-01T00:00Z
40 years since 1850-01-01 = 1890-01-01T00:00Z
50 years since 1850-01-01 = 1900-01-01T00:00Z
60 years since 1850-01-01 = 1910-01-01T00:00Z
70 years since 1850-01-01 = 1920-01-01T00:00Z
80 years since 1850-01-01 = 1930-01-01T00:00Z
90 years since 1850-01-01 = 1940-01-01T00:00Z

the solutions that occur to me are:

1) use ISO date strings
2) change the way udunits works
3) create another syntax that can be distinguished from udunits and make
it work like the above
4) something else i havent thought of

any ideas?
Received on Mon Mar 14 2011 - 18:31:18 GMT

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:41 BST

⇐ ⇒