kaitlyngaynor / gorongosa-camera-traps

Code for dissertation chapter on Gorongosa camera trap survey
0 stars 0 forks source link

Errors when scaling focal rasters #19

Open kaitlyngaynor opened 4 years ago

kaitlyngaynor commented 4 years ago

https://github.com/kaitlyngaynor/gorongosa-camera-traps/blob/c9c3523f7a50e0397528c701a6e87edbf233fb1f/scripts/01-cleaning/07-gorongosa-gis.Rmd#L464-L545

When looking into the non-standardized values of the focal rasters (for Maria) I noticed a problem - the values should be between 0 and 1 (representing mean values in the window) but they were not properly scaled. The sum of raster values should have been divided by the number of cells, but there were a few sloppy problems:

The 1km window is fine (and indeed, these values are all between 0 and 1).

This problem was not carried throughout the analysis, because I scaled all of these rasters to have a mean of 0 and SD of 1 anyway. However, going forward, if we want these rasters in their raw format (not scaled) we do need to recalculate them with the correct focal adjustment.

kaitlyngaynor commented 4 years ago

I started fixing this, but using the masked tree, termite, and pan rasters (masked to camera grid) for computational efficiency. However, then I realized that the neighborhood values at the edges of the grid would be incorrect, since the values would be NA for the points across the edge, so am rerunning with the cropped but unmasked tree, termite, and pan rasters.