API?
还没有人认领这个 Issue。
评估
调研方向
Start by reviewing the proposed accessor API in pint/#849 and the checked and unchecked DataArray and Dataset methods listed here. Determine which API items remain desired and whether the accessor should eventually be renamed from pint to units; done requires an agreed scope rather than a single isolated edit.
由索引模型根据 Issue 内容生成。
描述
@jthielen proposed a rough accessor API in pint/#849, to which I've added a couple of things:
DataArray:
-
da.pint.to(...): return dataarray with converted units (#11) -
da.pint.to_base_units(): return dataarray with base units -
da.pint.units: units of quantity (as a Unit) -
da.pint.magnitude: magnitude of quantity -
da.pint.quantify(unit_registry=None, unit=None): create DataArray wrapping a Quantity based on string unit attribute of DataArray or specified unit -
da.pint.dequantify(): replace data with the Quantity's magnitude, and add back string unit attribute from Quantity's unit -
da.pint.sel(): wrap da.sel to handle indexing with Quantities (by casting to magnitude in the coordinate's units similar to how MetPy does it, since true unit-aware indexing is not available yet in xarray) -
da.pint.loc: wrap da.loc likewise -
da.pint.to_system(system): convert all variables to be expressed in the (base?) units of a different system. Might require upstream additions to pint.
Dataset:
-
ds.pint.to(...): return Dataset with converted units (#11) -
ds.pint.to_base_units(): return dataset with base units -
ds.pint.quantify(unit_registry=None): convert all data variables to quantities -
ds.pint.dequantify(): convert all data variables from quantities to magnitudes with units as an attribute -
ds.pint.sel(): wrap ds.sel to handle indexing with Quantities -
ds.pint.loc: wrap ds.loc likewise -
ds.pint.to_system(system): convert all variables to be expressed in the (base?) units of a different system.
(this may be modified as things change on xarray's and pint's end, especially involving Dask arrays (xref #883))
Anything else?
At some point when the integration is more solidified (but before official release) we should change the accessor from pint to units, to get a interface more like what's described here.
This would be:
a) More intuitive
b) Units-library agnostic
c) A good fit for potentially using an entrypoint to choose which units library you want to use. There's already an entrypoint for plotting backends in xarray, and plans to add one for storage backends too.
- 主要语言
- Python
- 星标
- 120
- 派生
- 17
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xarray-contrib/pint-xarray 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 56/100
xarray-contrib/pint-xarray#400 ·
-
难度 3/5 1-2 天 新手友好度 48/100
xarray-contrib/pint-xarray#362 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
xarray-contrib/pint-xarray#361 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
xarray-contrib/pint-xarray#303 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
xarray-contrib/pint-xarray#271 · 7 条评论 ·
查看 xarray-contrib/pint-xarray 的全部 Issue
相似的 Issue
-
kind/bug priority/medium qa_automation
难度 2/5 1-3 小时 新手友好度 78/100
yugabyte/yugabyte-db#37324 ·
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 87/100
btclib-org/btclib-node#2260 ·
维护者通常 1 天内回复
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)可能已有人在做 @geyazheng 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
langchain-ai/langchain-aws#1469 ·
维护者通常 1 天内回复
-
GCToggler leaves collection enabled if the body re-enables it可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 7 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复