sample_for_sicktree_model_multi_tile: Sample training data for image classification from multiple...

Description Usage Arguments Value Note Examples

View source: R/sample_for_sicktree_model_multi_tile.r

Description

For each class in .shp polygon file, Sample training data for image classification from multiple image tiles using their raster bricks as predictors

Usage

1
2
3
sample_for_sicktree_model_multi_tile(r_train_dir, tile = "ALL", vuln_classes,
  Pols, field_name, data_outp_dir = NULL, abs_samp = 1000, parallel = F,
  nWorkers = 4)

Arguments

r_train_dir

A directory where .tifs for training can be found for multiple tiles

tile

Character vector. Names of tile(s) to run. 'ALL will run all tiles in r_train_dir. Default is 'ALL'

vuln_classes

A list of the classes you want to model. The list can contain one or more vectors. Each vector represents a seperate vegetation class and response variable for the model and the vector elements are synonyms used to describe that class. The fist place in each vector will be used in the output name used to store the calibrated model, so it should not contain spaces. The other places should appear as attributes in the field 'field_name' of Pols.

Pols

SpatialPointsDataFrame or SpatialPolygonsDataFrame of which one field contains the vuln.classes

field_name

The field in AOI.filename that contains the vuln_classes

data_outp_dir

The folder and filename prefix to save the sampled data to. No data is saved is data_outp_dir is NULL. Default is NULL.

abs_samp

How many 'absence' pixels should be randomly selected from eah tile to train the model? Default is 100.

parallel

Should the code be run in parallel using the doParallel package? Default is FALSE.

nWorkers

If running the ocde in parallel, how many workers should be used? Default is 4.

Value

Saves a list with class-specific data frames of which the first column is the presence-absence response that can be used to train distribution model.

Note

Run in 32-bit R installation. Do you need a 'require(rJava)?'. Implement optional parallel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
read in the calval data
class_test_path <- '//ies.jrc.it/h03/FISE/forest/CanopyHealthMonitoring/PWN/classification_tests'
training_pol_filename <- file.path(class_test_path,'cal_val_data/Castelo_Branco_DMC_Nov2016/DMC_Nov2016_inspect_multi_final_20170126.shp')
Pols <- raster::shapefile(training_pol_filename)

tt <- sample_for_sicktree_model_multi_tile(r_train_dir =
"//ies.jrc.it/h03/CANHEMON/H03_CANHEMON/Imagery/Portugal/DMC/ortophotos_22122016/RGBN_LUT",
                                          #tile = 'ALL',
                                          tile = c('pt606000-4401000', 'pt610000-4415000','pt610000-4410000','pt610000-4408000'),
                                          list(c('Pb')), Pols, field_name = 'type', data_outp_dir = 'E:/beckpie/temp/maxent_sample', parallel = T, nWorkers =2)


## End(Not run)

pieterbeck/CanHeMonR documentation built on May 25, 2019, 7:11 a.m.