Impact crater data science in Python.
Project description
Overview
Craterpy simplifies the extraction and statistical analysis of impact craters in planetary datasets. It can:
- work with tables of crater data in Python (using pandas)
- load and manipulate planetary image data in Python (using rasterio)
- extract, mask, filter, and compute stats on craters located in planetary imagery
- plot crater regions of interest
Craterpy currently only supports simple cylindrical images and requires you to provide a table of crater locations and sizes (e.g. it isn't a crater detection program). See the example below!
Note: Craterpy is in alpha. We appreciate bug reports and feature requests on the issues board.
Example
Craterpy in action:
import pandas as pd
from craterpy import dataset, stats
df = pd.DataFrame({'Name': ["Orientale", "Langrenus", "Compton"],
'Lat': [-19.9, -8.86, 55.9],
'Lon': [-94.7, 61.0, 104.0],
'Rad': [147.0, 66.0, 82.3]})
moon = dataset.CraterpyDataset("moon.tif")
stat_df = cs.ejecta_stats(df, moon, 4, ['mean', 'median', 'std'], plot=True)
stats_df.head()
New users should start with the Jupyter notebook tutorial for typical usage with examples. See also craterpy documentation on Read the Docs.
Note: This package currently only accepts image data in simple-cylindrical (Plate Caree) projection. If your data is in another projection, please reproject it to simple-cylindrical before importing it with craterpy. If you would like add reprojection functionality to craterpy, consider Contributing.
Installation
With pip:
pip install craterpy
python -c "import craterpy; print(craterpy.__version__)"
In a new conda environment:
# Create and activate a new conda environment called "craterpy"
conda create -n craterpy python=3.9
conda activate craterpy
# Install craterpy with pip
pip install craterpy
python -c "import craterpy; print(craterpy.__version__)"
With git and poetry (for latest version & development):
# Clone this repository
$ cd ~
$ git clone https://github.com/cjtu/craterpy.git
# Enter the repository
$ cd craterpy
# Configure poetry
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
# Install craterpy with poetry
$ poetry install
# Check installation
poetry version
# Either open a Jupyter server
$ poetry run jupyter notebook
# Or activate the venv from your Python editor of choice
# The venv is path is ~/craterpy/.venv/bin/python
On Windows (see rasterio installation for Windows):
- Note: Craterpy is tested on Ubuntu and OS X. If you would like to use craterpy on Windows, we recommend getting the Windows Subsystem for Linux (WSL) and installing into a Linux distribution. However, the following may also work for a native Windows installation and depends on a working installation of rasterio from pre-compiled binaries (see link above).
# Windows requires gdal binaries specific to the OS (32/64-bit) and python version
# First download the rasterio and GDAL binaries for your system (link above)
# If rasterio imports with no error then craterpy should be pip installable
pip install GDAL-X.Y.Z-...-win.whl
pip install rasterio-X.Y.Z-...-win.whl
python -c "import rasterio"
pip install craterpy
python -c "import craterpy; print(craterpy.__version__)"
Trouble installing craterpy? Let us know on the issues board.
Dependencies
Craterpy requires python >3.7.7 and is tested on Ubuntu and OS X. It's core dependencies are:
- rasterio
- pandas
- numpy
- matplotlib
Documentation
Full API documentation is available at readthedocs.
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 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 for details on how to get started - first time GitHub contributors welcome - and encouraged!
Citing craterpy
Craterpy is MIT Licenced and is free to use with attribution. Citation information can be found here.
Contact
If you have comments/question/concerns or just want to get in touch, you can email Christian at cj.taiudovicic@gmail.com or follow @TaiUdovicic on Twitter.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file craterpy-0.5.2.tar.gz
.
File metadata
- Download URL: craterpy-0.5.2.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.7.13 Linux/5.15.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cfb655754f83ef3c8116f8aeacc39c24a4d8fc8d9bf3645bddcc6888ee4f6e2 |
|
MD5 | 53cc6b391498ad87ae1d84f9a02ca75a |
|
BLAKE2b-256 | 48cde5430bf0f55c78f81d6798e5c1c85cfb26eb2b2138fe4ff5968ce5e759d8 |
File details
Details for the file craterpy-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: craterpy-0.5.2-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.7.13 Linux/5.15.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27155d859f4646373b44c194463c6f6ad26399896c1d3b981e3ec5feac8e0f4f |
|
MD5 | 4f9bad94ca02545e93a1a55e32f09c4c |
|
BLAKE2b-256 | 485bb84c94058ee3b52a88b9c55266c53ac9b072da0009cc0aa9d99e8678f08d |