UNDP-Data / geo-cogserver

GeoHub COG server
GNU General Public License v3.0
1 stars 1 forks source link

feat: added rca algorithm to titiler. #54

Closed JinIgarashi closed 6 months ago

JinIgarashi commented 6 months ago

closes https://github.com/UNDP-Data/geohub/issues/2965

map viewer http://127.0.0.1:8001/cog/map?url=https://undpgeohub.blob.core.windows.net/geo-nightlights/test/SVDNB_npp_merged_20240220_20240221.vrt&algorithm=rca&algorithm_params=%7B%22cloud_mask%22:false%7D&threshold%22:0.8%7D&colormap_name=viridis&rescale=0,1&maxzoom=18

http://127.0.0.1:8001/cog/tiles/6/36/34.png?tileMatrixSetId=WebMercatorQuad&url=https://undpgeohub.blob.core.windows.net/geo-nightlights/test/SVDNB_npp_merged_20240220_20240221.vrt&algorithm=rca&colormap_name=ylorbr&rescale=0,1

with no data value

image

after masking no data value

image

The below is the response of algorithm endpoint

{
   "inputs":{
      "nbands":4,
      "description":"the first two bands will be used to compute change detection. the last two bands will be used to mask the result. "
   },
   "outputs":{
      "nbands":1,
      "dtype":"uint8",
      "min":[
         0
      ],
      "max":[
         1
      ],
      "description":"Masked result which has changed greater than threshold"
   },
   "parameters":{
      "threshold":{
         "default":0.8,
         "description":"Threshold (%) to mask changes which is ranged between 0 and 1",
         "exclusiveMaximum":1,
         "minimum":0,
         "title":"Threshold(%)",
         "type":"number"
      },
      "nodata_value":{
         "default":-999,
         "description":"If either b1 or b2 has no value, the tool returns 0. Deault is -999.",
         "exclusiveMaximum":99999,
         "minimum":-99999,
         "title":"No data value",
         "type":"number"
      },
      "cloud_mask":{
         "default":false,
         "description":"If enabled, cloud will be removed masked by band 3 and band 4.",
         "title":"Cloud mask",
         "type":"boolean"
      },
      "cloud_mask_threshold":{
         "default":1,
         "description":"Remove cloud if band value is greater than this threshold",
         "title":"Cloud mask threshold",
         "type":"integer"
      }
   }
}

statistics endpoint response is below.

http://127.0.0.1:8001/cog/statistics?url=https://undpgeohub.blob.core.windows.net/geo-nightlights/test/SVDNB_npp_merged_20240220_20240221.vrt&algorithm=rca&algorithm_params=%7B%22cloud_mask%22:true%7D

{
   "(abs(b2 - b1) / (b2 + b1)) > 0.8":{
      "min":0,
      "max":1,
      "mean":0.005553040189628999,
      "count":75094,
      "sum":417,
      "std":0.07431153298298564,
      "median":0,
      "majority":0,
      "minority":1,
      "unique":2,
      "histogram":[
         [
            74677,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            417
         ],
         [
            0,
            0.1,
            0.2,
            0.30000000000000004,
            0.4,
            0.5,
            0.6000000000000001,
            0.7000000000000001,
            0.8,
            0.9,
            1
         ]
      ],
      "valid_percent":12.73,
      "masked_pixels":514730,
      "valid_pixels":75094,
      "percentile_2":0,
      "percentile_98":0
   }
}
JinIgarashi commented 6 months ago

another test data between 29 Dec and 1 Jan for earthquake in Japan

http://127.0.0.1:8001/cog/map?url=https://undpgeohub.blob.core.windows.net/geo-nightlights/test/SVDNB_npp_merged_20231229_20240101.vrt&algorithm=rca&algorithm_params=%7B%22cloud_mask%22:true%7D&threshold%22:0.8%7D&rescale=0,1&colormap_name=viridis&maxzoom=18

image