Skip to content

Commit

Permalink
[USGS-R#49] add explanation about python envs/dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jsadler2 committed Nov 10, 2021
1 parent f1a534a commit 2c6e6fc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions 1_network/src/catchment_attributes.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# The purpose of these functions is to interface between
# the scipiper pipeline and the Python code
download_and_combine_sb_attr_data <- function(out_ind) {
reticulate::use_condaenv("rgcn")
# reticulate will try to find a python executable to
# run the python functions. If the one it finds doesn't
# have the required libraries (see environment.yml) then
# it will cause an error (ModuleNotFound). In that case,
# you can either install the required packages in the Python
# environment that it is using via pip or conda, or you can
# create a conda environment from the projects environment.yml
# file and then tell reticulate to use that environment via
# reticulate::use_condaenv("drb_prep")
out_file <- as_data_file(out_ind)
catch_attr_py <-
reticulate::import_from_path('catch_attr', path = '1_network/src/')
Expand All @@ -12,7 +20,6 @@ download_and_combine_sb_attr_data <- function(out_ind) {

relate_attr_to_drb_segs <-
function(out_ind, all_attr, geofabric, drb_network) {
reticulate::use_condaenv("rgcn")
out_file <- as_data_file(out_ind)
attr_file <- as_data_file(all_attr)
geofab_file <- as_data_file(geofabric)
Expand All @@ -31,7 +38,6 @@ relate_attr_to_drb_segs <-


fetch_combine_catch_attr_metadata <- function(out_ind) {
reticulate::use_condaenv("rgcn")
out_file <- as_data_file(out_ind)
catch_attr_py <-
reticulate::import_from_path('catch_attr', path = '1_network/src/')
Expand Down

0 comments on commit 2c6e6fc

Please sign in to comment.