<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I have updated the bfast package and included a working example in the bfastmonitor example.</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Please see ?bfastmonitor</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
install bfast via </div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><a href="http://r-forge.r-project.org/R/?group_id=533" target="_blank" style="color:rgb(17,85,204)">http://r-forge.r-project.org/R/?group_id=533</a></div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">after the weekend then the new details will be available.</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Let me know if you have specific questions.</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Best,</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Jan</div><br><div class="gmail_quote">On Mon, Feb 18, 2013 at 5:08 PM, Polyanne Aguiar <span dir="ltr"><<a href="mailto:polyanneaguiar@gmail.com" target="_blank">polyanneaguiar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">I am using the bfast in my jobs. But, I am attempting run the bfastmonitor on a raster brick (time serie MODIS EVI), I not get.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">I followed the script proposed by you in this forum. </span><span><span lang="EN" style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">But</span></span><span><span lang="EN" style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif""> </span></span><span><span lang="EN" style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">I did not succeed.<u></u><u></u></span></span></p>
<p class="MsoNormal"><span><span lang="EN" style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif""><u></u> <u></u></span></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">Following is the script used:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif"">################################################################################<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Gill Sans MT","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal">## TUTORIAL for processing raster bricks (satellite image time series of 16-day NDVI images)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">file<- brick("MT_micro.tif", native, package="raster")<u></u><u></u></p><p class="MsoNormal">file<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">## helper function for the calc function <u></u><u></u></p><p class="MsoNormal">xbfast <- function(file) {<u></u><u></u></p><p class="MsoNormal"> ndvi <- ts(file, frequency=23, start=c(2000,9))<u></u><u></u></p>
<p class="MsoNormal"> result <- bfast(ndvi, season="harmonic", max.iter=1, breaks=2)<u></u><u></u></p><p class="MsoNormal"> return(cbind(result$Magnitude,result$Time)) ## save magnitude and time of the biggest break <u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">## apply on a single pixel for testing<u></u><u></u></p><p class="MsoNormal">pixel <- as.vector(file[50])<u></u><u></u></p>
<p class="MsoNormal">ndvi <- ts(pixel, frequency=23, start=c(2000,9))<u></u><u></u></p><p class="MsoNormal">plot(ndvi)<u></u><u></u></p><p class="MsoNormal">result <- bfast(ndvi, season="harmonic", max.iter=1, breaks=2)<u></u><u></u></p>
<p class="MsoNormal">plot(result)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">## apply on a single pixel using the xbfast function <u></u><u></u></p>
<p class="MsoNormal">output <- xbfast(pixel)<u></u><u></u></p><p class="MsoNormal">output<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">## optimise function that takes into account the percentage of NA's within a time series <u></u><u></u></p>
<p class="MsoNormal">bfastfun <- function(y) {<u></u><u></u></p><p class="MsoNormal"> percNA <- apply(y, 1, FUN=function(x) (sum(<a href="http://is.na" target="_blank">is.na</a>(x))/length(x)) ) ## checks the percentage of NA's with the time series<u></u><u></u></p>
<p class="MsoNormal"> <span lang="PT-BR">i <- (percNA<0.2)<u></u><u></u></span></p><p class="MsoNormal"><span lang="PT-BR"> res <- matrix(NA, length(i), 2)<u></u><u></u></span></p><p class="MsoNormal">
<span lang="PT-BR"> </span>if (sum(i) > 0) {<u></u><u></u></p><p class="MsoNormal"> res[i,] <- t(apply(y[i,], 1, xbfast))<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal">
res<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">##apply on the full satellite image time series <u></u><u></u></p><p class="MsoNormal">magntime <- calc(data, fun=bfastfun)<u></u><u></u></p>
<p class="MsoNormal">layerNames(magntime) <- c("Magnitude", "Time of biggest Break")<u></u><u></u></p><p class="MsoNormal">plot(magntime)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
## two rasters are returned: i.e. the magnitude and time of the biggest break ## WARNING: this is requires some time :-).<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">###############################################################################################<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Polyanne Aguiar dos Santos<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Master in Applied Ecology – UFLA<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Specialist in Environmental Management – UNISAM<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Biologist – ESFA<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Phone: <a href="tel:%2B55%2035%209178%203275" value="+553591783275" target="_blank">+55 35 9178 3275</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Gill Sans MT","sans-serif";color:#595959">Skype: polyanne.aguiar<u></u><u></u></span></p><p class="MsoNormal" align="center" style="text-align:center"><u></u> <u></u></p>
<p class="MsoNormal"><img width="134" height="45" src="cid:image001.png@01CE0DD5.FC599ED0" alt="cid:image001.png@01CDF3FB.781F9910"><span lang="PT-BR"><u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
<u></u> <u></u></p></div></div></div></div><br>_______________________________________________<br>
Bfast-commits mailing list<br>
<a href="mailto:Bfast-commits@lists.r-forge.r-project.org">Bfast-commits@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/bfast-commits" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/bfast-commits</a><br></blockquote></div><br>