<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dear César,</div><div><br></div><div>Like all exports from BIOMOD, raster data are stored in binary R format. These files are thus compressed and easy to load in R. The main advantage of this format is that the "class" of the object is kept.&nbsp;</div><div><br></div><div>The only thing to do is:&nbsp;</div><div><br></div><div>load("I:/Var/Prec_GAM.raster") &nbsp; ###The data are automatically loaded in the R workspace with the name BIOMOD gave to the binary file. The class of the object is then rasterLayer/rasterStack.&nbsp;</div><div><br></div><div>library(raster)</div><div>plot(Prec_GAM.raster)</div><div><br></div><div>You can even zoom in using :</div><div><br></div><div>zoom(Prec_GAM.raster)</div><div>and then make a selection on the plot.&nbsp;</div><div><br></div><div>Do not forget that in case your data are stacked together, you need to unstack them before exporting them in ASCII files for instance.</div><div>However, I'd rather encourage you to look at the different tools in raster, rdgal and maptools packages, because as far as I am concerned, I am not using any GIS software anymore, excepted for computationally intense work.&nbsp;</div><div><br></div><div>HIH,</div><div><br></div><div>Wilfried</div><div><br></div><div><br></div><div><br></div><br><div><div>Le 7 juil. 2010 à 20:06, César Capinha a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0" style="position: static; z-index: auto; "><tbody><tr><td valign="top" style="font: inherit;"><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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</o:p></span></p><p class="MsoNormal"><span style="" lang="EN-GB">Error in
.rasterObjectFromFile(x, band = band, objecttype =
"RasterLayer",<span style="">&nbsp; </span>:<o:p></o:p></span></p><p class="MsoNormal"><span style="" lang="EN-GB"><span style="">&nbsp; </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>&lt;<a href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a>&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Wilfried Thuiller &lt;<a href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a>&gt;<br>Subject: Re: [Biomod-commits] RasterStack<br>To: "César Capinha" &lt;<a href="mailto:nrevistada@yahoo.co.uk">nrevistada@yahoo.co.uk</a>&gt;<br>Cc: <a href="mailto:biomod-commits@r-forge.wu-wien.ac.at">biomod-commits@r-forge.wu-wien.ac.at</a><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.&nbsp;</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.&nbsp;</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.&nbsp;</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,&nbsp;bio_2,&nbsp;bio_3,&nbsp;bio_4,&nbsp;bio_5,&nbsp;bio_6,&nbsp;bio_7,&nbsp;bio_8,&nbsp;bio_9,&nbsp;bio_10,&nbsp;bio_11,&nbsp;bio_12,&nbsp;bio_13,<br><span class="Apple-tab-span" style="white-space: pre;">
        </span>bio_14,&nbsp;bio_15,&nbsp;bio_16,&nbsp;bio_17,&nbsp;bio_18,&nbsp;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:&nbsp;</div><div><br></div><div>bio&nbsp;&lt;-&nbsp;paste(rep('bio',&nbsp;times=19),&nbsp;seq(1:19),&nbsp;sep="_")</div><div><br>library(raster)<br><br></div><div>for(i&nbsp;in&nbsp;bio)&nbsp;<br><span class="Apple-tab-span" style="white-space: pre;">        </span>eval(parse(text=paste(i,&nbsp;"&lt;- raster('/Data/Wordclim/",&nbsp;i,"')",&nbsp;sep="")))</div><div><span class="Apple-tab-span" style="white-space: pre;">        </span><br>worldclim=stack(bio_1,&nbsp;bio_2,&nbsp;bio_3,&nbsp;bio_4,&nbsp;bio_5,&nbsp;bio_6,&nbsp;bio_7,&nbsp;bio_8,&nbsp;bio_9,&nbsp;bio_10,&nbsp;bio_11,&nbsp;bio_12,&nbsp;bio_13,<br><span class="Apple-tab-span" style="white-space: pre;">
        </span>bio_14,&nbsp;bio_15,&nbsp;bio_16,&nbsp;bio_17,&nbsp;bio_18,&nbsp;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.&nbsp;</div><div>Use the function "crop", "mask' or "resample" from package raster to make sure.&nbsp;</div><div><br></div><div>2] You can plot the rasters or stack very easily</div><div><br></div><div>&gt; plot(worldclim)</div><div>&nbsp;and then add your points if you have the coordinates (make sure the projections is the same. Worldclim is in WGS84)&nbsp;</div><div>&gt; 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></tbody></table><br>



      _______________________________________________<br>Biomod-commits mailing list<br><a href="mailto:Biomod-commits@lists.r-forge.r-project.org">Biomod-commits@lists.r-forge.r-project.org</a><br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits<br></blockquote></div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="font-size: 12px; "><div>--------------------------</div><div>Dr. Wilfried Thuiller</div><div>Laboratoire d'Ecologie Alpine, UMR CNRS 5553</div><div>Université Joseph Fourier</div><div>BP53, 38041 Grenoble cedex 9, France</div><div>tel: +33 (0)4 76 51 44 97</div><div>fax: +33 (0)4 76 51 42 79</div><div><br></div><div>Email:&nbsp;<a href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a><br>Home page:&nbsp;<a href="http://www.will.chez-alice.fr/">http://www.will.chez-alice.fr</a><br>Website:&nbsp;<a href="http://www-leca.ujf-grenoble.fr/equipes/tde.htm">http://www-leca.ujf-grenoble.fr/equipes/tde.htm</a><br><br>FP6 European MACIS project:&nbsp;<a href="http://www.macis-project.net/">http://www.macis-project.net</a><br>FP6 European EcoChange project:&nbsp;<a href="http://www.ecochange-project.eu/">http://www.ecochange-project.eu</a></div><div><br></div></span></div></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></body></html>