local globeIdentifier = asset.require("../../earth").Earth.Identifier


local Name = "Tsunami Historical Series: Aleutian Islands - 1946"
local Identifier = "noaa-sos-oceans-tsunami_historical_series-aleutians"
local Description = [[On April 1, 1946 at 4:28 am (12:28 UTC), an 8.6 moment magnitude 
earthquake struck off the coast of Unimak Island in Alaska's Aleutian Islands, 
generating a tsunami that caused the greatest damage and number of deaths in Hawaii's 
history, leading to the creation of the United States' first tsunami warning system. As 
is typical for dangerous tsunamis the greatest wave heights were nearest the epicenter. 
The waves reached as high as 42 m or about 138 ft. on Unimak Island and destroyed its 
lighthouse and killed the five people there. Elsewhere this tsunami caused the greatest 
damage and number of deaths on inhabited Pacific islands. In Hawaii the waves reached 
about 17 m or 55 ft. high and killed 158 people, most in the town of Hilo, while in the 
Marquesas Islands in French Polynesia the waves reached even higher to 20 m or 65 ft but 
killed only two people. Chile's Easter Island also got nearly 9 m or 28 ft.while its Juan 
Fernandez Islands got nearly 3 m or 9 ft. high waves. Pitcairn Island also had 5 m or 16 
ft. high waves, New Zealand had over 2 m or 8 ft. high waves, and Samoa had over 1 m or 
about 4 ft. high waves. In North America the highest waves were in California at over 2 m 
or over 8 ft. and killed one person there and in South America it killed one more person 
in Peru]]
local URL = "https://sos.noaa.gov/catalog/datasets/tsunami-historical-series-aleutian-islands-1946/"


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

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

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

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

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


asset.onInitialize(function() 
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_coastal)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_energy_coastal)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_energy)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_null)
end)


asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_coastal)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_energy_coastal)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_energy)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_null)
end)

asset.export(layer_coastal)
asset.export(layer_energy_coastal)
asset.export(layer_energy)
asset.export(layer_null)


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