Closed dnomadb closed 9 years ago
Centroid extraction (pulling data values from a single pixel within the finest triangles) is looking to be a good bet.
As this would allow us to skip rasterization, all np.where
, and np.mean
calculations, it is much faster - on the order of ~100x (anecdotal observation)
Testing for this over the weekend. Based on the amount of upsampling we are doing before sampling, I would think that the difference will be negligible, but this is yet to be determined.
This method is much faster than (rasterio.features.rasterize --> np.where --> np.mean), and preliminary results look ok. Going to use it and punt on accuracy testing for now, as the speed increase is significant.
Most time for grabbing raster values for facet geometry is spent here: https://github.com/mapbox/make-surface/blob/triangle-indexing/makesurface/scripts/fill_facets.py#L57
To help with https://github.com/mapbox/weather-data/issues/71:
numpy.where
cc: @ian29 @andreasviglakis @rclark @sgillies