local globeIdentifier = asset.require("../../earth").Earth.Identifier


local Name = "Land Cover: Woody Biomass in Pan-tropics"
local Identifier = "noaa-sos-land-pantropical_biomass"
local Description = [[Tropical deforestation and forest degradation account for an 
estimated 20% of the world's anthropogenic emissions of carbon dioxide, a significant 
greenhouse gas contributor. Despite the important services that tropical forests provide, 
there is incomplete data and knowledge of their condition and coverage, and thus no 
accurate baseline for evaluating and monitoring future changes]]
local URL = "https://sos.noaa.gov/catalog/datasets/land-cover-woody-biomass-in-pan-tropics/"


local syncedDirectory = asset.syncedResource({
  Name = Name,
  Type = "HttpSynchronization",
  Identifier = Identifier,
  Version = 1
})

local layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  FilePath = syncedDirectory .. "4096.jpg",
  Description = Description
}

local legend = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ScreenSpaceImageLocal",
  TexturePath = syncedDirectory .. "legend.jpg",
  FaceCamera = false,
  CartesianPosition = { 0.0, -0.5, -2.0 }
}


asset.onInitialize(function ()
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer)
  openspace.addScreenSpaceRenderable(legend);  
end)

asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer)
  openspace.removeScreenSpaceRenderable(legend)
end)

asset.export(layer)
asset.export(legend)


asset.meta = {
  Name = Name,
  Version = "1.0",
  Description = Description .. "Data provided by the National Oceanic and Atmospheric Administration",
  Author = "National Oceanic and Atmospheric Administration",
  URL = URL,
  License = "https://sos.noaa.gov/copyright/"
}
