diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 00000000..2b651393 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,36 @@ +name: pytest-dev + +on: + push: + branches: + - dev + +jobs: + pytest: + runs-on: ubuntu-latest + name: Sphinx docs to gh-pages + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Make conda environment + uses: mamba-org/setup-micromamba@v1 + with: + micromamba-version: '1.5.1-0' + environment-file: requirements_dev.yml + environment-name: earthdaily + cache-environment: true + post-cleanup: 'all' + init-shell: bash + - name: Installing the library + shell: bash -l {0} + run: | + pip install . + - name: tests and coverage + env: + EDS_CLIENT_ID: ${{ secrets.EDS_CLIENT_ID }} + EDS_AUTH_URL: ${{ secrets.EDS_AUTH_URL }} + EDS_SECRET: ${{ secrets.EDS_SECRET }} + EDS_API_URL: ${{ secrets.EDS_API_URL }} + run: | + pytest -v tests --cov=earthdaily \ No newline at end of file diff --git a/.github/workflows/ruff.yaml b/.github/workflows/ruff.yaml index b50dea9b..ae3b5353 100644 --- a/.github/workflows/ruff.yaml +++ b/.github/workflows/ruff.yaml @@ -21,7 +21,6 @@ jobs: with: src: "./earthdaily" args: format - - uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: 'style fixes by ruff' \ No newline at end of file + commit_message: 'ghactions/auto fix with ruff' \ No newline at end of file diff --git a/earthdaily/earthdatastore/cube_utils/_zonal.py b/earthdaily/earthdatastore/cube_utils/_zonal.py index 9c86af05..0bcf0c43 100644 --- a/earthdaily/earthdatastore/cube_utils/_zonal.py +++ b/earthdaily/earthdatastore/cube_utils/_zonal.py @@ -59,6 +59,7 @@ def zonal_stats_numpy( feats, yx_pos = _rasterize(gdf, dataset, all_touched=all_touched) ds = [] + features_idx = [] for data_var in dataset.data_vars: tqdm_bar.set_description(data_var) dataset_var = dataset[data_var] @@ -70,7 +71,7 @@ def zonal_stats_numpy( vals[t] = [] mem_asset = dataset_var.isel(time=t).to_numpy() for i in range(gdf.shape[0]): - features.append(i) + features_idx.append(i) if len(yx_pos) <= i + 1: break pos = np.asarray(yx_pos[i + 1]) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests_assetmapper.py b/tests/test_assetmapper.py similarity index 97% rename from tests/tests_assetmapper.py rename to tests/test_assetmapper.py index 58d97628..5a541174 100644 --- a/tests/tests_assetmapper.py +++ b/tests/test_assetmapper.py @@ -3,7 +3,7 @@ from earthdaily.earthdatastore.cube_utils.asset_mapper import AssetMapper -class TestZonalStats(unittest.TestCase): +class TestAssetMapper(unittest.TestCase): def setUp(self): self.aM = AssetMapper() diff --git a/tests/tests_zonalstats.py b/tests/test_zonalstats.py similarity index 100% rename from tests/tests_zonalstats.py rename to tests/test_zonalstats.py