Configurably truncated representation when FieldList is very long
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece localizando as implementações de str e repr de FieldList e o ponto de entrada cf.configuration() mencionados na issue. Revise os testes existentes de representação e, em seguida, defina o limite de truncamento e o comportamento da configuração; considera-se concluído quando representações longas de FieldList são abreviadas, as mais curtas permanecem inalteradas e o limite pode ser configurado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 151
- Forks
- 23
- Merge médio
- 3d 9h
- PRs com merge (30d)
- 2
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NCAS-CMS/cf-python
-
documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
-
Convert to/from iris cubesTalvez já em andamento @davidhassell assumiu há 3 dias. Abertaenhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
Convert from/to `xarray`Talvez já em andamento @davidhassell assumiu há 3 dias. Abertaenhancement xarray
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
installation
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
-
Attempt at unsupported conservative 3D mesh regriddingTalvez livre de novo @sadielbartholomew assumiu há 74 dias e não há nenhum pull request aberto. Abertabug?
Todas as issues de NCAS-CMS/cf-python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
UKGovernmentBEIS/inspect_ai#6733 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
ProyectoRespira/respira-webapp#334 ·
Mantenedores costumam responder em até 1 dia
-
bug security-alert
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
spectrayan/carefold#391 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
Jakeschincariol/instagram-agent-skill#83 ·
Mantenedores costumam responder em até 10 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 64/100