climate and productivity
Scratch: html preview.
Targets is a cool package. It allows you to specify a DAG of tasks, and then run them in parallel. It also allows you to cache the results of tasks, so that if you change one task, it will only re-run the tasks that depend on it.
The keynotes for running this package are:
- When you open your R session, run
library(targets)
. - When you want to run the entire pipeline, run
tar_make()
. - When you want to create a single object, run
tar_make(object_name)
. - To call a targets object, use
tar_read(object_name)
. - To see the DAG, run
tar_visnetwork()
. - To load the results of a target into memory, run
tar_load(object_name)
.
Added the raw productivity files to the targets script. The files can be loaded more efficiently as they have done here but I am not yet comfortable using targets. I will look at it again tomorrow. The directory issue is resolved but the scratch.qmd is not running fully in my local PC, still struggling with it. Like when I render the file, I don't get this. Need to fix it!
The variable information for climate data are available here.
- Fix the
add_enclosing_polydat()
function so that only calculates the enclosing polygon for any given weather station once.
#!/bin/bash
for tif in *.tif; do
nc="${tif%.tif}.nc"
gdal_translate -of NetCDF "$tif" "$nc"
done