crstn / CISC

Population projection code.
0 stars 0 forks source link

glur_array and pop_array have different length for some countries #3

Closed crstn closed 8 years ago

crstn commented 8 years ago

I just discovered – by coincidence – that for 48 countries, these two arrays are not of the same length. Here's a list of a all countries where the values don't match:

Country 492 : GLUR:  84 , POP:  96
Country 674 : GLUR:  121 , POP:  132
Country 500 : GLUR:  352 , POP:  368
Country 438 : GLUR:  416 , POP:  432
Country 48 : GLUR:  2440 , POP:  2480
Country 1003 : GLUR:  3350 , POP:  3417
Country 442 : GLUR:  8008 , POP:  7917
Country 772 : GLUR:  19256 , POP:  19422
Country 234 : GLUR:  22302 , POP:  22479
Country 388 : GLUR:  28462 , POP:  28196
Country 807 : GLUR:  56110 , POP:  56420
Country 84 : GLUR:  66676 , POP:  66887
Country 705 : GLUR:  67260 , POP:  66880
Country 480 : GLUR:  83361 , POP:  82610
Country 238 : GLUR:  102312 , POP:  101871
Country 694 : GLUR:  136145 , POP:  135780
Country 144 : GLUR:  138620 , POP:  138330
Country 254 : GLUR:  150856 , POP:  150510
Country 70 : GLUR:  159372 , POP:  158906
Country 528 : GLUR:  159714 , POP:  159247
Country 776 : GLUR:  238232 , POP:  237925
Country 320 : GLUR:  239057 , POP:  239538
Country 585 : GLUR:  271961 , POP:  272392
Country 31 : GLUR:  295822 , POP:  295121
Country 208 : GLUR:  336260 , POP:  337120
Country 548 : GLUR:  390566 , POP:  390115
Country 800 : GLUR:  448048 , POP:  447392
Country 524 : GLUR:  477252 , POP:  478234
Country 328 : GLUR:  510992 , POP:  511578
Country 192 : GLUR:  549444 , POP:  548142
Country 324 : GLUR:  587776 , POP:  588672
Country 44 : GLUR:  635780 , POP:  636610
Country 300 : GLUR:  1033296 , POP:  1034532
Country 368 : GLUR:  1161632 , POP:  1160461
Country 120 : GLUR:  1256582 , POP:  1255656
Country 90 : GLUR:  1406856 , POP:  1408462
Country 218 : GLUR:  1616000 , POP:  1618020
Country 764 : GLUR:  1775868 , POP:  1774872
Country 68 : GLUR:  2310802 , POP:  2309345
Country 608 : GLUR:  2318829 , POP:  2317662
Country 24 : GLUR:  2445240 , POP:  2446731
Country 104 : GLUR:  2446700 , POP:  2447775
Country 562 : GLUR:  2703222 , POP:  2701321
Country 466 : GLUR:  3517280 , POP:  3519256
Country 724 : GLUR:  5242641 , POP:  5245342
Country 1007 : GLUR:  8727785 , POP:  8722890
Country 356 : GLUR:  13132892 , POP:  13129290
Country 242 : GLUR:  44540231 , POP:  44539200
gabeFS commented 8 years ago

I just looked through a few of the countries that have this incongruity, and I'm pretty sure I understand what's going on: For both the GLUR and spatial population rasters, there are no data cells that correspond to areas that are uninhabitable (e.g., large bodies of water). I'm not sure how these areas were determined by whomever produced the data. It appears that with these countries, there are incongruities between what cells have no data, and what cells have a zero value. So, for example, a portion of the GLUR raster might have no data at a major lake, but the population raster includes some of that lake's geometry, populated with zero values. So despite the fact that the rasters have the same overall rows/columns, there are different internal counts resulting from this no-data incongruity (and it goes both ways; for some countries there are GLUR cells with 'rural' values where the population raster has no data.

Here's a quick snapshot of part of Mali, where this is happening. The layers are, in top-bottom order: 1) GLUR Array (RED) 2) Population Array (BLUE) 3) Basemap capture

So where we're seeing blue, there is no-data for the GLUR raster, but population data (== 0) for the population array. Then where the population raster also has no data, we're seeing the basemap.

carsonfarmer commented 8 years ago

Is this problem systematic enough that we can say: if between the two rasters there is a no-data and a zero, we can safely assume no data?

crstn commented 8 years ago

The question is also whether this throws our indexing off? If we have such a pixel mismatch, will all pixels after that be one pixel off when we look e.g. for a rural cell in one array, and then use that index to change the population of that cell in the population array?

crstn commented 8 years ago

@pmarcotullio and I just discussed this: if the rural/urban raster has a no data cell, and that cell has a 0 in the population raster, then we also set the population raster to no data.