local globe = asset.require("../../earth")



local Name = "Carbon Monoxide - 2000"
local Identifier = "noaa-sos-atmosphere-carbon_monoxide"
local Description = [[Carbon monoxide is known as "The Silent Killer" because it is a
colorless, odorless, tasteless gas that is poisonous to humans and other oxygen breathing
organisms. It is also naturally occurring in the atmosphere. Only in high concentrations
is carbon monoxide deadly. At the Earth's surface the concentration of carbon monoxide is
100 ppb (parts per billion), however, in urban areas it can get up to 10 ppm (parts per
million) or 100 times higher. One of the main anthropogenic sources of carbon monoxide in
the atmosphere is emissions from automobiles. In areas with heavy traffic the carbon
monoxide can be measured at 50 ppm. The natural sources of carbon monoxide include
volcanoes and brush burning. Between the anthropogenic and natural sources, scientists
estimate that the annual production of carbon monoxide is 2-5 gigatons]]
local URL = "https://sos.noaa.gov/catalog/datasets/carbon-monoxide-2000/"

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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ImageSequenceTileLayer",
  FolderPath = syncedDirectory .. "1024",
  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 }
}


asset.onInitialize(function()
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", Layer)
  openspace.addScreenSpaceRenderable(Colorbar)
end)

asset.onDeinitialize(function()
  openspace.removeScreenSpaceRenderable(Colorbar)
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", Layer)
end)

asset.export(Layer)
asset.export(Colorbar)



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