diff --git a/data/assets/examples/temperature_land_highres.asset b/data/assets/examples/temperature_land_highres.asset index 7a2552d6f5..b34baebc90 100644 --- a/data/assets/examples/temperature_land_highres.asset +++ b/data/assets/examples/temperature_land_highres.asset @@ -11,6 +11,7 @@ local layer_prototype = { Identifier = "ERA5_Land_HighRes_Monthly_2M_Temperature_Temporal_prototype", Name = "ERA5 Land HighRes Monthly 2M Temperature (Temporal) [Prototype]", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "1981-01-01", @@ -29,6 +30,7 @@ local layer_folder = { Identifier = "ERA5_Land_HighRes_Monthly_2M_Temperature_Temporal_folder", Name = "ERA5 Land HighRes Monthly 2M Temperature (Temporal) [Folder]", Type = "TemporalTileLayer", + Mode = "Folder", Folder = { Folder = "C:/Development/sync/http/earth_textures_climate/1", Format = "%Y-%m-%d-land.png" diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/amsr2_gcom_w1_sea_ice_concentration_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/amsr2_gcom_w1_sea_ice_concentration_temporal.asset index 80a6eeb6f7..98388e8e7b 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/amsr2_gcom_w1_sea_ice_concentration_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/amsr2_gcom_w1_sea_ice_concentration_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "AMSR2_GCOM_W1_Sea_Ice_Concentration_Temporal", Name = "AMSR2 GCOM W1 Sea Ice Concentration (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2012-05-08", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/aqua_modis_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/aqua_modis_temporal.asset index 19388a7c0c..4807d05cd1 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/aqua_modis_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/aqua_modis_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "Aqua_Modis_Temporal", Name = "Aqua Modis (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2002-07-04", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_viirs_combo.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_viirs_combo.asset index 4d93c325cd..374d067466 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_viirs_combo.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_viirs_combo.asset @@ -13,6 +13,7 @@ local layer = { Identifier = "Temporal_VIIRS_SNPP", Name = "Temporal VIIRS SNPP", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2015-11-24", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset index 0144aad829..9bf43d88d2 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "GHRSST_L4_G1SST_Sea_Surface_Temperature_Temporal", Name = "GHRSST L4 G1SST Sea Surface Temperature (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2010-06-21", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal.asset index 7b6c4cf9a4..4efb087717 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "GHRSST_L4_MUR_Sea_Surface_Temperature_Temporal", Name = "GHRSST L4 MUR Sea Surface Temperature (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2002-06-01", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/modis_terra_chlorophyll_a_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/modis_terra_chlorophyll_a_temporal.asset index 52a4945c6e..c4377b380e 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/modis_terra_chlorophyll_a_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/modis_terra_chlorophyll_a_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "MODIS_Terra_Chlorophyll_A_Temporal", Name = "MODIS Terra Chlorophyll A (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2013-07-02", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/terra_modis_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/terra_modis_temporal.asset index 50d8e1e535..fa39b2eff3 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/terra_modis_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/terra_modis_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "Terra_Modis_Temporal", Name = "Terra Modis (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2000-02-24", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/viirs_snpp_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/viirs_snpp_temporal.asset index 681cfe33d4..d1bb41c089 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/viirs_snpp_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/viirs_snpp_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "VIIRS_SNPP_Temporal", Name = "VIIRS SNPP (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2015-11-24", diff --git a/data/assets/scene/solarsystem/planets/earth/layers/nightlayers/earth_at_night_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/nightlayers/earth_at_night_temporal.asset index 3bf26d12fd..bd3c7f6cfb 100644 --- a/data/assets/scene/solarsystem/planets/earth/layers/nightlayers/earth_at_night_temporal.asset +++ b/data/assets/scene/solarsystem/planets/earth/layers/nightlayers/earth_at_night_temporal.asset @@ -4,6 +4,7 @@ local layer = { Identifier = "Earth_at_Night_Temporal", Name = "Earth at Night (Temporal)", Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = "2012-05-08", diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua index b2905defa0..8f2d50bc29 100644 --- a/modules/globebrowsing/scripts/layer_support.lua +++ b/modules/globebrowsing/scripts/layer_support.lua @@ -96,6 +96,7 @@ openspace.globebrowsing.addGibsLayer = function(layer, resolution, format, start local layer = { Identifier = layerName, Type = "TemporalTileLayer", + Mode = "Prototyped", Prototyped = { Time = { Start = startDate, diff --git a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp index d8f24486e2..a3d4bef00a 100644 --- a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp @@ -77,6 +77,17 @@ namespace { // [[codegen::verbatim(FixedTimeInfo.description)]] std::optional fixedTime; + enum class Mode { + Prototyped, + Folder + }; + // The mode that his temporal tile provider operates in. In the `Prototyped` mode, + // a given start and end time, temporal resolution, and perscriptive time format + // is used to generate the information used by GDAL to access the data. In the + // `folder` method, a folder and a time format is provided and each file in the + // folder is scanned using the time format instead + Mode mode; + struct Prototyped { struct Time { // The (inclusive) starting time of the temporal image range @@ -163,10 +174,16 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary) const Parameters p = codegen::bake(dictionary); - if (p.prototyped.has_value() == p.folder.has_value()) { - // Doesn't matter if they are both false or both true + // Make sure that the user provided the data that they requested. The mode parameter + // is a required one and these two if statements tie the table requirement to the mode + if (p.mode == Parameters::Mode::Folder && !p.folder.has_value()) { throw ghoul::RuntimeError( - "Need to specify exactly one of the 'Prototyped' and 'Folder' values" + "When selecting the `Folder` mode, a `Folder` table must be specified" + ); + } + if (p.mode == Parameters::Mode::Prototyped && !p.prototyped.has_value()) { + throw ghoul::RuntimeError( + "When selecting the `Prototyped` mode, a `Prototyped` table must be specified" ); }