iucm preproc mask

Mask grid cells based on a shape file

This command calculates the maximum population for the model based on a masking shape file. The given shape file is rasterized at high resolution (by default, 100 times the resolution of the input file) and the fraction for each grid cell that is covered by that shape file is calculated.

usage: iucm preproc mask [-h] [-m {'max-pop', 'mask', 'ignore'}] [-i str]
                         [-v str] [-overwrite] [-max float] [-r int]
                         str

Positional Arguments

str The path to a shapefile

Named Arguments

-m, --method

Default: “max-pop”. Determines how to handle the given shapes.

max-pop
The maximum population per grid cell is lowered by the fraction of the cell that is covered by the given shape. This will adjust the max_pop variable in the input file ifile
mask
The population of the grid cells in the input data that are touched by the given shapes will be kept constant during the simulation. This will adjust the mask variable in the input file ifile
ignore
The grid cells in the input data that are touched by the given grid cells are put to NaN and their population is not considered during the simulation. This will adjust the input population data (i.e. variable vname) directly

Default: “max-pop”

-i, --ifile The path of the input file. If not specified, the value of the configuration is used
-v, --vname The variable name to use. If not specified and only one variable exists in the dataset, this one is used. Otherwise, the 'run.vname' key in the experiment configuration is used
-overwrite

If True and the target variable exists already in the input file ifile (and method is not ‘ignore’), this variable is overwritten

Default: False

-max, --max-pop
 The maximum population. If not specified, the value in the configuration is used (only necessary if method=='max-pop')
-r, --hr-res

The resolution of the high resolution file, relative to the resolution of ifile (only necessary if method=='max-pop')

Default: 100

Notes

Note that the shapefile and the input file have to be defined on the same coordinate system! This function is not super efficient, for large data files we recommend using gdal_rasterize and gdalwarp.