Skip to content

Commit

Permalink
Merge branch 'release/2.25.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
floeschau committed Oct 11, 2024
2 parents 492281e + fc1a85f commit a6d446c
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 7 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.1</Version>
<Version>2.25.3</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 @@ -162,18 +162,26 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat
stacItem.Assets["metadata"].Properties.AddRange(metadataAsset.Properties);

// Overview/browse
string contentType = "image/png";
IAsset browseAsset = FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_browse\.png$", metadata.id));
if (browseAsset == null)
{
browseAsset = FindFirstAssetFromFileNameRegex(item, string.Format(@".*\.jpg$", metadata.id));
contentType = "image/jpg";
}
if (browseAsset != null)
{
stacItem.Assets.Add("overview", StacAsset.CreateOverviewAsset(stacItem, browseAsset.Uri, new ContentType("image/png"), "Browse image"));
stacItem.Assets.Add("overview", StacAsset.CreateOverviewAsset(stacItem, browseAsset.Uri, new ContentType(contentType), "Browse image"));
stacItem.Assets["overview"].Properties.AddRange(browseAsset.Properties);
}

// RGB TIFF (ortho)
IAsset imageAsset = metadata.IsFromText && metadata.id.EndsWith("_ortho") ? FindFirstAssetFromFileNameRegex(item, @".*\.tif") : FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_ortho\.tif$", metadata.id));
bool imageFound = false;

if (imageAsset != null)
{
imageFound = true;
StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, imageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "RGB image");
stacItem.Assets.Add("ORTHO_RGB", stacAsset);
stacAsset.Properties.AddRange(imageAsset.Properties);
Expand All @@ -194,6 +202,7 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat
IAsset imageAssetPan = metadata.IsFromText && metadata.id.EndsWith("_ortho-pan") ? FindFirstAssetFromFileNameRegex(item, @".*\.tif") : FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_ortho-pan\.tif$", metadata.id));
if (imageAssetPan != null)
{
imageFound = true;
StacAsset stacAssetPan = StacAsset.CreateDataAsset(stacItem, imageAssetPan.Uri, new ContentType("image/tiff; application=geotiff"), "PAN image");
stacItem.Assets.Add("ORTHO_PAN", stacAssetPan);
stacAssetPan.Properties.AddRange(imageAssetPan.Properties);
Expand All @@ -210,6 +219,7 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat
imageAsset = metadata.IsFromText && metadata.id.EndsWith("_georeferenced") ? FindFirstAssetFromFileNameRegex(item, @".*\.tif") : FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_georeferenced\.tif$", metadata.id));
if (imageAsset != null)
{
imageFound = true;
StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, imageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "RGB image");
stacItem.Assets.Add("GEO_RGB", stacAsset);
stacAsset.Properties.AddRange(imageAsset.Properties);
Expand All @@ -230,6 +240,7 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat
imageAssetPan = metadata.IsFromText && metadata.id.EndsWith("_georeferenced-pan") ? FindFirstAssetFromFileNameRegex(item, @".*\.tif") : FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_georeferenced-pan\.tif$", metadata.id));
if (imageAssetPan != null)
{
imageFound = true;
StacAsset stacAssetPan = StacAsset.CreateDataAsset(stacItem, imageAssetPan.Uri, new ContentType("image/tiff; application=geotiff"), "PAN image");
stacItem.Assets.Add("GEO_PAN", stacAssetPan);
stacAssetPan.Properties.AddRange(imageAssetPan.Properties);
Expand All @@ -242,6 +253,41 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat
};
}

