Skip to content

Commit 53714fd

Browse files
authored
Merge branch 'main' into main
2 parents 59dc09b + a7e1d93 commit 53714fd

38 files changed

+431
-262
lines changed

.github/workflows/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# GitHub Actions CI workflows
2+
23
Definitions for GitHub Actions (continuous integration) workflows
34

45
## Publishing
6+
57
To publish a new version of the `pymap3d` package to PyPI, create and publish a
6-
release in GitHub (preferrably from a Git tag) for the version; the workflow
8+
release in GitHub (preferably from a Git tag) for the version; the workflow
79
will automatically build and publish an sdist and wheel from the tag.
810

911
Requires the repo secret `PYPI_API_TOKEN` to be set to a PyPI API token: see

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "**.py"
77
- .github/workflows/ci.yml
88
- "!scripts/**"
9+
- "!examples/**"
910

1011
jobs:
1112

@@ -15,7 +16,7 @@ jobs:
1516
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
1617
strategy:
1718
matrix:
18-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
19+
python-version: ['3.10', '3.11', '3.12', '3.13']
1920
os: [ubuntu-latest]
2021
include:
2122
- os: macos-latest

.github/workflows/ci_stdlib_only.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "**.py"
77
- .github/workflows/ci_stdlib_only.yml
88
- "!scripts/**"
9+
- "!examples/**"
910

1011
jobs:
1112

CITATION.cff

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cff-version: 1.2.0
22
authors:
3-
- family-names: Hirsch
4-
given-names: Michael
5-
orcid: 0000-0002-1637-6526
6-
title: PyGemini
7-
doi: 10.5281/zenodo.3262738
3+
- orcid: 0000-0002-1637-6526
4+
name: SciVision
5+
title: PyMap3D
6+
doi: 10.21105/joss.00580

Examples/astropy_geodetic2ecef.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
https://github.com/geospace-code/pymap3d/issues/103
5+
"""
6+
7+
from datetime import datetime
8+
import sys
9+
10+
from astropy.time import Time
11+
import astropy
12+
import numpy as np
13+
14+
import pymap3d as pm
15+
16+
try:
17+
from pymap3d.tests.matlab_engine import matlab_ecef2eci, matlab_engine, has_matmap3d
18+
except ImportError:
19+
pass
20+
21+
print("Python version:", sys.version)
22+
print("AstroPy version:", astropy.__version__)
23+
24+
lat = 33.6 # deg
25+
lon = 134.3 # deg
26+
alt = 0 # m
27+
28+
dt = datetime(2020, 8, 14, 0, 0, 41)
29+
30+
# %% Astropy time for comparison
31+
astropy_time = Time(dt, scale="utc")
32+
print("----------------------------------------")
33+
print("Astropy Time (UTC):", astropy_time.utc)
34+
print("Julian Date (UTC):", astropy_time.utc.jd)
35+
print("Julian Date (TT):", astropy_time.tt.jd)
36+
print("GMST:", astropy_time.sidereal_time("mean", "greenwich"))
37+
38+
np.set_printoptions(precision=3, suppress=True)
39+
40+
# %% 1. Geodetic to ECEF
41+
ecef = pm.geodetic2ecef(lat, lon, alt)
42+
print("\nECEF Coordinates (meters):")
43+
print(np.array(ecef))
44+
45+
# %% AstroPy ECEF to ECI (J2000)
46+
astropy_eci = np.array(pm.ecef2eci(ecef[0], ecef[1], ecef[2], dt))
47+
print("\nAstroPy: ECI Coordinates (meters):")
48+
print(astropy_eci)
49+
50+
numpy_eci = np.array(pm.ecef2eci(ecef[0], ecef[1], ecef[2], dt, force_non_astropy=True))
51+
print("\nNumpy: ECI Coordinates (meters):")
52+
print(numpy_eci)
53+
54+
print("\nAstroPy - Numpy Difference (ECI meters):", astropy_eci - numpy_eci)
55+
56+
# %% Matlab comparison
57+
if matlab_engine in sys.modules:
58+
eng = matlab_engine()
59+
eci_matlab_aerospace = matlab_ecef2eci(eng, False, dt, ecef)
60+
print("\nMatlab Aerospace Toolbox: ECI Coordinates (meters):")
61+
print(np.array(eci_matlab_aerospace))
62+
print(
63+
"\nAstroPy - Matlab Aerospace Toolbox Difference (ECI meters):",
64+
astropy_eci - eci_matlab_aerospace,
65+
)
66+
print(
67+
"Numpy - Matlab Aerospace Toolbox Difference (ECI meters):",
68+
numpy_eci - eci_matlab_aerospace,
69+
)
70+
71+
if has_matmap3d(eng):
72+
eci_matmap3d = matlab_ecef2eci(eng, True, dt, ecef)
73+
print("\nMatlab Matmap3D: ECI Coordinates (meters):")
74+
print(np.array(eci_matmap3d))
75+
print("\nAstroPy - Matlab Matmap3D Difference (ECI meters):", astropy_eci - eci_matmap3d)
76+
print("Numpy - Matlab Matmap3D Difference (ECI meters):", numpy_eci - eci_matmap3d)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014-2022 Michael Hirsch, Ph.D.
1+
Copyright (c) 2014-2025 SciVision, Inc.
22
Copyright (c) 2013, Felipe Geremia Nievinski
33
Copyright (c) 2004-2007 Michael Kleder
44

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ use
177177
[Matlab Engine for Python](https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html)
178178
to compare Python PyMap3D output with Matlab output using Matlab functions.
179179

180+
```sh
181+
python -m pip install matlabengine
182+
```
183+
180184
## Notes
181185

182186
As compared to [PyProj](https://github.com/jswhit/pyproj):

codemeta.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
2+
"@context": "https://doi.org/10.5063/schema/codemeta-3.0",
33
"@type": "SoftwareSourceCode",
44
"license": "https://spdx.org/licenses/BSD-2-Clause",
55
"codeRepository": "https://github.com/geospace-code/pymap3d",
6-
"contIntegration": "https://github.com/geospace-code/pymap3d/actions",
7-
"dateCreated": "2014-08-01",
8-
"datePublished": "2014-08-03",
9-
"dateModified": "2020-05-10",
6+
"continuousIntegration": "https://github.com/geospace-code/pymap3d/actions",
107
"issueTracker": "https://github.com/geospace-code/pymap3d/issues",
118
"name": "PyMap3d",
12-
"identifier": "10.5281/zenodo.3262738",
9+
"identifier": "10.21105/joss.00580",
1310
"description": "pure-Python (Numpy optional) 3D coordinate conversions for geospace",
1411
"applicationCategory": "geospace",
1512
"developmentStatus": "active",
@@ -25,10 +22,8 @@
2522
],
2623
"author": [
2724
{
28-
"@type": "Person",
29-
"@id": "https://orcid.org/0000-0002-1637-6526",
30-
"givenName": "Michael",
31-
"familyName": "Hirsch"
25+
"@type": "Organization",
26+
"name": "SciVision"
3227
}
3328
]
3429
}

src/pymap3d/__init__.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Fortran: [Maptran3D](https://github.com/geospace-code/maptran3d)
3030
"""
3131

