Configurably truncated representation when FieldList is very long
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par localiser les implémentations de str et repr de FieldList ainsi que le point d’entrée cf.configuration() mentionnés dans l’issue. Examinez ensuite les tests de représentation existants, puis définissez le seuil de troncature et le comportement de configuration ; le travail est terminé lorsque les représentations longues de FieldList sont abrégées, que les plus courtes restent inchangées et que le seuil peut être configuré.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
In str and repr calls on a FieldList, we print a one-line view of all fields present in the list, which is generally useful and sensible, however when the FieldList is suitably long this can seem like far too much information that it becomes spammy and it becomes hard to access previous terminal or interactive Python calls and output. For example, working with WRF data I get >10,000 field representations spat out as a listing.
A nice feature would be to truncate this listing with an ellipsis (or otherwise, but that seems standard and sensible e.g. as used to truncate numpy arrays), when the list is over N items long for some sensible N:
[<CF Field: ncvar%ACGRDFLX(ncdim%Time(1), ncdim%south_north(179), ncdim%west_east(139)) J m-2>,
<CF Field: ncvar%ACGRDFLX(ncdim%Time(1), ncdim%south_north(179), ncdim%west_east(139)) J m-2>,
<CF Field: ncvar%ACGRDFLX(ncdim%Time(1), ncdim%south_north(179), ncdim%west_east(139)) J m-2>,
...
<CF Field: ncvar%ZS(ncdim%Time(1), ncdim%soil_layers_stag(4)) m>,
<CF Field: ncvar%ZS(ncdim%Time(1), ncdim%soil_layers_stag(4)) m>,
<CF Field: ncvar%ZS(ncdim%Time(1), ncdim%soil_layers_stag(4)) m>]
and perhaps to and also add a note of the full length to the start of the reporesentation to indicate how many fields have been subsumed into the ellipsis, e.g. to include a first line to the above such as this, or similar, where N is the length:
CF FieldList (N):
[ ... ]
Configurability
NumPy and others support configurability on the truncation threshold (point at which the representation gets summarised and not shown fully) via methods such as numpy.set_printoptions with a threshold argument, so ideally we can also allow the user to configure this for our FieldList (and maybe otherwise, with other truncation on aspects such as data array views?). I suggest adding another setting under cf.configuration() called print_threshold or similar, taking an integer as per the numpy threshold parameter.
- Langage dominant
- Python
- Étoiles
- 150
- Forks
- 23
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 2
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NCAS-CMS/cf-python
-
code tidy
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
bug?
-
release
-
enhancement
-
error from netCDF in cf.write Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
Toutes les issues de NCAS-CMS/cf-python
Issues similaires
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
bancolombia/sentinel#23 ·
-
test md OuverteCI
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100