Skip to content

Commit

Permalink
fix point based intersections, and add new use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed Nov 21, 2023
1 parent 9554109 commit 9254fcc
Show file tree
Hide file tree
Showing 28 changed files with 738 additions and 114 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ importFrom(terra,ext)
importFrom(terra,extract)
importFrom(terra,flip)
importFrom(terra,intersect)
importFrom(terra,is.related)
importFrom(terra,merge)
importFrom(terra,minmax)
importFrom(terra,nlyr)
Expand Down
2 changes: 1 addition & 1 deletion R/catalog.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @importFrom arrow read_parquet
#' @importFrom dplyr filter mutate select distinct `%>%` everything mutate_all bind_rows left_join rename group_by ungroup slice
#' @importFrom glue glue
#' @importFrom terra intersect project vect crs ext relate rast crop flip `ext<-` `crs<-` `units<-` `time<-` union sprc merge units nlyr as.polygons plot extract time align ymax ymin xmax xmin plot minmax setGDALconfig
#' @importFrom terra intersect project vect crs ext relate rast crop flip `ext<-` `crs<-` `units<-` `time<-` union sprc merge units nlyr as.polygons plot extract time align ymax ymin xmax xmin plot minmax setGDALconfig is.related
#' @importFrom RNetCDF open.nc close.nc var.get.nc dim.inq.nc var.inq.nc utcal.nc att.get.nc
#' @importFrom future.apply future_lapply
#' @importFrom ncmeta nc_coord_var nc_grid_mapping_atts nc_gm_to_prj nc_vars nc_var nc_dims
Expand Down
4 changes: 3 additions & 1 deletion R/climater_filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ climater_filter <- function(id = NULL,
gid = sapply(1:nrow(catalog), function(x) {
suppressWarnings({
tryCatch({
nrow(intersect(make_vect(catalog[x,]), terra::project(terra::ext(AOI), crs(AOI), catalog$crs[x]))) > 0
length(terra::is.related(make_vect(catalog[x,]),
terra::project(terra::ext(AOI), crs(AOI), catalog$crs[x]),
"intersects")) > 0
}, error = function(e) {
FALSE
})
Expand Down
4 changes: 3 additions & 1 deletion R/dap.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ dap_crop <- function(URL = NULL,
catalog$crs[i] = "EPSG:4326"
}
tryCatch({
ext(intersect(terra::project(terra::ext(AOI), crs(AOI), catalog$crs[i]), make_ext(catalog[i,])))
ext(terra::intersect(terra::project(terra::ext(AOI), crs(AOI), catalog$crs[i]),
make_vect(catalog[i,])))

#ext(intersect(project(spatAOI(AOI), catalog$crs[i]), make_ext(catalog[i,])))
},
error = function(e) {
Expand Down
18 changes: 9 additions & 9 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ authors:
html: "<img src='man/figures/noaa-logo.png' width=72 alt='ESIP'/>"
href: "https://www.esipfed.org"
footer:
roles: [cre,ctb]
roles: [cre, ctb]
citation:
roles: [cre]
sidebar:
roles: [cre,ctb, fnd]
roles: [cre, ctb, fnd]
articles:
- title: climateR
desc: Data access in R
- title: Quick Start
desc: Data access in R and Python
contents:
- 01-intro
- examples

- title: climatePy
desc: Data acces in Python
contents:
- 03-intro-climatepy

- title: Data Catalogs
contents:
- schema
- 02-catalogs

- title: Use Cases
contents:
- 05-mros-climateR
- 04-stream-morph

reference:
- title:
Expand Down
15 changes: 8 additions & 7 deletions docs/articles/01-intro.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-19-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-22-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/01-intro_files/figure-html/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9254fcc

Please sign in to comment.