Skip to content

Use appropriate types in the time coordinate units. #626

@ChrisBarker-NOAA

Description

@ChrisBarker-NOAA

Use appropriate types in the time coordinate examples.

Moderator

TBA

Moderator Status Review [last updated: YYYY-MM-DD]

Just started ...

Requirement Summary

Ideally, the examples in the CF docs should represent not only valid CF, but also "best practices".

This is because many folks follow examples, rather than reading the spec.

Currently, there are a number of examples that do not follow (IMHO) best practices for the time coordinate data type, specifically:

  • use of float, rather than double, for the data type.

  • use of a floating point type (rather than an integer) when an integer type would be more appropriate.

Technical Proposal Summary

I propose to update the data type used in a number of the examples in the CF doc.

This is a (belated) follow up to this discussion:

https://github.com/orgs/cf-convention/discussions/383

and there was a (now closed) PR: #557

I closed the PR because it was apparent that more discussion was needed, so hence this issue.

I think that, in fact, the discussion was pretty complete -- here's my summary:

  • The examples should never use float -- if a floating point type, they should be double.

  • More of the examples should use an integer type.

In the discussion there was disagreement -- I think a floating point type is almost never the best option, and others think that floats are often called for.

So the "best practice" is to use either a double or an integer depending the circumstances -- but the docs currently imply that double (or worse, float) is the best option, so we really should scatter some integer examples in there.

NOTE:

A secondary proposal is that we add some text discussing what data type should be used for tiem coordinate variables -- with the pros and cons for each option. At this point, I don't know that I have the bandwidth to write that, but if someone wants to take that on, that would be great.

Benefits

Anyone looking at the doc for examples to copy from will benefit -- and fewer "bad" datasets will be created.

Status Quo

The time coordinate examples include a lot of "float" types where it's not good, and very few integer types where they might be called for.

Associated pull request

#557

NOTE: that PR is currently closed, I'll re-open if the response is positive. It is also more aggressive about changing float to int that I think fits the current consensus -- I'll fix that if/when I re-open it.

It was also written a good while ago, and will probably need updating to the latest version.

Detailed Proposal

See the Discussion / PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementProposals to add new capabilities, improve existing ones in the conventions, improve style or format

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions