<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CCSARCA%7E1%5CDEFINI%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 85.05pt 70.85pt 85.05pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";
        mso-ansi-language:#0400;
        mso-fareast-language:#0400;
        mso-bidi-language:#0400;}
</style>
<![endif]-->
<p class="MsoNormal"><span style="" lang="EN-GB">Thanks
Wilfried,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB">It all
worked well but I have one more (hopefully last) doubt though.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB">Predictions
are stored in a .raster format which I guess is the native format of the raster
library. I need to import these predictions to GIS. Still I cant find the
correct method used to load them as a raster layer so I can then export them in
a GIS compatible format using the "writeRaster" command.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB">Ex. using
"raster" command<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB">pred =
raster("I:/Var/Prec_GAM.raster")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB">Error in
.rasterObjectFromFile(x, band = band, objecttype =
"RasterLayer",<span style=""> </span>:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-GB"><span style=""> </span>Cannot create a RasterLayer object from this
file.</span></p><p class="MsoNormal"><br></p><p class="MsoNormal">Thanks again</p><p class="MsoNormal"><br></p><p class="MsoNormal">César</p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br><span style="" lang="EN-GB"><o:p></o:p></span></p>
<br><br>--- On <b>Mon, 5/7/10, Wilfried Thuiller <i><wilfried.thuiller@ujf-grenoble.fr></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Wilfried Thuiller <wilfried.thuiller@ujf-grenoble.fr><br>Subject: Re: [Biomod-commits] RasterStack<br>To: "César Capinha" <nrevistada@yahoo.co.uk><br>Cc: biomod-commits@r-forge.wu-wien.ac.at<br>Date: Monday, 5 July, 2010, 17:39<br><br><div id="yiv1820470844"><div>Hi again,</div><div><br></div><div>RasterStack is like a <i>list</i> of raster objects. A raster object is an object from package "raster" that can be loaded from grid ascii files, or ESRI grids, or IMG files. </div><div>For each environmental variable, there is one raster object. Thus to make a projection, you need to to group them together (as you can do when you have multiple vectors for the environmental layers and the group them in a dataframe) in order to
make tell BIOMOD or whatever model where are the data. </div><div><br></div><div>I gather everyone knows the Worldclim data (<a rel="nofollow" target="_blank" href="http://www.worldclim.org/">http://www.worldclim.org/</a>). They can be downloaded easily from the web in different format. Let's say we have them in ESRI grids. </div><div><br></div><div>library(raster)</div><div>bio1 = raster("/Data/Wordclim/bio1")</div><div>bio2 = raster("/Data/Wordclim/bio2")</div><div>....</div><div><br></div><div>bio19 = raster("/Data/Worldclim/bio19")</div><div><br></div><div><br></div><div>Then you can create a stack from these 19 variables</div><div><br></div><div>worldclim=stack(bio_1, bio_2, bio_3, bio_4, bio_5, bio_6, bio_7, bio_8, bio_9, bio_10, bio_11, bio_12, bio_13,<br><span class="Apple-tab-span" style="white-space: pre;">
        </span>bio_14, bio_15, bio_16, bio_17, bio_18, bio_19)<br><br></div><div><br></div><div>Now you have a stack a raster that you can use to project the models (if calibrated on the same data of varuables!!)</div><div><br></div><div><br></div><div>A more sexy way of doing that is: </div><div><br></div><div>bio <- paste(rep('bio', times=19), seq(1:19), sep="_")</div><div><br>library(raster)<br><br></div><div>for(i in bio) <br><span class="Apple-tab-span" style="white-space: pre;">        </span>eval(parse(text=paste(i, "<- raster('/Data/Wordclim/", i,"')", sep="")))</div><div><span class="Apple-tab-span" style="white-space: pre;">        </span><br>worldclim=stack(bio_1, bio_2, bio_3, bio_4, bio_5, bio_6, bio_7, bio_8, bio_9, bio_10, bio_11, bio_12, bio_13,<br><span class="Apple-tab-span" style="white-space: pre;">
        </span>bio_14, bio_15, bio_16, bio_17, bio_18, bio_19)<br><br><br></div><div>********** Important********</div><div>1] The rasters must have the same extent (Xmin, Ymin, Xmas, Ymax) to be stacked. </div><div>Use the function "crop", "mask' or "resample" from package raster to make sure. </div><div><br></div><div>2] You can plot the rasters or stack very easily</div><div><br></div><div>> plot(worldclim)</div><div> and then add your points if you have the coordinates (make sure the projections is the same. Worldclim is in WGS84) </div><div>> points(X,Y)</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div><div>Le 5 juil. 2010 à 18:05, César Capinha a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><table border="0" cellpadding="0"
cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top"><table><tbody><tr valign="top"><td><code></code><br></td></tr></tbody></table>Hi all again,<br><br>Can someone provide a deeper insight on how to define and create the class 'RasterStack' needed to make the raster projections? <br><br>Best of wishes,<br><br>César<br></td></tr></tbody></table></blockquote></div></div></blockquote></td></tr></table><br>