Provide numbered view of a `FieldList`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Inizia individuando l’implementazione di FieldList e il comportamento esistente di repr e str, quindi esamina l’issue #772 per verificare le modifiche correlate alla rappresentazione. Conferma l’output attuale prima di progettare la vista numerata. Il lavoro è completato quando la stampa di un FieldList mostra ogni campo con un prefisso numerico chiaro, mentre repr rimane come descritto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A user has requested that we provide a representation of a FieldList that includes numbering of the fields. I can see that this would be really useful, because when you want to pick a specific one out you might well (especially if unaware of our filtering or reduction methods), in the absence of such numbers, count up from the first and/or back from the last to get the give field you want to pick out and particularly when it contains a lot of fields this can involve a lot of counting and possibly inaccuracy.
For instance, imagine you want the field <CF Field: long_name=O3 MASS MIXING RATIO AFTER TIMESTEP(ncdim%obs(13150)) 1> from this:
>>> f
[<CF Field: air_pressure(ncdim%obs(155419)) hPa>,
<CF Field: air_pressure(ncdim%obs(155419)) hPa>,
<CF Field: air_pressure(ncdim%obs(155419)) hPa>,
<CF Field: altitude(ncdim%obs(155419)) m>,
<CF Field: altitude(ncdim%obs(155419)) m>,
<CF Field: altitude(ncdim%obs(155419)) m>,
<CF Field: latitude(ncdim%obs(155419)) degree_north>,
<CF Field: latitude(ncdim%obs(13150)) degrees north>,
<CF Field: latitude(ncdim%obs(155419)) degree_north>,
<CF Field: latitude(ncdim%obs(155419)) degree_north>,
<CF Field: longitude(ncdim%obs(155419)) degree_east>,
<CF Field: longitude(ncdim%obs(13150)) unknown>,
<CF Field: longitude(ncdim%obs(155419)) degree_east>,
<CF Field: longitude(ncdim%obs(155419)) degree_east>,
<CF Field: long_name=O3 MASS MIXING RATIO AFTER TIMESTEP(ncdim%obs(13150)) 1>,
<CF Field: long_name=O3 MASS MIXING RATIO AFTER TIMESTEP(ncdim%obs(155419)) 1>,
<CF Field: long_name=O3 MASS MIXING RATIO ON PRESS LEVS(ncdim%obs(155419)) 1>,
<CF Field: long_name=CO MASS MIX RATIO ON PRESS LEVS(ncdim%obs(155419)) 1>,
<CF Field: region(ncdim%obs(155419)) 1>,
<CF Field: region(ncdim%obs(13150)) unknown>,
<CF Field: region(ncdim%obs(155419)) 1>,
<CF Field: region(ncdim%obs(155419)) 1>,
<CF Field: time(ncdim%obs(155419)) days since 1900-01-01 standard>,
<CF Field: time(ncdim%obs(13150)) days since 1900-01-01 standard>,
<CF Field: time(ncdim%obs(155419)) days since 1900-01-01 standard>,
<CF Field: time(ncdim%obs(155419)) days since 1900-01-01 standard>]
I suggest we have the repr as above and have the str representation which includes the numbered view like this or similar:
>>> print(f)
0| [<CF Field: air_pressure(ncdim%obs(155419)) hPa>,
1| <CF Field: air_pressure(ncdim%obs(155419)) hPa>,
2| <CF Field: air_pressure(ncdim%obs(155419)) hPa>,
3| <CF Field: altitude(ncdim%obs(155419)) m>,
...
(Suggesting a line-numbering type view format for the numbering to make it clear it is not a dictionary with index keys.).
Or we can include a keyword to str() that can be passed to print(), but I doubt that would get much use unless really well-advertised.
Probably easiest to implement along with #772, which also suggests improvement upon the representation of a FieldList.
- Lingua principale
- Python
- Stelle
- 150
- Fork
- 23
- Merge medio
- 1g 11h
- PR unite (30g)
- 2
Guida per i contributori
Apri 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 NCAS-CMS/cf-python
-
code tidy
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug?
-
release
-
enhancement
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Tutte le issue di NCAS-CMS/cf-python
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100