You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reading back the data with zarr-python would work just fine. However, reading the data with a unit-aware package would enable automatic decoding.
@@ -103,14 +106,84 @@ None of this requires any awareness of units on part of Zarr itself.
103
106
Conventions by definition are fully backwards and forwards compatible with all versions of Zarr, including both V2 and V3.
104
107
They require no changes to the spec or extensions and can be ignored by Zarr implementations.
105
108
109
+
Existing Zarr data conforming to _ad-hoc_ conventions that predate this ZEP can be supported via the **legacy conventions** mechanism described below.
110
+
New Zarr data written after this ZEP has been accepted should use the **explicit conventions** approach.
111
+
106
112
## Detailed description
107
113
108
-
This ZEP itself describes the _process_ by which conventions may be proposed, discussed, accepted, and published by the Zarr community.
114
+
This ZEP itself describes the structure and process by which conventions may be proposed, discussed, accepted, and published by the Zarr community.
109
115
This process is intended to be much more lightweight and informal than a spec change, which requires a ZEP.
110
116
111
-
If this ZEP is accepted, Conventions will be added to the <https://zarr-specs.readthedocs.io/> website as a new top-level heading
117
+
Conventions will be described by a _convention document_.
118
+
Conventions documents will be added to the <https://zarr-specs.readthedocs.io/> website as a new top-level heading
112
119
and a corresponding folder will be created in the `zarr-developers/zarr-specs` repo.
113
-
A conventions template, which accompanies this ZEP, will be added to that folder.
120
+
A convention document template, which accompanies this ZEP, will be added to that folder.
121
+
The template is intentionally simple.
122
+
123
+
### Identifying a Convention
124
+
125
+
In its convention document, a must should declare itself as either an **explicit convention** or a **legacy convention**.
126
+
127
+
#### Explicit Convention
128
+
129
+
The preferred way of identifying the presence of a convention in a Zarr group or array is via the attribute `zarr_conventions`.
130
+
This attribute must be an array of strings; each string is an identifier for the convention.
131
+
Multiple conventions may be present.
132
+
133
+
For example, a group metadata JSON document with conventions present might look like this
134
+
135
+
```
136
+
{
137
+
"zarr_format": 3,
138
+
"node_type": "group",
139
+
"attributes": {
140
+
"zarr_conventions": ["units-v1", "foo],
141
+
}
142
+
}
143
+
```
144
+
145
+
where `units-v1` and `bar` are the convention identifiers.
146
+
147
+
#### Legacy Convention
148
+
149
+
A legacy convention is a convention already in use that predates this ZEP.
150
+
Data conforming to legacy conventions will not have the `zarr_conventions` attribute.
151
+
The conventions document must therefore specify how software can identify the presence of the convention through a series of rules or tests.
152
+
153
+
For those comfortable with the terminology, legacy conventions can be thought of as a "conformance class" and a corresponding "conformance test".
154
+
155
+
An example of a legacy convention might be existing Zarr data written following [CF Conventions](https://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html).
156
+
Such data will have the group attribute `conventions` set to the value `CF-1.10` (or perhaps a different version number).
157
+
This forms the basis for a test for whether the group conforms to the convention.
158
+
159
+
#### Namespacing
160
+
161
+
Conventions may choose to store their attributes on a specific namespace.
162
+
This ZEP does not specify how namespacing works; that is up to the convention.
163
+
For example, the namespace may be specified as a prefix on attributes, e.g.
164
+
165
+
```
166
+
{
167
+
"attributes": {"units-v1:units": "m^2"}
168
+
}
169
+
```
170
+
171
+
or via a nested JSON object, e.g.
172
+
173
+
```
174
+
{
175
+
"attributes": {"units-v1": {"units: "m^2"}}
176
+
}
177
+
```
178
+
179
+
The use of namespacing is optional and is up to the convention to decide.
180
+
181
+
#### Versioning
182
+
183
+
There may be multiple versions of a convention.
184
+
It is recommended for a convention to explicitly declare its version.
185
+
For an explicit convention, the version identifier may be encoded into the convention identifier string, but this is not required.
186
+
The convention document should specify how to identify the convention version.
0 commit comments