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


local Name = "Buoy and Float Locations"
local Identifier = "noaa-sos-oceans-buoy_locations"
local Description = [[Buoys and floats with the ability to collect data are scattered 
through out the world's oceans in order to gain a better understanding of how the oceans 
work and how they are changing. The data is being used for monitoring chemical levels in 
the oceans, garnering accurate ocean temperatures and change in temperature, and many 
other endless uses. Each dot on this visualization represents a buoy or float, and each 
color indicates the use of the instrument. The buoy network is still expanding past what 
can be seen on this visualization]]
local URL = "https://sos.noaa.gov/catalog/datasets/buoy-and-float-locations/"


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 colorbar = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ScreenSpaceImageLocal",
  TexturePath = syncedDirectory .. "colorbar.png",
  FaceCamera = false,
  CartesianPosition = { 0.85, 0.0, -2.0 }
}

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

asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer)
  openspace.removeScreenSpaceRenderable(colorbar)
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/"
}
