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



local Name = "Typhoon Haiyan: Water Vapor and SST - Oct - Nov 2013"
local Identifier = "noaa-sos-atmosphere-typhoon_haiyan-wvsst"
local Description = [[Typhoon Haiyan, also known in the Phillippines as Typhoon Yolanda,
may be the strongest recorded tropical cyclone to make landfall with sustained speeds up
to 195 mph. If confirmed, it would beat the previous record holder, Hurricane Camille
(1969). This dataset is taken from the Real-Time Linear IR satellite dataset and
Real-time: SST from October 30th to November 12th, 2013]]
local URL = "https://sos.noaa.gov/catalog/datasets/typhoon-haiyan-water-vapor-and-sst-oct-nov-2013/"


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

local Track = {
  Identifier = Identifier .. "-track",
  Name = Name .. " (Track)",
  Enabled = asset.enabled,
  FilePath = syncedDirectory .. "track.png",
  Description = Description
}


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

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

asset.export(Layer)
asset.export(Track)



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