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



local Name = "Climate Model: Sea Ice Change (GFDL a1b) 1861 - 2100"
local Identifier = "noaa-sos-models-gfdl_seaice"
local Description = [[In the coming decades, the Arctic region is projected to warm at
about twice the rate of the global average according to the scientists at NOAA's
Geophysical Fluid Dynamics Laboratory. This is not good news for the Arctic sea ice. In
fact, the concentration of sea ice in the northern latitudes has been decreasing over the
past 30 years and this trend is expected to continue as the climate changes. The
disappearance of sea ice can have a major impact globally. Melting sea ice can disturb
the global ocean conveyor belt, impact sea life and the fishing industry, and change the
Earth energy budget. Sea ice cools the climate because it is reflective and so returns
much of the sun's warming back to space. As the ice melts, more of this energy is
absorbed in the darker ocean water. The temperature increases as more sunlight is
absorbed rather than reflected. This is a positive feedback loop because as temperature
rises, more sea ice melts causing increased absorption which leads to rising
temperatures]]
local URL = "https://sos.noaa.gov/catalog/datasets/climate-model-sea-ice-change-gfdl-a1b-1861-2100/"


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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ImageSequenceTileLayer",
  FolderPath = syncedDirectory .. "images",
  Description = Description
}

local Colorbar = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ScreenSpaceImageLocal",
  TexturePath = syncedDirectory .. "colorbar_big.png",
  FaceCamera = false,
  CartesianPosition = { 0.0, -0.5, -2.0 }
}


asset.onInitialize(function()
  openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", Layer)
  openspace.addScreenSpaceRenderable(Colorbar)
end)

asset.onDeinitialize(function()
  openspace.removeScreenSpaceRenderable(Colorbar)
  openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", Layer)
end)

asset.export(Layer)
asset.export(Colorbar)



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