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
Add downscale_function and covariates scripts #3272
base: develop
Are you sure you want to change the base?
Conversation
data <- input_data[[index]] | ||
carbon_data <- as.data.frame(t(data[which(names(data) == C_pool)])) | ||
names(carbon_data) <- paste0("ensemble",seq(1:ncol(carbon_data))) | ||
|
||
# Extract predictors from covariates raster using site coordinates | ||
predictors <- as.data.frame(terra::extract(covariates, site_coordinates)) | ||
predictors <- dplyr::select(predictors, -1) | ||
predictors <- dplyr::select(predictors, -ID) |
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.
I don't see where ID
is being defined/calculated in the code above.
# 2023 REU project used 10 minute spatial resolution | ||
|
||
## Solar Radiation (kJ m-2 day-1) | ||
srad <- terra::rast(list.files(path = "/projectnb/dietzelab/jploshay/pecan_copy/jploshay/10m_srad", |
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.
For anyone to be able to reuse this script they will have to redefine a LOT of local paths. Better would be to define ONE folder where all the data is located at the top of the script and then express all the other paths relative to that (e.g. using file.path()
)
|
||
#### Land Cover #### | ||
GLanCE_extract <- function(pattern, path) { | ||
files <- list.files(path = "/projectnb/dietzelab/dietze/glance2012/e4ftl01.cr.usgs.gov/MEASURES/GLanCE30.001/2012.07.01", #make this path default |
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.
I'm pretty sure you don't want to hard code a file path within a function. Much better to make it an argument. indeed, this function already has a path
argument that doesn't seem to be used anywhere.
sand <- geodata::soil_world(var = "sand", depth = 5, stat = "mean", path = tempdir()) | ||
|
||
|
||
#### Land Cover #### |
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.
For files that are manually downloaded, your earlier examples provided some indication of where the data is located and how to download it. Equivalent info is missing here.
|
||
#### Resample and Stack Maps #### | ||
# Define the extent to crop the covariates to North America | ||
NA_extent <- terra::ext(-178.19453125, -10, 7.22006835937502, 83.5996093750001) |
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 would be good to have at the top of the script in case a user wants/needs to set a different extent.
@JoshuaPloshay this PR is failing because of a conflict between the updated Roxygen and the not-yet-updated man page. Could you pull the changes I've made into your local branch, then rerun make document, then commit the updated NA_downscale.Rd? |
Description
Motivation and Context
Review Time Estimate
Types of changes
Checklist: