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
[ | |
{ | |
"number": 0, | |
"timestamp": 1433080800 | |
}, | |
{ | |
"number": -6, | |
"timestamp": 1433084400 | |
}, | |
{ |
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
// GRID3 population data | |
var img_pop3 = ee.ImageCollection('users/henrique/GRID3_NGA_PopEst_v1_1_mean_float') | |
// Nigerian nightlights (1Y median) | |
var nighttime = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG') | |
.filter(ee.Filter.date('2018–09–01', '2019–09–30')) | |
.median() | |
.select('avg_rad') | |
.clipToCollection(nigeria); | |
// Demand layer | |
var demand = img_pop3.gte(pop_threshold) // threshold population |
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
// GMeans Segmentation | |
var seg = ee.Algorithms.Image.Segmentation.GMeans(smooth.gt(demand_threshold), 3, 50, 10); | |
Map.addLayer(seg.randomVisualizer(), {opacity:0.5}, 'GMeans Segmentation'); | |
// SNIC Segmentation | |
var snic = ee.Algorithms.Image.Segmentation.SNIC(smooth.gt(demand_threshold), 30, 0, 8, 300); | |
Map.addLayer(snic.randomVisualizer(), {opacity:0.5}, 'SNIC Segmentation'); | |
// Uniquely label the patches and visualize. | |
var patchid = smooth.gt(demand_threshold) | |
.connectedComponents(ee.Kernel.plus(1), 256); |
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
// Make a suitable image for `reduceConnectedComponents()` | |
// by adding a label band to the `img_pop3` image. | |
img_pop3 = img_pop3.addBands(patchid.select('labels')); | |
// Calculate the total population in demand area | |
// defined by the previously added "labels" band | |
// and reproject to original scale | |
var patchPop = img_pop3.reduceConnectedComponents({ | |
reducer: ee.Reducer.sum(), | |
labelBand: 'labels', |
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
{ | |
"classes": ["apple", "aquarium_fish", "baby", "bear", "beaver", "bed", "bee", "beetle", "bicycle", "bottle", "bowl", "boy", "bridge", "bus", "butterfly", "camel", "can", "castle", "caterpillar", "cattle", "chair", "chimpanzee", "clock", "cloud", "cockroach", "couch", "crab", "crocodile", "cup", "dinosaur", "dolphin", "elephant", "flatfish", "forest", "fox", "girl", "hamster", "house", "kangaroo", "keyboard", "lamp", "lawn_mower", "leopard", "lion", "lizard", "lobster", "man", "maple_tree", "motorcycle", "mountain", "mouse", "mushroom", "oak_tree", "orange", "orchid", "otter", "palm_tree", "pear", "pickup_truck", "pine_tree", "plain", "plate", "poppy", "porcupine", "possum", "rabbit", "raccoon", "ray", "road", "rocket", "rose", "sea", "seal", "shark", "shrew", "skunk", "skyscraper", "snail", "snake", "spider", "squirrel", "streetcar", "sunflower", "sweet_pepper", "table", "tank", "telephone", "television", "tiger", "tractor", "train", "trout", "tulip", "turtle", "wardrobe", "whale", "willow_tree", "wolf", " |
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
{ | |
"0": "tench, Tinca tinca", | |
"1": "goldfish, Carassius auratus", | |
"2": "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias", | |
"3": "tiger shark, Galeocerdo cuvieri", | |
"4": "hammerhead, hammerhead shark", | |
"5": "electric ray, crampfish, numbfish, torpedo", | |
"6": "stingray", | |
"7": "cock", | |
"8": "hen", |