I really appreciate that others have joined the discussion. From my 
understanding the ISO 8601 standard should be considered as a mapping to the 
underlying calendar, i.e. year 0 and -1 in ISO 8601 are mapped to year 1 BCE 
and 2 BCE, respectively. In that sense, there is no conflict between ISO 8601 
and the calendar, even though it is slightly confusing. The ISO 8601 document 
itself is probably a better source of information than Wikipedia. In section 
B.1 (Date and time representations) of the ISO 8601:2004 version it has an 
example:

| Basic format | Extended format | Explanation |
| --- | --- | --- |
| −00020412 | −0002-04-12 | Expanded; four digits to represent the year. The 
twelfth of April in the second year before the year [0000] |

Other than that it is relatively short of good explanation about how negative 
years should be treated. Two other relevant fragments in the document are:

- "NOTE In the proleptic Gregorian calendar, the calendar year [0000] is a leap 
year." (Section 3.2.1 The Gregorian calendar)

- "By mutual agreement of the partners in information interchange, it is 
permitted to expand the component identifying the calendar year, which is 
otherwise limited to four digits. This enables reference to dates and times in 
calendar years outside the range supported by complete representations, i.e. 
before the start of the year [0000] or after the end of the year [9999]." 
(Section 3.5 Expansion)

The newer version of the ISO standard from 2019 defines extensions in ISO 
8601-2:2019:

- "In ISO 8601-1, a negative calendar year cannot be expressed for the years 
-0001 through -9999. This subclause removes that restriction. ... When a 
negative calendar year represents a date, the negative value is to represent 
the number of years prior to year zero (0) (year zero is expressed as '0000' in 
implicit form and '0Y' in explicit form." (Section 4.4.1.2 Calendar year)

- "The calendar year before year one (1) is represented as follows:
Explicit:
[yearE]["B"]
EXAMPLE 1 '1YB' is the first year before year one (1), equivalent to the effect 
of '0Y'.
EXAMPLE 2 '12YB' is the twelfth year before year one (1), equivalent to the 
effect of '-11Y'."
(Section 4.4.1.6 Calendar year before year one (1))

Therefore, it looks like both ways of counting/not counting year 0 are 
supported by the standard, and they are distinguished by adding "YB" to the 
year number without leading zeros in the "explicit form".

I think it would be desirable to follow ISO 8601 (but I am not sure about the 
"YB" form because it may be too complicated to parse all variations of the 
format), unless there are historical reasons not to, such as how the handling 
of negative years has been implemented in udunits. I will try to do a short 
survey of how existing NetCDF libraries implement zero and negative years.

I have been in contact with the developer of Panoply (Robert B. Schmunk, 
@rschmunk - I hope that is his GitHub username), who said that handling of 
dates in Panoply follows standard Java classes, which is according to the ISO 
8601 standard of including year 0 in the calculations.

@Dave-Allured, I wouldn't be trying to only solve my use case here. I know I 
could work around it easily by choosing a reference time with a positive year. 
I am quite interested in solving the issue for all users of NetCDF, as much as 
I can contribute to the discussion. It looks like there is enough interest from 
others too.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/cf-convention/cf-conventions/issues/298#issuecomment-698076375
This list forwards relevant notifications from Github.  It is distinct from 
cf-metad...@cgd.ucar.edu, although if you do nothing, a subscription to the 
UCAR list will result in a subscription to this list.
To unsubscribe from this list only, send a message to 
cf-metadata-unsubscribe-requ...@listserv.llnl.gov.

Reply via email to