An already-validated Dataset silently discards x, y, item and the other constructor arguments
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with _is_input_validated in src/modelskill/timeseries/_timeseries.py and trace the six observation and model-result constructors listed in the issue. Then inspect VerticalAccessor._agg in src/modelskill/comparison/_vertical_comparison.py and the network-class behavior; done means the validated-input semantics are decided per argument and the vertical aggregation path remains correct.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Every observation and model result constructor skips parsing when the input is already a modelskill dataset:
if not self._is_input_validated(data):
data = _parse_xyz_point_input(data, name=name, item=item, quantity=quantity,
aux_items=aux_items, x=x, y=y, z=z)
_is_input_validated (src/modelskill/timeseries/_timeseries.py:182) keys on one dataset-level attribute:
return isinstance(data, xr.Dataset) and "modelskill_version" in data.attrs
Parsing is where x, y, z, item, name, quantity and aux_items are applied, so on that path every one of them is discarded without a word:
o = ms.PointObservation(df, x=1.0, y=2.0, item="WL")
o2 = ms.PointObservation(o.data, x=999.0, y=999.0)
o2.x, o2.y # (1.0, 2.0) <- the arguments were dropped
mr = ms.PointModelResult(o.data, name="renamed")
mr.name # 'WL' <- likewise
Sites
src/modelskill/obs.py:247PointObservationsrc/modelskill/obs.py:366TrackObservationsrc/modelskill/obs.py:473VerticalObservationsrc/modelskill/model/point.py:54PointModelResultsrc/modelskill/model/track.py:57TrackModelResultsrc/modelskill/model/vertical.py:100VerticalModelResult
NodeObservation (obs.py:588) and ReachObservation (obs.py:794) did the same until network-phase-2, where they were changed to raise when the location named disagrees with the one the data carries.
Why the rest cannot simply follow
One internal caller depends on the drop. VerticalAccessor._agg (src/modelskill/comparison/_vertical_comparison.py:279) builds a PointModelResult with an x/y that legitimately differs from the data's:
raw_mod_data[mod_name] = PointModelResult(raw, x=cmp.x, y=cmp.y, quantity=cmp.quantity)
cmp.x is the observation's position, carried into the matched dataset by matching.py:428, while raw derives from cmp.raw_mod_data[...].data, which carries the dfsu element centre (src/modelskill/model/dfsu.py:233-234). raw comes from getattr(r_grouped, agg_func)(), and groupby("time").mean() preserves modelskill_version, so it takes the validated path and the arguments are dropped today.
So cmp.vertical.mean() currently works because of this bug. Deciding what it should do is a prerequisite for fixing the general case.
Suggested fix
Decide per argument what the validated path means, rather than applying one rule to all of them:
- A location argument that contradicts the data is a mistake — raise, as the network classes now do.
nameandquantitycan be applied after the fact;TimeSeriesalready has setters for both (_timeseries.py:195,:205).itemandaux_itemscannot be honoured at all once parsing is skipped, so they should raise.
Settle VerticalAccessor._agg first: either pass the coordinates through a path that honours them, or stop passing them.
- Lingua principale
- Python
- Stelle
- 56
- Fork
- 9
- Merge medio
- 1h 24m
- PR unite (30g)
- 2
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- 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 DHI/modelskill
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
DHI/modelskill#628 ·
-
Vertical: z sign convention is guessed in plots and ignored in matchingForse già presa @otzi5300 l’ha presa 6 giorni fa. Apertabug
DHI/modelskill#715 · 1 assegnatario ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
DHI/modelskill#714 · 1 reazione ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 72/100
DHI/modelskill#712 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
DHI/modelskill#706 · 2 commenti ·
Tutte le issue di DHI/modelskill
Issue simili
-
Claiming namespace `apoint`Apertanamespace operations
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
EclipseFdn/open-vsx.org#13573 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
collective/icalendar#1854 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rancher/rancher-ai-agent#412 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TUDelftGeodesy/DePSI#134 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
HenriquesLab/rxiv-maker#335 ·