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



local Name = "Float Tracks: Argo (buoy surface animation)"
local Identifier = "noaa-sos-oceans-argo_buoy_tracks"
local Description = [["Argo is a global array of 3,000 free-drifting profiling floats
that measures the temperature and salinity of the upper 2000 m of the ocean. This allows,
for the first time, continuous monitoring of the temperature, salinity, and velocity of
the upper ocean, with all data being relayed and made publicly available within hours
after collection." - from the Argo website. In Greek mythology, Jason sailed on the ship
Argo to capture a golden fleece. In the world of oceanography, Jason is a satellite
altimeter that allows scientists to measure the heights of the ocean surfaces. This
worldwide buoy program was named Argo because the data from the Jason project and from
this buoy project will be used together in computer models to help forecast ocean
climate]]
local URL = "https://sos.noaa.gov/catalog/datasets/float-tracks-argo-buoy-surface-animation/"


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 .. "4096",
  Description = Description
}

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


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

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

asset.export(Layer)
asset.export(Buoy)



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