-
Notifications
You must be signed in to change notification settings - Fork 239
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
Updating the LandTrendr.AGB.R functions #2909
base: develop
Are you sure you want to change the base?
Conversation
download_urls_final <- download_urls | ||
# ------ new way using the database | ||
if (product_version == "v1") { | ||
median_input_id <- 2000000234 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we're hard coding input ID's
##' @export | ||
##' @author Shawn Serbin | ||
##' | ||
download.LandTrendr.AGB <- function(outdir, target_dataset = "biomass", product_dates = NULL, | ||
product_version = "v1", con = NULL, run_parallel = TRUE, | ||
ncores = NULL, overwrite = FALSE) { | ||
product_version = "v1", run_parallel = TRUE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not seeing how you specify what locations you want to download
@@ -183,6 +264,8 @@ download.LandTrendr.AGB <- function(outdir, target_dataset = "biomass", product_ | |||
results$formatname[i] <- out_formats[i] | |||
} | |||
|
|||
suppressWarnings(PEcAn.DB::db.close(con, showWarnings = FALSE)) # why isnt TRUE invisible? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line. Functions should not close db connections that they were passed as arguments (and thus that they didn't open themselves) because they don't know if that connection will be needed for a later function.
data_dir = NULL, product_dates = NULL, output_file = NULL, | ||
...) { | ||
|
||
## get coordinates and provide spatial info | ||
## get coordinates and provide spatial info - should harmonize what packages we use in all data.remote functions | ||
site_info <- site_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not clear what this line is trying to achieve
data_dir = NULL, product_dates = NULL, output_file = NULL, | ||
...) { | ||
|
||
## get coordinates and provide spatial info | ||
## get coordinates and provide spatial info - should harmonize what packages we use in all data.remote functions | ||
site_info <- site_info | ||
site_coords <- data.frame(site_info$lon, site_info$lat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will crash if site_info is NULL. To me, it seems like you'd want to revert your change above that allows site_info to be NULL, but if you decide to keep it you need to add a lot of error checking for what to do if the site is null.
@serbinsh just a reminder about this PR. Not pressing, but would be good to wrap this up |
Updating the LandTrendr biomass functions to work with the new v2 dataset and write file locations to betydb
Description
Confirming functions work with v1 and v2. Other fixes. Updating file tracking to use BETYdb
Motivation and Context
Write files to BETYdb & bug fixes
Review Time Estimate
Types of changes
Checklist: