Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 3.03 KB

README.md

File metadata and controls

57 lines (42 loc) · 3.03 KB

DataPlus2018

This repository contains supplementary scripts for the Energy Infrastructure Map of the World Dataset, a product of Team 10 in the Data Plus Program at Duke University.

Generating inputs for machine learning pipelines

multiclassmask.py

Within input folder, converts all CSV files of annotations into multiclass mask for input into machine learning models. Outputs mask as tif and npz file, with options for other output formats. Example terminal command: python multiclassmask.py folder_name/

Conversion between pixel- and geo-coordinates

PixToGeo.py

Description: Converts pixel coordinate annotations retained in a json file to geocoordinates. A geojson file containing the geocoordiantes as well as image metadata is created.

Usage: Run this script in the directory containing the tiff files and their associated json files. The files should share the same name prior to the extention (example.tif, example.json). A geojson with the same name will be generated (example.geojson).

geoToPix.py

Description: Script to pull pixel coordinates from the properties section of geojson files generated by pixToGeo.py. A json file containing the pixel coordinates is generated. The file is formatted to be read into pyimmannotate (an annotation tool create by Artem Streltsov).

Usage: Run this script in the directory that contains the geojson files to be converted and their associated tif images. Both the tif and geojson must have the same name before the extention. In practice, example.tif and example.geojson are input and example.json is created.

Merging and unmerging files

merge_geojson.py

Description: Script to output one geojson file from a set of given geojson files. The new geojson file is created by appending all geojson features (http://wiki.geojson.org/GeoJSON_Features) to an array outputted as a geojson.

Usage: To use the script, run $ merge_geojson.py in your cmd. All geojson in the current working directory are then merged to merged_geojson.geojson .

unmerge_geojson.py

Description: Script to output the original geojson files from a given geojson file. The original geojson files are recreated by sorting geojson features (http://wiki.geojson.org/GeoJSON_Features) by their respective filename property.

Usage: To use the script, run $ unmerge_geojson.py examplefile.geojson in your cmd. The examplefile.geojson is then unmerged.

cutTiff.py

Cuts input tif into specified patches of specific size using gdal_translate. Different from numpy approach in patching.py because this does not loop through values within the tif file. Example terminal command: python cutTiff.py Brazil_Rio_1.tif 5000

mergeTiff.py

Merges all tif files in given folder, using geo-coordinates, into a single image 'output.tif'. Run with: python mergeTiff.py folder_name/

Files used to create dataset

WorldView3_converter_folder.py

Converts WorldView3 satellite imagery (SpaceNet images) into viewable format, scaled according to global max and min. Example run: python WorldView3_converter_folder.py input_folder/ output_folder/