Skip to content

Commit

Permalink
fetch precip for part of USGS-VIZLAB#11
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan S Read committed Nov 1, 2017
1 parent cb5b3a3 commit 256a37e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
13 changes: 12 additions & 1 deletion scripts/fetch/precip_grid_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,16 @@ fetch.precip_grid_data <- function(viz){
sp_grid_WGS84 <- sp::spTransform(sp_grid, "+proj=longlat +datum=WGS84")

stencil <- geoknife::simplegeom(sp_grid_WGS84)
warning('the rest is not implemented')
fabric_args <- viz[["webdata_args"]]

fabric <- geoknife::webdata(
url = fabric_args$url,
times = as.POSIXct(fabric_args$times),
variables = fabric_args$variables
)

job <- geoknife::geoknife(stencil, fabric, wait = TRUE, REQUIRE_FULL_COVERAGE=FALSE)

data <- geoknife::result(job, with.units = TRUE)
saveRDS(data, file = viz[['location']])
}
2 changes: 1 addition & 1 deletion scripts/process/grid_from_mask.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ process.grid_from_mask <- function(viz){
cell_grid_clipped <- sf::st_intersection(cell_grid, clip_mask)

# add an id to be used for adding data later:
cell_grid_clipped <- st_sf(cell_grid_clipped, id = paste('cell_', 1:length(cell_grid_clipped), sep= ''))
cell_grid_clipped <- st_sf(cell_grid_clipped, row.names = paste('cell_', 1:length(cell_grid_clipped), sep= ''))
saveRDS(cell_grid_clipped, file = viz[['location']])
}
8 changes: 8 additions & 0 deletions viz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ info:
sp:
repo: CRAN
version: 1.2.5
geoknife:
repo: GRAN
version: 1.6.0
parameter:
-
id: spatial_metadata
Expand Down Expand Up @@ -72,6 +75,11 @@ fetch:
reader: rds
fetcher: precip_grid_data
scripts: scripts/fetch/precip_grid_data.R
webdata_args:
times: ["2014-01-01", "2014-01-04"]
url: "https://cida.usgs.gov/thredds/dodsC/stageiv_combined"
variables: "Total_precipitation_surface_1_Hour_Accumulation"
comment: "times and other metadata will be moved to another target, e.g., timesteps"
depends:
grid: precip_grid

Expand Down

0 comments on commit 256a37e

Please sign in to comment.