{"id":18295840,"url":"https://github.com/astropenguin/xarray-custom","last_synced_at":"2025-10-05T06:34:42.482Z","repository":{"id":62589777,"uuid":"261949849","full_name":"astropenguin/xarray-custom","owner":"astropenguin","description":":zap: Data classes for custom xarray creation","archived":false,"fork":false,"pushed_at":"2021-09-16T14:23:04.000Z","size":573,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T04:01:53.683Z","etag":null,"topics":["data-class","python","python-package","xarray"],"latest_commit_sha":null,"homepage":"https://astropenguin.github.io/xarray-custom","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astropenguin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-07T04:32:16.000Z","updated_at":"2021-12-16T22:16:26.000Z","dependencies_parsed_at":"2022-11-03T22:43:49.183Z","dependency_job_id":null,"html_url":"https://github.com/astropenguin/xarray-custom","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-custom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-custom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-custom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-custom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astropenguin","download_url":"https://codeload.github.com/astropenguin/xarray-custom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247338954,"owners_count":20923001,"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":["data-class","python","python-package","xarray"],"created_at":"2024-11-05T14:38:32.229Z","updated_at":"2025-10-05T06:34:42.380Z","avatar_url":"https://github.com/astropenguin.png","language":"Python","readme":"# xarray-custom\n\n[![PyPI](https://img.shields.io/pypi/v/xarray-custom.svg?label=PyPI\u0026style=flat-square)](https://pypi.org/pypi/xarray-custom/)\n[![Python](https://img.shields.io/pypi/pyversions/xarray-custom.svg?label=Python\u0026color=yellow\u0026style=flat-square)](https://pypi.org/pypi/xarray-custom/)\n[![Test](https://img.shields.io/github/workflow/status/astropenguin/xarray-custom/Test?logo=github\u0026label=Test\u0026style=flat-square)](https://github.com/astropenguin/xarray-custom/actions)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?label=License\u0026style=flat-square)](LICENSE)\n[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.3971531-blue?style=flat-square)](https://doi.org/10.5281/zenodo.3971531)\n\n:zap: Data classes for custom xarray creation\n\n## TL;DR\n\nxarray-custom is a third-party Python package which helps to create custom DataArray classes in the same manner as [the Python's native dataclass].\nHere is an introduction code of what the package provides:\n\n```python\nfrom xarray_custom import coord, dataarrayclass\n\n@dataarrayclass\nclass Image:\n    \"\"\"DataArray class to represent images.\"\"\"\n\n    dims = 'x', 'y'\n    dtype = float\n    accessor = 'img'\n\n    x: coord('x', int) = 0\n    y: coord('y', int) = 0\n\n    def normalize(self):\n        return self / self.max()\n```\n\nThe key features are:\n\n```python\n# create a custom DataArray\nimage = Image([[0, 1], [2, 3]], x=[0, 1], y=[0, 1])\n\n# use a custom method via an accessor\nnormalized = image.img.normalize()\n\n# create a custom DataArray filled with ones\nones = Image.ones((2, 2), x=[0, 1], y=[0, 1])\n```\n\n- Custom DataArray instances with fixed dimensions, datatype, and coordinates can easily be created.\n- NumPy-like special functions like ``ones()`` are provided as class methods.\n- Custom DataArray methods can be available via a custom accessor.\n\n## Requirements\n\n- **Python:** 3.6, 3.7, or 3.8 (tested by the author)\n- **Dependencies:** See [pyproject.toml](pyproject.toml)\n\n## Installation\n\n```shell\n$ pip install xarray-custom\n```\n\n## License\n\nCopyright (c) 2020 Akio Taniguchi\n\n- xarray-custom is distributed under the MIT License\n- xarray-custom uses an icon of [xarray] distributed under the Apache 2.0 license\n\n\u003c!-- References --\u003e\n[xarray]: https://github.com/pydata/xarray\n[the Python's native dataclass]: https://docs.python.org/3/library/dataclasses.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropenguin%2Fxarray-custom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastropenguin%2Fxarray-custom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropenguin%2Fxarray-custom/lists"}