if (!imageFound)
{
IAsset unclearImageAsset = FindFirstAssetFromFileNameRegex(item, @".*\.tif");
if (unclearImageAsset != null && Path.GetFileName(unclearImageAsset.Uri.AbsolutePath).Contains("MS"))
{
StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, unclearImageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "RGB image");
stacItem.Assets.Add("GEO_RGB", stacAsset);
stacAsset.Properties.AddRange(unclearImageAsset.Properties);
stacAsset.Properties["gsd"] = metadata.gsd;
stacAsset.EoExtension().Bands = new EoBandObject[] {
new EoBandObject("B1-RED", EoBandCommonName.red) { CenterWavelength = 0.645, FullWidthHalfMax = 0.11 },
new EoBandObject("B2-GREEN", EoBandCommonName.green) { CenterWavelength = 0.545, FullWidthHalfMax = 0.09 },
new EoBandObject("B3-BLUE", EoBandCommonName.blue) { CenterWavelength = 0.485, FullWidthHalfMax = 0.07 },
};
stacAsset.RasterExtension().Bands = new RasterBand[] {
new RasterBand() { DataType = Stac.Common.DataType.uint16, BitsPerSample = 12 },
new RasterBand() { DataType = Stac.Common.DataType.uint16, BitsPerSample = 12 },
new RasterBand() { DataType = Stac.Common.DataType.uint16, BitsPerSample = 12 },
};
}
else if (unclearImageAsset != null && Path.GetFileName(unclearImageAsset.Uri.AbsolutePath).Contains("PN"))
{
StacAsset stacAssetPan = StacAsset.CreateDataAsset(stacItem, unclearImageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "PAN image");
stacItem.Assets.Add("GEO_PAN", stacAssetPan);
stacAssetPan.Properties.AddRange(unclearImageAsset.Properties);
stacAssetPan.Properties["gsd"] = metadata.gsd;
stacAssetPan.EoExtension().Bands = new EoBandObject[] {
new EoBandObject("pan", EoBandCommonName.pan) { CenterWavelength = 0.575, FullWidthHalfMax = 0.25 },
};
stacAssetPan.RasterExtension().Bands = new RasterBand[] {
new RasterBand() { DataType = Stac.Common.DataType.uint16, BitsPerSample = 12 },
};
}
}

// Mask TIFF (non-ortho)
IAsset imageAssetMask = FindFirstAssetFromFileNameRegex(item, string.Format(@"{0}_mask\.tif$", metadata.id));
if (imageAssetMask != null)
Expand Down
11 changes: 7 additions & 4 deletions 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.1</Version>
<Version>2.25.3</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<NoWarn>NU1603</NoWarn>
Expand Down Expand Up @@ -33,7 +33,7 @@
<PackageReference Include="MimeTypes" Version="2.0.2" />
<PackageReference Include="Terradue.OpenSearch.SciHub" Version="1.48.*"/>
<PackageReference Include="Terradue.OpenSearch.Asf" Version="1.4.*" />
<PackageReference Include="Terradue.OpenSearch.Usgs" Version="1.7.*" />
<PackageReference Include="Terradue.OpenSearch.Usgs" Version="1.8.0" />
<PackageReference Include="Terradue.OpenSearch.GeoJson" Version="1.4.5" />
<PackageReference Include="Terradue.GeoJson" Version="1.12.1" />
<PackageReference Include="MaxRev.Gdal.Core" Version="3.3.3.110" />
Expand All @@ -54,9 +54,12 @@
<!--<ItemGroup>
<ProjectReference Include="../../../terradue.opensearch.scihub/Terradue.OpenSearch.SciHub/Terradue.OpenSearch.SciHub.csproj" />
</ItemGroup>-->
<!-- <ItemGroup>
<!--<ItemGroup>
<ProjectReference Include="../../../terradue.opensearch.asf/Terradue.OpenSearch.Asf/Terradue.OpenSearch.Asf.csproj" />
</ItemGroup>-->
<!--<ItemGroup>
<ProjectReference Include="../../../terradue.opensearch.usgs/Terradue.OpenSearch.Usgs/Terradue.OpenSearch.Usgs.csproj" />
</ItemGroup> -->
</ItemGroup>-->
<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="..\..\docs\logo\Stars_logo.png" Pack="true" PackagePath="" />
Expand Down
3 changes: 3 additions & 0 deletions src/Stars.Services/Processing/Archive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Terradue.Stars.Services.Processing
public abstract class Archive : ILocatable
{
public static readonly Dictionary<string, ArchiveType> ArchiveFileExtensions = new Dictionary<string, ArchiveType>() {
{ ".tar", ArchiveType.Tar },
{ ".tar.gz", ArchiveType.TarGzip },
{ ".tgz", ArchiveType.TarGzip },
{ ".tar.Z", ArchiveType.TarGzip },
Expand Down Expand Up @@ -48,6 +49,8 @@ internal static async Task<Archive> Read(IAsset asset, ILogger logger, IResource
{
case ArchiveType.Zip:
return new ZipArchiveAsset(asset, logger, resourceServiceProvider, fileSystem);
case ArchiveType.Tar:
return new TarArchiveAsset(asset, resourceServiceProvider, logger);
case ArchiveType.TarGzip:
return new TarGzipArchive(asset, resourceServiceProvider, logger);
case ArchiveType.Gzip:
Expand Down
1 change: 1 addition & 0 deletions src/Stars.Services/Processing/ArchiveType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum ArchiveType
{
None,
Compress,
Tar,
TarGzip,
TarBzip2,
Zip,
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.1</Version>
<Version>2.25.3</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<AssemblyName>Terradue.Stars.Services</AssemblyName>
Expand Down

0 comments on commit a6d446c

Please sign in to comment.