Skip to content

Commit

Permalink
Merge branch 'release/2.25.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
floeschau committed Oct 16, 2024
2 parents a6d446c + 6c9c969 commit 3015332
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Stars.Console/Terradue.Stars.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<Version>2.25.3</Version>
<Version>2.25.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Description>Stars is a CLI for working with Spatio Temporal Catalog such as STAC but not only</Description>
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
70 changes: 45 additions & 25 deletions src/Stars.Data/Model/Metadata/Kanopus/KanopusVMetadataExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("<Ch" + (i + 1) + ">/bSpectralZone").Split(',')), (double.Parse));
mean = channelValues.Sum() / channelValues.Length;
string deviceName = metadata.GetString("<Device>/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("<Ch" + (i + 1) + ">/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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Data/Terradue.Stars.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ProjectName>Terradue.Stars.Data</ProjectName>
<Title>Terradue.Stars.Data</Title>
<Description>Collection of data Plugins for Terradue.Stars</Description>
<Version>2.25.3</Version>
<Version>2.25.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<NoWarn>NU1603</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Services/Terradue.Stars.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Title>Terradue.Stars</Title>
<Description>Stars is a set of services for working with Spatio Temporal Catalog such as STAC but not only</Description>
<Version>2.25.3</Version>
<Version>2.25.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<AssemblyName>Terradue.Stars.Services</AssemblyName>
Expand Down

0 comments on commit 3015332

Please sign in to comment.