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



local Name = "Blue Marble - Seasonal"
local Identifier = "noaa-sos-land-seasonal_blue_marble"
local Description = [[The Blue Marble is an incredibly detailed, true-color depiction of
the Earth. NASA is responsible for this dataset made from a compilation of satellite
images throughout 2001. Most of the information came from NASA's MODIS, the Moderate
Resolution Imaging Spectroradiometer, which is attached to the Terra satellite 435 miles
above Earth. The background image of the land and oceans was created using data from June
through September of 2001. This could not be done in a single day or even a week because
on any given day clouds are blocking a significant portion of the surface]]
local URL = "https://sos.noaa.gov/catalog/datasets/blue-marble-seasonal/"


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


local Layer = {
  Identifier = Identifier,
  Name = Name,
  Enabled = asset.enabled,
  Type = "TemporalTileLayer",
  Mode = "Folder",
  Folder = {
    Folder = syncedDirectory .. "4096",
    -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the
    -- time formatting string
    Format = "world%Y%jx4kx2k.jpg"
  },
  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/"
}
