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



local Name = "Hurricane Sandy: Linear IR - Oct. 2012"
local Identifier = "noaa-sos-atmosphere-sandy"
local Description = [[Hurricane Sandy was a memorable and disastrous storm that hit the
  Caribbean islands and the Mid-Atlantic States in October of 2012.It was the second
  costliest storm in U.S. history, after Hurricane Katrina]]
local URL = "https://sos.noaa.gov/catalog/datasets/precipitable-water-galveston-hurricane-1900/"


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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "TemporalTileLayer",
  Mode = "Folder",
  Folder = {
    Folder = syncedDirectory .. "4096",
    -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the
    -- time formatting string
    Format = "linear_rgb_cyl_%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/"
}
