diff --git a/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/MetadataExtractorsTests_urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose.json b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/MetadataExtractorsTests_urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose.json new file mode 100644 index 00000000..e3c10495 --- /dev/null +++ b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/MetadataExtractorsTests_urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose.json @@ -0,0 +1,171 @@ +{ + "stac_version": "1.0.0", + "stac_extensions": [ + "https://stac-extensions.github.io/eo/v1.0.0/schema.json", + "https://stac-extensions.github.io/processing/v1.0.0/schema.json", + "https://stac-extensions.github.io/projection/v1.0.0/schema.json", + "https://stac-extensions.github.io/raster/v1.0.0/schema.json", + "https://stac-extensions.github.io/sat/v1.0.0/schema.json", + "https://stac-extensions.github.io/view/v1.0.0/schema.json" + ], + "type": "Feature", + "id": "urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -51.624, + -30.02 + ], + [ + -51.263, + -30.021 + ], + [ + -51.261, + -28.964 + ], + [ + -51.618, + -28.962 + ], + [ + -51.624, + -30.02 + ] + ] + ] + }, + "properties": { + "start_datetime": "2024-04-04T13:16:10Z", + "end_datetime": "2024-04-04T13:16:28Z", + "datetime": "2024-04-04T13:16:19Z", + "constellation": "cbers-4", + "platform": "cbers-4", + "mission": "cbers-4", + "instruments": [ + "pan" + ], + "sensor_type": "optical", + "gsd": 10.0, + "title": "CBERS-4 PAN10M L4 2024-04-04 13:16:19", + "eo:bands": [ + { + "name": "band-2", + "common_name": "green", + "center_wavelength": 0.555, + "full_width_half_max": 0.07, + "solar_illumination": 1823.4 + }, + { + "name": "band-3", + "common_name": "red", + "center_wavelength": 0.66, + "full_width_half_max": 0.06, + "solar_illumination": 1536.38 + }, + { + "name": "band-4", + "common_name": "nir", + "center_wavelength": 0.83, + "full_width_half_max": 0.12, + "solar_illumination": 981.91 + } + ], + "cbers:path": 158, + "cbers:row": 133, + "sat:platform_international_designator": "2014-079A", + "proj:epsg": 32722, + "view:off_nadir": 0.0, + "view:sun_azimuth": 46.5463, + "view:sun_elevation": 43.1737, + "processing:level": "L4", + "providers": [ + { + "name": "INPE/CAST", + "description": "The China-Brazil Earth Resources Satellite mission is to provide remote sensing images to observe and monitor vegetation - especially deforestation in the Amazon region - the monitoring of water resources, agriculture, urban growth, land use and education.", + "roles": [ + "producer", + "processor", + "licensor" + ], + "url": "http://www.cbers.inpe.br/sobre/cbers3-4.php" + } + ], + "licence": "proprietary" + }, + "bbox": [ + -51.624, + -30.021, + -51.261, + -28.962 + ], + "assets": { + "compose": { + "type": "image/tiff", + "roles": [ + "data", + "dn" + ], + "title": "PAN10M L4 COMPOSE", + "href": "data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/CBERS_4_PAN_20240404_158_133_L4__compose.tif", + "filename": "CBERS_4_PAN_20240404_158_133_L4__compose.tif", + "file:size": 0, + "eo:bands": [ + { + "name": "band-2", + "common_name": "green", + "center_wavelength": 0.555, + "full_width_half_max": 0.07, + "solar_illumination": 1823.4 + }, + { + "name": "band-3", + "common_name": "red", + "center_wavelength": 0.66, + "full_width_half_max": 0.06, + "solar_illumination": 1536.38 + }, + { + "name": "band-4", + "common_name": "nir", + "center_wavelength": 0.83, + "full_width_half_max": 0.12, + "solar_illumination": 981.91 + } + ], + "raster:bands": [ + { + "offset": 0.0 + }, + { + "offset": 0.0 + }, + { + "offset": 0.0 + } + ] + }, + "metadata": { + "type": "text/csv", + "roles": [ + "metadata" + ], + "title": "Metadata file", + "href": "data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_eop_inpe_cbers_4_pan_20240404_158_133_l4__compose-metadata.csv", + "filename": "urn_ogc_def_eop_inpe_cbers_4_pan_20240404_158_133_l4__compose-metadata.csv", + "file:size": 534 + }, + "thumbnail": { + "type": "image/jpeg", + "roles": [ + "thumbnail" + ], + "href": "data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-icon.jpg", + "filename": "urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-icon.jpg", + "file:size": 6474 + } + }, + "links": [] +} \ No newline at end of file diff --git a/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/CBERS_4_PAN_20240404_158_133_L4__compose.tif b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/CBERS_4_PAN_20240404_158_133_L4__compose.tif new file mode 100644 index 00000000..e69de29b diff --git a/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-icon.jpg b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-icon.jpg new file mode 100644 index 00000000..3f865218 Binary files /dev/null and b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-icon.jpg differ diff --git a/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-preview.jpg b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-preview.jpg new file mode 100644 index 00000000..197da65e Binary files /dev/null and b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose-preview.jpg differ diff --git a/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_eop_inpe_cbers_4_pan_20240404_158_133_l4__compose-metadata.csv b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_eop_inpe_cbers_4_pan_20240404_158_133_l4__compose-metadata.csv new file mode 100644 index 00000000..85826923 --- /dev/null +++ b/src/Stars.Data.Tests/Resources/INPE/CBERS-4/PAN10M/data/1003-INPE-CBERS-4-urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose/urn_ogc_def_eop_inpe_cbers_4_pan_20240404_158_133_l4__compose-metadata.csv @@ -0,0 +1,2 @@ +AGENCY,SATELLITE,INSTRUMENT,MODE,IDENTIFIER,START_DATE,COMPLETE_DATE,FOOTPRINT,PRODUCT_URL,AOI,FORMAT,PROCESSING_LEVEL,PROCESSING_LEVEL_DESCRIPTION,PROJECTION,EPSG,PATH,ROW,OFF_NADIR,SUN_AZIMUTH,SUN_ELEVATION,ABSOLUTE_CALIBRATION_COEFFICIENTS +INPE,CBERS4,PAN,,urn_ogc_def_EOP_INPE_CBERS_4_PAN_20240404_158_133_L4__compose,2024-04-04T13:16:10+0000,2024-04-04T13:16:28+0000," -28.962 -51.618 -28.964 -51.261 -30.021 -51.263 -30.02 -51.624 -28.962 -51.618 ",,,GeoTiff,L1B,,Geocoded,32722,158,133,0,46.5463,43.1737,band0:0 band1:0 band2:0 \ No newline at end of file diff --git a/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs index e5500282..d8c0d1a3 100644 --- a/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Inpe/InpeMetadataExtractor.cs @@ -36,7 +36,7 @@ public class InpeMetadataExtractor : MetadataExtraction protected static string metadataAssetRegexPattern => @".*(CBERS_4|Call|CBERS_4A?|cbers_4|call|cbers_4A?|AMAZONIA_1|amazonia_1).*\.(xml|csv)$"; protected static string compositeAssetRegexPattern => @".*(CBERS_4|Call|CBERS_4A?|cbers_4|call|cbers_4A?|AMAZONIA_1|amazonia_1).*\.(tif|tiff)$"; - private Regex identifierInfoRegex = new Regex(@".*(?'mode'awfi|mux|pan5m|pan10m|wfi|wpm)_\d{8}_\d{3}_\d{3}_l(?'level'[^_]+)_(?'rest'.*)$"); + private Regex identifierInfoRegex = new Regex(@".*(?'mode'awfi|mux|pan|pan5m|pan10m|wfi|wpm)_\d{8}_\d{3}_\d{3}_l(?'level'[^_]+)_(?'rest'.*)$"); // Dictionary containing platform international designators private Dictionary platformInternationalDesignators = new Dictionary { @@ -87,6 +87,7 @@ public override bool CanProcess(IResource route, IDestination destination) } catch (Exception e) { + Console.WriteLine("CAN NOT PROCESS: {0}\n{1}", e.Message, e.StackTrace); return false; } } @@ -256,8 +257,9 @@ protected virtual IAsset GetMetadataAsset(IItem item) public virtual async Task ReadMetadata(IAsset metadataAsset) { - Match identifierMatch = identifierRegex.Match(Path.GetFileName(metadataAsset.Uri.OriginalString)); - Match identifierMatch2 = identifierRegex2.Match(Path.GetFileName(metadataAsset.Uri.OriginalString).ToLower()); + string originalAssetName = Path.GetFileName(metadataAsset.Uri.OriginalString); + Match identifierMatch = identifierRegex.Match(originalAssetName); + Match identifierMatch2 = identifierRegex2.Match(originalAssetName.ToLower()); string typeStr; string level; @@ -276,6 +278,11 @@ protected virtual IAsset GetMetadataAsset(IItem item) throw new Exception("No metadata file found"); } + if (typeStr == "PAN") + { + if (originalAssetName.ToLower().Contains("_compose")) typeStr = "PAN10M"; + else typeStr = "PAN5M"; + } switch (typeStr) { case "AWFI": @@ -590,6 +597,11 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat { string mode = match.Groups["mode"].Value.ToUpper(); string rest = match.Groups["rest"].Value; + if (mode == "PAN") + { + if (rest.Contains("compose")) mode = "PAN10M"; + else mode = "PAN5M"; + } if (metadata.satellite.name == "CBERS") {