{"id":13569435,"url":"https://github.com/xarray-contrib/pint-xarray","last_synced_at":"2025-05-16T11:07:04.358Z","repository":{"id":37950674,"uuid":"253759252","full_name":"xarray-contrib/pint-xarray","owner":"xarray-contrib","description":"Interface for using pint with xarray, providing convenience accessors","archived":false,"fork":false,"pushed_at":"2025-05-10T21:03:12.000Z","size":310,"stargazers_count":109,"open_issues_count":25,"forks_count":13,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-10T22:18:14.134Z","etag":null,"topics":["accessor","pint","xarray"],"latest_commit_sha":null,"homepage":"https://pint-xarray.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xarray-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-07T10:21:19.000Z","updated_at":"2025-05-10T21:03:14.000Z","dependencies_parsed_at":"2023-02-01T01:15:17.024Z","dependency_job_id":"c826d8b9-0530-459f-a1ea-6cf2432b43c3","html_url":"https://github.com/xarray-contrib/pint-xarray","commit_stats":{"total_commits":193,"total_committers":7,"mean_commits":"27.571428571428573","dds":"0.49740932642487046","last_synced_commit":"cb379bc2afafc0dda80f07b96cf0a0528872de40"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xarray-contrib%2Fpint-xarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xarray-contrib%2Fpint-xarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xarray-contrib%2Fpint-xarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xarray-contrib%2Fpint-xarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xarray-contrib","download_url":"https://codeload.github.com/xarray-contrib/pint-xarray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518382,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessor","pint","xarray"],"created_at":"2024-08-01T14:00:39.998Z","updated_at":"2025-05-16T11:06:59.346Z","avatar_url":"https://github.com/xarray-contrib.png","language":"Python","readme":"[![CI](https://github.com/xarray-contrib/pint-xarray/workflows/CI/badge.svg?branch=main)](https://github.com/xarray-contrib/pint-xarray/actions?query=branch%3Amain)\n[![code coverage](https://codecov.io/gh/xarray-contrib/pint-xarray/branch/main/graph/badge.svg)](https://codecov.io/gh/xarray-contrib/pint-xarray)\n[![docs](https://readthedocs.org/projects/pint-xarray/badge/?version=latest)](https://pint-xarray.readthedocs.io)\n[![PyPI version](https://img.shields.io/pypi/v/pint-xarray.svg)](https://pypi.org/project/pint-xarray)\n[![codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n[![conda-forge](https://img.shields.io/conda/vn/conda-forge/pint-xarray)](https://github.com/conda-forge/pint-xarray-feedstock)\n\n# pint-xarray\n\nA convenience wrapper for using [pint](https://pint.readthedocs.io) with\n[xarray](https://xarray.pydata.org).\n\n## Usage\n\nTo convert the variables of a `Dataset` to quantities:\n```python\nIn [1]: import pint_xarray\n   ...: import xarray as xr\n\nIn [2]: ds = xr.Dataset({\"a\": (\"x\", [0, 1, 2]), \"b\": (\"y\", [-3, 5, 1], {\"units\": \"m\"})})\n   ...: ds\nOut[2]:\n\u003cxarray.Dataset\u003e\nDimensions:  (x: 3, y: 3)\nDimensions without coordinates: x, y\nData variables:\n    a        (x) int64 0 1 2\n    b        (y) int64 -3 5 1\n\nIn [3]: q = ds.pint.quantify(a=\"s\")\n   ...: q\nOut[3]:\n\u003cxarray.Dataset\u003e\nDimensions:  (x: 3, y: 3)\nDimensions without coordinates: x, y\nData variables:\n    a        (x) int64 [s] 0 1 2\n    b        (y) int64 [m] -3 5 1\n```\nto convert to different units:\n```python\nIn [4]: c = q.pint.to({\"a\": \"ms\", \"b\": \"km\"})\n   ...: c\nOut[4]:\n\u003cxarray.Dataset\u003e\nDimensions:  (x: 3, y: 3)\nDimensions without coordinates: x, y\nData variables:\n    a        (x) float64 [ms] 0.0 1e+03 2e+03\n    b        (y) float64 [km] -0.003 0.005 0.001\n```\nto convert back to non-quantities:\n```python\nIn [5]: d = c.pint.dequantify()\n   ...: d\nOut[5]:\n\u003cxarray.Dataset\u003e\nDimensions:  (x: 3, y: 3)\nDimensions without coordinates: x, y\nData variables:\n    a        (x) float64 0.0 1e+03 2e+03\n    b        (y) float64 -0.003 0.005 0.001\n```\n\nFor more, see the [documentation](https://pint-xarray.readthedocs.io)\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxarray-contrib%2Fpint-xarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxarray-contrib%2Fpint-xarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxarray-contrib%2Fpint-xarray/lists"}