Population sum total differences exist between original codebase and foundation
Closed this issue · 5 comments
Original code algorithm
The algorithm the original code follows, as I recall it from our Tuesday Sept. 3rd meeting:
- a spatial raster class is instantiated from a TIFF file
- it is aggregated, if desired
- it is cropped, if desired
- it is resampled
Foundation algorithm
The new code-base follows this algorithm, as I recall (being its author):
- a spatial raster class is instantiated from a TIFF file
- it is cropped, if desired
- it is aggregated, if desired
TODO
I need to determine what the largest cause of the population sum total difference is and rectify that. The new and the old code-base shouldn't differ on such a detail.
This test validates that aggregating and cropping does not impact the population of the area(s) of interest.
- Remove or use the
layers
object in test of aggregation and cropping of population raster
#27 is a duplicate of item 4 in this issue.
I think I'll resolve this issue by adding the ability to toggle between resampling or not.
Various resampling methods were tried in the original codebase, so having a drop-down to select the resampling method when resampling is enabled would be useful.
I have done some review of the old code and it appears that terra::resample
was only used as part of an effort to crop the raster of the population to the silhouette of the nation under study. It transfers values from a source to a sink spatRaster, and the sink is the population spatRaster with the source being a binary rasterization (the values are either zero or one) of the provincial and national borders of the nation.
In conclusion, I don't need to worry about the fact that resample was used. It was used improperly, more or less, in the original code.