Skip to content

Commit

Permalink
comment skips (#157)
Browse files Browse the repository at this point in the history
* comment skips

* bugfix query local STAC

* all_close instead of equal, py3.9

* added comments
  • Loading branch information
fwfichtner authored Jul 28, 2021
1 parent 096ebbc commit 06a8cac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

[Master] (2021-**-**)
---------------------
Fixed
^^^^^
- ``data``: bugfix query local STAC

[1.3.0] (2021-07-27)
---------------------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_aoi_geointerface(self):
self.assertEqual(tuple(geom.exterior.coords), ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (2.0, -1.0), (0.0, 0.0)))
self.assertEqual(len(geom.interiors), 1)

@unittest.skip("Skip until we find a better test or this also runs with Github Actions")
# @unittest.skip("Skip until we find a better test or this also runs with Github Actions")
def test_query_metadata_stac_local(self):
with Source(datahub=Datahub.STAC_local, catalog=catalog_path) as src:
meta = src.query_metadata(
Expand Down
7 changes: 4 additions & 3 deletions tests/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_mask_image(self):
),
)

@unittest.skip("Skip until we find a better test or this also runs with Github Actions")
# @unittest.skip("Skip until we find a better test or this also runs with Github Actions")
def test_warp(self):
self.img.warp("EPSG:3857")
self.assertEqual(self.img.dataset.meta["crs"], "EPSG:3857")
Expand All @@ -234,7 +234,7 @@ def test_warp(self):
source_img.warp("EPSG:3857", target_align=target_img)
self.assertEqual(source_img.dataset.transform, target_img.dataset.transform)

@unittest.skip("Skip until we find a better test or this also runs with Github Actions")
# @unittest.skip("Skip until we find a better test or this also runs with Github Actions")
def test_dn2toa(self):
target_dir = Path(__file__).parents[0] / "testfiles" / "satellite_data"
tests = [
Expand Down Expand Up @@ -275,7 +275,8 @@ def test_dn2toa(self):
platform=tests[i]["platform"], mtl_file=tests[i]["mtl_file"], wavelengths=tests[i]["wavelengths"]
)

self.assertTrue(np.array_equal(img_dn.arr, img_toa.arr, equal_nan=True))
# np.array_equal did not work on Github Runner environment
self.assertTrue(np.allclose(img_dn.arr, img_toa.arr, equal_nan=True))
img_dn.close()
img_toa.close()

Expand Down
11 changes: 7 additions & 4 deletions ukis_pysat/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ def query_metadata(self, platform, date, aoi, cloud_cover=None, kwargs=None):
# query STAC Catalog for metadata
geom = self._prep_aoi(aoi)
for item in self.api.get_all_items():
if item.ext.eo.cloud_cover and cloud_cover:
if not cloud_cover[0] <= item.ext.eo.cloud_cover < cloud_cover[1]:
eo_ext = EOExtension.ext(item)
if eo_ext.cloud_cover and cloud_cover:
if not cloud_cover[0] <= eo_ext.cloud_cover < cloud_cover[1]:
continue
if (
platform.value == item.common_metadata.platform
Expand Down Expand Up @@ -172,6 +173,8 @@ def query_metadata(self, platform, date, aoi, cloud_cover=None, kwargs=None):
max_results=10000,
**kwargs,
)
for meta in products:
yield self.construct_metadata(meta=meta, platform=platform)

else:
# query Scihub for metadata
Expand All @@ -185,8 +188,8 @@ def query_metadata(self, platform, date, aoi, cloud_cover=None, kwargs=None):
)
products = self.api.to_geojson(products)["features"]

for meta in products:
yield self.construct_metadata(meta=meta, platform=platform)
for meta in products:
yield self.construct_metadata(meta=meta, platform=platform)

def query_metadata_srcid(self, platform, srcid):
"""Queries metadata from data source by srcid.
Expand Down

0 comments on commit 06a8cac

Please sign in to comment.