<div align="center">
<strong>Craterpy:</strong><em> Impact crater data science in Python.</em>
</div>
<div align="center">
<!-- PYPI version -->
<a href="https://badge.fury.io/py/craterpy">
<img src="https://badge.fury.io/py/craterpy.svg"
alt="PYPI version" />
</a>
<!-- Code quality and testing (CI) -->
<a href="https://github.com/cjtu/craterpy/actions">
<img src="https://github.com/cjtu/craterpy/workflows/Code%20Quality%20Checks/badge.svg"
alt="Code Quality Checks" />
</a>
<!-- Test Coverage (codecov) -->
<a href="https://codecov.io/gh/cjtu/craterpy">
<img src="https://codecov.io/gh/cjtu/craterpy/branch/trunk/graph/badge.svg?token=9K567x0YUJ"
alt="Code Coverage" />
</a>
</div>
<div align="center">
<!-- Zenodo citation -->
<a href="https://zenodo.org/badge/latestdoi/88457986">
<img src="https://zenodo.org/badge/88457986.svg"
alt="Cite on Zenodo" />
</a>
<!-- ReadTheDocs -->
<a href="http://craterpy.readthedocs.io/en/latest/?badge=latest">
<img src="http://readthedocs.org/projects/craterpy/badge/?version=latest"
alt="Cite on Zenodo" />
</a>
<!-- Code Style -->
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg"
alt="Code Style: Black" />
</a>
</div>
# Overview
Craterpy simplifies the extraction and statistical analysis of impact crater regions of interest in planetary datasets. It can:
- work with tables of crater data in Python (pandas)
- quickly extract data associated with each crater in ellipses or annuli (rasterstats)
- eliminate some pain points of planetary GIS analysis (antimeridian wrapping, local equal-area projections, etc.)
Note: craterpy is not a detection algorithm (e.g., [PyCDA](https://github.com/AlliedToasters/PyCDA)), nor is it a crater count age dating tool (see [craterstats](https://github.com/ggmichael/craterstats)).
**Note:** *Craterpy is in beta. We appreciate bug reports and feature requests on the [issues board](https://github.com/cjtu/craterpy/issues).*
## Example
Craterpy in action:
```python
import pandas as pd
from craterpy import CraterDatabase
df = pd.DataFrame({'Name': ["Orientale", "Compernicus", "Tycho"],
'Lat': [-19.9, 9.62, -43.35],
'Lon': [-94.7, -20.08, -11.35],
'Rad': [250., 48., 42.]})
cdb = CraterDatabase(df, "Moon", units="km")
# Define annular ROIs for central peak, crater floor, and rim (sizes in crater radii)
cdb.add_annuli(0, 0.1, "peak")
cdb.add_annuli(0.3, 0.6, "floor")
cdb.add_annuli(1.0, 1.2, "rim")
stats = cdb.get_stats("dem.tif", regions=['floor', 'peak', 'rim'], stats=['mean', 'std'])
cdb.plot()
```

| **Name** | **Lat** | **Lon** | **Rad** | **mean_floor** | **std_floor** | **mean_peak** | **std_peak** | **mean_rim** | **std_rim** |
|---|---|---|---|---|---|---|---|---|---|
| Orientale | -19.90 | -94.70 | 250.0 | -2400.0 | 400.0 | -2800.0 | 100.0 | 400.0 | 1100.0 |
| Compernicus | 9.62 | -20.08 | 48.0 | -3400.0 | 200.0 | -3400.0 | 100.0 | -0.0 | 200.0 |
| Tycho | -43.35 | -11.35 | 42.0 | -3200.0 | 400.0 | -2100.0 | 500.0 | 900.0 | 400.0 |
Quickly compute stats on many more craters and many datasets in parallel.

See the full [craterpy documentation](https://readthedocs.org/projects/craterpy/) on Read the Docs.
## Installation
With pip:
```bash
pip install craterpy
```
From the repo with [poetry](https://python-poetry.org/docs/) (for latest version & to contribute). First fork and clone the repository, then:
```bash
# Install craterpy with poetry
$ cd craterpy
$ poetry install
# Check installation version
poetry version
# Activate the venv
$ poetry shell
$ which python
# Or open a Jupyter notebook
$ poetry run jupyter notebook
```
- **Note**: Craterpy is currently only tested on Ubuntu and OS X. If you would like to use craterpy on Windows, check out the Windows Subsystem for Linux ([WSL](https://docs.microsoft.com/en-us/windows/wsl/install)).
Trouble installing craterpy? Let us know on the [issues](https://github.com/cjtu/craterpy/issues) board.
## Documentation
Full API documentation is available at [readthedocs](https://readthedocs.org/projects/craterpy/).
## Contributing
There are two major ways you can help improve craterpy:
### Bug Reporting and Feature Requests
You can report bugs or request new features on the [issues](https://github.com/cjtu/craterpy/issues) board.
### Contributing Directly
Want to fix a bug / implement a feature / fix some documentation? We welcome pull requests from all new contributors! You (yes you!) can help us make craterpy as good as it can be! See [CONTRIBUTING.rst](https://github.com/cjtu/craterpy/blob/trunk/CONTRIBUTING.rst) for details on how to get started - first time GitHub contributors welcome - and encouraged!
## Citing craterpy
Craterpy is [MIT Licenced](https://github.com/cjtu/craterpy/blob/master/LICENSE.txt) and is free to use with attribution. Citation information can be found [here](https://zenodo.org/badge/latestdoi/88457986).
Raw data
{
"_id": null,
"home_page": "https://github.com/cjtu/craterpy",
"name": "craterpy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "python, crater, data analysis, planetary, moon",
"author": "Christian J. Tai Udovicic",
"author_email": "cj.taiudovicic@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/60/88/c933eb8ffdcc852f5763aed7142eab9405d8a8e5e0154d646171ed7ac79e/craterpy-0.6.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <strong>Craterpy:</strong><em> Impact crater data science in Python.</em>\n</div>\n\n<div align=\"center\">\n <!-- PYPI version -->\n <a href=\"https://badge.fury.io/py/craterpy\">\n <img src=\"https://badge.fury.io/py/craterpy.svg\"\n alt=\"PYPI version\" />\n </a>\n <!-- Code quality and testing (CI) -->\n <a href=\"https://github.com/cjtu/craterpy/actions\">\n <img src=\"https://github.com/cjtu/craterpy/workflows/Code%20Quality%20Checks/badge.svg\"\n alt=\"Code Quality Checks\" />\n </a>\n <!-- Test Coverage (codecov) -->\n <a href=\"https://codecov.io/gh/cjtu/craterpy\">\n <img src=\"https://codecov.io/gh/cjtu/craterpy/branch/trunk/graph/badge.svg?token=9K567x0YUJ\"\n alt=\"Code Coverage\" />\n </a>\n</div>\n<div align=\"center\">\n <!-- Zenodo citation -->\n <a href=\"https://zenodo.org/badge/latestdoi/88457986\">\n <img src=\"https://zenodo.org/badge/88457986.svg\"\n alt=\"Cite on Zenodo\" />\n </a>\n <!-- ReadTheDocs -->\n <a href=\"http://craterpy.readthedocs.io/en/latest/?badge=latest\">\n <img src=\"http://readthedocs.org/projects/craterpy/badge/?version=latest\"\n alt=\"Cite on Zenodo\" />\n </a>\n <!-- Code Style -->\n <a href=\"https://github.com/psf/black\">\n <img src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\n alt=\"Code Style: Black\" />\n </a>\n</div>\n\n# Overview\n\nCraterpy simplifies the extraction and statistical analysis of impact crater regions of interest in planetary datasets. It can:\n\n- work with tables of crater data in Python (pandas)\n- quickly extract data associated with each crater in ellipses or annuli (rasterstats)\n- eliminate some pain points of planetary GIS analysis (antimeridian wrapping, local equal-area projections, etc.)\n\nNote: craterpy is not a detection algorithm (e.g., [PyCDA](https://github.com/AlliedToasters/PyCDA)), nor is it a crater count age dating tool (see [craterstats](https://github.com/ggmichael/craterstats)).\n\n**Note:** *Craterpy is in beta. We appreciate bug reports and feature requests on the [issues board](https://github.com/cjtu/craterpy/issues).*\n\n## Example\n\nCraterpy in action:\n\n```python\nimport pandas as pd\nfrom craterpy import CraterDatabase\ndf = pd.DataFrame({'Name': [\"Orientale\", \"Compernicus\", \"Tycho\"],\n 'Lat': [-19.9, 9.62, -43.35],\n 'Lon': [-94.7, -20.08, -11.35],\n 'Rad': [250., 48., 42.]})\ncdb = CraterDatabase(df, \"Moon\", units=\"km\")\n# Define annular ROIs for central peak, crater floor, and rim (sizes in crater radii)\ncdb.add_annuli(0, 0.1, \"peak\")\ncdb.add_annuli(0.3, 0.6, \"floor\")\ncdb.add_annuli(1.0, 1.2, \"rim\")\nstats = cdb.get_stats(\"dem.tif\", regions=['floor', 'peak', 'rim'], stats=['mean', 'std'])\ncdb.plot()\n```\n\n\n\n\n| **Name** | **Lat** | **Lon** | **Rad** | **mean_floor** | **std_floor** | **mean_peak** | **std_peak** | **mean_rim** | **std_rim** |\n|---|---|---|---|---|---|---|---|---|---|\n| Orientale | -19.90 | -94.70 | 250.0 | -2400.0 | 400.0 | -2800.0 | 100.0 | 400.0 | 1100.0 |\n| Compernicus | 9.62 | -20.08 | 48.0 | -3400.0 | 200.0 | -3400.0 | 100.0 | -0.0 | 200.0 |\n| Tycho | -43.35 | -11.35 | 42.0 | -3200.0 | 400.0 | -2100.0 | 500.0 | 900.0 | 400.0 |\n\nQuickly compute stats on many more craters and many datasets in parallel.\n\n\n\nSee the full [craterpy documentation](https://readthedocs.org/projects/craterpy/) on Read the Docs.\n\n\n## Installation\n\nWith pip:\n\n```bash\npip install craterpy\n```\n\nFrom the repo with [poetry](https://python-poetry.org/docs/) (for latest version & to contribute). First fork and clone the repository, then:\n\n```bash\n# Install craterpy with poetry\n$ cd craterpy\n$ poetry install\n\n# Check installation version\npoetry version\n\n# Activate the venv \n$ poetry shell\n$ which python\n\n# Or open a Jupyter notebook\n$ poetry run jupyter notebook\n```\n- **Note**: Craterpy is currently only tested on Ubuntu and OS X. If you would like to use craterpy on Windows, check out the Windows Subsystem for Linux ([WSL](https://docs.microsoft.com/en-us/windows/wsl/install)). \n\nTrouble installing craterpy? Let us know on the [issues](https://github.com/cjtu/craterpy/issues) board.\n\n\n## Documentation\n\nFull API documentation is available at [readthedocs](https://readthedocs.org/projects/craterpy/).\n\n## Contributing\n\nThere are two major ways you can help improve craterpy:\n\n### Bug Reporting and Feature Requests\n\nYou can report bugs or request new features on the [issues](https://github.com/cjtu/craterpy/issues) board.\n\n### Contributing Directly\n\nWant to fix a bug / implement a feature / fix some documentation? We welcome pull requests from all new contributors! You (yes you!) can help us make craterpy as good as it can be! See [CONTRIBUTING.rst](https://github.com/cjtu/craterpy/blob/trunk/CONTRIBUTING.rst) for details on how to get started - first time GitHub contributors welcome - and encouraged!\n\n## Citing craterpy\n\nCraterpy is [MIT Licenced](https://github.com/cjtu/craterpy/blob/master/LICENSE.txt) and is free to use with attribution. Citation information can be found [here](https://zenodo.org/badge/latestdoi/88457986).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Impact crater data science in Python.",
"version": "0.6.0",
"project_urls": {
"Bug Tracker": "https://github.com/cjtu/craterpy/issues",
"Documentation": "https://readthedocs.org/projects/craterpy/",
"Homepage": "https://github.com/cjtu/craterpy",
"Repository": "https://github.com/cjtu/craterpy"
},
"split_keywords": [
"python",
" crater",
" data analysis",
" planetary",
" moon"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a09e2018fe780920a9e77438ca546178d86cf3284aeddfd8c287693e03bf364d",
"md5": "89ae935ca2c541180aaadac3e4d83f72",
"sha256": "105c92184edd2ee7bfd551b758e2392abaf2ae3201df724caf93d3f3380bf9fa"
},
"downloads": -1,
"filename": "craterpy-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "89ae935ca2c541180aaadac3e4d83f72",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 2928315,
"upload_time": "2025-02-24T10:10:38",
"upload_time_iso_8601": "2025-02-24T10:10:38.661800Z",
"url": "https://files.pythonhosted.org/packages/a0/9e/2018fe780920a9e77438ca546178d86cf3284aeddfd8c287693e03bf364d/craterpy-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6088c933eb8ffdcc852f5763aed7142eab9405d8a8e5e0154d646171ed7ac79e",
"md5": "99e061f997d0f2069d8e9aabbd7ccf59",
"sha256": "3612de0dba6c500b2aea1809046b9328d2e924fde6d616bcee4f717d7ef7f54a"
},
"downloads": -1,
"filename": "craterpy-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "99e061f997d0f2069d8e9aabbd7ccf59",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 2923661,
"upload_time": "2025-02-24T10:10:43",
"upload_time_iso_8601": "2025-02-24T10:10:43.993126Z",
"url": "https://files.pythonhosted.org/packages/60/88/c933eb8ffdcc852f5763aed7142eab9405d8a8e5e0154d646171ed7ac79e/craterpy-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-24 10:10:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cjtu",
"github_project": "craterpy",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "craterpy"
}