Skip to content

Commit

Permalink
Merge pull request #13 from Stoops-ML/dev
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
Stoops-ML authored Aug 27, 2024
2 parents b61c6c9 + d673179 commit 2635344
Show file tree
Hide file tree
Showing 17 changed files with 1,600 additions and 1,305 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
python3 -m pip install numpy
python3 -m pip install setuptools
python3 -m pip install setuptools-scm
python3 -m pip install numpy
python3 setup.py sdist
- name: Store the distribution packages
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
python -m pip install .[tests]
- name: Generate coverage report
run: python -m pytest --cov=transforms84 --cov-report=xml:pytest_cov.xml
- name: Upload coverage to Codecov
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ repos:
- id: debug-statements
language_version: python3

# - repo: https://github.com/cpp-linter/cpp-linter-hooks
# rev: v0.5.1
# hooks:
# - id: clang-format
# args: [--style=Google] # Other coding style: LLVM, GNU, Chromium, Microsoft, Mozilla, WebKit.
# - id: clang-tidy
# args: [--checks='boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*']
- repo: https://github.com/cpp-linter/cpp-linter-hooks
rev: v0.5.1
hooks:
- id: clang-format
args: [--style=WebKit] # Other coding style: LLVM, GNU, Chromium, Microsoft, Mozilla, WebKit.
# - id: clang-tidy
# args: [--checks='boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*']

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
Expand Down
54 changes: 50 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

Small geographic coordinate systems Python library with a few additional helper functions.

This package focuses on:
1. Performance
2. Input and output coordinates of ideal mathematical shapes. Ideally, all coordinates should be of shapes (3,1) or (nPoints,3,1), but shapes (3,) and (nPoints,3) are supported too.
3. Functions that adapt to differing input matrices shapes: one-to-one, many-to-many and one-to-many points. See [below](#many-to-many--one-to-many) for an example.

## Installation
`pip install transforms84`

## Examples
See the Jupyter notebooks in [examples](examples) to see how to use the transform84. Run `pip install transforms84[examples]` to run the examples locally.

## Operations
### Transformations
The following transformations have been implemented:
Expand All @@ -32,5 +34,49 @@ The following functions have been implemented:
- [rad, rad, X] → [deg, deg, X]
- [deg, deg, X] → [rad, rad, X]

## Examples
See the Jupyter notebooks in [examples](examples) to see how to use the transform84. Run `pip install transforms84[examples]` to run the examples locally.

### Many-to-many & one-to-many
The `transforms.ECEF2ENU` transformation accepts same and differing matrix shape sizes. Below showcases the many-to-many method where three target points, `rrm_target`, in the geodetic coordinate system ([WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System)) are transformed to the local ENU coordinate system about the point `rrm_local`, where both matrices are of shape (3, 3, 1):
```
>> import numpy as np
>> from transforms84.systems import WGS84
>> from transforms84.helpers import DDM2RRM
>> from transforms84.transforms import ECEF2ENU, geodetic2ECEF
>> rrm_local = DDM2RRM(np.array([[[30], [31], [0]], [[30], [31], [0]], [[30], [31], [0]]], dtype=np.float64)) # convert each point from [deg, deg, X] to [rad, rad, X]
>> rrm_target = DDM2RRM(np.array([[[31], [32], [0]], [[31], [32], [0]], [[31], [32], [0]]], dtype=np.float64))
>> ECEF2ENU(rrm_local, geodetic2ECEF(rrm_target, WGS84.a, WGS84.b), WGS84.a, WGS84.b) # geodetic2ECEF -> ECEF2ENU
array([[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]],
[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]],
[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]]])
```

We can achieve the same result using the one-to-many method with a single local point of shape (3, 1):
```
>> rrm_local = DDM2RRM(np.array([[30], [31], [0]], dtype=np.float64))
>> ECEF2ENU(rrm_local, geodetic2ECEF(rrm_target, WGS84.a, WGS84.b), WGS84.a, WGS84.b)
array([[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]],
[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]],
[[ 4.06379074e+01],
[-6.60007585e-01],
[ 1.46643956e+05]]])
```

## Contributing
PRs are always welcome and appreciated!
PRs are always welcome and appreciated! Please install the pre-commit hooks before making commits.
130 changes: 0 additions & 130 deletions distances.c

This file was deleted.

Loading

0 comments on commit 2635344

Please sign in to comment.