Geographic Information Systems Asked on June 15, 2021
I have the code below, however, when I try to plot my chart, I am getting one error message. I believe this is related to the fact that within my object VIIR2014List
I have two lists, one for average radiance, another for coordinates.
How can I get rid of this error message?
////////////////------------------------------------------------ VIIRS DATA
var VIIRS = ee.ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG");
VIIRS = VIIRS.select('avg_rad');
var latLon = ee.Image.pixelLonLat().select('longitude');
var VIIRS2014 = VIIRS.filterDate('2014-1-1','2015-1-1').mean().addBands(latLon);
var VIIRS2019 = VIIRS.filterDate('2019-1-1','2020-1-1').mean().addBands(latLon);
var VIIR2014List = VIIRS2014.reduceRegion({
reducer: ee.Reducer.toList(),
geometry: mydiagonal,
scale: 1000,
maxPixels: 1e9
});
print (VIIR2014List, "Lists 2014"); /// 2014
var VIIR2019List = VIIRS2019.reduceRegion({
reducer: ee.Reducer.toList(),
geometry: mydiagonal,
scale: 1000,
maxPixels: 1e9
});
print (VIIR2019List, "Lists 2019"); /// 2019
The returned object is an ee.Dictionary()
. Get the single list values from the dictionary and plot these as follows:
// subset the lists
var lon = ee.List(VIIR2014List.get('longitude'))
var avgRad = ee.List(VIIR2014List.get('avg_rad'))
var chart = ui.Chart.array.values(avgRad, 0, lon )
See full link
Correct answer by Kuik on June 15, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP