Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test Python package

on:
- push
on: [push, pull_request]

jobs:
test:
Expand Down Expand Up @@ -50,4 +49,3 @@ jobs:
run: tox -e format
- name: Test with tox
run: tox -e test

2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- pyproj>=2.1
- PyYAML>=5.4
- rasterio>=1.0.23
- requests==2.22.0
- requests>=2.27.1
- rtree>=0.9.3
- scikit-image>=0.16.2
- scipy>=1.3.2
Expand Down
10 changes: 5 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ shapely>=1.8.0
tqdm>=4.40.0
urllib3<1.26
# testing requirements
black
black==22.1.0
pytest
tox
isort
flake8
pre-commit
tox==3.24.5
isort==5.10.1
flake8==4.0.1
pre-commit
4 changes: 2 additions & 2 deletions solaris/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import data, utils, vector # noqa: F401
from . import data, tile, utils, vector # noqa: F401

# data, eval, preproc, raster, tile, have gdal in them need to replace with rasterio
__version__ = "0.0.1"
__version__ = "0.5.0"
5 changes: 2 additions & 3 deletions solaris/tile/raster_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ def save_tile(self, tile_data, mask, profile, dest_fname_base=None):
if self.proj_unit not in ["meter", "metre"]:
dest_fname = "{}_{}_{}.tif".format(
dest_fname_root,
np.round(profile["transform"][2], 3),
np.round(profile["transform"][5], 3),
np.round(profile["transform"][2], 6),
np.round(profile["transform"][5], 6),
)
else:
dest_fname = "{}_{}_{}.tif".format(
Expand All @@ -537,7 +537,6 @@ def save_tile(self, tile_data, mask, profile, dest_fname_base=None):
dest.write(mask, profile["count"] + 1)

dest.close()

return dest_path

# if self.cog_output:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
36 changes: 9 additions & 27 deletions tests/test_tile/test_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,27 @@ def test_tiler(self):
os.path.join(data_dir, "rastertile_test_result"), src_tile_size=(90, 90)
)
raster_tiler.tile(src=os.path.join(data_dir, "sample_geotiff.tif"))
raster_tiling_result_files = os.listdir(
os.path.join(data_dir, "rastertile_test_result")
)
raster_tiling_result_files = os.listdir(os.path.join(data_dir, "rastertile_test_result"))
assert len(raster_tiling_result_files) == len(
os.listdir(os.path.join(data_dir, "rastertile_test_expected"))
)
for f in raster_tiling_result_files:
result = skimage.io.imread(
os.path.join(data_dir, "rastertile_test_result", f)
)
expected = skimage.io.imread(
os.path.join(data_dir, "rastertile_test_expected", f)
)
result = skimage.io.imread(os.path.join(data_dir, "rastertile_test_result", f))
expected = skimage.io.imread(os.path.join(data_dir, "rastertile_test_expected", f))
assert np.array_equal(result, expected)
os.remove(os.path.join(data_dir, "rastertile_test_result", f))
os.rmdir(os.path.join(data_dir, "rastertile_test_result"))
vector_tiler = VectorTiler(os.path.join(data_dir, "vectortile_test_result"))
vector_tiler.tile(
os.path.join(data_dir, "geotiff_labels.geojson"), raster_tiler.tile_bounds
)
vector_tiling_result_files = os.listdir(
os.path.join(data_dir, "vectortile_test_result")
)
vector_tiling_result_files = os.listdir(os.path.join(data_dir, "vectortile_test_result"))
assert len(vector_tiling_result_files) == len(
os.listdir(os.path.join(data_dir, "vectortile_test_expected"))
)
for f in vector_tiling_result_files:
result = gpd.read_file(os.path.join(data_dir, "vectortile_test_result", f))
expected = gpd.read_file(
os.path.join(data_dir, "vectortile_test_expected", f)
)
expected = gpd.read_file(os.path.join(data_dir, "vectortile_test_expected", f))
if len(result) == 0:
assert len(expected) == 0
else:
Expand Down Expand Up @@ -80,9 +70,7 @@ def test_tiler_custom_proj(self):
assert np.array_equal(result, expected)
os.remove(os.path.join(data_dir, "rastertile_test_custom_proj_result", f))
os.rmdir(os.path.join(data_dir, "rastertile_test_custom_proj_result"))
vector_tiler = VectorTiler(
os.path.join(data_dir, "vectortile_test_custom_proj_result")
)
vector_tiler = VectorTiler(os.path.join(data_dir, "vectortile_test_custom_proj_result"))
vector_tiler.tile(
os.path.join(data_dir, "geotiff_custom_proj_labels.geojson"),
raster_tiler.tile_bounds,
Expand All @@ -94,9 +82,7 @@ def test_tiler_custom_proj(self):
os.listdir(os.path.join(data_dir, "vectortile_test_custom_proj_expected"))
)
for f in vector_tiling_result_files:
result = gpd.read_file(
os.path.join(data_dir, "vectortile_test_custom_proj_result", f)
)
result = gpd.read_file(os.path.join(data_dir, "vectortile_test_custom_proj_result", f))
expected = gpd.read_file(
os.path.join(data_dir, "vectortile_test_custom_proj_expected", f)
)
Expand Down Expand Up @@ -124,9 +110,7 @@ def test_tiler_fill_nodata(self):
restrict_to_aoi=True,
)

vector_tiler = VectorTiler(
os.path.join(data_dir, "vectortile_test_nonfilled_result")
)
vector_tiler = VectorTiler(os.path.join(data_dir, "vectortile_test_nonfilled_result"))

vector_tiler.tile(
os.path.join(data_dir, "nebraska_wgs84_with_nodata_labels.geojson"),
Expand Down Expand Up @@ -177,9 +161,7 @@ def test_tiler_fill_nodata(self):
assert np.array_equal(result, expected)

for f in vector_tiling_result_files:
result = skimage.io.imread(
os.path.join(data_dir, "vectortile_test_filled_result", f)
)
result = skimage.io.imread(os.path.join(data_dir, "vectortile_test_filled_result", f))
expected = skimage.io.imread(
os.path.join(data_dir, "vectortile_test_filled_expected", f)
)
Expand Down