Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jbferet committed Apr 27, 2020
2 parents c5008e7 + 6330c2c commit 0507848
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
7 changes: 4 additions & 3 deletions vignettes/biodivMapR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
28 changes: 22 additions & 6 deletions vignettes/biodivMapR_1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.

0 comments on commit 0507848

Please sign in to comment.