Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate R script #25

Merged
merged 122 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
1c420db
feat: developing algorithm training and evaluation module
glitt13 Aug 22, 2024
7f3921e
fix: minor bug fixes with paths and np array values retrieval
glitt13 Aug 22, 2024
d9c8dfe
feat: create initial fs_algo package
glitt13 Aug 22, 2024
1ebcc23
feat: contain all training/eval into a single class
glitt13 Aug 23, 2024
1a74ca6
feat: simplify evaluation file write and module import
glitt13 Aug 23, 2024
a9019bd
feat: add basic unit testing for AlgoTrainEval class
glitt13 Aug 23, 2024
3a7025e
feat: convert save dir structure creation and fsds dataset reader int…
glitt13 Aug 23, 2024
5e922c4
Update README.md
glitt13 Aug 23, 2024
b6dffaf
feat: simplify aspects of attribute organization and combining with m…
glitt13 Aug 23, 2024
84d9de6
feat: beginning to convert attribute wrangling into a class
glitt13 Aug 23, 2024
f78cb2c
feat: add algorithm configuration file
glitt13 Aug 23, 2024
f1d15a8
feat: established class for attribute configuration file, scripts fun…
glitt13 Aug 23, 2024
b75e3d5
feat: add verbose option
glitt13 Aug 23, 2024
02325af
fix: update to warnings.warn()
glitt13 Aug 23, 2024
2c480d6
feat: building out additional unit tests for AttrConfigAndVars class
glitt13 Aug 23, 2024
2c2ae67
chore: remove spaces
glitt13 Aug 27, 2024
dd8f796
chore: remove spaces
glitt13 Aug 27, 2024
f96ca62
feat: add unit test for fs_read_attr_comid
glitt13 Aug 28, 2024
96debe1
feat: add UserWarnings and associated unit test
glitt13 Aug 28, 2024
c7f8e61
feat: add unit tests for _find_feat_srce_id, fs_retr_nhdp_comids and …
glitt13 Aug 29, 2024
54a3a35
feat: add unit test for fs_save_algo_dir_struct
glitt13 Aug 29, 2024
619e1a5
feat: a basic unit test for _open_response_data_fsds
glitt13 Aug 29, 2024
f28d90d
chore: simplify algo script based on functionality moved into fs_algo…
glitt13 Aug 29, 2024
48a1e6a
doc: add sphinx documentation to _read_attr_config and fs_read_attr_c…
glitt13 Aug 29, 2024
b9b034e
doc: add sphinx-formatted documentation to the functions in the fs_a…
glitt13 Aug 29, 2024
75cfb58
fix: changes vars to attrs in AlgoTrainEval arg
glitt13 Aug 29, 2024
901ff10
fix: added the new parameters that were hard-coded (test_size & seed)
glitt13 Aug 29, 2024
f4780dc
fix: swapped the train/test fractions to appropriate printout order
glitt13 Aug 29, 2024
fa703c4
feat: make sphinx documentation
glitt13 Aug 30, 2024
43d88c0
fix: reinstall sphinx docs for fsds_proc
glitt13 Aug 30, 2024
342838d
fix: remove unused path_camels
glitt13 Aug 30, 2024
283da30
fix: remove unused references to path_camels
glitt13 Aug 30, 2024
10cea4f
fix: update standard fsds_proc config files to create netcdf rather t…
glitt13 Aug 30, 2024
591cbed
doc: update config file documentation on preferred save_type
glitt13 Aug 30, 2024
6a4d645
doc: update description of yaml file's dataset
glitt13 Aug 30, 2024
8af7720
fix: update config files with featureID and featureSource entries
glitt13 Aug 30, 2024
d4c842b
fix: change vars to attrs based on package's object name change
glitt13 Aug 30, 2024
f179124
fix: change logic to ensure config file read if dataset attribute rea…
glitt13 Aug 30, 2024
7275e8a
feat: add a raw data input checker/corrector for cases when nwissite …
glitt13 Aug 31, 2024
1f0a8be
fix: changed path_data to represent the raw input files containing co…
glitt13 Aug 31, 2024
36414d5
fix: added appropriate fillna for nwissite gage ids not needed to be …
glitt13 Aug 31, 2024
728f1b4
fix: adjust path check for attributes instead of algo
glitt13 Aug 31, 2024
aef2f01
doc: add descriptive notes on algo pre-processing and suggest future …
glitt13 Aug 31, 2024
3b19a2a
doc: simplify attr_config, change dir_attrs to dir_db_attrs
glitt13 Aug 31, 2024
1dc0c6d
chore: add some additional hydroatlas and USGS NHD variables for cons…
glitt13 Aug 31, 2024
f6ccc91
chore: add updated attribute variables to config files, based on top …
glitt13 Aug 31, 2024
5137b99
fix: add error handling when hydrofabric could not be downloaded for …
glitt13 Sep 2, 2024
c91e25f
fix: avoid index error generated from attr_ddf_sub.shape[0].compute()…
glitt13 Sep 2, 2024
7d8b0f7
fix: change fs_read_attr_comid to return pd.DataFrame instead of dask…
glitt13 Sep 2, 2024
4743a47
feat: add NA drop prior to train/test split
glitt13 Sep 2, 2024
15be337
feat: create a separate function that standarizes the algorithm file …
glitt13 Sep 2, 2024
b4484aa
doc: add documentation to the std_algo_path func
glitt13 Sep 2, 2024
49b878e
Merge pull request #1 from glitt13/train_algo
glitt13 Sep 3, 2024
22835f5
feat: create script to generate algo prediction data for testing
glitt13 Sep 3, 2024
346f668
feat: generating predictions from trained algos under dev
glitt13 Sep 3, 2024
b6723fd
feat: add processing of xssa locations, randomly selecting a subset t…
glitt13 Sep 3, 2024
66f51dc
feat: develop algo prediction's config ingest, and determine paths to…
glitt13 Sep 4, 2024
becfc45
feat: add config file path builder
glitt13 Sep 4, 2024
10d2422
fix: resolve merge conflict
glitt13 Sep 4, 2024
8fe0a7c
feat: create metric prediction and write results to file
glitt13 Sep 4, 2024
0fffc45
feat: build unit test for build_cfig_path()
glitt13 Sep 5, 2024
62ff9aa
feat: build unit test for build_cfig_path()
glitt13 Sep 5, 2024
42edc50
feat: add unit testsfor std_pred_path and _read_pred_comid; test cove…
glitt13 Sep 5, 2024
f07b9c9
feat: add oob = True as default for RandomForestRegressor
glitt13 Sep 5, 2024
bae5175
feat: add hyperparameterization capability using grid search and asso…
glitt13 Sep 6, 2024
90c1443
feat: add unit testing for train_eval()
glitt13 Sep 6, 2024
5adb43b
chore: change algo config for testing out hyperparameterization
glitt13 Sep 6, 2024
b0c3ef2
chore: add UserWarning category specification to warnings.warn
glitt13 Sep 6, 2024
3abfb08
fix: algo config assignment accidentally only looked at first line of…
glitt13 Sep 6, 2024
c7de9ae
fix: make sure that hyperparameter key:value pairings contained insid…
glitt13 Sep 6, 2024
3e60519
fix: adjust unit test's algo_config formats to represent the issue of…
glitt13 Sep 6, 2024
b4034e8
fix: _check_attributes_exist now appropriately reports missing attrib…
glitt13 Sep 6, 2024
7e982d2
fix: ensure algo and pipeline keys contain algo and pipeline object t…
glitt13 Sep 6, 2024
5d368c0
Update pkg/fs_algo/fs_algo/fs_algo_train_eval.py
glitt13 Sep 16, 2024
e34640a
Update pkg/fs_algo/fs_algo/fs_algo_train_eval.py
glitt13 Sep 16, 2024
f70f4d3
feat: merge the algo prediction features from the pred_alg branch
glitt13 Sep 16, 2024
bd42892
chore: Update README.md
glitt13 Sep 16, 2024
c7dddde
merge upstream/main
glitt13 Sep 30, 2024
0080556
fix: remove network hardcoding for lyrs in proc_attr_wrap call
glitt13 Oct 2, 2024
1d5b4e2
fix: rename ext to fileext since ext is a pre-defined object
glitt13 Oct 4, 2024
88cd39a
fix: change unit test use of ext to fileext
glitt13 Oct 4, 2024
292e949
feat: experimenting with attribute grabbing
glitt13 Oct 4, 2024
3717fbc
doc: revise function documentation for clarity
glitt13 Oct 13, 2024
b607501
chore: rename fsds to fs in all python-related files and config files
glitt13 Oct 13, 2024
4df6fed
chore: rename fsds_proc directory to fs_proc
glitt13 Oct 13, 2024
202e338
chore: rename additional fsds to fs
glitt13 Oct 13, 2024
f3c9e9c
chore: rename remaining fsds to fs
glitt13 Oct 13, 2024
3410c21
doc: minor change to install instructions of fs_proc
glitt13 Oct 13, 2024
41717b9
feat: add requirements for fs_algo package
glitt13 Oct 13, 2024
8bc5bf1
feat: add requirements.yml for conda environment of fs_algo/fs_proc p…
glitt13 Oct 13, 2024
05b23f6
Merge pull request #2 from glitt13/fs_id
glitt13 Oct 13, 2024
7b29342
doc: add details on func for creating col_schema_df
glitt13 Oct 14, 2024
20b5a6c
feat: add nwissite gage id leading zero checker as automated step
glitt13 Oct 14, 2024
4dccd31
fix: new line continuation in f-string messages related to nwis checker
glitt13 Oct 14, 2024
e80175a
fix: update local config path and example in script
glitt13 Oct 14, 2024
2e64ae2
doc: change install description for this package
glitt13 Oct 14, 2024
9b048e6
fix: modify logical test on elif featureSource == nwissite
glitt13 Oct 14, 2024
3dbb9b9
feat: update and add new unit testing that accommodates the check_fix…
glitt13 Oct 14, 2024
a1e6acd
Merge pull request #3 from glitt13/fs_id
glitt13 Oct 14, 2024
dfd661b
fix: update temp directory assignment to work with non-Unix systems
glitt13 Oct 14, 2024
70792db
doc: minor adjustment for instructional example on running unit tests
glitt13 Oct 14, 2024
6cdfa4d
Merge pull request #4 from glitt13/fs_id
glitt13 Oct 14, 2024
e757599
Make the change match the exact repo name
bolotinl Oct 16, 2024
397fbcc
Make changes match exact repo name
bolotinl Oct 16, 2024
c46ff89
doc: minor changes that will be removed: comid loc lookup
glitt13 Oct 16, 2024
1f9718c
merge: upstream/main merge
glitt13 Oct 16, 2024
71c0b14
fix: rename fsds to fs in files corresponding to proc.attr.hydfab R p…
glitt13 Oct 16, 2024
d916a03
feat: update R package with name change of fsds to fs
glitt13 Oct 16, 2024
8943877
chore: update fsds to fs in config files and R unit tests
glitt13 Oct 16, 2024
3522370
doc: update README from fsds to fs in non-url instances
glitt13 Oct 16, 2024
6427c1a
doc: Update README.md
glitt13 Oct 16, 2024
3a07b0b
Update README.md
glitt13 Oct 16, 2024
702654e
merge upstream/main
glitt13 Oct 16, 2024
9afb17a
merge: upstream/main
glitt13 Oct 16, 2024
217b53e
merge origin/main
glitt13 Oct 16, 2024
ecd1a7e
merge: fsds to fs changes
glitt13 Oct 16, 2024
61368a2
chore: rename fsds_attrs_grab.R to fs_attrs_grab.R and add updated Rd…
glitt13 Oct 16, 2024
0eb76ee
merge: sync up with fsds to fs changes
glitt13 Oct 16, 2024
97902d6
doc: update arg name change of ext to fileext
glitt13 Oct 17, 2024
07d00ca
doc: remove commented out code and create delineations on code sections
glitt13 Oct 17, 2024
0fa4d55
Merge branch 'main' into hfab
bolotinl Oct 23, 2024
0be6ab2
doc: correct mis-spellings
glitt13 Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Attributes from non-standardized datasets may need to be acquired for RaFTS mode
Run [`flow.install.proc.attr.hydfab.R`](https://github.com/NOAA-OWP/formulation-selector/blob/main/pkg/proc.attr.hydfab/flow/flow.install.proc.attr.hydfab.R) to install the package. Note that a user may need to modify the section that creates the `fs_dir` for their custom path to this repo's directory.

## Usage - `proc.attr.hydfab`
The following is an example script that runs the attribute grabber: [`fs_attrs_grab`](https://github.com/NOAA-OWP/formulation-selector/blob/main/pkg/proc.attr.hydfab/flow/fsds_attrs_grab.R).
The following is an example script that runs the attribute grabber: [`fs_attrs_grab`](https://github.com/NOAA-OWP/formulation-selector/blob/main/pkg/proc.attr.hydfab/flow/fs_attrs_grab.R).

This script grabs attribute data corresponding to locations of interest, and saves those attribute data inside a directory as multiple parquet files. The `proc.attr.hydfab::retrieve_attr_exst()` function may then efficiently query and then retrieve desired data by variable name and comid from those parquet files.

Expand Down
16 changes: 8 additions & 8 deletions pkg/proc.attr.hydfab/R/proc_attr_grabber.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ retrieve_attr_exst <- function(comids, vars, dir_db_attrs, bucket_conn=NA){
}


proc_attr_std_hfsub_name <- function(comid,custom_name='', ext='gpkg'){
proc_attr_std_hfsub_name <- function(comid,custom_name='', fileext='gpkg'){
#' @title Standardidze hydrofabric subsetter's local filename
#' @description Internal function that ensures consistent filename
#' @param comid the USGS common identifier, generated by nhdplusTools
#' @param custom_name Desired custom name following 'hydrofab_'
#' @param ext file extension of the hydrofrabric data. Default 'gpkg'
#' @param fileext file extension of the hydrofrabric data. Default 'gpkg'

hfsub_fn <- base::gsub(pattern = paste0(custom_name,"__"),
replacement = "_",
base::paste0('hydrofab_',custom_name,'_',comid,'.',ext))
base::paste0('hydrofab_',custom_name,'_',comid,'.',fileext))
return(hfsub_fn)
}

Expand Down Expand Up @@ -185,7 +185,7 @@ proc_attr_usgs_nhd <- function(comid,usgs_vars){
}


proc_attr_hf <- function(comid, dir_db_hydfab,custom_name="{lyrs}_",ext = 'gpkg',
proc_attr_hf <- function(comid, dir_db_hydfab,custom_name="{lyrs}_",fileext = 'gpkg',
lyrs=c('divides','network')[2],
hf_cat_sel=TRUE, overwrite=FALSE){

Expand All @@ -195,7 +195,7 @@ proc_attr_hf <- function(comid, dir_db_hydfab,custom_name="{lyrs}_",ext = 'gpkg'
#' @param comid character class. The common identifier USGS location code for a surface water feature.
#' @param dir_db_hydfab character class. Local directory path for storing hydrofabric data
#' @param custom_name character class. A custom name to insert into hydrofabric file. Default \code{glue("{lyrs}_")}
#' @param ext character class. file extension of hydrofabric file. Default 'gpkg'
#' @param fileext character class. file extension of hydrofabric file. Default 'gpkg'
#' @param lyrs character class. The layer name(s) of interest from hydrofabric. Default 'network'.
#' @param hf_cat_sel boolean. TRUE for a total catchment characterization specific to a single comid, FALSE (or anything else) for all subcatchments
#' @param overwrite boolean. Overwrite local data when pulling from hydrofabric s3 bucket? Default FALSE.
Expand All @@ -204,7 +204,7 @@ proc_attr_hf <- function(comid, dir_db_hydfab,custom_name="{lyrs}_",ext = 'gpkg'
# Build the hydfab filepath
name_file <- proc.attr.hydfab:::proc_attr_std_hfsub_name(comid=comid,
custom_name=glue::glue('{lyrs}_'),
ext=ext)
fileext=fileext)
fp_cat <- base::file.path(dir_db_hydfab, name_file)

if(!base::dir.exists(dir_db_hydfab)){
Expand All @@ -225,7 +225,7 @@ proc_attr_hf <- function(comid, dir_db_hydfab,custom_name="{lyrs}_",ext = 'gpkg'

# Read the hydrofabric file gpkg for each layer
hfab_ls <- list()
if (ext == 'gpkg') {
if (fileext == 'gpkg') {
# Define layers
layers <- sf::st_layers(dsn = fp_cat)
for (lyr in layers$name){
Expand Down Expand Up @@ -469,7 +469,7 @@ proc_attr_gageids <- function(gage_ids,featureSource,featureID,Retr_Params,
# Retrieve the variables corresponding to datasets of interest & update database
loc_attrs <- try(proc.attr.hydfab::proc_attr_wrap(comid=comid,
Retr_Params=Retr_Params,
lyrs='network',overwrite=FALSE))
lyrs=lyrs,overwrite=FALSE))
if("try-error" %in% class(loc_attrs)){
message(glue::glue("Skipping gage_id {gage_id} corresponding to comid {comid}"))
}
Expand Down
91 changes: 56 additions & 35 deletions pkg/proc.attr.hydfab/flow/fs_attrs_grab.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' term 'gage_id' is used as a variable in glue syntax to create featureID
#' @seealso [fs_proc] A python package that processes input data for the
#' formulation-selector
#' @usage Rscript fs_attrs_grab.R "/path/to/attribute_config.yaml"

# Changelog / Contributions
# 2024-07-24 Originally created, GL
Expand All @@ -21,61 +22,81 @@ library(yaml)
library(ncdf4)
library(proc.attr.hydfab)
library(glue)

# TODO is AWS_NO_SIGN_REQUEST necessary??
# Sys.setenv(AWS_NO_SIGN_REQUEST="YES")

# TODO create config yaml.

# TODO read in config yaml, must populate NA for items that are empty.

# Define input directory:
# TODO change this to reading the standardized metadata, not the generated data
# Define command line argument
cmd_args <- commandArgs("trailingOnly" = TRUE)

# raw_config <- yaml::read_yaml("/Users/guylitt/git/formulation-selector/scripts/eval_ingest/xssa/xssa_attr_config.yaml")
raw_config <- yaml::read_yaml("/Users/guylitt/git/formulation-selector/scripts/eval_ingest/SI/SI_attr_config.yaml")
if(base::length(cmd_args)!=1){
warning("Unexpected to have more than one argument in Rscript fs_attrs_grab.R /path/to/attribute_config.yaml.")
}

# Read in config file, e.g. "~/git/formulation-selector/scripts/eval_ingest/SI/SI_attr_config.yaml"
path_attr_config <- cmd_args[1] # "~/git/formulation-selector/scripts/eval_ingest/xssa/xssa_attr_config.yaml"
raw_config <- yaml::read_yaml(path_attr_config)

datasets <- ds <- raw_config$formulation_metadata[[grep("datasets",raw_config$formulation_metadata)]]$datasets#c("juliemai-xSSA",'all')[1] # A listing of datasets to grab attributes. Dataset names match what is inside dir_std_base. 'all' processes all datasets inside dir_std_base.
#ds_nc_filenames <- c('juliemai-xSSA_Raven_blended.nc','*.nc')[1]

# A listing of datasets to grab attributes. Dataset names match what is inside dir_std_base. 'all' processes all datasets inside dir_std_base.
datasets <- raw_config$formulation_metadata[[grep("datasets",
raw_config$formulation_metadata)]]$datasets #c("juliemai-xSSA",'all')[1]

# Define directory paths from the config file
home_dir <- Sys.getenv("HOME")
dir_base <- file.path(home_dir,'noaa','regionalization','data')

dir_std_base <- file.path(dir_base,"input","user_data_std") # The location of standardized data generated by fs_proc python package
dir_db_hydfab <- file.path(dir_base,'input','hydrofabric') # The local dir where hydrofabric data are stored to limit s3 connections
dir_db_attrs <- file.path(dir_base,'input','attributes') # The parent dir where each comid's attribute parquet file is stored in the subdirectory 'comid/', and each dataset's aggregated parquet attributes are stored in the subdirectory '/{dataset_name}


s3_base <- "s3://lynker-spatial/tabular-resources" # s3 path containing hydrofabric-formatted attribute datasets
s3_bucket <- 'lynker-spatial' # s3 bucket containing hydrofabric data

s3_path_hydatl <- glue::glue('{s3_base}/hydroATLAS/hydroatlas_vars.parquet') # path to hydroatlas data formatted for hydrofabric
dir_base <- glue::glue(base::unlist(raw_config$file_io)[['dir_base']])#file.path(home_dir,'noaa','regionalization','data')
dir_std_base <- glue::glue(base::unlist(raw_config$file_io)[['dir_std_base']]) #file.path(dir_base,"input","user_data_std") # The location of standardized data generated by fs_proc python package
dir_db_hydfab <- glue::glue(base::unlist(raw_config$file_io)[['dir_db_hydfab']]) # file.path(dir_base,'input','hydrofabric') # The local dir where hydrofabric data are stored to limit s3 connections
dir_db_attrs <- glue::glue(base::unlist(raw_config$file_io)[['dir_db_attrs']]) # file.path(dir_base,'input','attributes') # The parent dir where each comid's attribute parquet file is stored in the subdirectory 'comid/', and each dataset's aggregated parquet attributes are stored in the subdirectory '/{dataset_name}

# Read s3 connection details
s3_base <- base::unlist(raw_config$hydfab_config)[['s3_base']]#s3://lynker-spatial/tabular-resources" # s3 path containing hydrofabric-formatted attribute datasets
s3_bucket <- base::unlist(raw_config$hydfab_config)[['s3_bucket']] #'lynker-spatial' # s3 bucket containing hydrofabric data

# s3 path to hydroatlas data formatted for hydrofabric
if ("s3_path_hydatl" %in% names(base::unlist(raw_config$attr_select))){
s3_path_hydatl <- glue::glue(base::unlist(raw_config$attr_select)[['s3_path_hydatl']]) # glue::glue('{s3_base}/hydroATLAS/hydroatlas_vars.parquet')
} else {
s3_path_hydatl <- NULL
}

# Additional config options
hf_cat_sel <- c("total","all")[1] # total: interested in the single location's aggregated catchment data; all: all subcatchments of interest
ext <- 'gpkg'
attr_sources <- c("hydroatlas","usgs") # "streamcat",
# TODO communicate to user that these are standardized variable names
ha_vars <- c('pet_mm_s01', 'cly_pc_sav', 'cly_pc_uav','cly_pc_sav','ari_ix_sav') # hydroatlas variables
sc_vars <- c() # TODO look up variables. May need to select datasets first
usgs_vars <- c('TOT_TWI','TOT_PRSNOW','TOT_POPDENS90','TOT_EWT','TOT_RECHG','TOT_PPT7100_ANN','TOT_AET','TOT_PET','TOT_SILTAVE','TOT_BASIN_AREA','TOT_BASIN_SLOPE','TOT_ELEV_MEAN','TOT_ELEV_MAX','TOT_Intensity','TOT_Wet','TOT_Dry' ) # list of variables retrievable using nhdplusTools::get_characteristics_metadata()
hf_cat_sel <- base::unlist(raw_config$hydfab_config)[['hf_cat_sel']] #c("total","all")[1] # total: interested in the single location's aggregated catchment data; all: all subcatchments of interest
ext <- base::unlist(raw_config$hydfab_config)[['ext']] # 'gpkg'

#-----------------------------------------------------
# Variable listings:
names_attr_sel <- base::unlist(base::lapply(raw_config$attr_select,
function(x) base::names(x)))

# Transform into single named list of lists rather than nested sublists
idxs_vars <- base::grep("_vars", names_attr_sel)
var_names <- names_attr_sel[idxs_vars]
sub_attr_sel <- base::lapply(idxs_vars, function(i)
raw_config$attr_select[[i]][[1]])
base::names(sub_attr_sel) <- var_names

# Subset to only those non-null variables:
sub_attr_sel <- sub_attr_sel[base::unlist(base::lapply(sub_attr_sel,
function(x) base::any(!base::is.null(unlist(x)))))]
var_names_sub <- names(sub_attr_sel)
#-----------------------------------------------------
message(glue::glue("Attribute dataset sources include the following:\n
{paste0(var_names_sub,collapse='\n')}"))

# TODO generate this listing structure based on what is provided in yaml config
# & accounting for empty entries
message(glue::glue("Attribute variables to be acquired include :\n
{paste0(sub_attr_sel,collapse='\n')}"))

Retr_Params <- list(paths = list(# Note that if a path is provided, ensure the
Retr_Params <- base::list(paths = base::list(
# Note that if a path is provided, ensure the
# name includes 'path'. Same for directory having variable name with 'dir'
dir_db_hydfab=dir_db_hydfab,
dir_db_attrs=dir_db_attrs,
s3_path_hydatl = s3_path_hydatl,
dir_std_base = dir_std_base),
vars = list(usgs_vars = usgs_vars,
ha_vars = ha_vars,
sc_vars = sc_vars),
vars = sub_attr_sel,
datasets = datasets
)
# PROCESS ATTRIBUTES

ls_comids <- proc.attr.hydfab:::grab_attrs_datasets_fs_wrap(Retr_Params,overwrite = TRUE)

Expand Down
4 changes: 2 additions & 2 deletions pkg/proc.attr.hydfab/man/proc_attr_hf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/proc.attr.hydfab/man/proc_attr_std_hfsub_name.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ testthat::test_that("proc_attr_usgs_nhd", {

testthat::test_that("proc_attr_hf not a comid",{
testthat::expect_error(proc.attr.hydfab::proc_attr_hf(comid="13Notacomid14", dir_db_hydfab,
custom_name="{lyrs}_",ext = 'gpkg',
custom_name="{lyrs}_",fileext = 'gpkg',
lyrs=c('divides','network')[2],
hf_cat_sel=TRUE, overwrite=FALSE))
})
Expand Down
Loading