From 710871e058032d739b0594c04d2470ec98a3fca5 Mon Sep 17 00:00:00 2001 From: marshHawk4 Date: Thu, 28 Mar 2024 12:28:28 -0400 Subject: [PATCH] added metadata (#18) --- README.md | 275 ++++++++++++++++++++------------- cdr_schemas/feature_results.py | 4 +- dev/docs.py | 1 + 3 files changed, 174 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 0592165..0f0da2d 100644 --- a/README.md +++ b/README.md @@ -50,18 +50,20 @@ poetry run docs ```mermaid classDiagram - class Pixel_Point { - rows_from_top: Union[float, int] - columns_from_left: Union[float, int] - type: GeomType = GeomType.Point + class ProjectionResult { + crs: str + gcp_ids: list[str] + file_name: str } - class GeoreferenceResults { - cog_id: str - georeference_results: Optional[list[GeoreferenceResult]] - gcps: Optional[list[GroundControlPoint]] - system: str - system_version: str + class GroundControlPoint { + gcp_id: str + map_geom: Geom_Point + px_geom: Pixel_Point + confidence: Optional[float] + model: str + model_version: str + crs: Optional[str] } class GeomType { @@ -82,42 +84,40 @@ classDiagram model_version: Optional[str] } - class Geom_Point { - latitude: Union[float, int, NoneType] - longitude: Union[float, int, NoneType] - type: GeomType = GeomType.Point + class GeoreferenceResult { + likely_CRSs: Optional[list[str]] + map_area: Optional[Area_Extraction] + projections: Optional[list[ProjectionResult]] } - class ProjectionResult { - crs: str - gcp_ids: list[str] - file_name: str + class GeoreferenceResults { + cog_id: str + georeference_results: Optional[list[GeoreferenceResult]] + gcps: Optional[list[GroundControlPoint]] + system: str + system_version: str } - class GroundControlPoint { - gcp_id: str - map_geom: Geom_Point - px_geom: Pixel_Point - confidence: Optional[float] - model: str - model_version: str - crs: Optional[str] + class Geom_Point { + latitude: Union[float, int, NoneType] + longitude: Union[float, int, NoneType] + type: GeomType = GeomType.Point } - class GeoreferenceResult { - likely_CRSs: Optional[list[str]] - map_area: Optional[Area_Extraction] - projections: Optional[list[ProjectionResult]] + class Pixel_Point { + rows_from_top: Union[float, int] + columns_from_left: Union[float, int] + type: GeomType = GeomType.Point } Area_Extraction ..> GeomType Area_Extraction ..> AreaType Geom_Point ..> GeomType Pixel_Point ..> GeomType - GroundControlPoint ..> Pixel_Point GroundControlPoint ..> Geom_Point - GeoreferenceResult ..> ProjectionResult + GroundControlPoint ..> Pixel_Point GeoreferenceResult ..> Area_Extraction + GeoreferenceResult ..> ProjectionResult GeoreferenceResults ..> GroundControlPoint GeoreferenceResults ..> GeoreferenceResult @@ -134,14 +134,6 @@ classDiagram ```mermaid classDiagram - class CogMetaData { - cog_id: str - system: str - system_version: str - multiple_maps: Optional[bool] - map_metadata: Optional[list[MapMetaData]] - } - class MapMetaData { title: Optional[str] year: Optional[int] @@ -165,6 +157,14 @@ classDiagram grayscale: str = 'grayscale' } + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] + map_metadata: Optional[list[MapMetaData]] + } + class MapShapeTypes { <> rectangular: str = 'rectangular' @@ -188,24 +188,33 @@ classDiagram ```mermaid classDiagram - class PointLegendAndFeaturesResult { - id: str - crs: str - cdr_projection_id: Optional[str] - name: Optional[str] - description: Optional[str] - legend_bbox: Optional[list[Union[float, int]]] - point_features: Optional[list[PointFeatureCollection]] + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] + map_metadata: Optional[list[MapMetaData]] } - class LineLegendAndFeaturesResult { + class FeatureResults { + cog_id: str + line_feature_results: Optional[list[LineLegendAndFeaturesResult]] + point_feature_results: Optional[list[PointLegendAndFeaturesResult]] + polygon_feature_results: Optional[list[PolygonLegendAndFeauturesResult]] + cog_area_extractions: Optional[list[Area_Extraction]] + cog_metadata_extractions: Optional[list[CogMetaData]] + system: str + system_version: str + } + + class PointLegendAndFeaturesResult { id: str crs: str cdr_projection_id: Optional[str] name: Optional[str] description: Optional[str] legend_bbox: Optional[list[Union[float, int]]] - line_features: Optional[LineFeatureCollection] + point_features: Optional[list[PointFeatureCollection]] } class Area_Extraction { @@ -219,14 +228,14 @@ classDiagram model_version: Optional[str] } - class FeatureResults { - cog_id: str - line_feature_results: Optional[list[LineLegendAndFeaturesResult]] - point_feature_results: Optional[list[PointLegendAndFeaturesResult]] - polygon_feature_results: Optional[list[PolygonLegendAndFeauturesResult]] - map_area_extractions: Optional[list[Area_Extraction]] - system: str - system_version: str + class LineLegendAndFeaturesResult { + id: str + crs: str + cdr_projection_id: Optional[str] + name: Optional[str] + description: Optional[str] + legend_bbox: Optional[list[Union[float, int]]] + line_features: Optional[LineFeatureCollection] } class PolygonLegendAndFeauturesResult { @@ -249,10 +258,12 @@ classDiagram PointLegendAndFeaturesResult ..> PointFeatureCollection PolygonLegendAndFeauturesResult ..> MapUnit PolygonLegendAndFeauturesResult ..> PolygonFeatureCollection + CogMetaData ..> MapMetaData + FeatureResults ..> CogMetaData FeatureResults ..> PointLegendAndFeaturesResult - FeatureResults ..> PolygonLegendAndFeauturesResult - FeatureResults ..> LineLegendAndFeaturesResult FeatureResults ..> Area_Extraction + FeatureResults ..> LineLegendAndFeaturesResult + FeatureResults ..> PolygonLegendAndFeauturesResult ``` @@ -267,6 +278,11 @@ classDiagram ```mermaid classDiagram + class Point { + coordinates: list[Union[float, int]] + type: GeomType = GeomType.Point + } + class PointLegendAndFeaturesResult { id: str crs: str @@ -284,18 +300,6 @@ classDiagram Polygon: str = 'Polygon' } - class PointFeature { - type: GeoJsonType = GeoJsonType.Feature - id: str - geometry: Point - properties: PointProperties - } - - class Point { - coordinates: list[Union[float, int]] - type: GeomType = GeomType.Point - } - class PointProperties { model: Optional[str] model_version: Optional[str] @@ -305,6 +309,13 @@ classDiagram dip_direction: Optional[int] } + class PointFeature { + type: GeoJsonType = GeoJsonType.Feature + id: str + geometry: Point + properties: PointProperties + } + class PointFeatureCollection { type: GeoJsonType = GeoJsonType.FeatureCollection features: list[PointFeature] @@ -317,8 +328,8 @@ classDiagram } Point ..> GeomType - PointFeature ..> PointProperties PointFeature ..> Point + PointFeature ..> PointProperties PointFeature ..> GeoJsonType PointFeatureCollection ..> PointFeature PointFeatureCollection ..> GeoJsonType @@ -337,14 +348,6 @@ classDiagram ```mermaid classDiagram - class LineProperty { - model: Optional[str] - model_version: Optional[str] - confidence: Optional[float] - dash_pattern: Optional[DashType] = None - symbol: Optional[str] - } - class LineFeature { type: GeoJsonType = GeoJsonType.Feature id: str @@ -352,11 +355,6 @@ classDiagram properties: LineProperty } - class Line { - coordinates: list[list[Union[float, int]]] - type: GeomType = GeomType.LineString - } - class DashType { <> solid: str = 'solid' @@ -364,17 +362,30 @@ classDiagram dotted: str = 'dotted' } + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' + } + class GeoJsonType { <> Feature: str = 'Feature' FeatureCollection: str = 'FeatureCollection' } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' + class Line { + coordinates: list[list[Union[float, int]]] + type: GeomType = GeomType.LineString + } + + class LineProperty { + model: Optional[str] + model_version: Optional[str] + confidence: Optional[float] + dash_pattern: Optional[DashType] = None + symbol: Optional[str] } class LineLegendAndFeaturesResult { @@ -419,10 +430,11 @@ classDiagram features: Optional[list[PolygonFeature]] } - class PolygonProperty { - model: Optional[str] - model_version: Optional[str] - confidence: Optional[float] + class GeomType { + <> + Point: str = 'Point' + LineString: str = 'LineString' + Polygon: str = 'Polygon' } class PolygonFeature { @@ -438,11 +450,15 @@ classDiagram FeatureCollection: str = 'FeatureCollection' } - class GeomType { - <> - Point: str = 'Point' - LineString: str = 'LineString' - Polygon: str = 'Polygon' + class Polygon { + coordinates: list[list[list[Union[float, int]]]] + type: GeomType = GeomType.Polygon + } + + class PolygonProperty { + model: Optional[str] + model_version: Optional[str] + confidence: Optional[float] } class MapUnit { @@ -470,11 +486,6 @@ classDiagram polygon_features: Optional[PolygonFeatureCollection] } - class Polygon { - coordinates: list[list[list[Union[float, int]]]] - type: GeomType = GeomType.Polygon - } - Polygon ..> GeomType PolygonFeature ..> PolygonProperty PolygonFeature ..> Polygon @@ -485,6 +496,60 @@ classDiagram PolygonLegendAndFeauturesResult ..> PolygonFeatureCollection +``` + + + +### Cog Metadata + +
+ cog metadata + +```mermaid +classDiagram + + class MapMetaData { + title: Optional[str] + year: Optional[int] + crs: Optional[str] + authors: Optional[list[str]] + organization: Optional[str] + scale: Optional[int] + quadrangle_name: Optional[str] + map_shape: Optional[MapShapeTypes] + map_color_scheme: Optional[MapColorSchemeTypes] + publisher: Optional[str] + state: Optional[str] + model: str + model_version: str + } + + class MapColorSchemeTypes { + <> + full_color: str = 'full_color' + monochrome: str = 'monochrome' + grayscale: str = 'grayscale' + } + + class CogMetaData { + cog_id: str + system: str + system_version: str + multiple_maps: Optional[bool] + map_metadata: Optional[list[MapMetaData]] + } + + class MapShapeTypes { + <> + rectangular: str = 'rectangular' + non_rectangular: str = 'non_rectangular' + } + + MapMetaData ..> MapColorSchemeTypes + MapMetaData ..> MapShapeTypes + CogMetaData ..> MapMetaData + + ```
diff --git a/cdr_schemas/feature_results.py b/cdr_schemas/feature_results.py index 18f2a49..33f1992 100644 --- a/cdr_schemas/feature_results.py +++ b/cdr_schemas/feature_results.py @@ -6,6 +6,7 @@ from cdr_schemas.features.line_features import LineLegendAndFeaturesResult from cdr_schemas.features.point_features import PointLegendAndFeaturesResult from cdr_schemas.features.polygon_features import PolygonLegendAndFeauturesResult +from cdr_schemas.metadata import CogMetaData class FeatureResults(BaseModel): @@ -37,7 +38,8 @@ class FeatureResults(BaseModel): A list of legend extractions with associated polygon feature results. """, ) - map_area_extractions: Optional[List[Area_Extraction]] + cog_area_extractions: Optional[List[Area_Extraction]] + cog_metadata_extractions: Optional[List[CogMetaData]] system: str = Field( ..., description=""" diff --git a/dev/docs.py b/dev/docs.py index 7544b99..18d0e03 100644 --- a/dev/docs.py +++ b/dev/docs.py @@ -53,6 +53,7 @@ def run(): Module(title="point feature", ref=cdr_schemas.features.point_features), Module(title="line feature", ref=cdr_schemas.features.line_features), Module(title="polygon feature", ref=cdr_schemas.features.polygon_features), + Module(title="cog metadata", ref=cdr_schemas.metadata), ] for m in modules: