-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(raster)!: update titiler-pgstac from 0.2.3 to 0.8.0 (#239)
ref #234 This PR aims to update titiler-pgstac from version 0.2.3 to 0.8.0. Doing so, will also update titiler, rio-tiler, morecantile, fastapi and pydantic. Endpoint changes - ~~Use `/collections/{collection_id}/items/{item_id}` prefix for Item endpoint.~~ I was able to keep this as it was (`{endpoint}/stac/info?collection=collection1&item=item1`) - `post_process=` -> `algorithm=` - change tile url path parameter order from `/tiles/{searchid}/{TileMatrixSetId}/{z}/{x}/{y`} to `/{searchid}/tiles/{TileMatrixSetId}/{z}/{x}/{y}` ``` # Before {endpoint}/mosaic/tiles/20200307aC0853900w361030/0/0/0 # Now {endpoint}/mosaic/20200307aC0853900w361030/tiles/0/0/0 ``` - replace `/{searchid}/{z}/{x}/{y}/assets` endpoints by `/{searchid}/tiles/{z}/{x}/{y}/assets` - replace - by _ in query parameters - coord-crs -> coord_crs - dst-crs -> dst_crs - remove `max_size` default for mosaic's `/statistics [POST]` endpoint breaking change - add `/bbox` and `/feature [POST]` optional endpoints
- Loading branch information
Showing
15 changed files
with
207 additions
and
1,160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""veda custom algorithms""" | ||
|
||
import math | ||
|
||
import numpy | ||
from rio_tiler.models import ImageData | ||
|
||
from titiler.core.algorithm import Algorithms | ||
from titiler.core.algorithm.base import BaseAlgorithm | ||
|
||
# https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/reader.py#L35-L37 | ||
|
||
# From eoAPI datasetparams edl_auth branch https://github.com/NASA-IMPACT/eoAPI/blob/edl_auth/src/eoapi/raster/eoapi/raster/datasetparams.py | ||
|
||
|
||
class SWIR(BaseAlgorithm): | ||
"""SWIR Custom Algorithm.""" | ||
|
||
low_value: float = math.e | ||
high_value: float = 255 | ||
low_threshold: float = math.log(1000) | ||
high_threshold: float = math.log(7500) | ||
|
||
def __call__(self, img: ImageData) -> ImageData: | ||
"""Apply processing.""" | ||
data = numpy.log(img.array) | ||
data[numpy.where(data <= self.low_threshold)] = self.low_value | ||
data[numpy.where(data >= self.high_threshold)] = self.high_value | ||
indices = numpy.where((data > self.low_value) & (data < self.high_value)) | ||
data[indices] = ( | ||
self.high_value | ||
* (data[indices] - self.low_threshold) | ||
/ (self.high_threshold - self.low_threshold) | ||
) | ||
img.array = data.astype("uint8") | ||
return img | ||
|
||
|
||
algorithms = Algorithms( | ||
{ | ||
"swir": SWIR, | ||
} | ||
) | ||
|
||
PostProcessParams = algorithms.dependency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.