-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding tests for polygons and data_io
- Loading branch information
1 parent
700fbf6
commit 08ce1da
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
@test "testing input output functions" begin | ||
package_path = pathof(NighttimeLights) | ||
path_len = length(package_path) | ||
assets_path = package_path[1:path_len-22] * "assets" | ||
map_path = assets_path * "/mumbai_map/mumbai_districts.shp" | ||
radiance_jld_path = assets_path * "/mumbai_ntl/datacube/mumbai_radiance.jld" | ||
radiance_img_path = assets_path * "/mumbai_ntl/img/april2012.tif" | ||
@test length(size(load_datacube(radiance_jld_path))) == 3 | ||
@test length(size(load_img(radiance_img_path))) == 2 | ||
@test sizeof(load_shapefile(map_path)) > 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@testset "Testing functions on polygons and shapefiles" begin | ||
package_path = pathof(NighttimeLights) | ||
path_len = length(package_path) | ||
assets_path = package_path[1:path_len-22] * "assets" | ||
map_path = assets_path * "/mumbai_map/mumbai_districts.shp" | ||
|
||
radiance_datacube = rand(1:100, 156, 85, 95) | ||
mumbai_districts = load_shapefile(map_path) | ||
mumbai_districts_ntl = aggregate_dataframe(MUMBAI_COORDINATE_SYSTEM, radiance_datacube, mumbai_districts, "DISTRICT") | ||
@test sizeof(mumbai_districts_ntl) > 0 | ||
|
||
district1 = mumbai_dists[1,:] # Select the first district | ||
district1_mask = polygon_mask(my_coordinate_system, district1) | ||
|
||
@test sum(district1_mask) >=0 | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters