From 5729d23f5134a8b799cdf0ee2de04062ef5d87eb Mon Sep 17 00:00:00 2001 From: floeschau Date: Tue, 15 Oct 2024 14:20:24 +0200 Subject: [PATCH 1/3] Fix for Vision-1 metadata extractor with additional asset name parts (ESACPE-2101) --- src/Stars.Data/Model/Metadata/Dimap/DMC/Vision1DimapProfiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stars.Data/Model/Metadata/Dimap/DMC/Vision1DimapProfiler.cs b/src/Stars.Data/Model/Metadata/Dimap/DMC/Vision1DimapProfiler.cs index 5cf57a97..efeb120b 100644 --- a/src/Stars.Data/Model/Metadata/Dimap/DMC/Vision1DimapProfiler.cs +++ b/src/Stars.Data/Model/Metadata/Dimap/DMC/Vision1DimapProfiler.cs @@ -112,7 +112,7 @@ public override string GetProductKey(IAsset bandAsset, t_Data_File dataFile) nameParts[3] ); if (nameParts[1] != "PAN") key += string.Format("-{0}", nameParts[1]); - if (nameParts.Length >= 7) key += string.Format("-{0}", nameParts[6]); + if (nameParts.Length >= 7) key += string.Format("-{0}", nameParts[nameParts.Length - 1]); return key; } From b1c21906a94ba1e3ac8ea9da798a9717ec74117b Mon Sep 17 00:00:00 2001 From: floeschau Date: Wed, 16 Oct 2024 17:15:15 +0200 Subject: [PATCH 2/3] Using default MSS bands for Kanopus-V in case of absent metadata file --- .../Kanopus/KanopusVMetadataExtractor.cs | 70 ++++++++++++------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/src/Stars.Data/Model/Metadata/Kanopus/KanopusVMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Kanopus/KanopusVMetadataExtractor.cs index c70d3d1f..38c851da 100644 --- a/src/Stars.Data/Model/Metadata/Kanopus/KanopusVMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Kanopus/KanopusVMetadataExtractor.cs @@ -211,40 +211,60 @@ private StacAsset GetBandAsset(StacItem stacItem, string name, IAsset asset, Kan if (name == "MSS") { - for (int i = 0; i < numberOfChannels; i++) - { - channelValues = Array.ConvertAll((metadata.GetString("/bSpectralZone").Split(',')), (double.Parse)); - mean = channelValues.Sum() / channelValues.Length; + string deviceName = metadata.GetString("/cDeviceName"); - if (mean < 0.69 && mean > 0.63) + // This is the normal case, but the MSS metadata file could be missing + // and in that case, we add the default bands (see below after else) + if (deviceName == null || deviceName.Contains("MSS")) + { + for (int i = 0; i < numberOfChannels; i++) { - eoarr[i] = new EoBandObject("red", EoBandCommonName.red); - eoarr[i].Properties.Add("description", "red"); - } + channelValues = Array.ConvertAll((metadata.GetString("/bSpectralZone").Split(',')), (double.Parse)); + mean = channelValues.Sum() / channelValues.Length; - else if (mean < 0.60 && mean > 0.52) - { - eoarr[i] = new EoBandObject("green", EoBandCommonName.green); - eoarr[i].Properties.Add("description", "green"); - } + if (mean < 0.69 && mean > 0.63) + { + eoarr[i] = new EoBandObject("red", EoBandCommonName.red); + eoarr[i].Properties.Add("description", "red"); + } - else if (mean < 0.52 && mean > 0.44) - { - eoarr[i] = new EoBandObject("blue", EoBandCommonName.blue); - eoarr[i].Properties.Add("description", "blue"); - } + else if (mean < 0.60 && mean > 0.52) + { + eoarr[i] = new EoBandObject("green", EoBandCommonName.green); + eoarr[i].Properties.Add("description", "green"); + } + + else if (mean < 0.52 && mean > 0.44) + { + eoarr[i] = new EoBandObject("blue", EoBandCommonName.blue); + eoarr[i].Properties.Add("description", "blue"); + } + + else if (mean < 0.84 && mean > 0.75) + { + eoarr[i] = new EoBandObject("nir", EoBandCommonName.nir); + eoarr[i].Properties.Add("description", "nir"); + } - else if (mean < 0.84 && mean > 0.75) + } + // Swap bands 1 and 3 (red and blue) if the channels are not in RGB order in the metadata + if (numberOfChannels >= 3 && eoarr[0].CommonName == EoBandCommonName.blue && eoarr[2].CommonName == EoBandCommonName.red) { - eoarr[i] = new EoBandObject("nir", EoBandCommonName.nir); - eoarr[i].Properties.Add("description", "nir"); + (eoarr[2], eoarr[0]) = (eoarr[0], eoarr[2]); } - } - // Swap bands 1 and 3 (red and blue) if the channels are not in RGB order in the metadata - if (numberOfChannels >= 3 && eoarr[0].CommonName == EoBandCommonName.blue && eoarr[2].CommonName == EoBandCommonName.red) + else + // default bands { - (eoarr[2], eoarr[0]) = (eoarr[0], eoarr[2]); + eoarr = new EoBandObject[4]; + eoarr[0] = new EoBandObject("red", EoBandCommonName.red); + eoarr[0].Properties.Add("description", "red"); + eoarr[1] = new EoBandObject("green", EoBandCommonName.green); + eoarr[1].Properties.Add("description", "green"); + eoarr[2] = new EoBandObject("blue", EoBandCommonName.blue); + eoarr[2].Properties.Add("description", "blue"); + eoarr[3] = new EoBandObject("nir", EoBandCommonName.nir); + eoarr[3].Properties.Add("description", "nir"); } stacAsset.EoExtension().Bands = eoarr; } From 6c9c969b83112a92ceeb9f4ee3d6584624f0516d Mon Sep 17 00:00:00 2001 From: floeschau Date: Wed, 16 Oct 2024 17:19:26 +0200 Subject: [PATCH 3/3] Version 2.25.4 --- src/Stars.Console/Terradue.Stars.Console.csproj | 2 +- src/Stars.Data/Terradue.Stars.Data.csproj | 2 +- src/Stars.Services/Terradue.Stars.Services.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stars.Console/Terradue.Stars.Console.csproj b/src/Stars.Console/Terradue.Stars.Console.csproj index d81d16fd..b0aea475 100644 --- a/src/Stars.Console/Terradue.Stars.Console.csproj +++ b/src/Stars.Console/Terradue.Stars.Console.csproj @@ -2,7 +2,7 @@ Exe net6.0 - 2.25.3 + 2.25.4 Stars is a CLI for working with Spatio Temporal Catalog such as STAC but not only $(Version)-$(VersionSuffix) diff --git a/src/Stars.Data/Terradue.Stars.Data.csproj b/src/Stars.Data/Terradue.Stars.Data.csproj index f18cc3b9..b1a2e008 100644 --- a/src/Stars.Data/Terradue.Stars.Data.csproj +++ b/src/Stars.Data/Terradue.Stars.Data.csproj @@ -4,7 +4,7 @@ Terradue.Stars.Data Terradue.Stars.Data Collection of data Plugins for Terradue.Stars - 2.25.3 + 2.25.4 $(Version)-$(VersionSuffix) NU1603 diff --git a/src/Stars.Services/Terradue.Stars.Services.csproj b/src/Stars.Services/Terradue.Stars.Services.csproj index 17edaa40..22e7417b 100644 --- a/src/Stars.Services/Terradue.Stars.Services.csproj +++ b/src/Stars.Services/Terradue.Stars.Services.csproj @@ -3,7 +3,7 @@ netstandard2.0 Terradue.Stars Stars is a set of services for working with Spatio Temporal Catalog such as STAC but not only - 2.25.3 + 2.25.4 $(Version)-$(VersionSuffix) Terradue.Stars.Services