-
Notifications
You must be signed in to change notification settings - Fork 10
Proposal: Projection Attribute Extension for Zarr v3 #21
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
60fddbc
f09f67a
83a5f93
77bae32
caee06b
9daf0d3
7e77fa1
01537ec
17a0700
289f774
cd14f53
0932243
cd58d28
c317a4a
8a60696
96b5db1
e9e754e
1893b7b
a244d90
1cffe00
d903aa7
f4364e4
cc9f913
21b0d1c
1bde1bc
190ad60
a4b2bef
544687d
4582d2a
1c0134f
ac841d8
803f269
27a1123
eeb64ae
22b277d
c84a05e
5132326
b13da42
f9ffc2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Attributes Extensions | ||
|
||
This directory contains specifications for Zarr v3 attribute extensions. | ||
|
||
## What are Attribute Extensions? | ||
|
||
Attribute extensions define standardized schemas and semantics for metadata stored in the `attributes` field of Zarr arrays and groups. These extensions enable interoperability by establishing common conventions for domain-specific metadata. | ||
|
||
## Registered Extensions | ||
|
||
| Extension | Version | Description | | ||
|-----------|---------|-------------| | ||
| [projection](./projection/) | 1.0.0 | Coordinate reference system metadata for geospatial data | | ||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Creating an Attribute Extension | ||
|
||
When creating an attribute extension, consider: | ||
|
||
1. **Namespace**: Use a unique prefix to avoid conflicts (e.g., `proj:` for projection) | ||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
2. **Schema**: Provide a JSON schema for validation | ||
3. **Inheritance**: Define behavior when attributes are set at group vs array level | ||
4. **Compatibility**: Consider interoperability with existing tools and standards | ||
|
||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
## Extension Requirements | ||
|
||
Each attribute extension MUST: | ||
- Define the attribute key(s) and structure | ||
- Provide a JSON schema for validation | ||
- Include examples of usage | ||
- Document any inheritance or precedence rules | ||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,149 @@ | ||||||
# Projection Attribute Extension for Zarr | ||||||
|
||||||
- **Extension Name**: Projection Attribute Extension | ||||||
- **Version**: 1.0.0 | ||||||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
- **Extension Type**: Attribute | ||||||
- **Status**: Proposed | ||||||
- **Owners**: @emmanuelmathot | ||||||
|
||||||
## Description | ||||||
|
||||||
This extension defines a standardized way to encode coordinate reference system (CRS) information for geospatial Zarr arrays and groups using the `geo:proj` attribute. | ||||||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
||||||
## Motivation | ||||||
|
||||||
- Provides simple, standardized CRS encoding without complex nested structures | ||||||
- Addresses issues identified in GeoZarr discussions regarding CF convention complexity | ||||||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
- Compatible with existing geospatial tools (GDAL, rasterio, pyproj) | ||||||
|
- Compatible with existing geospatial tools (GDAL, rasterio, pyproj) | |
- Future cross-compatibility with existing geospatial tools (GDAL, rasterio, pyproj) |
I think this better reflects the current status and goals
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.
We know the data model is compatible. We can a section about the tooling implementation status but I'd avoid putting assumptions in the motivation section.
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
I think this could be broadened a bit to allow any dimension_names
that includes these patterns. That would catch cases where there is also time
or something.
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.
The geo:proj extension specifically scopes to only the spatial dimensions that the CRS applies to (typically 2D: y/x, lat/lon, etc.). Non-spatial dimensions like time, band, or depth are outside the scope of this extension. The pattern matching is designed to identify exactly the spatial dimension pair that corresponds to the CRS, not to handle additional dimensions in the array.
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.
Sorry, I just got your comments afterwards. This is not a static pattern that dimension_names must exactly match. The pattern matching rule is a set of possible name that must be found together in dimension_names
to match a possible combination
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
When talking about "the array" I think it's necessary to separate out the "dimension array" from the "data variable array". My understanding is here the proposal is to compare the shape of all data variable arrays with the shape of any listed dimension arrays
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.
yes indeed but the "non matching" dimension arrays would be skipped if not matching the pattern of the spatial_dimensions defintion
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
Most of these examples are for arrays even though it is recommended that this be defined at the group level. Are we sure we want to allow inheritance from the group level?
I very much like @benbovy's suggestion (#21 (comment)) that the "geo:proj" blobs be defined at that group level with an id and then the arrays reference a specific id
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.
I am still a bit confused with the "dimension array" term you often use. Are they coordinates? In that case, this is out of scope. We want to keep the spec on top of the base Zarr concepts (arrays and shapes).
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.
@jsignell I think I finally understood your point here and I updated the readme to better describe how the spec should interpret at array-level.
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://zarr-specs.readthedocs.io/en/latest/extensions/attributes/projection/v1.0.0/schema.json", | ||
"title": "Zarr Projection Attribute Extension", | ||
"description": "Projection attribute extension for Zarr arrays and groups", | ||
"type": "object", | ||
"definitions": { | ||
"projectionMetadata": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": ["string", "null"], | ||
"description": "Authority:code identifier (e.g., EPSG:4326)", | ||
"pattern": "^[A-Z]+:[0-9]+$" | ||
}, | ||
"wkt2": { | ||
"type": ["string", "null"], | ||
"description": "WKT2 (ISO 19162) CRS representation" | ||
}, | ||
"projjson": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "https://proj.org/schemas/v0.7/projjson.schema.json" | ||
}, | ||
{ | ||
"type": "null" | ||
} | ||
], | ||
"description": "PROJJSON CRS representation" | ||
}, | ||
"bbox": { | ||
"type": "array", | ||
"oneOf": [ | ||
{ | ||
"minItems": 4, | ||
"maxItems": 4 | ||
}, | ||
{ | ||
"minItems": 6, | ||
"maxItems": 6 | ||
} | ||
emmanuelmathot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
], | ||
"items": { | ||
"type": "number" | ||
}, | ||
"description": "Bounding box in CRS coordinates" | ||
}, | ||
"transform": { | ||
"type": "array", | ||
"oneOf": [ | ||
{ | ||
"minItems": 6, | ||
"maxItems": 6 | ||
}, | ||
{ | ||
"minItems": 9, | ||
"maxItems": 9 | ||
} | ||
], | ||
"items": { | ||
"type": "number" | ||
}, | ||
"description": "Affine transformation coefficients" | ||
}, | ||
"spatial_dims": { | ||
"type": "array", | ||
"minItems": 2, | ||
"maxItems": 2, | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "Names of spatial dimensions [y_name, x_name]" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"required": ["code"] | ||
}, | ||
{ | ||
"required": ["wkt2"] | ||
}, | ||
{ | ||
"required": ["projjson"] | ||
} | ||
] | ||
} | ||
}, | ||
"properties": { | ||
"attributes": { | ||
"type": "object", | ||
"properties": { | ||
"geo:proj": { | ||
"$ref": "#/definitions/projectionMetadata" | ||
} | ||
} | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.