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


local Name = "Tsunami Historical Series: Alaska - 1964"
local Identifier = "noaa-sos-oceans-tsunami_historical_series-alaska"
local Description = [[At 5:36 pm on Friday, March 27, 1964 (28 March, 03:36Z UTC) the 
largest earthquake ever measured in North America, and the second-largest recorded 
anywhere, struck 40 miles west of Valdez, Alaska in Prince William Sound with a moment 
magnitude we now know to be 9.2. Almost an hour and a half later the Honolulu Magnetic 
and Seismic Observatory (later renamed the Pacific Tsunami Warning Center, or PTWC) was 
able to issue its first "tidal wave advisory" that noted that a tsunami was possible and 
that it could arrive in the Hawaiian Islands five hours later. Upon learning of a tsunami 
observation in Kodiak Island, Alaska, an hour and a half later the Honolulu Observatory 
issued a formal "tidal wave/seismic sea-wave warning" cautioning that damage was possible 
in Hawaii and throughout the Pacific Ocean but that it was not possible to predict the 
intensity of the tsunami. The earthquake did in fact generate a tsunami that killed 124 
people (106 in Alaska, 13 in California, and 5 in Oregon) and caused about $2.3 billion 
(2016 dollars) in property loss all along the Pacific coast of North America from Alaska 
to southern California and in Hawaii. The greatest wave heights were in Alaska at over 
67 m or 220 ft. and waves almost 10 m or 32 ft high struck British Columbia, Canada. In 
the "lower 48" waves as high as 4.5 m or 15 ft. struck Washington, as high as 3.7 m or 
12 ft. struck Oregon, and as high as 4.8 m or over 15 ft. struck California. Waves of 
similar size struck Hawaii at nearly 5 m or over 16 ft. high. Waves over 1 m or 3 ft. 
high also struck Mexico, Chile, and even New Zealand]]
local URL = "https://sos.noaa.gov/catalog/datasets/tsunami-historical-series-alaska-1964/"


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

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

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

local layer_null = {
  Identifier = Identifier .. "-null",
  Name = Name .. " (Null)",
  FilePath = syncedDirectory .. "Tsunami_Null_Coastal_Map_Alaska_1964_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/"
}
