overlap_fraction.Rd
overlap_fraction
overlap_fraction(shp, cellsize = 0.1, range = NULL, outfile = NULL, ...)
I
: the order of base
, [lon, lat]
, image
works directly on it.
cell
: the order of gdal
, [lon, rev(lat)]
, returned by values(r)
,
if (FALSE) { # \dontrun{
library(nctools)
f = "//kong-nas/CMIP6/DATA/China/CN0.5.1_ChinaDaily_025x025/yearly/CN05.1_Tmax_1961_2021_yearly_025x025.nc"
data = ncread(f, "tmax")
image(data[, , 1]) # should works
r = rast(f)
range = as.vector(ext(r))
cellsize = res(r)
} # }
# shp = basin_Baihe
shp = bou1_4p
#> Error: object 'bou1_4p' not found
cellsize <- 0.5
range <- st_range(shp, cellsize)
#> Error: object 'shp' not found
dat = overlap_fraction(shp, cellsize = cellsize, range, outfile = NULL)
#> Error in (function (cond) .Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = "object of type 'builtin' is not subsettable", call = range[1], object = .Primitive("range")), class = c("notSubsettableError", "error", "condition"))): error in evaluating the argument 'x' in selecting a method for function 'ext': object of type 'builtin' is not subsettable
print(dat)
#> Error: object 'dat' not found