From 9384bd70064080bc540d80739e7209c04252a779 Mon Sep 17 00:00:00 2001 From: mlongobardo-gituname Date: Fri, 2 Aug 2024 16:52:09 +0200 Subject: [PATCH 1/4] ESACPE-2034 stac item now produced (titles to check) --- src/Stars.Data/Model/Metadata/Bka/BkaMetadataExtractor.cs | 6 +++--- src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs | 4 ++-- .../Model/Metadata/Saocom1/Saocom1MetadataExtractor.cs | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Stars.Data/Model/Metadata/Bka/BkaMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Bka/BkaMetadataExtractor.cs index 0d7c9f6c..8bbe45bc 100644 --- a/src/Stars.Data/Model/Metadata/Bka/BkaMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Bka/BkaMetadataExtractor.cs @@ -62,7 +62,7 @@ public override bool CanProcess(IResource route, IDestination destination) else { BkaMetadata[] metadata = ReadMetadata(metadataAssets).GetAwaiter().GetResult(); - return metadata != null; + return metadata != null && metadata.Length > 0; } } catch (Exception) @@ -544,7 +544,7 @@ protected virtual IAsset[] GetMetadataAssets(IAssetsContainer container, IEnumer protected virtual IAsset GetTopZipAsset(IItem item) { - IAsset zipAsset = FindFirstAssetFromFileNameRegex(item, @".*\.zip"); + IAsset zipAsset = FindFirstAssetFromFileNameRegex(item, @"^(?!.*(S2A_|S2B_)).*\.zip$"); return zipAsset; } @@ -561,7 +561,7 @@ protected virtual IAsset GetProductZipAsset(IAsset topAsset, IAssetsContainer co protected virtual IEnumerable GetInnerZipAssets(IAssetsContainer container) { - IEnumerable zipAssets = FindAssetsFromFileNameRegex(container, @".*\.zip"); + IEnumerable zipAssets = FindAssetsFromFileNameRegex(container, @"^(?!.*(S2A_|S2B_)).*\.zip$"); return zipAssets; } diff --git a/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs index e5d34673..14d4cbd0 100644 --- a/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs @@ -84,12 +84,12 @@ public override bool CanProcess(IResource route, IDestination destination) { IAsset metadataAsset = GetMetadataAsset(item); Schemas.Metadata metadata = ReadMetadata(metadataAsset).GetAwaiter().GetResult(); + return metadata != null; - return true; } catch (Exception e) { - Console.WriteLine("CAN NOT PROCESS: {0}\n{1}", e.Message, e.StackTrace); + //Console.WriteLine("CAN NOT PROCESS: {0}\n{1}", e.Message, e.StackTrace); return false; } } diff --git a/src/Stars.Data/Model/Metadata/Saocom1/Saocom1MetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Saocom1/Saocom1MetadataExtractor.cs index c0a1bf00..e79b05e1 100644 --- a/src/Stars.Data/Model/Metadata/Saocom1/Saocom1MetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Saocom1/Saocom1MetadataExtractor.cs @@ -64,6 +64,7 @@ public override bool CanProcess(IResource route, IDestination destination) else { SAOCOM_XMLProduct metadata = ReadMetadata(metadataAsset).GetAwaiter().GetResult(); + return metadata != null; } return true; } @@ -696,7 +697,7 @@ protected virtual IAsset GetParametersAsset(IItem item) protected virtual IAsset GetZipAsset(IItem item) { IAsset zipAsset = null; - zipAsset = FindFirstAssetFromFileNameRegex(item, @"S.*\.zip"); + zipAsset = FindFirstAssetFromFileNameRegex(item, @"^(?!.*(S2A_|S2B_))S.*\.zip$"); return zipAsset; } From d5e290b127c2a6de15062ad5b1e831cfe0576704 Mon Sep 17 00:00:00 2001 From: mlongobardo-gituname Date: Fri, 2 Aug 2024 17:31:35 +0200 Subject: [PATCH 2/4] bump ver --- src/Stars.Console/Terradue.Stars.Console.csproj | 2 +- src/Stars.Data/Terradue.Stars.Data.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stars.Console/Terradue.Stars.Console.csproj b/src/Stars.Console/Terradue.Stars.Console.csproj index 2df27433..d82808bc 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.24.6 + 2.24.7 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 989cd2ca..045e9bc0 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.24.6 + 2.24.7 $(Version)-$(VersionSuffix) NU1603 From 6d91d83552c977d5b302c0a0ceb108e363d9ece1 Mon Sep 17 00:00:00 2001 From: mlongobardo-gituname Date: Fri, 2 Aug 2024 17:33:17 +0200 Subject: [PATCH 3/4] check --- src/Stars.Console/Terradue.Stars.Console.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stars.Console/Terradue.Stars.Console.csproj b/src/Stars.Console/Terradue.Stars.Console.csproj index d82808bc..cfd79142 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.24.7 + 2.24.7 Stars is a CLI for working with Spatio Temporal Catalog such as STAC but not only $(Version)-$(VersionSuffix) From 39cfa6264e11286abb231954c0ffcb575fa5c89b Mon Sep 17 00:00:00 2001 From: floeschau Date: Mon, 5 Aug 2024 10:26:38 +0200 Subject: [PATCH 4/4] Formatting fixes --- src/Stars.Console/Operations/CopyOperation.cs | 2 +- src/Stars.Data/ThirdParty/Publication/GeosquareService.cs | 2 +- src/Stars.Services/Store/StacStoreService.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stars.Console/Operations/CopyOperation.cs b/src/Stars.Console/Operations/CopyOperation.cs index 2af1d1c2..6a62b85d 100644 --- a/src/Stars.Console/Operations/CopyOperation.cs +++ b/src/Stars.Console/Operations/CopyOperation.cs @@ -349,7 +349,7 @@ private async Task CopyAssetsFromContainer(IDestination desti if (deliveryReport.AssetsExceptions.Count > 0) throw new AggregateException(deliveryReport.AssetsExceptions.Values); // no delivery but exception in quotation - if (deliveryReport.AssetsExceptions.Count == 0 && ( deliveryReport.Quotation.AssetsExceptions != null && deliveryReport.Quotation.AssetsExceptions.Count > 0)) + if (deliveryReport.AssetsExceptions.Count == 0 && (deliveryReport.Quotation.AssetsExceptions != null && deliveryReport.Quotation.AssetsExceptions.Count > 0)) throw new AggregateException(deliveryReport.Quotation.AssetsExceptions.Values); } diff --git a/src/Stars.Data/ThirdParty/Publication/GeosquareService.cs b/src/Stars.Data/ThirdParty/Publication/GeosquareService.cs index 01422f70..cefa1be3 100644 --- a/src/Stars.Data/ThirdParty/Publication/GeosquareService.cs +++ b/src/Stars.Data/ThirdParty/Publication/GeosquareService.cs @@ -151,7 +151,7 @@ public async Task PostCollectionToCatalog(ICollection collectionNode, IR // Get Item from the collection var items = collectionNode.GetLinks().Where(l => l.Relationship == "item"); - if ( items.Any() && catalogPublicationState.GeosquarePublicationModel.SkipCollectionsWithItems == true) + if (items.Any() && catalogPublicationState.GeosquarePublicationModel.SkipCollectionsWithItems == true) { logger.LogWarning("Skipping collection {0} because it has items", collectionNode); return state; diff --git a/src/Stars.Services/Store/StacStoreService.cs b/src/Stars.Services/Store/StacStoreService.cs index 2b3940a9..b09e4731 100644 --- a/src/Stars.Services/Store/StacStoreService.cs +++ b/src/Stars.Services/Store/StacStoreService.cs @@ -313,7 +313,7 @@ private void PrepareStacCollectionForDestination(StacCollectionNode stacCollecti else MakeAssetUriRelative(stacCollectionNode, destination); } - + public void PrepareStacItemForDestination(StacItemNode stacItemNode, IDestination destination) {