Skip to content

Commit

Permalink
testing scikeo
Browse files Browse the repository at this point in the history
  • Loading branch information
ytarazona committed Jul 26, 2023
1 parent 6822926 commit 39672e8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/test_scikeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from scikeo.pca import PCA
from scikeo.tassCap import tassCap
from scikeo.fusionrs import fusionrs
from scikeo.process import crop


def test_confintervalML():
Expand Down Expand Up @@ -106,9 +107,19 @@ def test_fusionrs():
cum_var = fusion.get('Cumulative_variance')*100
assert round(cum_var[8],0) == 100

def test_crop_all_returns_list(in_paths, output_dir, basic_geometry_gdf):
def test_crop():
"""Test that crop all returns a list."""
img_list = es.crop_all(
in_paths, output_dir, basic_geometry_gdf, overwrite=True
)
assert type(img_list) == list
# raster to be clipped
path_raster = "tests/data/LC08_232066_20190727.tif"
# area of Interes -> shapefile
path_shp = "tests/data/clip.shp"
# Path where the image will be saved
output_path_raster = "tests/data"
# The raster name
output_name = 'LC08_232066_20190727_clip'
# Applying the crop() function:
crop(image = path_raster, shp = path_shp,
filename = output_name,
filepath = output_path_raster)
clip_image = rasterio.open(output_path_raster + '/' + output_name+ '.tif')
assert type(clip_image) == rasterio.io.DatasetReader

0 comments on commit 39672e8

Please sign in to comment.