feat(array): pa.from_xarray walks readers registered by each carrier's package, and a refusal lists every reason
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start with pipekit_array/bridges/xarray.py and the referenced q2_xarray_readers.py prototype; review #406 for the NoMatch contract. Implement the registry and from_xarray discovery behavior, including the named DimArray reader. Done means refusals report every reader and reason in order, imports stay lazy, and lint, type checks, and tests pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem / Request
Add a reader registry to pipekit_array.bridges.xarray and make pa.from_xarray(da) try each registered reader in priority order, returning the first carrier or raising one ValueError that lists each reader's name and reason. DimArray's reader is last and never declines.
Motivation
There are three entry points today, and each assumes the DataArray is its own. The prototype gave each carrier's DataArray to each reader:
| Reader | GeoArray's DataArray |
CField's DataArray |
DimArray's DataArray |
|---|---|---|---|
GeoArray.from_xarray |
GeoArray |
AttributeError |
ValueError: no grid |
CField.from_xarray |
CField at T, georeference dropped |
CField at U |
CField at T |
pipekit's from_xarray |
DimArray, georeference dropped |
DimArray on (y_c, x_g) |
DimArray |
A chain of the three, each returning a carrier or NoMatch(reason), picked the right carrier in all three cases. coordax does the same with NoCoordinateMatch (CP-D3).
Proposed API
# proposed (CP-D3)
# a reader returns a carrier or NoMatch(reason); one that raises is recorded as declining
def register_reader(name: str, reader: Callable[[xr.DataArray], Any], *, priority: int) -> None: ...
# DataArray → the first carrier a reader claims
def from_xarray(da: xr.DataArray, *, readers: tuple[str, ...] | None = None) -> Any: ...
# ValueError: no carrier reads this DataArray:
# geoarray: no spatial_ref coordinate
# gridax: no dim coordinate with an xgcm axis attribute
pa.from_xarray(da, readers=("geoarray", "gridax"))
Reuse
pipekit_array/bridges/xarray.py:from_xarraybecomes theDimArrayreader, unchanged.pipekit_ops.carriers.NoMatchfrom #406.
References & Existing Code
- Design:
docs/design/coordax_carriers.mdin jejjohnson/geostack (merged in jejjohnson/geostack#368), pattern 2 and question CP-O1. - Prototype:
q2_xarray_readers.py.
Implementation Steps
- The registry and
from_xarrayinpipekit_array/bridges/xarray.py, with the discovery CP-O1 decides (entry pointspipekit.readersrecommended). - Keep today's
DimArrayreader reachable by name (readers=("pipekit",)).
Definition of Done
- A DataArray no reader claims except
DimArray's reads as today. - A refusal lists every reader tried, in order, with its reason.
- A reader that raises is reported with the exception's type and first line.
-
import pipekit_arrayimports no reader package. - Lint, type check and tests green.
Relationships
- Parent: jejjohnson/geostack#369
- Blocked by: #406
- Blocks: jejjohnson/geotoolz#850, jejjohnson/gridax#628, #409
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 0
- Merge medio
- 3h 50m
- PR unite (30g)
- 143
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jejjohnson/pipekit
-
area:code layer:0-primitives priority:p2 type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jejjohnson/pipekit#296 ·
I maintainer di solito rispondono entro 1 giorno
-
area:code type:feature
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
jejjohnson/pipekit#411 ·
I maintainer di solito rispondono entro 1 giorno
-
area:code type:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
jejjohnson/pipekit#410 ·
I maintainer di solito rispondono entro 1 giorno
-
area:code type:feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
jejjohnson/pipekit#409 ·
I maintainer di solito rispondono entro 1 giorno
-
area:code type:feature
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
jejjohnson/pipekit#408 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di jejjohnson/pipekit
Issue simili
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorForse già presa @jejjohnson l’ha presa oggi. Apertatype:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jejjohnson/integrix#144 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
finos/ai-governance-framework#459 ·
-
slurm: a case outcome nested too deep crashes status/collect instead of reading as no outcomeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
freelawproject/litigant-portal#1307 ·
I maintainer di solito rispondono entro 2 giorni
-
type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
h2oai/h2o-llmstudio#1163 ·
I maintainer di solito rispondono entro 1 giorno