-
Notifications
You must be signed in to change notification settings - Fork 235
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
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.
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.
Looks like it was added by terra::extract
on line 34 above, and could be suppressed by by passing ID = FALSE
there
# 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? |
@JoshuaPloshay I believe you have code that loads up existing PEcAn output, calls your downscale function, and does some analyses and visualizations of the outputs (including quantile checks). It would be good to add such code to this PR (e.g. in the /inst folder) so that others don't need to recreate this to be able to pick up on where your analyses left off. |
Merge branch 'develop' of https://github.com/JoshuaPloshay/pecan into develop # Conflicts: # modules/assim.sequential/man/NA_downscale.Rd
Description
Motivation and Context
Review Time Estimate
Types of changes
Checklist: