diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cde81b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: GeodePy CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest pytest-cov coveralls + pip install -r requirements.txt + + - name: Test with pytest + run: | + pytest --cov-report term-missing:skip-covered --cov=geodepy geodepy/tests/ diff --git a/.github/workflows/python-publish.yml b/.github/workflows/pypi.yml similarity index 92% rename from .github/workflows/python-publish.yml rename to .github/workflows/pypi.yml index 3bfabfc..8c49c70 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/pypi.yml @@ -6,11 +6,11 @@ # separate terms of service, privacy policy, and support # documentation. -name: Upload Python Package +name: GeodePy PyPI on: release: - types: [published] + types: [released] jobs: deploy: @@ -22,7 +22,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.x' + python-version: '3.7' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml deleted file mode 100644 index 70bba55..0000000 --- a/.github/workflows/python-app.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python application - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index b55b361..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,40 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest diff --git a/geodepy/tests/test_height.py b/geodepy/tests/test_height.py deleted file mode 100644 index fde9df9..0000000 --- a/geodepy/tests/test_height.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Fri Nov 08 10:52:07 2019 - -@author: u84157 -""" -import unittest -import numpy as np -import geodepy.height - -#___________________________________________________________________________# -## Some test Cases to run, check againts ga.gov.au/ausgeoid -# Test Coordinates -Long=148.716 -Lat=-25.716 -Height=0 -# What the output should be -AVWS_H=-40.79437480 -AVWS_H_STD=0.05786271 -AHD_H=-42.231267 -AHD_H_STD=0.10002191 -DOVPM=-13.71323159 -DOVPV=-2.4971921 - -class TestHeights(unittest.TestCase): - def test_AVWS_H(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.GPS_to_AVWS(Lat, Long, Height)[0]), AVWS_H, 7) - def test_AVWS_H_STD(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.GPS_to_AVWS(Lat, Long, Height)[1]), AVWS_H_STD, 7) - def test_DOVPV(self): - self.assertAlmostEqual(np.asscalar(geodepy.height.DOV(Lat, Long)[1]), DOVPV, 7) - def test_DOVPM(self): - self.assertAlmostEqual(np.asscalar(geodepy.height.DOV(Lat, Long)[0]), DOVPM, 7) - def test_AHD_H(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.GPS_to_AHD(Lat, Long, Height)[0]), AHD_H, 7) - def test_AHD_H_STD(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.GPS_to_AHD(Lat, Long, Height)[1]), AHD_H_STD, 7) - -#___________________________________________________________________________# -## Some test Cases to run, check againts ga.gov.au/ausgeoid -# Test Coordinates -Long1=141.478560 -Lat1=-31.599542 -Height1=368.40 -Long2=141.478560 -Lat2=-31.599542 -Height2=3690.40 -# What the output should be -RECOVERED_GRAV=9.79062606 -NC=0.80179403 - -class TestNC(unittest.TestCase): - def test_NC(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.normal_correction(Lat1, Long1, Height1, Lat2, Long2, Height2)[0]), NC, 7) - def test_Grav(self): - self.assertAlmostEqual(np.asscalar( - geodepy.height.normal_correction(Lat1, Long1, Height1, Lat2, Long2, Height2)[1]), RECOVERED_GRAV, 7) - - -class TestNoc(unittest.TestCase): - def test_noc(self): - # sample data - PLH1 = [-30.89632356, 141.08948867, 75.279] - PLH2 = [-30.86585867, 141.07870767, 71.449] - expected_result = 0.000182 - - result = geodepy.height.normal_orthometric_correction(PLH1[0], PLH1[1], PLH1[2], PLH2[0], PLH2[1], PLH2[2]) - - self.assertAlmostEqual(expected_result, result, places=6) - - -if __name__ == '__main__': - unittest.main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..296d654 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +numpy \ No newline at end of file