-
Notifications
You must be signed in to change notification settings - Fork 50
Revision to leap seconds and calendar conventions (v3) #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JonathanGregory
wants to merge
44
commits into
cf-convention:main
Choose a base branch
from
JonathanGregory:leaps133
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
3074c99
leap seconds
JonathanGregory 83c6527
update
JonathanGregory b9e8d36
update
JonathanGregory 78b9528
update
JonathanGregory a2ebbd6
update
JonathanGregory 5d3e7f6
update
JonathanGregory 106086d
update
JonathanGregory cc8d1fe
update following David and Chris comments
JonathanGregory 11badbf
corrections
JonathanGregory 68fa84c
changes agreed with Lars
JonathanGregory 33d6cff
updates arising from comments
JonathanGregory e8f8a1e
having completed replies to comments
JonathanGregory b6fefda
corrections
JonathanGregory 5cfd764
revisions
JonathanGregory d34314b
further revision
JonathanGregory 30e52e7
toc-extra
JonathanGregory 08c4e84
revisions
JonathanGregory 8f21bd6
typo
JonathanGregory 6e9ee55
examples
JonathanGregory f713416
rearrangement of early paras of 4.4.3
JonathanGregory b7ff4fa
changes in response to comments
JonathanGregory 73b806d
remove two duplicate sentences
JonathanGregory 8c69f6f
restrict format of time zone offset
JonathanGregory 53e99eb
minute is two digits in time zone offset
JonathanGregory 197abdb
partly done
JonathanGregory 5a046b7
complete
JonathanGregory f454bc8
corrections
JonathanGregory 3b880b7
minor change
JonathanGregory e6098ca
move 4.4.4 to appendix L, shorten some remarks about leap seconds
JonathanGregory 4d4ae92
updates following discussions with Lars; 4.4.4 to App L
JonathanGregory b586eef
table caption
JonathanGregory 7d737ae
additional authors
JonathanGregory 22fb11e
history
JonathanGregory 4b0fee3
changes arising from Lars's comments (except on the appendix) and ema…
JonathanGregory 0f4f5ca
changes to app arising from Lars's comments (unfinished)
JonathanGregory 29ec776
minor change in appendix
JonathanGregory 7a34df4
update entry for 584
JonathanGregory f936688
minor
JonathanGregory dd7895f
refer to ch4 of SI
JonathanGregory 814045d
copy the new version to PR 612
JonathanGregory 44c81b1
remove highlighting and deletions, rename appendix to M
JonathanGregory 475c764
no appendix L
JonathanGregory 1ce5e50
remove a newline
JonathanGregory 888cd2b
Merge branch 'main' into leaps133
JonathanGregory File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
|
|
||
| [[appendix-mesh-topology-attributes, Appendix K, Mesh Topology Attributes]] | ||
|
|
||
| [appendix] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| [[appendix-leap-seconds, Appendix L, Leap Seconds]] | ||
| :doc-part: L | ||
| :figure: 0 | ||
| [appendix] | ||
| == Leap Seconds | ||
|
|
||
| This appendix describes the treatment of leap seconds in CF in more detail than <<calendar>>. | ||
| Since precision to the second has rarely been needed in the climate and forecast community, leap seconds have typically been ignored, including in many datasets and earlier versions of the CF standard. | ||
|
|
||
| If you are producing real-world datasets with datetimes in UTC, and if it's important for your time coordinates and datetimes to be accurate to the second, the **`utc`** calendar is recommended. | ||
| When a datetime is converted to a time coordinate or vice-versa in the **`utc`** calendar, any leap seconds must be counted that occurred between the instant concerned and the reference datetime in the **`units`** attribute. | ||
| Therefore both the writer and the user of the dataset will need leap-second-aware software for conversion between datetimes and time coordinates. | ||
|
|
||
| For example, a leap second was added to UTC at the end of 2016. | ||
| Therefore if **`calendar="utc"`** and **`units="seconds since 2016-12-31 23:59:58"`**, a value of 4 for the time coordinate represents the datetime 2017-01-01 00:00:01, because four seconds had elapsed by that instant since 2016-12-31 23:59:58 (seconds ending at 2016-12-31 23:59:59, 2016-12-31 23:59:60, 2017-01-01 00:00:00, 2017-01-01 00:00:01). | ||
| In the **`utc`** calendar, the elapsed time between the same time of day on consecutive days is normally 86400 seconds, but increases to 86401 seconds when a positive leap second intervenes. | ||
| For example, with respect to the the reference datetime in **`units="seconds since 2016-12-31 23:59:58"`**, the datetime 2017-01-01 23:59:58, which is one calendar day later, is represented by a time coordinate of 86401. | ||
|
|
||
| In all calendars except **`utc`**, datetimes within leap seconds are not valid, reference datetimes in the **`units`** attribute must not contain seconds equal to or greater than 60, and the elapsed time between the same time of day on consecutive days is always 86400 seconds. | ||
|
|
||
| If you are producing model-generated datasets with datetimes that follow the Gregorian calendar but do not include leap seconds, the **`proleptic_gregorian`** calendar is recommended. | ||
| This calendar may also be used for real-world datasets with UTC datetimes to be converted to time coordinates, with two caveats: | ||
|
|
||
| * Datetimes within leap seconds cannot be converted to time coordinates. | ||
| * The difference between two time coordinates will differ from the duration of the time interval between the two instants by the net number of leap seconds that occurred between them. | ||
|
|
||
| The advantages of the **`proleptic_gregorian`** calendar are: | ||
|
|
||
| * The user can recover the datetimes exactly from the time coordinates. | ||
| * Leap-second-aware software is not required for conversion between datetimes and time coordinates. | ||
|
|
||
| Because the **`proleptic_gregorian`** calendar includes no leap seconds, the time coordinate for a given datetime and **`units`** may differ between this calendar and **`utc`**. | ||
| For example, if **`calendar="proleptic_gregorian"`** and **`units="seconds since 2016-12-31 23:59:58"`**, the datetime 2017-01-01 00:00:01 is represented by a time coordinate of 3, because the UTC leap second (from 2016-12-31 23:59:60 to 2017-01-01 00:00:00) does not exist in the **`proleptic_gregorian`** calendar, whereas the time coordinate is 4 in **`utc`** with the same **`units`** attribute. | ||
| In the **`proleptic_gregorian`** calendar, the time coordinate for 2017-01-01 00:00:58 is 60, and for 2017-01-01 23:59:58 is 86400. | ||
|
|
||
| The **`standard`** calendar is not recommended for new datasets because of its uncertainty about leap seconds. | ||
| The **`standard`** calendar has been used in existing datasets both for real-world data, and for data generated by models that follow the Gregorian calendar and do not include leap seconds in the timeline. | ||
| For real-world data in the **`standard`** calendar since 1972, datetimes are in UTC or a local time zone offset from UTC. | ||
| Hence leap seconds may have occurred between the instant of the reference datetime in the **`udunits`** and the instant referred to by a time coordinate. | ||
| Some real-world datasets take leap seconds into account, and others do not. | ||
| For example, equipment that automatically records data with UTC datetimes can insert a new leap second only if it has prior knowledge of when this is to be done, or is appropriately synchronized to UTC time services that deliver leap second support. | ||
|
|
||
| As a consequence of such differences, users of real-world data in the **`standard`** calendar need to be aware that the difference between two time coordinates might not exactly equal the duration of the time interval between the two instants, but could be inaccurate by a number of seconds. | ||
| Similar uncertainties apply if you do not know whether the data is observational or model-generated. | ||
| Furthermore, the time coordinates for the same real-world instant in two datasets, both using the **`standard`** calendar, could disagree by some number of seconds. | ||
|
|
||
| CF version 1.12 introduced possible values of the form "**`leap_seconds:`** __value__" for the **`units_metadata`** attribute, in order to specify the treatment of leap seconds in the **`standard`**, **`julian`** and **`proleptic_gregorian`** calendars. | ||
| CF version 1.13 withdrew this use of **`units_metadata`**, in favour of the recommendations given above that the **`utc`** or **`proleptic_gregorian`** calendars should be used by data-producers instead of **`standard`**. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want/need to make this blanket recommendation against using the
standardcalendar? As we know, almost all use cases do not need (or want) this second-precision accuracy. We must not be unaware of the fact that making the recommendation as stated may initiate a lot of work on changing workflow and software systems. Or, alternatively, that people and organisations decide not to follow the stated recommendation, which only undermines the status of the CF Conventions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I put in the issue comments, I think we should generally recommend the standard calendar for model results.
The standard calendar is for when leap seconds aren't relevant (i.e. from above ", leap seconds have typically been ignored") -- that is still the case.
Granted the other difference between standard and proleptic_gregorian is the "proleptic" part -- but that's a whole other question -- if folks are encoding time before pope gregory, the leap seconds are certainly not an issue ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #613