= Modeling species habitat with environmental predictor variables = In this example, we demonstrate how to predict the occurrence of a marine animal from points where the animal was observed by sampling oceanographic images (bathymetry, SST, and chlorophyll density), fitting a multivariate statistical model, and then predicting probability of occurrence maps from the oceanographic images. This type of analysis is sometimes called habitat modeling, species distribution modeling, species occurrence modeling, or range mapping. == Watch the webinar == This demonstration was given as a one hour "webinar" to the EBM Tools Network on 15 October 2008. It consisted of a short !PowerPoint presentation followed by a longer demonstration showing how to perform the analysis in ArcGIS using geoprocessing tools in MGET. You can download the !PowerPoint slides in either [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET%20Demonstration%20by%20Jason%20Roberts%20101508.ppt?format=raw Microsoft PowerPoint format] or [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET%20Demonstration%20by%20Jason%20Roberts%20101508.pdf?format=raw Adobe PDF format]. You can also watch a recording of the webinar. We highly recommend this because the !PowerPoint does not explain any details of the analysis. All of the details are captured in the ArcGIS demonstration. To watch the webiniar, download one of the following files. If you plan to watch it on a Windows computer, choose Windows Media Player format. For other operating systems, choose MPEG 4 format. If you plan to watch on a portable device such as an iPhone, choose 480x320 resolution. Otherwise choose 640x480 to maximize the clarity. * [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET_wmv_640_480.zip?format=raw MGET_wmv_640_480.zip] (Windows Media Player format, 640x480, 135 MB) * MGET_wmv_480_320.zip (Windows Media Player format, 480x320, in preparation) * [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET_mp4_640_480.zip?format=raw MGET_mp4_640_480.zip] (MPEG 4 format, 640x480, 175 MB) * [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET_mp4_480_320.zip?format=raw MGET_mp4_480_320.zip] (MPEG 4 format, 480x320, 81 MB) Thanks to Rui Prieto for preparing these recordings! At the end of the presentation, the EBM Tools Network encountered a technical problem with its conference calling system and had to terminate the audio right when I called for questions. Thus you will hear the audio cut out while the video keeps going. If you have any questions about the end of the presentation, please contact me ([mailto:jason.roberts@duke.edu]). If 640x480 does not provide enough clarity, you can download the [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET%20Demonstration%20by%20Jason%20Roberts%20101508.wmv?format=raw original video] (Windows Media Player format, 50 MB). Although this is smaller than the files above, it provides greater clarity. Unfortunately it does not have the audio track. Thus it is best to watch one of the files above and only use this one to review key moments in the presentation with enhanced clarity (for example, if you wish to read some text that I've entered into a geoprocessing tool). If desired, you can also download the [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/MGET%20Demonstration%20by%20Jason%20Roberts%20101508.mp3?format=raw original audio] (MP3 format, 7 MB) and play it back simultaneously with the original video, if you know how to configure your media players accordingly. == Download the demonstration and run it yourself == If you have ArcGIS 9.2 or a later version, you can download the demonstration and run it yourself. === Demo requirements === To run the demo, the following software must be installed. See the [http://code.env.duke.edu/projects/mget/browser/MGET/Trunk/PythonPackage/dist/TracOnlineDocumentation/Documentation/GettingStarted.html?format=raw#Installation MGET Installation Instructions] for step-by-step installation instructions. Please contact [mailto:jason.roberts@duke.edu] if you need help. * ArcGIS 9.2, 9.3, or 9.3.1 * ArcGIS Spatial Analyst extension * Python 2.4 or 2.5 * Python pywin32 package (a.k.a. Python for Windows Extensions) installed for your version of Python * MGET '''0.7''' for your version of Python * 0.7 Beta 1 and Beta 2 will work; earlier versions will not work; later versions will probably work; contact us for help if needed * R 2.7.0 or later === Running the demo === 1. Download the file [/projects/mget/browser/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/HabModExample2.zip?format=raw HabModExample2.zip] (274 MB) and save it to '''C:\''' directory. 2. Extract the file above to the directory '''C:\HabModExample2'''. If you have !WinZip, you can accomplish this from Windows Explorer or My Computer by navigating to the '''C:\''' directory, right clicking on the '''HabModExample2.zip''' file, selecting '''!WinZip''' and then '''Extract to here'''. If you don't have !WinZip, just open the file with Windows and follow the instructions. You might have to change some options to get it to extract to '''C:\HabModExample2'''. When you are done, your directory structure should look like this from !ArcCatalog: [[Image(source:/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/FolderLayout.png, nolink)]] 3. The ZIP file includes the satellite oceanography data files but not the species observations. You must download these yourself from OBIS-SEAMAP. Go to http://seamap.env.duke.edu/datasets/detail/5, click on the '''Download''' tab, and download the data as an ESRI shapefile. You will have to accept the OBIS-SEAMAP Terms of Use. Save the file to '''C:\HabModExample2\seamap5.zip'''. 4. Unzip '''C:\HabModExample2\seamap5.zip''' into the directory that contains it. Now, the directory structure should look like this from !ArcCatalog (you may have to refresh the window): [[Image(source:/WikiFiles/Examples/HabitatModeling/EBMToolsNetworkPresentation/FolderLayout2.png, nolink)]] 5. You are now ready to run the geoprocessing models. In !ArcCatalog, open the toolbox that is labelled for your version of ArcGIS and Python. You'll see five models. Right-click on the first one and select '''Edit'''. When the model diagram comes up, open the '''Model''' menu and select '''Run entire model'''. This first model will convert the oceanography data files contained in the C:\HabModExample2\!OceanographyFiles directory to ArcGIS binary grids in the C:\HabModExample2\!OceanographyRasters directory. This will take 30 to 60 minutes, depending on the speed of your computer. 6. After the first model completes, run each of the remaining models in sequence using the same method. Right-click, select '''Edit''', open the '''Model''' menu and select '''Run entire model'''. These will run much faster than the first one. === Important notes === * On ArcGIS 9.3, the '''Step 2: Create absence points''' model may initially show a red X, suggesting that it won't work. It will. The red X occurs because the model was built with ArcGIS 9.2, and 9.3 thinks there is a problem with the model. There isn't. Just run it like the others. * If you unzipped the example to some other directory than '''C:\HabModExample2''', the '''Step 3: Sample oceanography rasters at points''' model will fail when it reaches the '''Sample Rasters Listed in Fields''' tool. The problem is that this model assumes the example is stored in '''C:\HabModExample2''' and the sampling fails when it cannot find the directory. To fix this, you must change the model to use your directory: * In the toolbox, right click on '''Step 3: Sample oceanography rasters at points''' and select '''Edit'''. * Double-click the first '''Calculate Field''' tool. * In the '''Expression''' parameter, change the path in the first component of the expression from '''C:\HabModExample2''' to your directory. For example, if you stored the example in '''D:\My_Stuff\GIS\HabModExample2''', then change the first component of the string from {{{"C:\HabModExample2\OceanographyRasters\Chl\8Day\chl"}}} to {{{"D:\My_Stuff\GIS\HabModExample2\OceanographyRasters\Chl\8Day\chl"}}}. Note: if you do use your own directory, we highly recommend it not contain any spaces. * Repeat the procedure above for the other two '''Calculate Field''' tools. * Now you can run the model. * The ArcGIS models in the downloadable demo differ somewhat from those in the video recording. As we enhance the tools, we update the downloadable demo to be compatible with the latest enhancements. For example, in the '''Step 4: Create exploratory plots''' model, the video recording shows how to add and calculate fields called !LogBathymetry and !LogChlorophyll. The downloadable demo contains a much simpler model, made possible by enhancements to the Scatterplot Matrix and Density Histogram tools. These tools now allow you to specify transform expressions, so you don't have to calculate the transforms yourself in separate fields. * If you have R 2.9.x and you experience a failure from the '''Predict GAM From Rasters''' tool in the '''Step 5: Fit and Evaluate a GAM, and predict habitat''' model that says '''GDAL Error 3: Attempt to read past EOF''', please see ticket #375 for a discussion of and solution to this problem. If you have any questions, please email [mailto:mgel-help@nicholas.duke.edu].