Configurably truncated representation when FieldList is very long
まだ誰も着手していません。
評価
調査の方向性
まず、issue で言及されている FieldList の str および repr 実装と、cf.configuration() のエントリーポイントを探します。次に既存の表現テストを確認し、その後、切り詰めのしきい値と設定の動作を定義します。長い FieldList の表現が省略され、短いものは変更されず、しきい値を設定できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 151
- フォーク
- 23
- 平均マージ
- 3日 9時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NCAS-CMS/cf-python のほかの issue
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
Convert to/from iris cubes対応中かも @davidhassell が 3 日前に担当しました。 オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
Convert from/to `xarray`対応中かも @davidhassell が 3 日前に担当しました。 オープンenhancement xarray
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
installation
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
Attempt at unsupported conservative 3D mesh regridding再び着手できるかも @sadielbartholomew が 74 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug?
NCAS-CMS/cf-python の issue をすべて見る
似ている issue
-
eegprep-lean: set channel types from the Zarr group's channel_type対応中かも @claude が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
blacklanternsecurity/bbot#3679 ·
メンテナーはふだん 2 日以内に返信
-
Link Checker ReportオープンBot Type: Bug Type: Documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
speakeasy-api/speakeasy#2159 ·
メンテナーはふだん 1 日以内に返信