Skip to content

Commit ce9330a

Browse files
committed
Merge branch 'staging' into thanks_dependbot
2 parents 4abd5d6 + 1e6bf41 commit ce9330a

File tree

15 files changed

+50
-158
lines changed

15 files changed

+50
-158
lines changed

.github/workflows/terraform_build.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_dev }}
1818
AWS_REGION: ${{ secrets.aws_region_dev }}
1919
LOCALSTACK_AUTH_TOKEN: ${{ secrets.localstack_auth_token }}
20-
PLANET_API_KEY: ${{secrets.planet_api_key }}
2120
run: |
2221
./scripts/test
2322

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Raster and vector tile API for datasets in the [GFW Data API](https://github.com
1515

1616
{bastion_host} might be something like: `ec2-18-215-196-0.compute-1.amazonaws.com`
1717

18-
* Set the environment variables for the **read only** credentials of the above database. The environment variables are `GFW_DB_NAME`, `GFW_DB_USER_RO`, `GFW_DB_PASSWORD_RO`, and `PLANET_API_KEY`. These are also listed in the `docker-compose.dev.yml` file. You get the values of secrets from the secrets manager of the appropriate AWS environment (production, staging, etc.)
18+
* Set the environment variables for the **read only** credentials of the above database. The environment variables are `GFW_DB_NAME`, `GFW_DB_USER_RO`, and `GFW_DB_PASSWORD_RO`. These are also listed in the `docker-compose.dev.yml` file. You get the values of secrets from the secrets manager of the appropriate AWS environment (production, staging, etc.)
1919

2020
* In `docker-compose.dev.yml`, set `DATA_LAKE_BUCKET` to the desired environment's bucket name. By default, the `staging` environment bucket (`gfw-data-lake-staging`) will be used.
2121

app/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
raster_tiles as umd_glad_sentinel2_alerts_raster_tiles,
3737
)
3838
from .routes.wur_radd_alerts import raster_tiles as wur_radd_alerts_raster_tiles
39-
from .routes.planet import raster_tiles as planet_raster_tiles
4039
from .routes import wmts
4140
from .routes import preview
4241

@@ -85,7 +84,6 @@
8584
umd_glad_landsat_alerts_raster_tiles.router,
8685
umd_glad_sentinel2_alerts_raster_tiles.router,
8786
wur_radd_alerts_raster_tiles.router,
88-
planet_raster_tiles.router,
8987
raster_tiles.router,
9088
wmts.router,
9189
viirs_esri_vector_tile_server.router,

app/routes/planet/__init__.py

Whitespace-only changes.

app/routes/planet/raster_tiles.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

app/routes/titiler/algorithms/integrated_alerts_drivers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def create_mask(self):
9797
condition are masked.
9898
"""
9999

100-
mask = self.alert_drivers > 0
100+
mask = ~self.no_data * (self.alert_drivers > 0)
101101

102102
if self.alert_confidence:
103103
confidence_mask = (

app/routes/titiler/gfw_integrated_alerts_drivers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from typing import Optional, Tuple
33

44
from aenum import Enum, extend_enum
5-
from fastapi import APIRouter, Depends, Query, Response
5+
from fastapi import APIRouter, Depends, Query, Response, HTTPException
6+
from rio_tiler.errors import TileOutsideBounds
67
from titiler.core.resources.enums import ImageType
78
from titiler.core.utils import render_image
89

@@ -81,7 +82,10 @@ async def gfw_integrated_alerts_drivers_raster_tile(
8182
folder: str = f"s3://{DATA_LAKE_BUCKET}/gfw_integrated_alerts/{integrated_alerts_version}/raster/epsg-4326/cog"
8283
with AlertsReader(input=folder) as reader:
8384
tile_x, tile_y, zoom = xyz
84-
image_data = reader.tile(tile_x, tile_y, zoom, bands=bands)
85+
try:
86+
image_data = reader.tile(tile_x, tile_y, zoom, bands=bands)
87+
except TileOutsideBounds:
88+
raise HTTPException(status_code=404, detail="Tile outside of bounds of this dataset")
8589

8690
integrated_alerts_drivers = IntegratedAlertsDrivers(
8791
start_date=start_date,
@@ -93,11 +97,10 @@ async def gfw_integrated_alerts_drivers_raster_tile(
9397
with COGReader(
9498
f"s3://{DATA_LAKE_BUCKET}/wur_integration_alert_drivers_class/{version}/raster/epsg-4326/cog/class.tif"
9599
) as reader:
96-
if reader.tile_exists(tile_x, tile_y, zoom):
100+
try:
97101
integrated_alerts_drivers.alert_drivers = reader.tile(tile_x, tile_y, zoom).data[0]
98-
else:
99-
print("Non-existent tile, wur_integration_alert_drivers_class")
100-
integrated_alerts_drivers.alert_drivers = None
102+
except TileOutsideBounds:
103+
raise HTTPException(status_code=404, detail="Tile outside of bounds of this dataset")
101104

102105
processed_image = integrated_alerts_drivers(image_data)
103106

app/settings/globals.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class Globals(BaseSettings):
7474
None, description="AWS service endpoint URL"
7575
)
7676
lambda_host: Optional[str] = Field(None, description="AWS Lamdba host URL")
77-
planet_api_key: Optional[str] = Field(None, description="Planet Api key")
7877
tile_cache_url: Optional[str] = Field(None, description="Tile Cache URL")
7978
sql_request_timeout: int = Field(
8079
58000, description="SQL timeout time (server side)"

docker-compose-local-data-api.dev.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ services:
2121
- LOG_LEVEL=debug
2222
- RASTER_TILER_LAMBDA_NAME=test
2323
- ENV=dev
24-
- PLANET_API_KEY
2524
ports:
2625
- 8088:80
2726
entrypoint: wait_for_postgres.sh /app/start.sh

docker-compose.dev.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ services:
2424
- LOG_LEVEL=debug
2525
- RASTER_TILER_LAMBDA_NAME=test
2626
- ENV=dev
27-
- PLANET_API_KEY=${PLANET_API_KEY}
2827
- AWS_REQUEST_PAYER=requester
2928
- 'DIST_ALERTS_FOREST_FILTERS={"tree_cover_loss": {"dataset": "umd_tree_cover_loss", "version": "v1.10.1"}, "tree_cover_height": {"dataset": "umd_tree_cover_height_2020", "version": "v2022"}, "tree_cover_density": {"dataset": "umd_tree_cover_density_2010", "version": "v1.6"}}'
3029
ports:

0 commit comments

Comments
 (0)