32-
__version__ = "3.1.1"
32+
__version__ = "3.1.2"
3333

3434
from .aer import aer2ecef, aer2geodetic, ecef2aer, geodetic2aer
3535
from .dca import (
@@ -161,11 +161,8 @@
161161
]
162162

163163

164-
try:
165-
from .aer import aer2eci, eci2aer
166-
from .azelradec import azel2radec, radec2azel
167-
from .eci import ecef2eci, eci2ecef
164+
from .aer import aer2eci, eci2aer
165+
from .azelradec import azel2radec, radec2azel
166+
from .eci import ecef2eci, eci2ecef
168167

169-
__all__ += ["aer2eci", "eci2aer", "ecef2eci", "eci2ecef"]
170-
except ImportError:
171-
from .vallado import azel2radec, radec2azel
168+
__all__ += ["aer2eci", "eci2aer", "ecef2eci", "eci2ecef"]

src/pymap3d/aer.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" transforms involving AER: azimuth, elevation, slant range"""
1+
"""transforms involving AER: azimuth, elevation, slant range"""
22

33
from __future__ import annotations
44

@@ -12,17 +12,15 @@
1212
from .eci import ecef2eci, eci2ecef
1313
except ImportError:
1414

15-
def eci2ecef(x, y, z, time: datetime) -> tuple:
15+
def eci2ecef(x, y, z, time: datetime, force_non_astropy: bool = False) -> tuple:
1616
raise ImportError("Numpy required for eci2ecef")
1717

18-
def ecef2eci(x, y, z, time: datetime) -> tuple:
18+
def ecef2eci(x, y, z, time: datetime, force_non_astropy: bool = False) -> tuple:
1919
raise ImportError("Numpy required for ecef2eci")
2020

2121

2222
__all__ = ["aer2ecef", "ecef2aer", "geodetic2aer", "aer2geodetic", "eci2aer", "aer2eci"]
2323

24-
ELL = Ellipsoid.from_name("wgs84")
25-
2624

2725
def ecef2aer(
2826
x,
@@ -31,7 +29,7 @@ def ecef2aer(
3129
lat0,
3230
lon0,
3331
h0,
34-
ell: Ellipsoid = ELL,
32+
ell: Ellipsoid | None = None,
3533
deg: bool = True,
3634
) -> tuple:
3735
"""
@@ -81,7 +79,7 @@ def geodetic2aer(
8179
lat0,
8280
lon0,
8381
h0,
84-
ell: Ellipsoid = ELL,
82+
ell: Ellipsoid | None = None,
8583
deg: bool = True,
8684
) -> tuple:
8785
"""
@@ -129,7 +127,7 @@ def aer2geodetic(
129127
lat0,
130128
lon0,
131129
h0,
132-
ell: Ellipsoid = ELL,
130+
ell: Ellipsoid | None = None,
133131
deg: bool = True,
134132
) -> tuple:
135133
"""
@@ -219,7 +217,7 @@ def aer2eci(
219217
lon0,
220218
h0,
221219
t: datetime,
222-
ell: Ellipsoid = ELL,
220+
ell: Ellipsoid | None = None,
223221
*,
224222
deg: bool = True,
225223
) -> tuple:
@@ -272,7 +270,7 @@ def aer2ecef(
272270
lat0,
273271
lon0,
274272
alt0,
275-
ell: Ellipsoid = ELL,
273+
ell: Ellipsoid | None = None,
276274
deg: bool = True,
277275
) -> tuple:
278276
"""

0 commit comments

Comments
 (0)