Metadata-Version: 2.4
Name: metablate
Version: 0.7.0
Summary: A collection of meteor ablation models
Author-email: Daniel Kastinen <daniel.kastinen@irf.se>, Johan Kero <kero@irf.se>
Maintainer-email: Daniel Kastinen <daniel.kastinen@irf.se>
License-Expression: GPL-3.0-or-later
Project-URL: Documentation, https://danielk.developer.irf.se/ablate/
Project-URL: Repository, https://github.com/danielk333/ablate
Project-URL: Homepage, https://github.com/danielk333/ablate
Project-URL: Issues, https://github.com/danielk333/ablate/issues
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Operating System :: Unix
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tqdm
Requires-Dist: scipy
Requires-Dist: numpy>2
Requires-Dist: numba>=0.60
Requires-Dist: matplotlib
Requires-Dist: pymsis>=0.11
Requires-Dist: xarray
Requires-Dist: spacecoords>0.2
Provides-Extra: develop
Requires-Dist: pytest; extra == "develop"
Requires-Dist: mypy; extra == "develop"
Requires-Dist: flake8; extra == "develop"
Requires-Dist: wheel; extra == "develop"
Requires-Dist: build; extra == "develop"
Requires-Dist: twine; extra == "develop"
Requires-Dist: pytest-cov; extra == "develop"
Requires-Dist: matplotlib; extra == "develop"
Requires-Dist: ipykernel; extra == "develop"
Requires-Dist: radon; extra == "develop"
Requires-Dist: numpydoc; extra == "develop"
Requires-Dist: pre-commit; extra == "develop"
Requires-Dist: black; extra == "develop"
Requires-Dist: auditwheel; extra == "develop"
Requires-Dist: patchelf; extra == "develop"
Requires-Dist: mkdocs-material; extra == "develop"
Requires-Dist: mkdocstrings[python]; extra == "develop"
Requires-Dist: mkdocs-jupyter; extra == "develop"
Requires-Dist: mkdocs-gen-files; extra == "develop"
Requires-Dist: mkdocs-literate-nav; extra == "develop"
Requires-Dist: mkdocs-section-index; extra == "develop"
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"
Requires-Dist: mypy; extra == "tests"
Provides-Extra: visualization
Requires-Dist: pyvista; extra == "visualization"
Dynamic: license-file

# Meteoroid Ablation Models

`metablate` provides meteoroid ablation and atmospheric-entry models, MSIS
atmospheres, material presets, and plasma-density calculations.

## Install

Install the latest published release:

```bash
pip install metablate
```

The bleeding-edge version is available with:

```bash
pip install git+https://github.com/danielk333/ablate.git
```

or trough cloning this repo.

## Minimal ablation example

Run the Kero–Szasz (2008) model with a cometary meteoroid and the default
`AtmPymsis` atmosphere:

```python
import numpy as np
from spacecoords import frames

import metablate.material as mat
import metablate.models.kero_szasz_2008 as ks

lat, lon = 67.0, 20.0
position = frames.geodetic_wgs84_to_ecef(lat, lon, 100e3, degrees=True)
direction = frames.azel_to_ecef(lat, lon, az=10, el=-45, degrees=True)

model = ks.KeroSzasz2008(
    options=ks.KeroSzaszOptions(
        material=mat.cometary,
        atmosphere_kwargs=dict(as_dataset=False),
    ),
)
result = model.run(
    parameters=ks.KeroSzaszInitialState(
        epoch=np.datetime64("2018-06-28T12:45:33"),
        position_ecef=position,
        velocity_ecef=direction * 60e3,
        mass=1e-6,
    ),
)
print(f"Runtime: {result.runtime:.3f} s")
```

Positions and velocities use ECEF coordinates in metres and metres per second;
mass is in kilograms. Results include time, mass, velocity, temperature and position.

## Atmospheres and computation

`AtmPymsis` calls the Fortran extensions supplied by `pymsis`, with MSIS 2.1 by
default. ODE models use `atmosphere.total_density(...)`, which returns a NumPy
array of total mass density in kg/m^3. `density(...)` also provides species data
and temperature; e.g. sputtering calculation uses this full output.
Historical solar and geomagnetic indices are downloaded when needed and cached
within their three-hour interval. Custom atmospheres can override `total_density`
for speed; its default implementation extracts `"Total"` from `density`.

`AtmMSISE00` is optional and requires the separate `msise00` package and a Fortran
compiler; see its [installation instructions](https://github.com/space-physics/msise00#install).

Some functions use Numba to speed up subsequent calls. The first call
compiles the kernels, which are cached for subsequent runs. Set `NUMBA_DISABLE_JIT=1`
to run the same formulas in Python for debugging.

## Examples

See [docs/examples](docs/examples) for e.g. ablation, fireball, alpha–beta and plasma examples.
For example, after a repository checkout, generate an ablation sweep with:

```bash
python docs/examples/ablation_sweep.py --output ablation_sweep.png
```

Which produces this plot:

![Kero-Szasz ablation sweep](docs/assets/kero_figure1_example.png)

## Development

From a repository checkout:

```bash
pip install -e .[tests]
# or pip install -e .[develop] for all dev packages
pytest
```
