metablate 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {metablate-0.1.0 → metablate-0.3.0}/PKG-INFO +77 -21
- metablate-0.3.0/README.md +92 -0
- {metablate-0.1.0 → metablate-0.3.0}/pyproject.toml +28 -3
- metablate-0.3.0/src/metablate/__init__.py +27 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/atmosphere/atm_msise00.py +8 -6
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/atmosphere/atm_pymsis.py +41 -34
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/atmosphere/atmosphere.py +8 -7
- metablate-0.3.0/src/metablate/material.py +110 -0
- metablate-0.3.0/src/metablate/models/__init__.py +6 -0
- metablate-0.3.0/src/metablate/models/alpha_beta_2026.py +323 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/models/dimant_oppenheim_2017.py +154 -79
- metablate-0.3.0/src/metablate/models/kero_szasz_2008.py +372 -0
- metablate-0.3.0/src/metablate/models/model.py +16 -0
- metablate-0.3.0/src/metablate/models/simple_ablation_2026.py +384 -0
- metablate-0.3.0/src/metablate/models/simple_motion.py +209 -0
- metablate-0.3.0/src/metablate/models/stulov_mirskii_vislyi_1995.py +228 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/__init__.py +4 -1
- metablate-0.3.0/src/metablate/physics/aerodynamics.py +63 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/alpha_beta.py +78 -95
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/ballistic.py +2 -0
- metablate-0.3.0/src/metablate/physics/plasma_production.py +109 -0
- metablate-0.3.0/src/metablate/physics/spheres.py +11 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/sputtering.py +5 -6
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/thermal_ablation.py +226 -157
- metablate-0.3.0/src/metablate/types.py +70 -0
- metablate-0.3.0/src/metablate/version.py +6 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate.egg-info/PKG-INFO +77 -21
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate.egg-info/SOURCES.txt +18 -4
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate.egg-info/requires.txt +7 -2
- metablate-0.3.0/tests/test_aerodynamics.py +19 -0
- metablate-0.3.0/tests/test_alpha_beta.py +85 -0
- metablate-0.3.0/tests/test_atmosphere.py +72 -0
- metablate-0.3.0/tests/test_dimant_oppenheim.py +83 -0
- metablate-0.3.0/tests/test_dimant_oppenheim_paper.py +61 -0
- metablate-0.3.0/tests/test_dimant_oppenheim_points.py +31 -0
- metablate-0.3.0/tests/test_material.py +17 -0
- metablate-0.3.0/tests/test_models.py +90 -0
- metablate-0.3.0/tests/test_sputtering.py +27 -0
- metablate-0.3.0/tests/test_thermal_ablation.py +34 -0
- metablate-0.1.0/README.md +0 -40
- metablate-0.1.0/src/metablate/__init__.py +0 -16
- metablate-0.1.0/src/metablate/ablation_model.py +0 -40
- metablate-0.1.0/src/metablate/coordinates.py +0 -149
- metablate-0.1.0/src/metablate/material.py +0 -155
- metablate-0.1.0/src/metablate/models/__init__.py +0 -5
- metablate-0.1.0/src/metablate/models/kero_szasz_2008.py +0 -348
- metablate-0.1.0/src/metablate/ode.py +0 -82
- metablate-0.1.0/src/metablate/version.py +0 -3
- metablate-0.1.0/tests/test_atmosphere.py +0 -23
- metablate-0.1.0/tests/test_ode_solver.py +0 -27
- {metablate-0.1.0 → metablate-0.3.0}/LICENSE +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/setup.cfg +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/atmosphere/__init__.py +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/physics/luminosity.py +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate/py.typed +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate.egg-info/dependency_links.txt +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/src/metablate.egg-info/top_level.txt +0 -0
- {metablate-0.1.0 → metablate-0.3.0}/tests/test_import.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: metablate
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A collection of meteor ablation models
|
|
5
5
|
Author-email: Daniel Kastinen <daniel.kastinen@irf.se>, Johan Kero <kero@irf.se>
|
|
6
6
|
Maintainer-email: Daniel Kastinen <daniel.kastinen@irf.se>
|
|
@@ -694,10 +694,12 @@ Description-Content-Type: text/markdown
|
|
|
694
694
|
License-File: LICENSE
|
|
695
695
|
Requires-Dist: tqdm
|
|
696
696
|
Requires-Dist: scipy
|
|
697
|
-
Requires-Dist: numpy
|
|
697
|
+
Requires-Dist: numpy>2
|
|
698
|
+
Requires-Dist: numba>=0.60
|
|
698
699
|
Requires-Dist: matplotlib
|
|
699
|
-
Requires-Dist: xarray
|
|
700
700
|
Requires-Dist: pymsis
|
|
701
|
+
Requires-Dist: xarray
|
|
702
|
+
Requires-Dist: spacecoords>0.2
|
|
701
703
|
Provides-Extra: develop
|
|
702
704
|
Requires-Dist: pytest; extra == "develop"
|
|
703
705
|
Requires-Dist: flake8; extra == "develop"
|
|
@@ -722,45 +724,99 @@ Requires-Dist: mkdocs-section-index; extra == "develop"
|
|
|
722
724
|
Provides-Extra: tests
|
|
723
725
|
Requires-Dist: pytest; extra == "tests"
|
|
724
726
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
727
|
+
Provides-Extra: visualization
|
|
728
|
+
Requires-Dist: pyvista; extra == "visualization"
|
|
725
729
|
Dynamic: license-file
|
|
726
730
|
|
|
727
731
|
# Meteoroid Ablation Models
|
|
728
732
|
|
|
733
|
+
`metablate` provides meteoroid ablation and atmospheric-entry models, MSIS
|
|
734
|
+
atmospheres, material presets, and plasma-density calculations.
|
|
735
|
+
|
|
729
736
|
## Install
|
|
730
737
|
|
|
738
|
+
Install the latest published release:
|
|
739
|
+
|
|
731
740
|
```bash
|
|
732
|
-
|
|
741
|
+
pip install metablate
|
|
733
742
|
```
|
|
734
743
|
|
|
735
|
-
|
|
744
|
+
The bleeding-edge version is available with:
|
|
736
745
|
|
|
737
|
-
|
|
746
|
+
```bash
|
|
747
|
+
pip install git+https://github.com/danielk333/ablate.git
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
or trough cloning this repo.
|
|
738
751
|
|
|
739
|
-
|
|
752
|
+
## Minimal ablation example
|
|
740
753
|
|
|
741
|
-
|
|
754
|
+
Run the Kero–Szasz (2008) model with a cometary meteoroid and the default
|
|
755
|
+
`AtmPymsis` atmosphere:
|
|
742
756
|
|
|
743
|
-
|
|
757
|
+
```python
|
|
758
|
+
import numpy as np
|
|
759
|
+
from spacecoords import frames
|
|
744
760
|
|
|
745
|
-
|
|
761
|
+
import metablate.material as mat
|
|
762
|
+
import metablate.models.kero_szasz_2008 as ks
|
|
746
763
|
|
|
747
|
-
|
|
764
|
+
lat, lon = 67.0, 20.0
|
|
765
|
+
position = frames.geodetic_wgs84_to_ecef(lat, lon, 100e3, degrees=True)
|
|
766
|
+
direction = frames.azel_to_ecef(lat, lon, az=10, el=-45, degrees=True)
|
|
767
|
+
|
|
768
|
+
model = ks.KeroSzasz2008(
|
|
769
|
+
options=ks.KeroSzaszOptions(
|
|
770
|
+
material=mat.cometary,
|
|
771
|
+
atmosphere_kwargs=dict(as_dataset=False),
|
|
772
|
+
),
|
|
773
|
+
)
|
|
774
|
+
result = model.run(
|
|
775
|
+
parameters=ks.KeroSzaszInitialState(
|
|
776
|
+
epoch=np.datetime64("2018-06-28T12:45:33"),
|
|
777
|
+
position_ecef=position,
|
|
778
|
+
velocity_ecef=direction * 60e3,
|
|
779
|
+
mass=1e-6,
|
|
780
|
+
),
|
|
781
|
+
)
|
|
782
|
+
print(f"Runtime: {result.runtime:.3f} s")
|
|
783
|
+
```
|
|
748
784
|
|
|
749
|
-
|
|
785
|
+
Positions and velocities use ECEF coordinates in metres and metres per second;
|
|
786
|
+
mass is in kilograms. Results include time, mass, velocity, temperature and position.
|
|
750
787
|
|
|
788
|
+
## Atmospheres and computation
|
|
789
|
+
|
|
790
|
+
`AtmPymsis` uses `pymsis`, with MSIS 2.1 by default. Historical solar and geomagnetic
|
|
791
|
+
indices are downloaded and cached when not supplied. Setting `as_dataset=False`
|
|
792
|
+
in `atmosphere_kwargs` avoids constructing an xarray dataset at each solver step.
|
|
793
|
+
|
|
794
|
+
`AtmMSISE00` is optional and requires the separate `msise00` package and a Fortran
|
|
795
|
+
compiler; see its [installation instructions](https://github.com/space-physics/msise00#install).
|
|
796
|
+
|
|
797
|
+
Some functions use Numba to speed up subsequent calls. The first call
|
|
798
|
+
compiles the kernels, which are cached for subsequent runs. Set `NUMBA_DISABLE_JIT=1`
|
|
799
|
+
to run the same formulas in Python for debugging.
|
|
800
|
+
|
|
801
|
+
## Examples
|
|
802
|
+
|
|
803
|
+
See [docs/examples](docs/examples) for e.g. ablation, fireball, alpha–beta and plasma examples.
|
|
804
|
+
For example, after a repository checkout, generate an ablation sweep with:
|
|
751
805
|
|
|
752
806
|
```bash
|
|
753
|
-
|
|
754
|
-
cd /my/env/msise00_source
|
|
755
|
-
git clone https://github.com/scivision/msise00
|
|
756
|
-
cd msise00
|
|
757
|
-
pip install -e .
|
|
758
|
-
python -c "import msise00; msise00.base.build()"
|
|
807
|
+
python docs/examples/ablation_sweep.py --output ablation_sweep.png
|
|
759
808
|
```
|
|
760
809
|
|
|
761
|
-
|
|
810
|
+
Which produces this plot:
|
|
811
|
+
|
|
812
|
+

|
|
813
|
+
|
|
814
|
+
## Development
|
|
815
|
+
|
|
816
|
+
From a repository checkout:
|
|
762
817
|
|
|
763
818
|
```bash
|
|
764
|
-
pip install
|
|
765
|
-
|
|
819
|
+
pip install -e .[tests]
|
|
820
|
+
# or pip install -e .[develop] for all dev packages
|
|
821
|
+
pytest
|
|
766
822
|
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Meteoroid Ablation Models
|
|
2
|
+
|
|
3
|
+
`metablate` provides meteoroid ablation and atmospheric-entry models, MSIS
|
|
4
|
+
atmospheres, material presets, and plasma-density calculations.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
Install the latest published release:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install metablate
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The bleeding-edge version is available with:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install git+https://github.com/danielk333/ablate.git
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or trough cloning this repo.
|
|
21
|
+
|
|
22
|
+
## Minimal ablation example
|
|
23
|
+
|
|
24
|
+
Run the Kero–Szasz (2008) model with a cometary meteoroid and the default
|
|
25
|
+
`AtmPymsis` atmosphere:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import numpy as np
|
|
29
|
+
from spacecoords import frames
|
|
30
|
+
|
|
31
|
+
import metablate.material as mat
|
|
32
|
+
import metablate.models.kero_szasz_2008 as ks
|
|
33
|
+
|
|
34
|
+
lat, lon = 67.0, 20.0
|
|
35
|
+
position = frames.geodetic_wgs84_to_ecef(lat, lon, 100e3, degrees=True)
|
|
36
|
+
direction = frames.azel_to_ecef(lat, lon, az=10, el=-45, degrees=True)
|
|
37
|
+
|
|
38
|
+
model = ks.KeroSzasz2008(
|
|
39
|
+
options=ks.KeroSzaszOptions(
|
|
40
|
+
material=mat.cometary,
|
|
41
|
+
atmosphere_kwargs=dict(as_dataset=False),
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
result = model.run(
|
|
45
|
+
parameters=ks.KeroSzaszInitialState(
|
|
46
|
+
epoch=np.datetime64("2018-06-28T12:45:33"),
|
|
47
|
+
position_ecef=position,
|
|
48
|
+
velocity_ecef=direction * 60e3,
|
|
49
|
+
mass=1e-6,
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
print(f"Runtime: {result.runtime:.3f} s")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Positions and velocities use ECEF coordinates in metres and metres per second;
|
|
56
|
+
mass is in kilograms. Results include time, mass, velocity, temperature and position.
|
|
57
|
+
|
|
58
|
+
## Atmospheres and computation
|
|
59
|
+
|
|
60
|
+
`AtmPymsis` uses `pymsis`, with MSIS 2.1 by default. Historical solar and geomagnetic
|
|
61
|
+
indices are downloaded and cached when not supplied. Setting `as_dataset=False`
|
|
62
|
+
in `atmosphere_kwargs` avoids constructing an xarray dataset at each solver step.
|
|
63
|
+
|
|
64
|
+
`AtmMSISE00` is optional and requires the separate `msise00` package and a Fortran
|
|
65
|
+
compiler; see its [installation instructions](https://github.com/space-physics/msise00#install).
|
|
66
|
+
|
|
67
|
+
Some functions use Numba to speed up subsequent calls. The first call
|
|
68
|
+
compiles the kernels, which are cached for subsequent runs. Set `NUMBA_DISABLE_JIT=1`
|
|
69
|
+
to run the same formulas in Python for debugging.
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
See [docs/examples](docs/examples) for e.g. ablation, fireball, alpha–beta and plasma examples.
|
|
74
|
+
For example, after a repository checkout, generate an ablation sweep with:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python docs/examples/ablation_sweep.py --output ablation_sweep.png
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Which produces this plot:
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
From a repository checkout:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install -e .[tests]
|
|
90
|
+
# or pip install -e .[develop] for all dev packages
|
|
91
|
+
pytest
|
|
92
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "metablate"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "A collection of meteor ablation models"
|
|
9
9
|
readme = {file = "README.md", content-type = "text/markdown"}
|
|
10
10
|
authors = [
|
|
@@ -27,10 +27,12 @@ requires-python = ">=3.9"
|
|
|
27
27
|
dependencies = [
|
|
28
28
|
"tqdm",
|
|
29
29
|
"scipy",
|
|
30
|
-
"numpy",
|
|
30
|
+
"numpy>2",
|
|
31
|
+
"numba>=0.60",
|
|
31
32
|
"matplotlib",
|
|
32
|
-
"xarray",
|
|
33
33
|
"pymsis",
|
|
34
|
+
"xarray",
|
|
35
|
+
"spacecoords>0.2",
|
|
34
36
|
]
|
|
35
37
|
|
|
36
38
|
[tool.setuptools]
|
|
@@ -64,6 +66,7 @@ develop = [
|
|
|
64
66
|
"mkdocs-section-index",
|
|
65
67
|
]
|
|
66
68
|
tests = ["pytest", "pytest-cov"]
|
|
69
|
+
visualization = ["pyvista"]
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
[project.urls]
|
|
@@ -74,3 +77,25 @@ Issues = "https://github.com/danielk333/ablate/issues"
|
|
|
74
77
|
|
|
75
78
|
[tool.black]
|
|
76
79
|
line-length = 100
|
|
80
|
+
|
|
81
|
+
[tool.mypy]
|
|
82
|
+
disallow_untyped_defs = true
|
|
83
|
+
follow_untyped_imports = true
|
|
84
|
+
warn_unused_ignores = true
|
|
85
|
+
packages = ["metablate"]
|
|
86
|
+
|
|
87
|
+
[tool.ruff]
|
|
88
|
+
line-length = 110
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint.per-file-ignores]
|
|
91
|
+
"__init__.py" = ["F401"]
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
ignore = ["E203","D203","E251","E501","E226"]
|
|
95
|
+
|
|
96
|
+
[tool.pytest]
|
|
97
|
+
addopts = ["-v", "--cov=metablate"]
|
|
98
|
+
testpaths = ["tests"]
|
|
99
|
+
markers = [
|
|
100
|
+
"slow: tests expected to take longer than simple unit checks",
|
|
101
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# Meteoroid Ablation Models
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from . import physics
|
|
9
|
+
from . import models
|
|
10
|
+
from . import material
|
|
11
|
+
from . import atmosphere
|
|
12
|
+
from .atmosphere import Atmosphere
|
|
13
|
+
from .version import __version__
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def setup_logging(level=logging.INFO):
|
|
17
|
+
logger = logging.getLogger("metablate")
|
|
18
|
+
logger.setLevel(level)
|
|
19
|
+
|
|
20
|
+
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
|
21
|
+
|
|
22
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
23
|
+
handler.setLevel(level)
|
|
24
|
+
handler.setFormatter(formatter)
|
|
25
|
+
logger.addHandler(handler)
|
|
26
|
+
|
|
27
|
+
return logger
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
"""
|
|
6
6
|
import scipy.constants
|
|
7
|
+
import xarray as xr
|
|
7
8
|
from .atmosphere import Atmosphere
|
|
8
|
-
|
|
9
|
+
from ..types import NDArray_N
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
try:
|
|
11
13
|
import msise00
|
|
@@ -21,16 +23,16 @@ class AtmMSISE00(Atmosphere):
|
|
|
21
23
|
|
|
22
24
|
def density(
|
|
23
25
|
self,
|
|
24
|
-
time:
|
|
25
|
-
lat:
|
|
26
|
-
lon:
|
|
27
|
-
alt:
|
|
26
|
+
time: NDArray_N,
|
|
27
|
+
lat: NDArray_N,
|
|
28
|
+
lon: NDArray_N,
|
|
29
|
+
alt: NDArray_N,
|
|
28
30
|
f107: float = 80.0,
|
|
29
31
|
f107s: float = 80.0,
|
|
30
32
|
Ap: float = 4.0,
|
|
31
33
|
mass_densities: bool = False,
|
|
32
34
|
**kwargs
|
|
33
|
-
):
|
|
35
|
+
) -> xr.Dataset:
|
|
34
36
|
"""TODO: Write docstring
|
|
35
37
|
|
|
36
38
|
returns density in [m^-3]
|
|
@@ -39,17 +39,20 @@ class AtmPymsis(Atmosphere):
|
|
|
39
39
|
lat: npt.ArrayLike,
|
|
40
40
|
lon: npt.ArrayLike,
|
|
41
41
|
alt: npt.ArrayLike,
|
|
42
|
-
f107: npt.ArrayLike = None,
|
|
43
|
-
f107s: npt.ArrayLike = None,
|
|
44
|
-
aps: npt.ArrayLike = None,
|
|
42
|
+
f107: npt.ArrayLike | None = None,
|
|
43
|
+
f107s: npt.ArrayLike | None = None,
|
|
44
|
+
aps: npt.ArrayLike | None = None,
|
|
45
45
|
mass_densities: bool = False,
|
|
46
46
|
version: Union[float, str] = 2.1,
|
|
47
|
+
as_dataset: bool = True,
|
|
47
48
|
**kwargs
|
|
48
|
-
):
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
returns density in [m^-3]
|
|
49
|
+
) -> xr.Dataset | dict[str, xr.Variable]:
|
|
50
|
+
"""Return species number densities [m^-3], or mass densities [kg/m^3].
|
|
52
51
|
|
|
52
|
+
Set ``as_dataset=False`` in an ablation model's ``atmosphere_kwargs``
|
|
53
|
+
to skip dataset and coordinate construction at each solver step.
|
|
54
|
+
The returned variables still support ``.values``; total mass density
|
|
55
|
+
and temperature retain their units of kg/m^3 and K, respectively.
|
|
53
56
|
"""
|
|
54
57
|
if msis is None:
|
|
55
58
|
raise ImportError("pymsis is not installed")
|
|
@@ -77,34 +80,38 @@ class AtmPymsis(Atmosphere):
|
|
|
77
80
|
if len(result.shape) == 2:
|
|
78
81
|
result = result.reshape(result.shape[0], 1, 1, 1, result.shape[1])
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
83
|
+
variables = {
|
|
84
|
+
"Total": (["time", "lon", "lat", "alt"], result[:, :, :, :, 0]),
|
|
85
|
+
"N2": (["time", "lon", "lat", "alt"], result[:, :, :, :, 1]),
|
|
86
|
+
"O2": (["time", "lon", "lat", "alt"], result[:, :, :, :, 2]),
|
|
87
|
+
"O": (["time", "lon", "lat", "alt"], result[:, :, :, :, 3]),
|
|
88
|
+
"He": (["time", "lon", "lat", "alt"], result[:, :, :, :, 4]),
|
|
89
|
+
"H": (["time", "lon", "lat", "alt"], result[:, :, :, :, 5]),
|
|
90
|
+
"Ar": (["time", "lon", "lat", "alt"], result[:, :, :, :, 6]),
|
|
91
|
+
"N": (["time", "lon", "lat", "alt"], result[:, :, :, :, 7]),
|
|
92
|
+
"AnomalousO": (["time", "lon", "lat", "alt"], result[:, :, :, :, 8]),
|
|
93
|
+
"NO": (["time", "lon", "lat", "alt"], result[:, :, :, :, 9]),
|
|
94
|
+
"Temperature": (["time", "lon", "lat", "alt"], result[:, :, :, :, 10]),
|
|
95
|
+
}
|
|
96
|
+
if as_dataset:
|
|
97
|
+
result = xr.Dataset(
|
|
98
|
+
variables,
|
|
99
|
+
coords={
|
|
100
|
+
"time": time,
|
|
101
|
+
"lon": lon,
|
|
102
|
+
"lat": lat,
|
|
103
|
+
"alt": alt,
|
|
104
|
+
},
|
|
105
|
+
attrs=dict(
|
|
106
|
+
f107=f107,
|
|
107
|
+
f107s=f107s,
|
|
108
|
+
aps=aps,
|
|
109
|
+
mass_densities=mass_densities,
|
|
110
|
+
version=version,
|
|
111
|
+
),
|
|
106
112
|
)
|
|
107
|
-
|
|
113
|
+
else:
|
|
114
|
+
result = {key: xr.Variable(*value) for key, value in variables.items()}
|
|
108
115
|
|
|
109
116
|
if mass_densities:
|
|
110
117
|
for symbol, s in self.species.items():
|
|
@@ -5,7 +5,8 @@ from copy import copy
|
|
|
5
5
|
|
|
6
6
|
import scipy.constants as constants
|
|
7
7
|
import numpy as np
|
|
8
|
-
import
|
|
8
|
+
import xarray as xr
|
|
9
|
+
from ..types import NDArray_N
|
|
9
10
|
|
|
10
11
|
logger = logging.getLogger(__name__)
|
|
11
12
|
|
|
@@ -58,7 +59,7 @@ SPECIES = {
|
|
|
58
59
|
|
|
59
60
|
# TODO: get a a hold of other atm models to figure out how to generalize interface better
|
|
60
61
|
class Atmosphere:
|
|
61
|
-
def __init__(self, supported_species):
|
|
62
|
+
def __init__(self, supported_species: list[Species] | list[str]):
|
|
62
63
|
self.species = {}
|
|
63
64
|
for s in supported_species:
|
|
64
65
|
if isinstance(s, Species):
|
|
@@ -71,10 +72,10 @@ class Atmosphere:
|
|
|
71
72
|
@abstractmethod
|
|
72
73
|
def density(
|
|
73
74
|
self,
|
|
74
|
-
time:
|
|
75
|
-
lat:
|
|
76
|
-
lon:
|
|
77
|
-
alt:
|
|
75
|
+
time: np.datetime64,
|
|
76
|
+
lat: NDArray_N,
|
|
77
|
+
lon: NDArray_N,
|
|
78
|
+
alt: NDArray_N,
|
|
78
79
|
**kwargs
|
|
79
|
-
):
|
|
80
|
+
) -> xr.Dataset:
|
|
80
81
|
pass
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# Meteoroid material physics
|
|
3
|
+
|
|
4
|
+
[Fe SiO2 C C] mean molecular mass per target atoms corresponding
|
|
5
|
+
to the different meteoroid densities, see Rogers p. 1344 values
|
|
6
|
+
are from Tielens et al.
|
|
7
|
+
|
|
8
|
+
Mean molecular mass of ablated vapor assuming that all products
|
|
9
|
+
liberated from the meteoroid by thermal ablation were released
|
|
10
|
+
in complete molecular form.
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from dataclasses import asdict
|
|
15
|
+
import logging
|
|
16
|
+
from copy import copy
|
|
17
|
+
from scipy import constants
|
|
18
|
+
from .types import Material
|
|
19
|
+
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
MATERIALS = {}
|
|
23
|
+
|
|
24
|
+
iron = Material(
|
|
25
|
+
bulk_density=7800.0,
|
|
26
|
+
mean_atomic_mass=56.0 * constants.u,
|
|
27
|
+
latent_heat_of_fusion_vapourization=6.0e6,
|
|
28
|
+
specific_heat=1200,
|
|
29
|
+
average_atomic_number=26,
|
|
30
|
+
surface_binding_energy=4.1,
|
|
31
|
+
ablated_vapour_mean_molecular_mass=56.0 * constants.u,
|
|
32
|
+
penetration_correction_parameter_K=0.35,
|
|
33
|
+
clausius_clapeyron_coeff_A=10.6,
|
|
34
|
+
clausius_clapeyron_coeff_B=16120.0,
|
|
35
|
+
)
|
|
36
|
+
MATERIALS["iron"] = iron
|
|
37
|
+
|
|
38
|
+
asteroidal = Material(
|
|
39
|
+
bulk_density=3300.0,
|
|
40
|
+
mean_atomic_mass=20.0 * constants.u,
|
|
41
|
+
latent_heat_of_fusion_vapourization=6.0e6,
|
|
42
|
+
specific_heat=1200,
|
|
43
|
+
average_atomic_number=10,
|
|
44
|
+
surface_binding_energy=6.4,
|
|
45
|
+
ablated_vapour_mean_molecular_mass=50.0 * constants.u,
|
|
46
|
+
penetration_correction_parameter_K=0.1,
|
|
47
|
+
clausius_clapeyron_coeff_A=10.6,
|
|
48
|
+
clausius_clapeyron_coeff_B=13500.0,
|
|
49
|
+
)
|
|
50
|
+
MATERIALS["asteroidal"] = asteroidal
|
|
51
|
+
|
|
52
|
+
cometary = Material(
|
|
53
|
+
bulk_density=1000.0,
|
|
54
|
+
mean_atomic_mass=12.0 * constants.u,
|
|
55
|
+
latent_heat_of_fusion_vapourization=6.0e6,
|
|
56
|
+
specific_heat=1200,
|
|
57
|
+
average_atomic_number=6,
|
|
58
|
+
surface_binding_energy=4.0,
|
|
59
|
+
ablated_vapour_mean_molecular_mass=20.0 * constants.u,
|
|
60
|
+
penetration_correction_parameter_K=0.65,
|
|
61
|
+
clausius_clapeyron_coeff_A=10.6,
|
|
62
|
+
clausius_clapeyron_coeff_B=13500.0,
|
|
63
|
+
)
|
|
64
|
+
MATERIALS["cometary"] = cometary
|
|
65
|
+
|
|
66
|
+
porous = Material(
|
|
67
|
+
bulk_density=300.0,
|
|
68
|
+
mean_atomic_mass=12.0 * constants.u,
|
|
69
|
+
latent_heat_of_fusion_vapourization=6.0e6,
|
|
70
|
+
specific_heat=1200,
|
|
71
|
+
average_atomic_number=6,
|
|
72
|
+
surface_binding_energy=4.0,
|
|
73
|
+
ablated_vapour_mean_molecular_mass=20.0 * constants.u,
|
|
74
|
+
penetration_correction_parameter_K=0.65,
|
|
75
|
+
clausius_clapeyron_coeff_A=10.6,
|
|
76
|
+
clausius_clapeyron_coeff_B=13500.0,
|
|
77
|
+
)
|
|
78
|
+
MATERIALS["porous"] = porous
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def available():
|
|
82
|
+
"""List currently available meteoroid materials."""
|
|
83
|
+
return list(MATERIALS.keys())
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def get(material, as_dict=True):
|
|
87
|
+
"""Returns the physical parameters of the meteoroid based on its material.
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
material : str
|
|
92
|
+
name of material
|
|
93
|
+
as_dict : bool
|
|
94
|
+
Return data as dict instead of as a Material instance
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
Material or dict
|
|
99
|
+
Dictionary of all available material parameters (float or None)
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
_material = material.lower().strip()
|
|
103
|
+
if _material not in MATERIALS:
|
|
104
|
+
raise ValueError(
|
|
105
|
+
f'No data exists for material "{_material}"\n' f"Avalible materials are: {available()}"
|
|
106
|
+
)
|
|
107
|
+
if as_dict:
|
|
108
|
+
return asdict(MATERIALS[_material])
|
|
109
|
+
else:
|
|
110
|
+
return copy(MATERIALS[_material])
|