⇐ ⇒

[CF-metadata] udunits handling of fuzzy time units

From: Jon Blower <j.d.blower>
Date: Tue, 15 Mar 2011 09:46:43 +0000

Could you not just use "days since" and use a variable number of days on the axis?

31 days since 1930-01-01 = 1930-02-01
59 days since 1930-01-01 = 1930-03-01

This would correctly reflect the variable length of months, but puts a little more burden on the data provider to do the date arithmetic (not too hard given modern libraries).

Or is there a use case that would demand the use of "months/years since"?

(Also, are these time units really "fuzzy" as your subject line implies? I think they are just "irregularly spaced".)

Jon

-----Original Message-----
From: cf-metadata-bounces at cgd.ucar.edu [mailto:cf-metadata-bounces at cgd.ucar.edu] On Behalf Of John Caron
Sent: 15 March 2011 00:31
To: cf-metadata at cgd.ucar.edu
Subject: [CF-metadata] udunits handling of fuzzy time units

  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?



_______________________________________________
CF-metadata mailing list
CF-metadata at cgd.ucar.edu
http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata
Received on Tue Mar 15 2011 - 03:46:43 GMT

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

⇐ ⇒