Skip to content

Commit 81d7ba6

Browse files
wouellettewouellette
authored andcommitted
updated unit tests
1 parent c559fcf commit 81d7ba6

16 files changed

+146
-49
lines changed

label_maker/label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def make_labels(dest_folder, zoom, country, classes, ml_type, bounding_box, spar
122122

123123
# write out labels as numpy arrays
124124
labels_file = op.join(dest_folder, 'labels.npz')
125-
# print('Writing out labels to {}'.format(labels_file))
125+
print('Writing out labels to {}'.format(labels_file))
126126
np.savez(labels_file, **tile_results)
127127

128128
# write out labels as GeoJSON or PNG

label_maker/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ def cli():
8484
raise Exception(v.errors)
8585

8686
# for aoi, overwrite bounding_box config key to correct labelling
87-
if 'aoi' in config.keys:
87+
if 'aoi' in config.keys():
8888
config['bounding_box'] = get_bounds(json.load(open(config.get('aoi'), 'r')))
8989

9090
# custom validation for top level keys
9191
# require either: country & bounding_box or geojson
92-
if 'geojson' not in config.keys()) and not ('country' in config.keys() and 'bounding_box' in config.keys()):
92+
if 'geojson' not in config.keys() and not ('country' in config.keys() and 'bounding_box' in config.keys()):
9393
raise Exception('either "geojson" or "country" and "bounding_box" must be present in the configuration JSON')
9494

9595
# for geojson, overwrite other config keys to correct labeling

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Pillow==4.3.0
1212
protobuf==3.5.0.post1
1313
pyclipper==1.0.6
1414
pycurl==7.43.0.1
15-
pyproj==1.9.5.1
16-
rasterio==1.0a12
15+
pyproj==2.1.3
16+
rasterio==1.0.21
1717
requests>=2.20.0
1818
Shapely>=1.6.3
1919
six==1.10.0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"country": ["portugal"],
3+
"aoi": "test/fixtures/integration/portugal_aoi.geojson",
4+
"zoom": 17,
5+
"classes": [
6+
{ "name": "Water Tower", "filter": ["==", "man_made", "water_tower"] },
7+
{ "name": "Building", "filter": ["has", "building"] },
8+
{ "name": "Farmland", "filter": ["==", "landuse", "farmland"] },
9+
{ "name": "Ruins", "filter": ["==", "historic", "ruins"] },
10+
{ "name": "Parking", "filter": ["==", "amenity", "parking"] },
11+
{ "name": "Roads", "filter": ["has", "highway"] }
12+
],
13+
"imagery": "https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=ACCESS_TOKEN",
14+
"background_ratio": 1,
15+
"ml_type": "classification",
16+
"seed": 19
17+
}

test/fixtures/integration/config.integration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "portugal",
2+
"country": ["portugal"],
33
"bounding_box": [
44
-9.4575,
55
38.8467,

test/fixtures/integration/config.integration.object_detection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "portugal",
2+
"country": ["portugal"],
33
"bounding_box": [
44
-9.4575,
55
38.8467,

test/fixtures/integration/config.integration.segmentation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "portugal",
2+
"country": ^["portugal"],
33
"bounding_box": [
44
-9.4575,
55
38.8467,

test/fixtures/integration/config.integration.segmentation_sparse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "portugal",
2+
"country": ["portugal"],
33
"bounding_box": [
44
-9.4575,
55
38.8467,

test/fixtures/integration/config.integration_sparse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "portugal",
2+
"country": ["portugal"],
33
"bounding_box": [
44
-9.4575,
55
38.8467,

test/fixtures/integration/config.intergration.geotiff_package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"country": "sao_tome_and_principe",
2+
"country": ["sao_tome_and_principe"],
33
"bounding_box": [6.72746119738703,0.3382909054246151,6.72776258384623,0.33878086940393715],
44
"zoom": 20,
55
"classes": [

0 commit comments

Comments
 (0)