fnc_create_IDs: Create ID-raster pattern within polygon with set resolution

View source: R/fnc_create_IDs.R

fnc_create_IDsR Documentation

Create ID-raster pattern within polygon with set resolution

Description

This function creates a regular pattern of modelling points for a given test area and a given resolution.

Usage

fnc_create_IDs(
  poly,
  res = 50,
  ID_pre = "ID_",
  out_dir = NA,
  out_name = "IDs",
  tranches = NA,
  reduce_to_forest = T,
  with_clim_meta = T
)

Arguments

poly

polygon of the test area in EPSG:32632 as full path with file name and ending. Accepts all files that can be read with sf::st_read

res

resolution in m

ID_pre

optional, prefix for ID_custom-name as character. Default is ID_

out_dir

directory where df.ids shall be stored as .rds, if set to NA, data frame(s) will be returned to the console

out_name

optional, name for ID-files, default is IDs.rds

reduce_to_forest

exclude points that do not lie in forests. Will speed up all following steps like creating soils and parameter sets. Default is TRUE.

with_clim_meta

whether the columns tranche and id_standard shall be added if the WHH-KW Climate Data is to be used. These columns are needed by fnc_get_climate_args.

add_tranches

when large areas are modelled with a high resolution, it can be useful to model your area as tranches similar to a SUDOKU-field. This way you can calculate the results tranche by tranche and in a 9th of the total computing time you get a result covering the whole modelling area. In this case the IDs are assigned to a number of tranches set by tranches. Tranches must be square number, such as 4, 9, 16, or 25. Default is NA without tranches, otherwise several df.ids are stored as tranches named out_name_trX.rds in out_dir.

Value

returns a list of points with ID_custom (optional), x- and y- coordinates

Examples

df.ids <- fnc_create_IDs(poly = "H:/FVA-Projekte/P01540_WHHKW/Daten/Urdaten/GIS/metadaten/Freiburg_Wald.shp",
                         res = 100,
                         ID_pre = "ID_",
                         out_dir = NA,
                         out_name = "IDs",
                         tranches = 16)

sf.ids <- sf::st_as_sf(df.ids,
                       coords = c("easting", "northing"),
                       crs = 32632)

ggplot(sf.ids)+
   geom_sf(aes(color = factor(Tranche)))


rhabel/modLWFB90 documentation built on Nov. 21, 2024, 3:28 a.m.