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


local Name = "Human Influences on Marine Ecosystems"
local Identifier = "noaa-sos-oceans-marine_impacts"
local Description = [[The ocean has an impact on the lives of everyone on Earth, even 
those who don't live on the coasts. It has been estimated that one in every six jobs in 
the United States is marine-related and that 50% of all species on Earth are supported by 
the ocean. Because of this, it is important to protect and preserve the oceans. Humans 
however have been shown to have a negative impact on the oceans. A report issued in 
February 2008 found that 40% of the world's oceans are heavily impacted by human 
activities, such as overfishing and pollution. In all 17 different human activities were 
examined in the report, including fertilizer run-off, commercial shipping, and indirect 
activities such as changes in sea surface temperature, UV radiation, and ocean 
acidification]]
local URL = "https://sos.noaa.gov/catalog/datasets/human-influences-on-marine-ecosystems/"


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

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

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

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

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

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

asset.export(layer)
asset.export(colorbar)
asset.export(colorbar_human_impact)


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/"
}
