[RS-ecology] RS-ecology Digest, Vol 16, Issue 1

Dragan Kaludjerovic advancedgwt at gmail.com
Mon Dec 12 16:18:48 CET 2016


It is working!

This spectralIndices saves a lot of time and only expensive packages has
similar option, to calculate a lot of VI in one run.

Thank you very much to all!

On Mon, Dec 12, 2016 at 4:11 PM, Benjamin Leutner <
benjamin.leutner at uni-wuerzburg.de> wrote:

> Hi Dragan,
>
> for your first question: yes,  spectralIndices can be calculated on
> Sentinel 2 images as well and L1C data are indeed top of atmosphere
> reflectance.
> Just for calculating spectral indices in principle there's no need for
> further conversions. Nevertheless, it is a good idea to perform atmospheric
> correction on Sentinel 2 data beforehand (with ESA SNAP software and/or
> SEN2COR), because this should improve comparability among different scenes.
>
> for your last question. the data() function is out of place here.
> Your code should read:
> bs3 <- raster("C:/R_examples/VI/B3.TIF")
> bs4 <- raster("C:/R_examples/VI/B4.TIF")
> group <- stack(bs3, bs4)
> names(group) <- c("bs3", "bs4") # make proper names
> ndvi <- spectralIndices(group, red = "bs3", nir = "bs4", indices = "NDVI")
>
>
> Cheers,
> Benjamin
>
>
>
> On 12/12/2016 03:45 PM, Dragan Kaludjerovic wrote:
>
> Martin,
> I have replaced brick() with stack() and still got the error when I run
> the line data. Here is how it looks now:
>
> install.packages("RStoolbox")
> install.packages(raster)
>
> library(ggplot2)
> library(raster)
> library(rgdal)
>
> bs3 <- raster("C:/R_examples/VI/B3.TIF")
> bs4 <- raster("C:/R_examples/VI/B4.TIF")
>
> bs3
> bs4
>
> group <- stack(bs3, bs4)
>
> #writeRaster(group, filename = "C:/R_examples/VI/grupa.TIF")
>
> data(group)
>
> ## Calculate NDVI
>
> ndvi <- spectralIndices(group, red = "bs3", nir = "bs4", indices = "NDVI")
>
> ndvi
>
> eror when I run line data(group)
>
> Warning message:In data(group) : data set ‘group’ not found
>
>
> On Mon, Dec 12, 2016 at 8:17 AM, Martin Wegmann <
> martin.wegmann at uni-wuerzburg.de> wrote:
>
>> Dear Dragan,
>>
>> Please replace brick() with stack() and it should work, and of course you
>> need to adapt your band names in spectralIndices()‎.
>>
>> Regards, Martin
>>
>> *From: *Dragan Kaludjerovic
>> *Sent: *Sunday, December 11, 2016 23:21
>> *To: *rs-ecology at lists.uni-wuerzburg.de
>> *Subject: *Re: [RS-ecology] RS-ecology Digest, Vol 16, Issue 1
>>
>> Now I have changed it, but still getting error
>>
>> install.packages("RStoolbox")
>> install.packages(raster)
>>
>> library(ggplot2)
>> library(raster)
>> library(rgdal)
>>
>> bs3 <- raster("C:/R_examples/VI/B3.TIF")
>> bs4 <- raster("C:/R_examples/VI/B4.TIF")
>>
>> bs3
>> bs4
>>
>> group <- brick(bs3, bs4)
>>
>> data(group)
>>
>> ## Calculate NDVI
>>
>> ndvi <- spectralIndices(group, red = "bs3", nir = "bs4", indices = "NDVI")
>>
>> ndvi
>>
>> error is:
>>
>>
>> > group <- brick(bs3, bs4)> data(group)Warning message:In data(group) : data set ‘group’ not found
>>
>>
>> On Sun, Dec 11, 2016 at 12:00 PM, <
>> <rs-ecology-request at lists.uni-wuerzburg.de>rs-ecology-request at lists.uni-
>> wuerzburg.de> wrote:
>>
>>> Send RS-ecology mailing list submissions to
>>>         rs-ecology at lists.uni-wuerzburg.de
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>         https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology
>>> or, via email, send a message with subject or body 'help' to
>>>         rs-ecology-request at lists.uni-wuerzburg.de
>>>
>>> You can reach the person managing the list at
>>>         rs-ecology-owner at lists.uni-wuerzburg.de
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of RS-ecology digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>>    1. problem with RStoolbox (Dragan Kaludjerovic)
>>>    2. Re: problem with RStoolbox (Martin Wegmann)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Sat, 10 Dec 2016 19:00:11 +0100
>>> From: Dragan Kaludjerovic < <advancedgwt at gmail.com>advancedgwt at gmail.com
>>> >
>>> To: RS-ecology at lists.uni-wuerzburg.de
>>> Subject: [RS-ecology] problem with RStoolbox
>>> Message-ID:
>>>         <CAFZvhLipaCHuq-hQsk_5i31ThbCXGQZ4cPhP87+YS4P6__rzDw at mail.gm
>>> ail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> Hi,
>>> I have just discover RStoolbox and try simple simple script
>>>
>>> install.packages("RStoolbox")
>>> install.packages(raster)
>>>
>>> library(ggplot2)
>>> library(raster)
>>> library(rgdal)
>>>
>>> data(img)
>>>
>>> ## Calculate NDVI
>>> ndvi <- spectralIndices(img, red = "C:/R_examples/VI/B3.tif", nir =
>>> "C:/R_examples/VI/B4.tif", indices = "NDVI")
>>> ndvi
>>>
>>>
>>> when I run it I got error message
>>>
>>> Error in match(xi, names(img)) : object 'img' not found
>>>
>>> Any suggestion is welcomed!
>>>
>>> Best Regards,
>>>
>>> Dragan
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachme
>>> nts/20161210/0a7d11e2/attachment-0001.html>
>>>
>>> ------------------------------
>>>
>>> Message: 2
>>> Date: Sun, 11 Dec 2016 09:46:02 +0100
>>> From: Martin Wegmann <martin.wegmann at uni-wuerzburg.de>
>>> To: Dragan Kaludjerovic < <advancedgwt at gmail.com>advancedgwt at gmail.com>,
>>>         RS-ecology at lists.uni-wuerzburg.de
>>> Subject: Re: [RS-ecology] problem with RStoolbox
>>> Message-ID: <20161211084602.5943378.73264.3393 at uni-wuerzburg.de>
>>> Content-Type: text/plain; charset="us-ascii"
>>>
>>> An HTML attachment was scrubbed...
>>> URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachme
>>> nts/20161211/c04e82de/attachment-0001.html>
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> RS-ecology mailing list
>>> RS-ecology at lists.uni-wuerzburg.de
>>> https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology
>>>
>>>
>>> End of RS-ecology Digest, Vol 16, Issue 1
>>> *****************************************
>>>
>>
>>
>>
>
>
> _______________________________________________
> RS-ecology mailing listRS-ecology at lists.uni-wuerzburg.dehttps://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology
>
>
> --
> Benjamin Leutner M.Sc.
> PhD candidate
>
> Department of Remote Sensing
> University of Wuerzburg
> Campus Hubland Nord 86
> 97074 Wuerzburg, Germany
>
> Tel: +49-(0)931-31 89594 <+49%20931%203189594>
> Fax: +49-(0)931-31 89594-0
> Email: benjamin.leutner at uni-wuerzburg.de
> Web: http://www.fernerkundung.uni-wuerzburg.de
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20161212/a250aa9a/attachment-0001.html>


More information about the RS-ecology mailing list