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



local Name = "Hurricane Season - 2005"
local Identifier = "noaa-sos-atmosphere-2005_hurricane-grayir"
local Description = [["This hurricane season shattered records that have stood for
decades - most named storms, most hurricanes and most category five storms. Arguably, it
was the most devastating hurricane season the country has experienced in modern times,"
said retired Navy Vice Adm. Conrad C. Lautenbacher, Jr., Ph.D., undersecretary of
commerce for oceans and atmosphere and NOAA administrator]]
local URL = "https://sos.noaa.gov/catalog/datasets/hurricane-season-2005/"


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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "TemporalTileLayer",
  Mode = "Folder",
  Folder = {
    Folder = syncedDirectory .. "images",
    -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the
    -- time formatting string
    Format = "ir_combined_%Y%m%d_%H%M.jpg"
  },
  Description = Description
}


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

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

asset.export(Layer)



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