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



local Name = "Biosphere: Marine Chlorophyll Concentration Model"
local Identifier = "noaa-sos-oceans-chlorophyll_model"
local Description = [[This animation shows the daily concentration of ocean surface
chlorophyll as simulated by the Parallel Ocean Program (POP) with an embedded marine
ecosystem model. While POP calculates the ocean currents, temperature and salinity, the
ecosystem model simulates the complex interaction of microscopic marine plants
(chlorophyll-containing phytoplankton), animals (zooplankton) and nutrients (such as
nitrogen, phosphorus and iron). In addition to constituting a major part of the global
food web, phytoplankton remove carbon dioxide from the atmosphere via photosynthesis much
like their counterparts on land. As conditions in the ocean and atmosphere change due to
increased carbon emissions, it is important to be able to use these kinds of models to
understand the possible effects on life in the ocean and the global carbon cycle]]
local URL = "https://sos.noaa.gov/catalog/datasets/biosphere-marine-chlorophyll-concentration-model/"


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

local Colorbar = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "ScreenSpaceImageLocal",
  TexturePath = syncedDirectory .. "colorbar.png",
  FaceCamera = false,
  Scale = 0.3,
  BackgroundColor = { 1.0, 1.0, 1.0, 1.0 },
  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/"
}
