All functions

apply_relative_extent()

Compute a domain extent from a process extent within a domain extent.

ar_of_pr_rho()

Creates a function that interpolates an AR-to-PR dataset. The data calculates attack rate as a function of PR and recovery.

arg_parser()

Parse command-line arguments.

assemble()

Reads output from workers and produces GeoTIFFs and images.

build_ar2pr()

This goes the other way, from AR to PR, with rho=0.

check_args()

Check whether the input arguments make sense.

check_linearized_outputs()

Check that the results are all finite.

chunk_nonzero()

Find nonzeros in each chunk of tile data to see they loaded.

chunk_sums()

Find the sum of each chunk of tile data to see they differ.

collect_and_permute()

Given a list of matrices, construct a single three-dimensional array.

combine_output()

Given everything from lapply, combine it.

construct_plan()

Makes an initial plan.

data_for_country()

Get all the data for a country as a convenience function.

decode_hilbert()

Given a Hilbert z-value, translate it into an x and y value.

draw_parameters()

Takes a parameter that is an expression (of drawing a distribution) and calls it.

draw_parameters_three()

Takes a parameter that is an expression (of drawing a distribution) and calls it.

draw_parameters_two()

Takes a parameter that is an expression (of drawing a distribution) and calls it.

encode_hilbert()

These functions are used to arrange a walk across a 2D matrix to use cache more efficiently. They implement a space-filling curve in 2D. A space-filling curve gives you a single integer to index a two-dimensional array. If you have 2D tiles, then you would find the Hilbert index of each tile and sort by that index in order to improve cache use. Given an x and y value, translate it into a Hilbert z-value.

encode_hilbert_zero()

Computes an integer Hilbert index for x and y using a variant algorithm.

find_relative_extent()

Find where the tile is within the process extent.

flatten_draws()

The draws are hierarchical by variable and then quantile. This flattens them.

funcmain()

If you want to run from the R command line, you can call this.

gadm_country_shapefile()

Retrieve the shapefile for a country at the given level. GADM identifies countries with the Alpha-3 country code. If the file doesn't exist, it will return a NULL.

globalrc

globalrc: Calculate R_c from PfPR and treatment rates.

improved_errors()

Asks R for a stack trace that shows which function had the problem.

is_tile()

Check that this is a tile.

linearized_work()

Takes an input array in multiple dimensions and linearizes and removes NA. This replaces the outputs back into multiple dimensions after making the call.

load_data()

Load input data, including pr2ar, the PfPR, and the AM.

load_pixel_script()

Loads a script that has functions to compute pixel values.

load_plan()

Load the plan that you saved.

main()

If you want to run from the Bash command line, you can call this.

my_tasks()

Pull my work, according to my task index.

over_block_draw()

Run the pixel function on a chunk of data.

pixel_bounding_box()

Given a bounding box in map coordinates (maybe lat-long), return pixel bbox.

pixel_four()

This version works harder on the low end and high end of PfPR to make the values have good variance there.

pixel_three()

This version works harder on the low end and high end of PfPR to make the values have good variance there.

pixel_two()

This was made with fits to the middle values of PfPR. It was finished Monday 23 Nov 2020. This was the version sent to MAP that had reasonable values (c is corrected in last step).

plan_domain_decomposition()

Given command-line arguments, determine how much data to load. It's deciding splits without consulting arguments for now. This decomposes the domain into tiles because, when we parallelize with the parallel package, each task needs at least a few seconds of work to do in order to make data transfer worthwhile.

plot_as_png()

Customized plotting for different variables.

prepare_timeseries()

Given the raw input data, prepare it for computation.

raster_extent_from_work()

Given a list of tiles, figures out the bounding box of pixel values.

read_dataset_names()

Finds the name of every three-dimensional array in a file.

remove_tiles_over_water()

Removes tiles that have all NA for this example slice.

save_chunks()

Save a list of arrays to a single file.

save_plan()

Save a plan for parallel execution to a file.

slice_funcmain()

If you want to run from the R command line, you can call this.

slice_main()

If you want to run from the Bash command line, you can call this.

summarize_draws()

Given a list of draws, summarize mean and confidence intervals.

task_work()

Takes the extent of the tiles and returns a list of which tiles to do.

task_work_from_tiles()

Takes the extent of the tiles and returns a list of which tiles to do.

worker()

Reads the plan and produces this task's part of that plan.

write_output()

Given outputs for a tile, write them to a folder.

years_in_filenames()

Given a bunch of filenames, find all four-number digit strings.