PermafrostDiscoveryGateway / viz-staging

PDG Visualization staging pipeline
Apache License 2.0
2 stars 4 forks source link

Create a statistic to count the number of values within specified bounds #57

Open katmatson opened 5 months ago

katmatson commented 5 months ago

Add a 'bounded_count' statistic and an associated 'bounds' field to the config. This can be used to create a custom statistic counting the number of vectors with a value for the specified property that is within the provided bounds.

For example, in the lake change dataset, to add statistics to count the number of expanding and shrinking lakes within each tile, the statistics entry in the config could include:

statistics = [
    {
      "name": "growing_lakes", 
      "property": "ChangeRateNet_myr-1", 
      "aggregation_method": "bounded_count", 
      "resampling_method": "sum",  
      "bounds": (0, None)
      # ... other standard fields related to display
    },
    {
      "name": "shrinking_lakes", 
      "property": "ChangeRateNet_myr-1", 
      "aggregation_method": "bounded_count", 
      "resampling_method": "sum",  
      "bounds": (None, 0)
      # ... other standard fields related to display
    },
]

The statistic itself will be handled in the viz-raster pipeline, so this PR shouldn't be merged until after https://github.com/PermafrostDiscoveryGateway/viz-raster/pull/35 in the viz-raster repository.