diff --git a/src/Stars.Data.Tests/Harvesters/MetadataExtractorsTests.cs b/src/Stars.Data.Tests/Harvesters/MetadataExtractorsTests.cs index e61f74fa..b08abcbb 100644 --- a/src/Stars.Data.Tests/Harvesters/MetadataExtractorsTests.cs +++ b/src/Stars.Data.Tests/Harvesters/MetadataExtractorsTests.cs @@ -125,4 +125,4 @@ private static void RemoveAssetUriTmp(StacItemNode stacItemNode) } } } -} \ No newline at end of file +} diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-102-20240320-024025-217335171_ortho-pan.json b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-102-20240320-024025-217335171_ortho-pan.json new file mode 100644 index 00000000..e9cb72eb --- /dev/null +++ b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-102-20240320-024025-217335171_ortho-pan.json @@ -0,0 +1,81 @@ +{ + "stac_version": "1.0.0", + "stac_extensions": [ + "https://stac-extensions.github.io/processing/v1.0.0/schema.json" + ], + "type": "Feature", + "id": "BSG-102-20240320-024025-217335171_ortho-pan", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 107.20026032340076, + 47.7408500353907 + ], + [ + 107.31073894793276, + 47.738677702031254 + ], + [ + 107.31338802634312, + 47.79841769410016 + ], + [ + 107.20278300270137, + 47.800594553305935 + ], + [ + 107.20026032340076, + 47.7408500353907 + ] + ] + ] + }, + "properties": { + "datetime": "2024-03-20T00:00:00Z", + "agency": "BlackSky", + "platform": "global-1", + "constellation": "blacksky-global", + "mission": "blacksky-global", + "instruments": [ + "spaceview-24" + ], + "sensor_type": "optical", + "spectral_mode": "MS", + "gsd": 1.0, + "title": "BLACKSY GLOBAL-1 GEO MS", + "processing:level": "GEO", + "providers": [ + { + "name": "BlackSky", + "description": "BlackSky Constellation is a commercially owned and operated constellation of 60 high resolution imaging microsatellites developed by BlackSky Global. The constellation aims to provide higher temporal resolution and lower cost Earth imaging, and currently contains 17 operational microsatellites, each with an expected lifetime of 4 years.", + "roles": [ + "producer", + "processor", + "licensor" + ], + "url": "https://www.blacksky.com" + } + ] + }, + "bbox": [ + 107.20026032340076, + 47.738677702031254, + 107.31338802634312, + 47.800594553305935 + ], + "assets": { + "metadata": { + "type": "application/json", + "roles": [ + "metadata" + ], + "title": "Metadata file", + "href": "data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_DG000000001.txt", + "filename": "BS01N47_769636E107_2567602024032000000000MS03_DG000000001.txt", + "file:size": 1963 + } + }, + "links": [] +} \ No newline at end of file diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_non-ortho.json b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_non-ortho.json index f02a1dff..89daa50e 100644 --- a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_non-ortho.json +++ b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_non-ortho.json @@ -1,70 +1,180 @@ { - "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/view/v1.0.0/schema.json" - ], - "type": "Feature", - "id": "BSG-108-20210902-213556-11999279_non-ortho", - "geometry": { - "type": "Polygon", - "coordinates": [ + "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/raster/v1.0.0/schema.json", + "https://stac-extensions.github.io/view/v1.0.0/schema.json" + ], + "type": "Feature", + "id": "BSG-108-20210902-213556-11999279_non-ortho", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -75.12948188832118, + 39.951193872769544 + ], + [ + -75.17209285763781, + 39.99133716421872 + ], + [ + -75.20606168353703, + 39.96975426955367 + ], + [ + -75.16335070466222, + 39.92967968802465 + ], [ - [ - -75.12948188832118, - 39.951193872769544 - ], - [ - -75.16335070466222, - 39.92967968802465 - ], - [ - -75.20606168353703, - 39.96975426955367 - ], - [ - -75.17209285763781, - 39.99133716421872 - ], - [ - -75.12948188832118, - 39.951193872769544 - ] + -75.12948188832118, + 39.951193872769544 ] ] + ] + }, + "properties": { + "datetime": "2021-09-02T21:35:56.707Z", + "agency": "BlackSky", + "platform": "global-8", + "constellation": "blacksky-global", + "mission": "blacksky-global", + "instruments": [ + "spaceview-24" + ], + "sensor_type": "optical", + "spectral_mode": "PAN/MS", + "gsd": 0.8632106, + "title": "BLACKSY GLOBAL-8 GEO PAN MS", + "view:off_nadir": 13.258979, + "view:sun_azimuth": 262.15057, + "view:sun_elevation": 20.95552, + "processing:level": "GEO", + "eo:cloud_cover": 0.0, + "eo:bands": [ + { + "name": "B1-RED", + "common_name": "red", + "center_wavelength": 0.645, + "full_width_half_max": 0.11 + }, + { + "name": "B2-GREEN", + "common_name": "green", + "center_wavelength": 0.545, + "full_width_half_max": 0.09 + }, + { + "name": "B3-BLUE", + "common_name": "blue", + "center_wavelength": 0.485, + "full_width_half_max": 0.07 + }, + { + "name": "pan", + "common_name": "pan", + "center_wavelength": 0.575, + "full_width_half_max": 0.25 + } + ], + "providers": [ + { + "name": "BlackSky", + "description": "BlackSky Constellation is a commercially owned and operated constellation of 60 high resolution imaging microsatellites developed by BlackSky Global. The constellation aims to provide higher temporal resolution and lower cost Earth imaging, and currently contains 17 operational microsatellites, each with an expected lifetime of 4 years.", + "roles": [ + "producer", + "processor", + "licensor" + ], + "url": "https://www.blacksky.com" + } + ] + }, + "bbox": [ + -75.20606168353703, + 39.92967968802465, + -75.12948188832118, + 39.99133716421872 + ], + "assets": { + "metadata": { + "type": "application/json", + "roles": [ + "metadata" + ], + "title": "Metadata file", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_metadata.json", + "filename": "BSG-108-20210902-213556-11999279_metadata.json", + "file:size": 3807 + }, + "overview": { + "type": "image/png", + "roles": [ + "overview" + ], + "title": "Browse image", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_browse.png", + "filename": "BSG-108-20210902-213556-11999279_browse.png", + "file:size": 1 }, - "properties": { - "title": "GLOBAL-8 2021-09-02 21:35:56", - "agency": "BlackSky", - "platform": "global-8", - "mission": "Global", - "instruments": [ - "global-8" + "GEO_RGB": { + "type": "image/tiff; application=geotiff", + "roles": [ + "data" ], - "sensor_type": "optical", + "title": "RGB image", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced.tif", + "filename": "BSG-108-20210902-213556-11999279_georeferenced.tif", + "file:size": 1, "gsd": 0.8632106, - "datetime": "2021-09-02T21:35:56.707Z", - "eo:cloud_cover": 0.0, "eo:bands": [ { - "name": "red", + "name": "B1-RED", "common_name": "red", "center_wavelength": 0.645, "full_width_half_max": 0.11 }, { - "name": "green", + "name": "B2-GREEN", "common_name": "green", "center_wavelength": 0.545, "full_width_half_max": 0.09 }, { - "name": "blue", + "name": "B3-BLUE", "common_name": "blue", "center_wavelength": 0.485, "full_width_half_max": 0.07 + } + ], + "raster:bands": [ + { + "data_type": "uint16", + "bits_per_sample": 12 + }, + { + "data_type": "uint16", + "bits_per_sample": 12 }, + { + "data_type": "uint16", + "bits_per_sample": 12 + } + ] + }, + "GEO_PAN": { + "type": "image/tiff; application=geotiff", + "roles": [ + "data" + ], + "title": "PAN image", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced-pan.tif", + "filename": "BSG-108-20210902-213556-11999279_georeferenced-pan.tif", + "file:size": 1, + "gsd": 0.8632106, + "eo:bands": [ { "name": "pan", "common_name": "pan", @@ -72,141 +182,54 @@ "full_width_half_max": 0.25 } ], - "view:sun_azimuth": 262.15057, - "view:sun_elevation": 20.95552, - "view:off_nadir": 13.258979, - "processing:level": "ORTHO", - "providers": [ + "raster:bands": [ { - "name": "BlackSky", - "description": "BlackSky Constellation is a commercially owned and operated constellation of 60 high resolution imaging microsatellites developed by BlackSky Global. The constellation aims to provide higher temporal resolution and lower cost Earth imaging, and currently contains 17 operational microsatellites, each with an expected lifetime of 4 years.", - "roles": [ - "producer", - "processor", - "licensor" - ], - "url": "https://www.blacksky.com" + "data_type": "uint16", + "bits_per_sample": 12 } ] }, - "bbox": [ - -75.20606168353703, - 39.92967968802465, - -75.12948188832118, - 39.99133716421872 - ], - "assets": { - "overview": { - "title": "Browse image", - "type": "image/png", - "roles": [ - "overview" - ], - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_browse.png", - "filename": "BSG-108-20210902-213556-11999279_browse.png", - "file:size": 1 - }, - "metadata": { - "title": "Metadata file", - "type": "application/json", - "roles": [ - "metadata" - ], - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_metadata.json", - "filename": "BSG-108-20210902-213556-11999279_metadata.json", - "file:size": 3807 - }, - "georeferenced": { - "title": "RGB image file", - "type": "image/tiff; application=geotiff", - "roles": [ - "data" - ], - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced.tif", - "filename": "BSG-108-20210902-213556-11999279_georeferenced.tif", - "file:size": 1, - "gsd": 0.8632106, - "eo:bands": [ - { - "name": "red", - "common_name": "red", - "center_wavelength": 0.645, - "full_width_half_max": 0.11 - }, - { - "name": "green", - "common_name": "green", - "center_wavelength": 0.545, - "full_width_half_max": 0.09 - }, - { - "name": "blue", - "common_name": "blue", - "center_wavelength": 0.485, - "full_width_half_max": 0.07 - } - ] - }, - "georeferenced-pan": { - "type": "image/tiff; application=geotiff", - "roles": [ - "data" - ], - "title": "PAN image file", - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced-pan.tif", - "filename": "BSG-108-20210902-213556-11999279_georeferenced-pan.tif", - "file:size": 1, - "gsd": 0.8632106, - "eo:bands": [ - { - "name": "pan", - "common_name": "pan", - "center_wavelength": 0.575, - "full_width_half_max": 0.25 - } - ] - }, - "mask": { - "type": "image/tiff; application=geotiff", - "roles": [ - "data" - ], - "title": "Pixel mask", - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_mask.tif", - "filename": "BSG-108-20210902-213556-11999279_mask.tif", - "file:size": 1, - "gsd": 0.8632106 - }, - "georefrenced-rpc": { - "type": "text/plain", - "roles": [ - "metadata" - ], - "title": "RPC (RGB)", - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced_rpc.txt", - "filename": "BSG-108-20210902-213556-11999279_georeferenced_rpc.txt", - "file:size": 1 - }, - "georefrenced-pan-rpc": { - "type": "text/plain", - "roles": [ - "metadata" - ], - "title": "RPC (PAN)", - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced-pan_rpc.txt", - "filename": "BSG-108-20210902-213556-11999279_georeferenced-pan_rpc.txt", - "file:size": 1 - }, - "mask-rpc": { - "type": "text/plain", - "roles": [ - "metadata" - ], - "title": "RPC (mask)", - "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_mask_rpc.txt", - "filename": "BSG-108-20210902-213556-11999279_mask_rpc.txt", - "file:size": 1 - } + "mask": { + "type": "image/tiff; application=geotiff", + "roles": [ + "data" + ], + "title": "Mask file", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_mask.tif", + "filename": "BSG-108-20210902-213556-11999279_mask.tif", + "file:size": 1, + "gsd": 0.8632106 + }, + "georefrenced-rgb-rpc": { + "type": "text/plain", + "roles": [ + "metadata" + ], + "title": "RPC (RGB)", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced_rpc.txt", + "filename": "BSG-108-20210902-213556-11999279_georeferenced_rpc.txt", + "file:size": 1 + }, + "georefrenced-pan-rpc": { + "type": "text/plain", + "roles": [ + "metadata" + ], + "title": "RPC (PAN)", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_georeferenced-pan_rpc.txt", + "filename": "BSG-108-20210902-213556-11999279_georeferenced-pan_rpc.txt", + "file:size": 1 }, - "links": [] - } \ No newline at end of file + "mask-rpc": { + "type": "text/plain", + "roles": [ + "metadata" + ], + "title": "RPC (mask)", + "href": "data/BSG-108-20210902-213556-11999279_non-ortho/BSG-108-20210902-213556-11999279_mask_rpc.txt", + "filename": "BSG-108-20210902-213556-11999279_mask_rpc.txt", + "file:size": 1 + } + }, + "links": [] +} \ No newline at end of file diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_ortho.json b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_ortho.json index 75aba1fc..82a8d948 100644 --- a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_ortho.json +++ b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/MetadataExtractorsTests_BSG-108-20210902-213556-11999279_ortho.json @@ -1,70 +1,180 @@ { - "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/view/v1.0.0/schema.json" - ], - "type": "Feature", - "id": "BSG-108-20210902-213556-11999279_ortho", - "geometry": { - "type": "Polygon", - "coordinates": [ + "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/raster/v1.0.0/schema.json", + "https://stac-extensions.github.io/view/v1.0.0/schema.json" + ], + "type": "Feature", + "id": "BSG-108-20210902-213556-11999279_ortho", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -75.12948188832118, + 39.951193872769544 + ], + [ + -75.17209285763781, + 39.99133716421872 + ], + [ + -75.20606168353703, + 39.96975426955367 + ], [ - [ - -75.12948188832118, - 39.951193872769544 - ], - [ - -75.16335070466222, - 39.92967968802465 - ], - [ - -75.20606168353703, - 39.96975426955367 - ], - [ - -75.17209285763781, - 39.99133716421872 - ], - [ - -75.12948188832118, - 39.951193872769544 - ] + -75.16335070466222, + 39.92967968802465 + ], + [ + -75.12948188832118, + 39.951193872769544 ] ] + ] + }, + "properties": { + "datetime": "2021-09-02T21:35:56.707Z", + "agency": "BlackSky", + "platform": "global-8", + "constellation": "blacksky-global", + "mission": "blacksky-global", + "instruments": [ + "spaceview-24" + ], + "sensor_type": "optical", + "spectral_mode": "PAN/MS", + "gsd": 0.8632106, + "title": "BLACKSY GLOBAL-8 ORTHO PAN MS", + "view:off_nadir": 13.258979, + "view:sun_azimuth": 262.15057, + "view:sun_elevation": 20.95552, + "processing:level": "ORTHO", + "eo:cloud_cover": 0.0, + "eo:bands": [ + { + "name": "B1-RED", + "common_name": "red", + "center_wavelength": 0.645, + "full_width_half_max": 0.11 + }, + { + "name": "B2-GREEN", + "common_name": "green", + "center_wavelength": 0.545, + "full_width_half_max": 0.09 + }, + { + "name": "B3-BLUE", + "common_name": "blue", + "center_wavelength": 0.485, + "full_width_half_max": 0.07 + }, + { + "name": "pan", + "common_name": "pan", + "center_wavelength": 0.575, + "full_width_half_max": 0.25 + } + ], + "providers": [ + { + "name": "BlackSky", + "description": "BlackSky Constellation is a commercially owned and operated constellation of 60 high resolution imaging microsatellites developed by BlackSky Global. The constellation aims to provide higher temporal resolution and lower cost Earth imaging, and currently contains 17 operational microsatellites, each with an expected lifetime of 4 years.", + "roles": [ + "producer", + "processor", + "licensor" + ], + "url": "https://www.blacksky.com" + } + ] + }, + "bbox": [ + -75.20606168353703, + 39.92967968802465, + -75.12948188832118, + 39.99133716421872 + ], + "assets": { + "metadata": { + "type": "application/json", + "roles": [ + "metadata" + ], + "title": "Metadata file", + "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_metadata.json", + "filename": "BSG-108-20210902-213556-11999279_metadata.json", + "file:size": 3807 }, - "properties": { - "title": "GLOBAL-8 2021-09-02 21:35:56", - "agency": "BlackSky", - "platform": "global-8", - "mission": "Global", - "instruments": [ - "global-8" + "overview": { + "type": "image/png", + "roles": [ + "overview" ], - "sensor_type": "optical", + "title": "Browse image", + "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_browse.png", + "filename": "BSG-108-20210902-213556-11999279_browse.png", + "file:size": 1 + }, + "ORTHO_RGB": { + "type": "image/tiff; application=geotiff", + "roles": [ + "data" + ], + "title": "RGB image", + "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_ortho.tif", + "filename": "BSG-108-20210902-213556-11999279_ortho.tif", + "file:size": 1, "gsd": 0.8632106, - "datetime": "2021-09-02T21:35:56.707Z", - "eo:cloud_cover": 0.0, "eo:bands": [ { - "name": "red", + "name": "B1-RED", "common_name": "red", "center_wavelength": 0.645, "full_width_half_max": 0.11 }, { - "name": "green", + "name": "B2-GREEN", "common_name": "green", "center_wavelength": 0.545, "full_width_half_max": 0.09 }, { - "name": "blue", + "name": "B3-BLUE", "common_name": "blue", "center_wavelength": 0.485, "full_width_half_max": 0.07 + } + ], + "raster:bands": [ + { + "data_type": "uint16", + "bits_per_sample": 12 + }, + { + "data_type": "uint16", + "bits_per_sample": 12 }, + { + "data_type": "uint16", + "bits_per_sample": 12 + } + ] + }, + "ORTHO_PAN": { + "type": "image/tiff; application=geotiff", + "roles": [ + "data" + ], + "title": "PAN image", + "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_ortho-pan.tif", + "filename": "BSG-108-20210902-213556-11999279_ortho-pan.tif", + "file:size": 1, + "gsd": 0.8632106, + "eo:bands": [ { "name": "pan", "common_name": "pan", @@ -72,100 +182,13 @@ "full_width_half_max": 0.25 } ], - "view:sun_azimuth": 262.15057, - "view:sun_elevation": 20.95552, - "view:off_nadir": 13.258979, - "processing:level": "ORTHO", - "providers": [ + "raster:bands": [ { - "name": "BlackSky", - "description": "BlackSky Constellation is a commercially owned and operated constellation of 60 high resolution imaging microsatellites developed by BlackSky Global. The constellation aims to provide higher temporal resolution and lower cost Earth imaging, and currently contains 17 operational microsatellites, each with an expected lifetime of 4 years.", - "roles": [ - "producer", - "processor", - "licensor" - ], - "url": "https://www.blacksky.com" + "data_type": "uint16", + "bits_per_sample": 12 } ] - }, - "bbox": [ - -75.20606168353703, - 39.92967968802465, - -75.12948188832118, - 39.99133716421872 - ], - "assets": { - "overview": { - "title": "Browse image", - "type": "image/png", - "roles": [ - "overview" - ], - "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_browse.png", - "filename": "BSG-108-20210902-213556-11999279_browse.png", - "file:size": 1 - }, - "metadata": { - "title": "Metadata file", - "type": "application/json", - "roles": [ - "metadata" - ], - "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_metadata.json", - "filename": "BSG-108-20210902-213556-11999279_metadata.json", - "file:size": 3807 - }, - "ortho": { - "title": "RGB image file", - "type": "image/tiff; application=geotiff", - "roles": [ - "data" - ], - "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_ortho.tif", - "filename": "BSG-108-20210902-213556-11999279_ortho.tif", - "file:size": 1, - "gsd": 0.8632106, - "eo:bands": [ - { - "name": "red", - "common_name": "red", - "center_wavelength": 0.645, - "full_width_half_max": 0.11 - }, - { - "name": "green", - "common_name": "green", - "center_wavelength": 0.545, - "full_width_half_max": 0.09 - }, - { - "name": "blue", - "common_name": "blue", - "center_wavelength": 0.485, - "full_width_half_max": 0.07 - } - ] - }, - "ortho-pan": { - "type": "image/tiff; application=geotiff", - "roles": [ - "data" - ], - "title": "PAN image file", - "href": "data/BSG-108-20210902-213556-11999279_ortho/BSG-108-20210902-213556-11999279_ortho-pan.tif", - "filename": "BSG-108-20210902-213556-11999279_ortho-pan.tif", - "file:size": 1, - "gsd": 0.8632106, - "eo:bands": [ - { - "name": "pan", - "common_name": "pan", - "center_wavelength": 0.575, - "full_width_half_max": 0.25 - } - ] - } - }, - "links": [] - } \ No newline at end of file + } + }, + "links": [] +} \ No newline at end of file diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_BG000000001.jpg b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_BG000000001.jpg new file mode 100644 index 00000000..e69de29b diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_DG000000001.txt b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_DG000000001.txt new file mode 100644 index 00000000..fbe5f6e9 --- /dev/null +++ b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_DG000000001.txt @@ -0,0 +1,75 @@ +EVENT=202403_Flood_MNG +ENTITY_ID=BS01N47_769636E107_2567602024032000000000MS03 +AGENCY=BlackSky +PLATFORM=BLACKSKY +PLATFORM_NUMBER=1 +SENSOR=MSI +SENSOR_TYPE=MS +OBLIQUE_FLAG=N +RESTRICTED_FLAG=Y +LICENSE_TYPE=BLACKSKY_GLOBAL_LLC +MOSAIC_FLAG=N +ACQUISITION_DATE=20240320 +ACQUISITION_TIME= +END_ACQUISITION_DATE= +CENTER_LAT=47.7696361276686 +CENTER_LONG=107.256760975317 +UL_LAT=47.800594553305935 +UL_LONG=107.20278300270137 +UR_LAT=47.79841769410016 +UR_LONG=107.31338802634312 +LR_LAT=47.738677702031254 +LR_LONG=107.31073894793276 +LL_LAT=47.7408500353907 +LL_LONG=107.20026032340076 +PROCESS_LEVEL=G +VENDOR_PROCESS_LEVEL= +MAP_PROJECTION=UTM +PROJECTION_PARAMETERS= +DATUM=WGS84 +LINESPERBAND=6645 +PIXELSPERLINE=8289 +BROWSE_HEIGHT= +BROWSE_WIDTH= +PROJECTION_ZONE= +PIXEL_SIZE_X=1.000000 +PIXEL_SIZE_Y=1.000000 +PIX_SIZE_UNITS=M +NUM_BANDS=1 +BAND_NUMBERS=000000001 +INCIDENCE_ANGLE= +SUN_AZIMUTH= +SUN_ELEVATION= +CLOUD_COVER= +WRS_PATH= +WRS_ROW= +FILE_FORMAT=GEOTIFF +FULL_RES_LOC=https://hddsexplorer.usgs.gov/order/process?ordered=2563258&node=HDDS&dataset_name=EVENT3340 +FULL_RES_SIZE=54183440 +BROWSE_LOC=https://ims.cr.usgs.gov/browse/eo/disaster/202403_Flood_MNG/BLACKSKY_BlackSky/BS01N47_769636E107_2567602024032000000000MS03.png +METADATA_LOC=https://hddsexplorer.usgs.gov/order/process?ordered=2563258&node=HDDS&dataset_name=EVENT3340 +METADATA_SIZE=9000 +MED_QUAL_LOC=https://hddsexplorer.usgs.gov/order/process?ordered=2563258&node=HDDS&dataset_name=EVENT3340 +MED_QUAL_SIZE=12484653 +LOW_QUAL_LOC=https://hddsexplorer.usgs.gov/order/process?ordered=2563258&node=HDDS&dataset_name=EVENT3340 +LOW_QUAL_SIZE=5828206 +LICENSE_LOC= +VENDOR=BlackSky +VENDOR_SCENE_ID=BSG-102-20240320-024025-217335171_ortho-pan +CATALOG_ID= +SOFTWARE_VERSION=4.2.12 +CONTACT_INFORMATION=eocustserv@usgs.gov +DATE_ENTERED=2024-03-21 +DATE_UPDATED= +IMAGE_INDEX= +DISPLAY_INDEX= +SAT_AZIMUTH= +SAT_ELEVATION= +EVENT_TYPE= +DATA_SOURCE=SATELLITE +VERSION= +PRODUCT_TYPE= +POLARIZATION= +ORBIT_DIRECTION= +SENSOR_MODE=default +CIDR_ID= diff --git a/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_GG000000001.tif b/src/Stars.Data.Tests/Resources/BLACKSKY/Global/data/BSG-102-20240320-024025-217335171_ortho-pan/BS01N47_769636E107_2567602024032000000000MS03_GG000000001.tif new file mode 100644 index 00000000..e69de29b diff --git a/src/Stars.Data.Tests/testsettings.json b/src/Stars.Data.Tests/testsettings.json index fa092696..b650b40b 100644 --- a/src/Stars.Data.Tests/testsettings.json +++ b/src/Stars.Data.Tests/testsettings.json @@ -96,4 +96,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/Stars.Data/Model/Metadata/BlackSkyGlobal/BlackSkyGlobalMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/BlackSkyGlobal/BlackSkyGlobalMetadataExtractor.cs index 979ec013..504bd848 100644 --- a/src/Stars.Data/Model/Metadata/BlackSkyGlobal/BlackSkyGlobalMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/BlackSkyGlobal/BlackSkyGlobalMetadataExtractor.cs @@ -27,11 +27,27 @@ namespace Terradue.Stars.Data.Model.Metadata.BlackSkyGlobal { public class BlackSkyGlobalMetadataExtractor : MetadataExtraction { + public static Dictionary platformDesignators = new Dictionary { + { 1, "2018-096M" }, + { 2, "2018-099BG" }, + { 3, "2019-037C" }, + { 4, "2019-054E" }, + { 7, "2020-055BP" }, + { 8, "2020-055BQ" }, + { 9, "2021-023G" }, + { 12, "2021-115BA" }, + { 13, "2021-115BB" }, + { 14, "2021-106A" }, + { 15, "2021-106B" }, + { 16, "2021-120B" }, + }; + // Possible identifiers: // CSKS4_SCS_B_HI_16_HH_RA_FF_20211016045150_20211016045156 private Regex identifierRegex = new Regex(@"(?'id'CSKS(?'i'\d)_(?'pt'RAW_B|SCS_B|SCS_U|DGM_B|GEC_B|GTC_B)_(?'mode'HI|PP|WR|HR|S2)_(?'swath'..)_(?'pol'HH|VV|HV|VH|CO|CH|CV)_(?'look'L|R)(?'dir'A|D)_.._\d{14}_\d{14})"); private Regex coordinateRegex = new Regex(@"(?'lat'[^ ]+) (?'lon'[^ ]+)"); private static Regex h5dumpValueRegex = new Regex(@".*\(0\): *(?'value'.*)"); + private static Regex satNumberRegex = new Regex(@".+?(?'n'\d+)$"); public static XmlSerializer metadataSerializer = new XmlSerializer(typeof(Schemas.Metadata)); @@ -70,7 +86,7 @@ protected override async Task ExtractMetadata(IItem item, string suffi AddSatStacExtension(stacItem, metadata); AddProjStacExtension(stacItem, metadata); AddViewStacExtension(stacItem, metadata); - AddProcessingStacExtension(stacItem, metadata); + AddProcessingStacExtension(stacItem, metadata, item); AddEoStacExtension(stacItem, metadata); AddOtherProperties(stacItem, metadata); @@ -97,8 +113,6 @@ protected virtual IAsset GetMetadataAsset(IItem item) { logger.LogDebug("Opening metadata file {0}", metadataAsset.Uri); - System.Console.WriteLine("METADATA FILE: {0}", metadataAsset.Uri.AbsolutePath); - using (var stream = await resourceServiceProvider.GetAssetStreamAsync(metadataAsset, System.Threading.CancellationToken.None)) { using (StreamReader reader = new StreamReader(stream)) @@ -123,15 +137,19 @@ protected virtual IAsset GetMetadataAsset(IItem item) internal virtual StacItem CreateStacItem(Schemas.Metadata metadata, IItem item) { string suffix = String.Empty; - if (FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho\.tif$", metadata.id)) != null) suffix = "_ortho"; - else if (FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced\.tif$", metadata.id)) != null) suffix = "_non-ortho"; + if (!metadata.id.Contains("ortho")) + { + suffix = GetProcessingLevel(metadata, item); + if (suffix == "ORTHO") suffix = "_ortho"; + else suffix = "_non-ortho"; + } string identifier = String.Format("{0}{1}", metadata.id, suffix); Dictionary properties = new Dictionary(); FillDateTimeProperties(properties, metadata); - FillInstrument(properties, metadata); - FillBasicsProperties(properties, metadata); + FillInstrument(properties, metadata, item); + FillBasicsProperties(properties, metadata, item); StacItem stacItem = new StacItem(identifier, GetGeometry(metadata), properties); @@ -159,14 +177,19 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat IAsset imageAsset = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho\.tif$", metadata.id)); if (imageAsset != null) { - StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, imageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "RGB image file"); - stacItem.Assets.Add("ortho", stacAsset); + 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); stacAsset.Properties["gsd"] = metadata.gsd; stacAsset.EoExtension().Bands = new EoBandObject[] { - new EoBandObject("red", EoBandCommonName.red) { CenterWavelength = 0.645, FullWidthHalfMax = 0.11 }, - new EoBandObject("green", EoBandCommonName.green) { CenterWavelength = 0.545, FullWidthHalfMax = 0.09 }, - new EoBandObject("blue", EoBandCommonName.blue) { CenterWavelength = 0.485, FullWidthHalfMax = 0.07 }, + 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 }, }; } @@ -174,27 +197,35 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat IAsset imageAssetPan = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho-pan\.tif$", metadata.id)); if (imageAssetPan != null) { - StacAsset stacAssetPan = StacAsset.CreateDataAsset(stacItem, imageAssetPan.Uri, new ContentType("image/tiff; application=geotiff"), "PAN image file"); - stacItem.Assets.Add("ortho-pan", stacAssetPan); + 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); 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 }, + }; } // RGB TIFF (non-ortho) imageAsset = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced\.tif$", metadata.id)); if (imageAsset != null) { - StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, imageAsset.Uri, new ContentType("image/tiff; application=geotiff"), "RGB image file"); - stacItem.Assets.Add("georeferenced", stacAsset); + 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); stacAsset.Properties["gsd"] = metadata.gsd; stacAsset.EoExtension().Bands = new EoBandObject[] { - new EoBandObject("red", EoBandCommonName.red) { CenterWavelength = 0.645, FullWidthHalfMax = 0.11 }, - new EoBandObject("green", EoBandCommonName.green) { CenterWavelength = 0.545, FullWidthHalfMax = 0.09 }, - new EoBandObject("blue", EoBandCommonName.blue) { CenterWavelength = 0.485, FullWidthHalfMax = 0.07 }, + 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 }, }; } @@ -202,20 +233,23 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat imageAssetPan = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced-pan\.tif$", metadata.id)); if (imageAssetPan != null) { - StacAsset stacAssetPan = StacAsset.CreateDataAsset(stacItem, imageAssetPan.Uri, new ContentType("image/tiff; application=geotiff"), "PAN image file"); - stacItem.Assets.Add("georeferenced-pan", stacAssetPan); + 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); 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) { - StacAsset stacAssetMask = StacAsset.CreateDataAsset(stacItem, imageAssetMask.Uri, new ContentType("image/tiff; application=geotiff"), "Pixel mask"); + StacAsset stacAssetMask = StacAsset.CreateDataAsset(stacItem, imageAssetMask.Uri, new ContentType("image/tiff; application=geotiff"), "Mask file"); stacItem.Assets.Add("mask", stacAssetMask); stacAssetMask.Properties.AddRange(imageAssetMask.Properties); stacAssetMask.Properties["gsd"] = metadata.gsd; @@ -226,7 +260,7 @@ protected void AddAssets(StacItem stacItem, IItem item, Schemas.Metadata metadat if (rpcAsset != null) { StacAsset stacAssetRpc = StacAsset.CreateMetadataAsset(stacItem, rpcAsset.Uri, new ContentType("text/plain"), "RPC (RGB)"); - stacItem.Assets.Add("georefrenced-rpc", stacAssetRpc); + stacItem.Assets.Add("georefrenced-rgb-rpc", stacAssetRpc); stacAssetRpc.Properties.AddRange(rpcAsset.Properties); } @@ -261,26 +295,53 @@ private void FillDateTimeProperties(Dictionary properties, Schem } - private void FillInstrument(Dictionary properties, Schemas.Metadata metadata) + private void FillInstrument(Dictionary properties, Schemas.Metadata metadata, IItem item) { // platform & constellation properties["agency"] = "BlackSky"; properties["platform"] = metadata.sensorName.ToLower(); - properties["mission"] = "Global"; - properties["instruments"] = new string[] { metadata.sensorName.ToLower() }; + properties["constellation"] = "blacksky-global"; + properties["mission"] = "blacksky-global"; + properties["instruments"] = new string[] { "spaceview-24" }; properties["sensor_type"] = "optical"; + properties["spectral_mode"] = GetSpectralMode(metadata, item); + properties["gsd"] = metadata.gsd; } - private void FillBasicsProperties(IDictionary properties, Schemas.Metadata metadata) + private string GetSpectralMode(Schemas.Metadata metadata, IItem item) + { + if (metadata.spectralMode != null) + { + if (metadata.spectralMode == "PN") return "PAN"; + if (metadata.spectralMode == "MS") return "MS"; + if (metadata.spectralMode.Contains("MS") && metadata.spectralMode.Contains("MS")) return "PAN/MS"; + } + + bool pan = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho-pan\.tif$", metadata.id)) != null || FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced-pan\.tif$", metadata.id)) != null; + bool ms = FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho\.tif$", metadata.id)) != null || FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced\.tif$", metadata.id)) != null; + + return String.Format("{0}{1}{2}", pan ? "PAN" : String.Empty, pan && ms ? "/": String.Empty, ms ? "MS" : String.Empty); + + } + + private void FillBasicsProperties(IDictionary properties, Schemas.Metadata metadata, IItem item) { DateTime? acquisitionDate = GetAcquisitionDateTime(metadata); string dateStr = (acquisitionDate != null ? String.Format(" {0:yyyy-MM-dd HH:mm:ss}", acquisitionDate.Value.ToUniversalTime()) : String.Empty); CultureInfo culture = new CultureInfo("fr-FR"); - properties["title"] = String.Format("{0}{1}", + string processingLevel = GetProcessingLevel(metadata, item); + if (processingLevel == null) processingLevel = String.Empty; + else processingLevel = String.Format(" {0}", processingLevel); + string spectralMode = GetSpectralMode(metadata, item); + if (spectralMode == null) spectralMode = String.Empty; + else spectralMode = String.Format(" {0}", spectralMode.Replace("/", " ")); + properties["title"] = String.Format("BLACKSY {0}{1}{2}", metadata.sensorName.ToUpper(), + processingLevel, + spectralMode, dateStr ); } @@ -302,6 +363,16 @@ private void AddOtherProperties(StacItem stacItem, Schemas.Metadata metadata) private void AddSatStacExtension(StacItem stacItem, Schemas.Metadata metadata) { + var sat = new SatStacExtension(stacItem); + if (!String.IsNullOrEmpty("")) + { + Match match = satNumberRegex.Match(""); + if (match != null && Int32.TryParse(match.Groups["n"].Value, out int n) && platformDesignators.ContainsKey(n)) + { + sat.PlatformInternationalDesignator = platformDesignators[n]; + } + } + } @@ -320,16 +391,16 @@ private void AddProjStacExtension(StacItem stacItem, Schemas.Metadata metadata) private void AddViewStacExtension(StacItem stacItem, Schemas.Metadata metadata) { var view = new ViewStacExtension(stacItem); - view.OffNadir = metadata.offNadirAngle; - view.SunAzimuth = metadata.sunAzimuth; - view.SunElevation = metadata.sunElevation; + if (metadata.offNadirAngle.HasValue) view.OffNadir = metadata.offNadirAngle.Value; + if (metadata.sunAzimuth.HasValue) view.SunAzimuth = metadata.sunAzimuth.Value; + if (metadata.sunElevation.HasValue) view.SunElevation = metadata.sunElevation.Value; } - private void AddProcessingStacExtension(StacItem stacItem, Schemas.Metadata metadata) + private void AddProcessingStacExtension(StacItem stacItem, Schemas.Metadata metadata, IItem item) { var proc = stacItem.ProcessingExtension(); - proc.Level = "ORTHO"; + proc.Level = GetProcessingLevel(metadata, item); } @@ -378,6 +449,20 @@ private GeoJSON.Net.Geometry.IGeometryObject GetGeometry(Schemas.Metadata metada return polygon.NormalizePolygon(); } + private string GetProcessingLevel(Schemas.Metadata metadata, IItem item) + { + if (metadata.processLevel != null) + { + if (metadata.orthorectified.HasValue && metadata.orthorectified.Value) return "ORTHO"; + if (metadata.georeferenced.HasValue && metadata.georeferenced.Value) return "GEO"; + if (metadata.processLevel == "O") return "ORTHO"; + if (metadata.processLevel == "G") return "GEO"; + } + if (FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_ortho\.tif$", metadata.id)) != null) return "ORTHO"; + if (FindFirstAssetFromFileNameRegex(item, String.Format(@"{0}_georeferenced\.tif$", metadata.id)) != null) return "GEO"; + return null; + } + } diff --git a/src/Stars.Data/Model/Metadata/BlackSkyGlobal/Schemas/Metadata.cs b/src/Stars.Data/Model/Metadata/BlackSkyGlobal/Schemas/Metadata.cs index 5751a17e..97ce2823 100644 --- a/src/Stars.Data/Model/Metadata/BlackSkyGlobal/Schemas/Metadata.cs +++ b/src/Stars.Data/Model/Metadata/BlackSkyGlobal/Schemas/Metadata.cs @@ -16,25 +16,26 @@ public partial class Metadata { public string id { get; set; } public string acquisitionDate { get; set; } public string sensorName { get; set; } - public double gsd { get; set; } + public string spectralMode { get; set; } + public double? gsd { get; set; } public object geometry { get; set; } - public double cloudCoverPercent { get; set; } - public double offNadirAngle { get; set; } - public double sunElevation { get; set; } - public double sunAzimuth { get; set; } - public double satelliteElevation { get; set; } - public double satelliteAzimuth { get; set; } - public bool georeferenced { get; set; } - public bool orthorectified { get; set; } - public int width { get; set; } - public int height { get; set; } + public double? cloudCoverPercent { get; set; } + public double? offNadirAngle { get; set; } + public double? sunElevation { get; set; } + public double? sunAzimuth { get; set; } + public double? satelliteElevation { get; set; } + public double? satelliteAzimuth { get; set; } + public bool? georeferenced { get; set; } + public bool? orthorectified { get; set; } + public int? width { get; set; } + public int? height { get; set; } public string processingVersion { get; set; } public string targetType { get; set; } - public double estimatedCE90 { get; set; } - public int bitsPerPixel { get; set; } + public double? estimatedCE90 { get; set; } + public int? bitsPerPixel { get; set; } public string imageSpecVersion { get; set; } - public double fractionSaturated { get; set; } + public double? fractionSaturated { get; set; } public object numberRegistrationPoints { get; set; } public GeminiType gemini { get; set; } @@ -60,6 +61,14 @@ public static Metadata FromTextFile(StreamReader reader) } metadata.id = GetStringValue(textMetadata, "VENDOR_SCENE_ID"); + string platformNumber = GetStringValue(textMetadata, "PLATFORM_NUMBER"); + if (platformNumber == null) + { + string fileName = GetStringValue(textMetadata, "ENTITY_ID"); + if (fileName != null && fileName.StartsWith("BS")) platformNumber = fileName.Substring(2, 2).TrimStart('0'); + } + metadata.sensorName = String.Format("Global-{0}", platformNumber); + metadata.spectralMode = GetStringValue(textMetadata, "SENSOR_TYPE"); string acquisitionDate = GetStringValue(textMetadata, "ACQUISITION_DATE"); if (!String.IsNullOrEmpty(acquisitionDate)) { @@ -76,7 +85,6 @@ public static Metadata FromTextFile(StreamReader reader) acquisitionTime = acquisitionTime.Replace("Z", ""); metadata.acquisitionDate = String.Format("{0}T{1}Z", acquisitionDate, acquisitionTime); } - metadata.sensorName = GetStringValue(textMetadata, "SENSOR"); metadata.gsd = 1; // hardcoded List coordinates = new List(); @@ -129,13 +137,13 @@ public static string GetStringValue(Dictionary dict, string key) return null; } - public static double GetDoubleValue(Dictionary dict, string key) + public static double? GetDoubleValue(Dictionary dict, string key) { if (dict.ContainsKey(key)) { if (Double.TryParse(dict[key], out double value)) return value; } - return 0; + return null; } @@ -148,21 +156,3 @@ public partial class GeminiType { } - - - -/* -metadata.id -metadata.gsd; -metadata.sensorName.ToLower(); -metadata.sensorName.ToLower() }; -metadata.gsd; -metadata.sensorName.ToUpper(), -metadata.AncillaryDataReference.Tag, "Ellipsoid Designator"); -metadata.offNadirAngle; -metadata.sunAzimuth; -metadata.sunElevation; -metadata.cloudCoverPercent; -metadata.acquisitionDate, null, DateTimeStyles.AssumeUniversal, out DateTime result)) -metadata.geometry); - */ \ No newline at end of file diff --git a/src/Stars.Data/Terradue.Stars.Data.csproj b/src/Stars.Data/Terradue.Stars.Data.csproj index b412c83d..5eae3e1f 100644 --- a/src/Stars.Data/Terradue.Stars.Data.csproj +++ b/src/Stars.Data/Terradue.Stars.Data.csproj @@ -31,7 +31,7 @@ - +