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



local Name = "Tsunami Historical Series: Cascadia - 1700"
local Identifier = "noaa-sos-oceans-tsunami_historical_series-cascadia"
local Description = [[Just before midnight on January 27, 1700 a tsunami struck the
coasts of Japan without warning since no one in Japan felt the earthquake that must have
caused it. Nearly 300 years later scientists and historians in Japan and the United
States solved the mystery of what caused this "orphan tsunami" through careful analysis
of historical records in Japan as well as oral histories of Native Americans, sediment
deposits, and ghost forests of drowned trees in the Pacific Northwest of North America,
a region also known as Cascadia. They learned that this geologically active region, the
Cascadia Subduction Zone, not only hosts erupting volcanoes but also produces megathrust
earthquakes capable of generating devastating, ocean-crossing tsunamis. By comparing the
tree rings of dead trees with those still living they could tell when the last of these
great earthquakes struck the region. The trees all died in the winter of 1699 - 1700 when
the coasts of northern California, Oregon, and Washington suddenly dropped 1- 2 m (3.3 -
6.6 ft.), flooding them with seawater. That much motion over such a large area requires a
very large earthquake to explain it - perhaps as large as 9.2 magnitude, comparable to
the Great Alaska Earthquake of 1964. Such an earthquake would have ruptured the earth
along the entire length of the 1000 km (~600 mi) long fault of the Cascadia Subduction
Zone and severe shaking could have lasted for 5 minutes or longer. Its tsunami would
cross the Pacific Ocean and reach Japan in about 9 hours, so the earthquake must have
occurred around 9:00 at night in Cascadia on January 26, 1700 (05:00 January 27 UTC)]]
local URL = "https://sos.noaa.gov/catalog/datasets/tsunami-historical-series-cascadia-1700/"


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

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

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

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