Monday, 23 October 2017

google earth engine - Cannot add an object of type object as a layer


I keep getting the error: Cannot add an object of type object as a layer.


It is regarding line 53 of the link below (code is also copied below, error: Map.addLayer(CF_solar, CF_solar, "CF_solar")). I think I need to process the overlay differently but having tried multiple options, I am hitting a wall. What am I doing wrong?


GEE script



// import geometry (point to zoom in to)
var home_coords = ee.Geometry.Point([-7.6, 54.4])
var region = home_coords.buffer(20000);

// load image stack for one year
var dataset = ee.ImageCollection("NASA/GLDAS/V20/NOAH/G025/T3H")
.filterDate('2010-12-01', '2010-12-31')
.filterBounds(home_coords)

// has keys type, id, version, bands, features, properties

//print(dataset);

// extract air temperature, SW radiation for one year
var AirTemperature = dataset.select('Tair_f_inst'); //.rename("T");
var Irradiation_ShortWave = dataset.select('SWdown_f_tavg');
var WindSpeed = dataset.select('Wind_f_inst');

// take composite (yearly mean) of irradiation and air temp and store in different bands of image
var T_G_comp = ee.Image(AirTemperature.mean().subtract(273.15))
.addBands(ee.Image(Irradiation_ShortWave.mean()));


// ImageCollection, has same keys as above
//print(AirTemperature);

// Method for computing CFsolar mean
var CF = (
'(1-beta*(c1 + c2*T + c3*G - T_ref) + gamma*log_10(G+1))*G/G_ref',
{
'beta': 0.0045,
'c1': -3.75,

'c2': 1.14,
'c3': 0.0175,
'T_ref': 25,
'gamma': 0.1,
'G_ref': 1000,
'T': ee.Image(AirTemperature.mean().subtract(273.15)),
'G': ee.Image(Irradiation_ShortWave.mean()),
})

// use "print" to check any variables in the console

print(CF)

var T = {bands: "Tair_f_inst", min:-30, max: 688}
var G = {bands: "SWdown_f_tavg", min:-900, max: 999}
var CF_solar = {bands: "CF_solar", min: -999, max: 9310, palette: ["blue", "red", "orange", "yellow"]}


// Adding these layers is just doing a solid colour overlay.
Map.addLayer((AirTemperature.mean().subtract(273.15)), T, "T")
Map.addLayer((Irradiation_ShortWave.mean()), G, "G")


// Cannot add this type of object to a layer

Map.addLayer(CF_solar, CF_solar, "CF_solar")


// print graphs
//print(ui.Chart.image.doySeries(Irradiation_ShortWave, home_coords, ee.Reducer.mean(), 30));
//print(ui.Chart.image.doySeries(WindSpeed, home_coords, ee.Reducer.mean(), 30));


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...