D Case Study - Alternate PM2.5 surfaces
The PM2.5 exposure surfaces used in the provided pipeline comes from Surface PM2.5 V4.GL.02 dataset developed by van Donkelaar, A. et al. (2016). Alternative models of PM2.5 differing in method, temporal or spatial coverage and/or resolution which are more suited to your particular study may be used as the input exposure rasters.
To use different PM2.5 surfaces, replace the call to function import_globalgwr_pm25_2010_2015
in _targets.R
with targets importing and tidying the new raster data.
A satellite-derived land use regression (SatLUR) modelled PM2.5 surface produced by Luke Knibbs is available on request.
The preparation of van Donkelaar’s PM2.5 surfaces is performed in targets infile_globalgwr_pm25_2010_2015_files
, infile_globalgwr_pm25_2010_2015
and tidy_env_exposure_pm25
. (Only the latter two are present if downloading the data.) The first two targets are automatically generated by the tarchetypes::tar_files_input
then tidied and gathered into a raster brick in tidy_env_exposure_pm25
. This is performed in the following few lines:
<- list(
inputs
...,
# exposure rasters
exposure = import_globalgwr_pm25_2010_2015(years,
download = download_data,
datadir_envgen = file.path(dir_cardat, dir_envgen)),
... )
Substitute in a tar_files_input
pointing to the new input exposure raster files. Read and tidy the data in a tar_target
, producing a RasterBrick (or stack) with named layers by year. Your code should look similar to the following.
<- list(
inputs
...,
# exposure rasters
exposure = list(
tar_files_input(
infile_pm25,file.path(
sprintf("YOUR_DATA_DIR/SatPM25_2000_2015/data_derived_rasters/satlur_pm25_ug_m3_%s.tif",
years)
)
),tar_target(
tidy_env_exposure_pm25,
{<- brick(stack(infile_pm25))
b # rename the layers of the RasterBrick with the year
names(b) <- years
return(b)
}
)
),
... )
Add additional processing steps in tidy_env_exposure_pm25
as needed to tidy the raster input.