From 6330c2ca8df26e58b8f46ea21d57e3b2954cf2f0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Feret Date: Mon, 27 Apr 2020 18:25:56 +0200 Subject: [PATCH] - updated vignettes --- vignettes/biodivMapR.Rmd | 7 ++++--- vignettes/biodivMapR_1.Rmd | 28 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/vignettes/biodivMapR.Rmd b/vignettes/biodivMapR.Rmd index 60f0dc8e..84fea31a 100644 --- a/vignettes/biodivMapR.Rmd +++ b/vignettes/biodivMapR.Rmd @@ -61,10 +61,10 @@ The output directory defined with `Output_Dir` will contain all the results. For library(biodivMapR) Input_Image_File = system.file('extdata', 'RASTER', 'S2A_T33NUD_20180104_Subset', package = 'biodivMapR') +# please visit this webpage if you need to convert your raster image file using raster2BIL +# https://jbferet.github.io/biodivMapR/articles/biodivMapR_1.html # Input_Image_File = raster2BIL(Raster_Path = Input_Image_File, -# Sensor = 'SENTINEL_2A', -# Convert_Integer = TRUE, -# Output_Dir = '~/test') +# Sensor = 'SENTINEL_2A') Input_Mask_File = FALSE @@ -115,6 +115,7 @@ nbclusters = 50 ```{r Mask non vegetated / shaded / cloudy pixels} NDVI_Thresh = 0.5 +# these values are relevant only if reflectance is coded as integer values between 0 and 10000. Blue_Thresh = 500 NIR_Thresh = 1500 print("PERFORM RADIOMETRIC FILTERING") diff --git a/vignettes/biodivMapR_1.Rmd b/vignettes/biodivMapR_1.Rmd index 55312cb1..f28c1eee 100644 --- a/vignettes/biodivMapR_1.Rmd +++ b/vignettes/biodivMapR_1.Rmd @@ -36,12 +36,26 @@ A function is dedicated to conversion of a raster file into appropriate image fo ```{r raster2BIL} library(biodivMapR) +# define input variables for raster2BIL: +# full path or relative path for the raster file to convert +Path_Raster_File <- 'Where/is/your/raster/file/?' +# you also need to define a template for the .hdr file corresponding to your sensor. +# locate the install directory for biodivMapR +# system.file(package = "biodivMapR")` +# and write a file with description corresponding to your image (in terms of spectral bands, band name, etc) +Name_Template_HDR <- 'Name_of_hdr_template' +# you may want to convert reflectance from [0-1] real32 values to [0-10000] integer16 +# see explanation below +Convert_Integer <- TRUE +Multiplying_Factor <- 10000 +Multiplying_Factor_Last <- 1.0 Input_Image_File = raster2BIL(Raster_Path = Path_Raster_File, - Sensor = Path_Template_HDR, - Convert_Integer = TRUE, - Output_Dir = Path_Output_Directory) - + Sensor = Name_Template_HDR, + Output_Dir = Path_Output_Directory, + Convert_Integer = Convert_Integer, + Multiplying_Factor = Multiplying_Factor, + Multiplying_Factor_Last=Multiplying_Factor_Last) ``` ## Input variables @@ -50,10 +64,10 @@ The following information is expected as input information: * `Raster_Path`: a string containing the full path for the raster to be converted. * `Sensor`: a string containing the name of the sensor, which should actually be linked to a template for the corresponding header file. +* `Output_Dir` [optional]: a string defining the path for the output directory where converted file will be stored. * `Convert_Integer` [optional]: a boolean stating if the raster data should be converted into integer * `Multiplying_Factor` [optional]: a multiplying factor for the raster data. This is useful when converting real reflectance values between 0 and 1 into integer between 0 and 10000. Set `Multiplying_Factor =10000` in this case. -* `Output_Dir` [optional]: a string defining the path for the output directory where converted file will be stored. -* `Multiplying_Factor_Last` [optional]: a multiplying factor for last band. This option is useful if working with dry vegetation acquired with Sentinel-2 images, in order to artifically increase the reflectance of the B12 band (SWIR 2, centered at 2200 nm), so that SWIR 1 band remains below the convex hull defined during Continuum removal. +* `Multiplying_Factor_Last` [optional]: a multiplying factor for last band. This option is useful only if working with dry vegetation acquired with Sentinel-2 images, in order to artifically increase the reflectance of the B12 band (SWIR 2, centered at 2200 nm), so that SWIR 1 band remains below the convex hull defined during Continuum removal. __You do not need to use this option most of the time, unless you want to enhance teh sensitivity to different types of dry vegetation__. Please note that i) the coordinate system and minimal metadata (spatial resolution, geographic information...) are expected to be provided in the original image or image + header defined in `Raster_Path` if user want them to be included in the final image products. @@ -66,3 +80,5 @@ iii) `Convert_Integer=TRUE` saves 50% space if original image is stored in real ## output variable `raster2BIL` returns a string containing the full path for the raster once converted. + +You can directly use this output variable as input for the next steps of the process.