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


local Name = "El Nino and La Nina Seasonal Impacts"
local Identifier = "noaa-sos-oceans-elnino"
local Description = [[El Nino is the warming of the Pacific Ocean off of the western 
coast of South America near Ecuador and Peru. It is called El Nino, or little boy in 
Spanish, referring to the Christ child because the phenomena was originally noticed near 
Christmas time. The opposite of El Nino is La Nina, or little girl in Spanish, which is a 
cooling of the Pacific Ocean. Because the Earth system is interconnected, changes in the 
ocean cause changes in the atmosphere. El Nino and La Nina events not only impact ocean 
temperatures in the tropical Pacific, but also global weather. The occurrence of El Nino 
and La Nina is not predictable, but on average occurs once every four year and usually 
lasts for about 18 months]]
local URL = "https://sos.noaa.gov/catalog/datasets/el-nino-and-la-nina-seasonal-impacts/"


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

local layer_elnino_summer = {
  Identifier = Identifier .. "-elnino_summer",
  Name = Name .. " (El Nino, summer)",
  FilePath = syncedDirectory .. "elnino-summer-no-map-transparent-shapes.png",
  Description = Description
}

local layer_elnino_winter = {
  Identifier = Identifier .. "-elnino_winter",
  Name = Name .. " (El Nino, winter)",
  FilePath = syncedDirectory .. "elnino-winter-no-map-transparent-shapes.png",
  Description = Description
}

local layer_lanina_summer = {
  Identifier = Identifier .. "-lanina_summer",
  Name = Name .. " (La Nina, summer)",
  FilePath = syncedDirectory .. "lanina-summer-no-map-transparent-shapes.png",
  Description = Description
}

local layer_lanina_winter = {
  Identifier = Identifier .. "-lanina_winter",
  Name = Name .. " (La Nina, winter)",
  FilePath = syncedDirectory .. "lanina-winter-no-map-transparent-shapes.png",
  Description = Description
}

asset.onInitialize(function() 
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_elnino_summer)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_elnino_winter)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_lanina_summer)
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_lanina_winter)
end)

asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_elnino_summer)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_elnino_winter)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_lanina_summer)
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer_lanina_winter)
end)

asset.export(layer_elnino_summer)
asset.export(layer_elnino_winter)
asset.export(layer_lanina_summer)
asset.export(layer_lanina_winter)


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