overlap_fraction: overlap_fraction

View source: R/overlap_fraction.R

overlap_fractionR Documentation

overlap_fraction

Description

overlap_fraction

Usage

overlap_fraction(shp, cellsize = 0.1, range = NULL, outfile = NULL, ...)

Value

  • I : the order of base, ⁠[lon, lat]⁠, image works directly on it.

  • cell: the order of gdal, ⁠[lon, rev(lat)]⁠, returned by values(r),

Examples

## Not run: 
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)

## End(Not run)

# shp = basin_Baihe
shp = bou1_4p
cellsize <- 0.5
range <- st_range(shp, cellsize)

dat = overlap_fraction(shp, cellsize = cellsize, range, outfile = NULL)
print(dat)

kongdd/sp2 documentation built on Jan. 15, 2024, 11:31 p.m.