-
Notifications
You must be signed in to change notification settings - Fork 234
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
soilgrids extract function for the CMS SDA #2903
Conversation
We are providing here as a place to be reviewed by the CMS team and move forward with a full function. A few things to follow up on
I know I am forgetting some things here but wanted to get this up now so Cherry can move forward on completing this if the basic skeleton looks good to folks? In addition here are some warnings we might want to look into
|
The main function is in the soilgrids.R file and is currently called "soilgrids.soc.extract" An example of how the function works at this time:
and the output looks like this
The present function works by creating internal virtual rasters for each soilgrids depth then extracts the values for each site in the provided site list. |
Still needed: the ability to write out an Rdata file containing the results so that we dont have to run the extraction every time....duh I will update |
Updated to output an Rdata file but have not yet set up the function to record the file/results in BETY as I am not yet sure how to manage the lack of a time element but where we do have the site ID. Do we try to capture that so that future CMS runs know where it already has SOC data? How do we record what sites are already in the SOC file? Seems complicated if we are doing runs that only share part of the same site list! |
dat <- split(soc_fit, list(soc_fit$siteids, soc_fit$Depth)) | ||
|
||
#assume the soc profile follows gamma distribution best | ||
cgamma <- function(theta, val, stat) { |
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.
documentation of function args?
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.
Also, is there any reason to have these function internal to this function rather than just part of this pecan package
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.
moving function out to a utils file to make these functions exposed in data.remote()
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.
Actually these are pretty specific to the needs for calculating soil C by depth so I dont know if it makes sense to move these out into a general function as I wouldnt yet know why/what else we would use it for? To make it general we would need to pass the function the variable names
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 was thinking it may be useful for other soil C products other than SoilGrids
return(sum((pred - val) ^ 2)) | ||
} | ||
|
||
fitQ <- function(x) { |
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.
same
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.
agreed - moving out and exposing
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.
as stated above I dont actually know if it makes sense to move these if these arent really used anywhere else?
…soilgrid_extract
Updating output format too:
|
@serbinsh your comments mention a lot of fixes, but they don't seem to have been pushed into the PR yet. |
This is now superseded by @Qianyuxuan new PR #3040 There are tests in here that at some point we may want to bring into data.land but have left those out for now as they are API tests we dont want to hold up checks if the API/URL is unreachable |
Description
Frist pass at the soilgrids extract function for the NASA CMS SDA
Review Time Estimate
Types of changes
Checklist: