wri / gfw-raster-analysis-lambda

GFW Raster Analysis in AWS Lambda
8 stars 4 forks source link

Clarify how primary raster works #10

Closed jterry64 closed 5 years ago

jterry64 commented 5 years ago

From the perspective of the API, the input rasters are just a list and all treated the same. However, the code currently assumes the first raster ID references one of our primary data products (e.g. GLAD alerts, forest loss), and all the ones after are just contextual.

We should either make this clear in the API if we want to treat the primary raster differently. But right now the only real difference is that the primary raster source missing or empty gives a completely empty result, whereas the code just ignores missing contextual sources and still does the rest of the analysis. Otherwise the first is just arbitrarily chosen to create the geometry mask. So we could possibly just treat all rasters the same, and leave the responsibility on the client for raster source issues.

thomas-maschler commented 5 years ago

agree, now with the filters in a separate kwarg we could use something like this, which would make usage clearer

analysis(geom, analysis_raster_id, *contextual_raster_ids, filters=None, analysis="area")

thomas-maschler commented 5 years ago

One thing to keep in mind is that contextual layers might have different data types.

Right now we treat integer and float data differently.

integer layers are part of the group by clause, while float data will be aggregated (ie sum())

jterry64 commented 5 years ago

analysis(geom, analysis_raster_id, contextual_raster_ids=[], filters=None, analysis=["count"], analysis_raster_ids=[])

jterry64 commented 5 years ago

Final signature: analysis(geom, analysis_raster_id, contextual_raster_ids=[], filters=None, analysis="count", aggregate_raster_ids=[])