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



local Name = "Ocean Drain (with gray bathymetry)"
local Identifier = "noaa-sos-oceans-ocean_drain-gray"
local Description = [[Beneath the sea surface is an amazing sea floor that contains
mountain ranges, trenches and plains. The ocean covers 71% of the Earth's surface, has an
area of 139,400,000 square miles and an average depth of 2.3 miles. Due to this vast
size, only a few percent the sea floor has been mapped by ships. Maps of the sea floor
are created by combining soundings from ships, sonar scans from ships, and gravity
anomalies in the sea surface detected by satellites]]
local URL = "https://sos.noaa.gov/catalog/datasets/ocean-drain-with-gray-bathymetry/"


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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ImageSequenceTileLayer",
  FolderPath = syncedDirectory .. "4096",
  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/"
}
