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



local Name = "Tsunami Historical Series: Lisbon - 1755"
local Identifier = "noaa-sos-oceans-tsunami_historical_series-lisbon"
local Description = [[On the morning of November 1, 1755, a great earthquake shook
Portugal's capital city of Lisbon as worshipers filled churches and cathedrals for the
All Saints' Day Mass. In seconds it left the city in ruins and in minutes those ruins
were on fire. The earthquake probably killed about 30,000 people, though some estimates
double that figure. Many of the survivors fled to the wharves and keys of Lisbon's port,
but they would find no safety there. The first tsunami wave surged up the Tagus estuary
about an hour after the earthquake, reached a maximum runup of 12 meters (40 feet), and
killed another 1000 people. At least two more tsunami waves surged into the city,
completing the earthquake's destruction]]
local URL = "https://sos.noaa.gov/catalog/datasets/tsunami-historical-series-lisbon-1755/"


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


local LayerCoastal = {
  Identifier = Identifier .. "-coastal",
  Name = Name .. " (Coastal)",
  FilePath = syncedDirectory .. "Tsunami_Coastal_Map_Lisbon_1755_4k.jpg",
  Description = Description
}

local LayerEnergyCoastal = {
  Identifier = Identifier .. "-energy_coastal",
  Name = Name .. " (Energy Coastal)",
  FilePath = syncedDirectory .. "Tsunami_Energy+Coastal_Map_Lisbon_1755_4k.jpg",
  Description = Description
}

local LayerEnergy = {
  Identifier = Identifier .. "-energy",
  Name = Name .. " (Energy)",
  FilePath = syncedDirectory .. "Tsunami_Energy_Map_Lisbon_1755_4k.jpg",
  Description = Description
}

local LayerNull = {
  Identifier = Identifier .. "-null",
  Name = Name .. " (Null)",
  FilePath = syncedDirectory .. "Tsunami_Null_Coastal_Map_Lisbon_1755_4k.jpg",
  Description = Description
}


asset.onInitialize(function()
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", LayerCoastal)
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", LayerEnergyCoastal)
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", LayerEnergy)
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", LayerNull)
end)

asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", LayerNull)
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", LayerEnergy)
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", LayerEnergyCoastal)
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", LayerCoastal)
end)

asset.export(LayerCoastal)
asset.export(LayerEnergyCoastal)
asset.export(LayerEnergy)
asset.export(LayerNull)



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