There are some important details which need to be observed for using this function, they are listed below.
cocoa_hru(
hru_id,
buildR_dir,
agri_pattern = "a_",
directory = NULL,
save_to_png = FALSE,
verbose = TRUE
)(integer) ID of HRU to plot
(string) path to SWATbuildR project directory (containing the 'data/*' subdirectory)
(string) a pattern which identifies agriculturial fields (REGEX)
(string) directory where to save plots (optional, only if save_to_png is enabled. Will be created to sub-directory 'hru_report/'. If left blank, will use working directory).
(logical) TRUE = saves to file, FALSE = returns plot
(logical) Print status?
Either the path to the plot if save_to_png is TRUE, or returns the ggplot object itself if save_to_png is FALSE
This function only works with SWATbuildR output, along side with a generated land_connections_as_lines.shp file which can be generated using this code.
The land use theme is set up for my specific catchment. If you need to add to this theme then please send a pull request with the additional legend entries.