From c84d1d03ee9865cb50c191fa802469f22dc4111e Mon Sep 17 00:00:00 2001 From: Alexandra Kirk Date: Thu, 17 Oct 2024 16:19:08 -0600 Subject: [PATCH 1/4] feat(raster): added new soil texture colormap --- raster_api/runtime/src/cmap_data/README.md | 30 ++++++++++++++++++ .../runtime/src/cmap_data/soil_texture.npy | Bin 0 -> 1152 bytes 2 files changed, 30 insertions(+) create mode 100644 raster_api/runtime/src/cmap_data/soil_texture.npy diff --git a/raster_api/runtime/src/cmap_data/README.md b/raster_api/runtime/src/cmap_data/README.md index 91c39ecc..1a489350 100644 --- a/raster_api/runtime/src/cmap_data/README.md +++ b/raster_api/runtime/src/cmap_data/README.md @@ -80,3 +80,33 @@ for c, v in internal_colormap.items(): np.save("nlcd.npy", cmap) ``` + +##### Soil texture colormap + +```python +from rio_tiler.colormap import parse_color +import numpy as np + +# These categories are based on a USGS soil texture chart, not an official set of color mappings for soil texture categories +texture_categories = { + "1": "#F89E61", + "2": "#BA8560", + "3": "#D8D2B4", + "4": "#AE734C", + "5": "#9E8478", + "6": "#C6A365", + "7": "#B4A67D", + "8": "#E1D4C4", + "9": "#BEB56D", + "10": "#777C7A", + "11": "#A89B6F", + "12": "#E9E2AF" +} + +cmap = np.zeros((256, 4), dtype=np.uint8) +cmap[:] = np.array([0, 0, 0, 255]) +for k in texture_categories.keys(): + cmap[int(k)] = np.array(parse_color(texture_categories[k])) + +np.save("soil_texture.npy", cmap) +``` \ No newline at end of file diff --git a/raster_api/runtime/src/cmap_data/soil_texture.npy b/raster_api/runtime/src/cmap_data/soil_texture.npy new file mode 100644 index 0000000000000000000000000000000000000000..1a1a65183d712a40615a863144b182cedd809d0d GIT binary patch literal 1152 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1JQ);NLqoAIaUsO_*m=~X4l#&V(cT3DEP6dh= zXCxM+0{I$7re-<{CYm}5wF+bcE(QjM|3Bs>{@>M_@c+i8E&taQ`~08RQt|)T;?)0J qmeu}$c;(3deOq(?m)BJNUokuX|I0_~|AX|5;?Xb|O#?$e4FCWeOfiK3 literal 0 HcmV?d00001 From 5da794dabdff1dcfe77a2d5f3bf1cf84593dc206 Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:11:53 -0700 Subject: [PATCH 2/4] feat: disable default api gateway endpoints --- ingest_api/infrastructure/construct.py | 1 + raster_api/infrastructure/construct.py | 1 + stac_api/infrastructure/construct.py | 1 + 3 files changed, 3 insertions(+) diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index d7dcd05f..f75fadac 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -211,6 +211,7 @@ def build_api( self, f"{stack_name}-{construct_id}", default_integration=ingest_api_integration, + disable_execute_api_endpoint=True, ) def build_jwks_url(self, userpool_id: str) -> str: diff --git a/raster_api/infrastructure/construct.py b/raster_api/infrastructure/construct.py index b75a9f21..6341b61c 100644 --- a/raster_api/infrastructure/construct.py +++ b/raster_api/infrastructure/construct.py @@ -99,6 +99,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=raster_api_integration, + disable_execute_api_endpoint=True, ) CfnOutput( diff --git a/stac_api/infrastructure/construct.py b/stac_api/infrastructure/construct.py index c3ca56a0..3a76994d 100644 --- a/stac_api/infrastructure/construct.py +++ b/stac_api/infrastructure/construct.py @@ -106,6 +106,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=stac_api_integration, + disable_execute_api_endpoint=True, ) CfnOutput( From 7afc9abd4de91cb86590e01c5b111717182f33db Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:54:39 -0700 Subject: [PATCH 3/4] feat: add flag to disable default endpoints --- .example.env | 1 + config.py | 5 +++++ ingest_api/infrastructure/config.py | 5 +++++ ingest_api/infrastructure/construct.py | 4 +++- raster_api/infrastructure/config.py | 4 ++++ raster_api/infrastructure/construct.py | 2 +- stac_api/infrastructure/config.py | 4 ++++ stac_api/infrastructure/construct.py | 2 +- 8 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.example.env b/.example.env index c3fb4b62..984a692e 100644 --- a/.example.env +++ b/.example.env @@ -40,3 +40,4 @@ VEDA_CLOUDFRONT= VEDA_CLOUDFRONT_OAC=[OPTIONAL, CONFIGURES ORIGIN ACCESS CONTROL, DEFAULTS TO TRUE] VEDA_CUSTOM_HOST= VEDA_SHARED_WEB_ACL_ID=[OPTIONAL ID ARN for WEB ACL] +VEDA_DISABLE_DEFAULT_APIGW_ENDPOINT=[OPTIONAL BOOL TO DISABLE DEFAULT API GATEWAY ENDPOINTS] diff --git a/config.py b/config.py index c792b1b7..83fd256d 100644 --- a/config.py +++ b/config.py @@ -109,6 +109,11 @@ class vedaAppSettings(BaseSettings): None, description="Custom domain name, i.e. veda-backend.xyz" ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + ) + def cdk_env(self) -> dict: """Load a cdk environment dict for stack""" diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index 31a894bb..1b3eadf7 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -88,6 +88,11 @@ class IngestorConfig(BaseSettings): description="Raster API root path. Used to infer url of raster-api before app synthesis.", ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + ) + class Config: case_sensitive = False env_file = ".env" diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index f75fadac..5f298b86 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -91,6 +91,7 @@ def __init__( construct_id=construct_id, handler=self.api_lambda, custom_host=config.custom_host, + disable_default_apigw_endpoint=config.disable_default_apigw_endpoint, ) stack_name = Stack.of(self).stack_name @@ -188,6 +189,7 @@ def build_api( construct_id: str, handler: aws_lambda.IFunction, custom_host: Optional[str], + disable_default_apigw_endpoint: Optional[bool], ) -> aws_apigatewayv2_alpha.HttpApi: integration_kwargs = dict(handler=handler) if custom_host: @@ -211,7 +213,7 @@ def build_api( self, f"{stack_name}-{construct_id}", default_integration=ingest_api_integration, - disable_execute_api_endpoint=True, + disable_execute_api_endpoint=disable_default_apigw_endpoint, ) def build_jwks_url(self, userpool_id: str) -> str: diff --git a/raster_api/infrastructure/config.py b/raster_api/infrastructure/config.py index f3474226..caa9ee23 100644 --- a/raster_api/infrastructure/config.py +++ b/raster_api/infrastructure/config.py @@ -84,6 +84,10 @@ class vedaRasterSettings(BaseSettings): "VEDA (Visualization, Exploration, and Data Analysis)", description="Name of the STAC Catalog", ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + ) class Config: """model config""" diff --git a/raster_api/infrastructure/construct.py b/raster_api/infrastructure/construct.py index 6341b61c..389e29f5 100644 --- a/raster_api/infrastructure/construct.py +++ b/raster_api/infrastructure/construct.py @@ -99,7 +99,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=raster_api_integration, - disable_execute_api_endpoint=True, + disable_execute_api_endpoint=veda_raster_settings.disable_default_apigw_endpoint, ) CfnOutput( diff --git a/stac_api/infrastructure/config.py b/stac_api/infrastructure/config.py index 2196a430..52604f81 100644 --- a/stac_api/infrastructure/config.py +++ b/stac_api/infrastructure/config.py @@ -57,6 +57,10 @@ class vedaSTACSettings(BaseSettings): stac_enable_transactions: bool = Field( False, description="Whether to enable transactions endpoints" ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + ) @root_validator def check_transaction_fields(cls, values): diff --git a/stac_api/infrastructure/construct.py b/stac_api/infrastructure/construct.py index 3a76994d..10b4879b 100644 --- a/stac_api/infrastructure/construct.py +++ b/stac_api/infrastructure/construct.py @@ -106,7 +106,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=stac_api_integration, - disable_execute_api_endpoint=True, + disable_execute_api_endpoint=veda_stac_settings.disable_default_apigw_endpoint, ) CfnOutput( From da2d01e0a652c3ba6ee27473158f7e6e3959fd14 Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:41:14 -0700 Subject: [PATCH 4/4] fix: lint --- config.py | 2 +- ingest_api/infrastructure/config.py | 2 +- raster_api/infrastructure/config.py | 2 +- stac_api/infrastructure/config.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index 83fd256d..93bb6d8c 100644 --- a/config.py +++ b/config.py @@ -111,7 +111,7 @@ class vedaAppSettings(BaseSettings): disable_default_apigw_endpoint: Optional[bool] = Field( False, - description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", ) def cdk_env(self) -> dict: diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index 1b3eadf7..a4ca9d37 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -90,7 +90,7 @@ class IngestorConfig(BaseSettings): disable_default_apigw_endpoint: Optional[bool] = Field( False, - description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", ) class Config: diff --git a/raster_api/infrastructure/config.py b/raster_api/infrastructure/config.py index caa9ee23..f5e5a055 100644 --- a/raster_api/infrastructure/config.py +++ b/raster_api/infrastructure/config.py @@ -86,7 +86,7 @@ class vedaRasterSettings(BaseSettings): ) disable_default_apigw_endpoint: Optional[bool] = Field( False, - description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", ) class Config: diff --git a/stac_api/infrastructure/config.py b/stac_api/infrastructure/config.py index 52604f81..bba00ea4 100644 --- a/stac_api/infrastructure/config.py +++ b/stac_api/infrastructure/config.py @@ -59,7 +59,7 @@ class vedaSTACSettings(BaseSettings): ) disable_default_apigw_endpoint: Optional[bool] = Field( False, - description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false." + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", ) @root_validator