dev Documentation - HopkinsIDD/cholera-mapping-pipeline GitHub Wiki
sf_grid Documentation
This section explains the different id columns are in sf_grid and where they are set and modified in the code
rid
: identifier of raster tiles as stored in the database. A raster tile contains multiple raster cells.x
: identifier of cell column within the raster tile that contains the cell, as stored in the database.y
: identifier of the cells row within the raster tile that contains the cell, as stored in the database.id
: unique identifier of space-only grid cells. This is created directly from the reference grid pulled from the database using row_number. This id therefore covers all gridcells that intersect any of the location periods independently of whether they contain valid covariate data and sfrac values or not. Created here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_covar_cube.R#L123.long_id
: unique identifier of space/time grid cells. This id consists of a sequential id of space/time cells corresponding to a stakcing of the full space-only grid. As forid
, this corresponds to the full set of space/time cells irrespective of the covariate data and of sfrac values. Created here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_covar_cube.R#L133.upd_id
: sequential id of space/time grid cells that were retained after exculsion criteria (seenon_na_gridcells
below). Created in here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/packages/taxdat/R/stan_input_helpers.R#L398 in call tomake_smooth_grid
here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_stan_input.R#L56. This id is equivalent to the columnupd_long_id
in the location_period_dict object created here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/packages/taxdat/R/covariate_helpers.R#L1533, and used for the mapping from observation location periods to gridcells in here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/packages/taxdat/R/stan_input_helpers.R#L247.smooth_id
: sequential id of random effect grid cells. This id should go from 1 to the number of space-only cells x the number of spatial random effect time slices. This is created here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/packages/taxdat/R/stan_input_helpers.R#L405 in call tomake_smooth_grid
here https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_stan_input.R#L56
Notes:
- the combination of {rid, x, y} values determine the unique id of the space grid cell as stored in the database. There is one value of
id
for each {rid, x, y} tupple. non_na_gridcells
: this is an object which keeps track of which grid cells to keep for modeling. Originally this object was only meant to track which cells contained non-na covariate values. Its use is now expanded to also track cells for which the sfrac values are below the threshold, as well as cells that do not overlap the national level output shapefile. The object is updated in multiple places throughout the code:- First initialization based on non-na covariate values for all time slices: https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_covar_cube.R#L110
- Exclude grid cells that do not overlap with the output national level shapefile: https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_covar_cube.R#L171
- Exclude grid cells for which the maximum sfrac for corresponding space-only cell is below threshold: https://github.com/HopkinsIDD/cholera-mapping-pipeline/blob/656ab367614db1fdba5fca98caa3240e47d5d050/Analysis/R/prepare_covar_cube.R#L196