Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/mdio/builder/schemas/v1/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ class VariableMetadata(CoordinateMetadata):
description="Minimal summary statistics.",
)

crs: str | None = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a string CRS will be sufficient here. We should have support for the most common expected systems. An example of making it more usable might be:

{
  "CRS": {
    "type": "EPSG",
    "code": 1234
  }
}

There are probably several projection systems that we should support, if you could please take a look.

You can see how we might want to structure this as a set of enums similar to unitsV1. We will want to leave an escape hatch for custom free-form CRS data as well.

default=None,
description="Coordinate Reference System as an EPSG code (e.g., 'EPSG:4326').",
)

bin_inl: float | None = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bin_inl and bin_xl are too specific to a use-cases with 3D poststack data. I would recommend looking into adding it in dimensions.py and updating its key to be nominal_bin to support non-binned data as well.

default=None,
description="Inline bin size in grid units.",
)

bin_xl: float | None = Field(
default=None,
description="Crossline bin size in grid units.",
)


class Coordinate(NamedArray):
"""A simple MDIO Coordinate array with metadata.
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/v1/test_dataset_builder_add_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def test_add_variable_full_parameters() -> None:
attributes={"MGA": 51, "UnitSystem": "Imperial"},
chunk_grid=RegularChunkGrid(configuration=RegularChunkShape(chunk_shape=(20,))),
stats_v1=stats,
crs="EPSG:32610",
bin_inl=12.5,
bin_xl=25.0,
)
builder.add_variable(
"ampl",
Expand Down Expand Up @@ -214,3 +217,6 @@ def test_add_variable_full_parameters() -> None:
assert v.metadata.stats_v1.max == 10.84
assert v.metadata.stats_v1.histogram.bin_centers == [1, 2]
assert v.metadata.stats_v1.histogram.counts == [10, 15]
assert v.metadata.crs == "EPSG:32610"
assert v.metadata.bin_inl == 12.5
assert v.metadata.bin_xl == 25.0
Loading