In overlay_weights.R, I believe I am encountering a floating point issue when merging on "x" and "y" in line 181.
Using
- grid = the ERA5-Land grid,
- secondary_raster = Landsat 2010 population estimates, and
- polygons = 2010 US County shapefile,
w_merged only contains 43,567 rows with non-missing values for "weight". However, when I round "x" and "y" to 7 decimal points in area_weights and weights_dt before merging, this number jumps up to 120,754.
A possible fix could be to round "x" and "y" in area_weights and weights_dt just before merging in line 181.