-
Notifications
You must be signed in to change notification settings - Fork 3
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
Submission workflow #13
Changes from 2 commits
e1d6957
f23d69d
049b75f
b18e1ff
69a3564
2b3f09e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
|
||
spat4cast_submit <- function(dir, theme = "lai_recovery") { | ||
# upload anonymously to submissions bucket | ||
spat4cast_submit <- function(dir, theme = "lai_recovery", fire = "august_complex") { | ||
|
||
submitted_files <- list.files(dir, full = TRUE) | ||
|
||
# Check file type | ||
assertthat::assert_that(n_distinct(tools::file_ext(submitted_files)) == 1) | ||
assertthat::assert_that(unique(tools::file_ext(submitted_files)) == "tif", msg = "Error: The file extension in the directory is not 'tif'. Please check the file format.") | ||
|
||
# Check bounding box for files | ||
## can we use the `fire` argument to pull a template target file for comparison? | ||
## if we are to enforce these attributes, then we should modify `ingest_planetary_data` to remove dy, dx, dt, srs arguments (and have them enforced according to the fire of intered) | ||
res(rast(submitted_files)) | ||
origin(rast(submitted_files)) | ||
ext(rast(submitted_files)) | ||
emmamendelsohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Upload anonymously to submissions bucket | ||
minioclient::mc_alias_set("efi", "data.ecoforecast.org", "", "") | ||
minioclient::mc_cp(dir, | ||
paste0("efi/spat4cast-submissions/", theme), | ||
paste0("efi/spat4cast-submissions/", theme, "/", fire), # should we have separate buckets for each fire? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good call, that's probably easiest. paralleling the existing conventions in efi, I think we should refer to theme as the glue("efi/spat4cast-submissions/variable={theme}/site_id={fire}") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh somewhere in here we need a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how would you suggest validating |
||
recursive = TRUE) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Send from submissions to forecasts | ||
minioclient::mc_alias_set("efi", "data.ecoforecast.org", "", "") | ||
minioclient::mc_cp(from = paste0("efi/spat4cast-submissions/", theme), | ||
to = paste0("efi/spat4cast-forecasts/", theme), | ||
emmamendelsohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
recursive = 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.
looks great. 🎉
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.
Oh, we probably want a dictionary of valid site_id names (ideally this will come from some spatial vector table we give people with
site_id
, date of fire/disturbance, and the polygon geometry).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 now, added some documentation and set the function to enforce valid site_id and variable names:
https://github.com/eco4cast/modis-lai-forecast/blob/submission-workflow/R/spat4cast_submit.R#L5-L20