Ticket #359 (closed Defect: fixed)

Opened 4 years ago

Last modified 4 years ago

With ArcGIS 9.3.1, Predict GAM and Predict GLM tools fail with RPy_RException: Error: GDAL Error 5: Access window out of range in RasterIO()

Reported by: jjr8 Owned by: jjr8
Priority: Medium Milestone: 0.7
Component: Tools - Statistics Version:
Keywords: Cc:

Description

The problem is that the code that projects and clips all of the rasters to the same cell size and dimensions is not producing rasters that all have the same dimensions. In the HabModExample?2 example, two of the rasters are coming out as 121x181, but the third is coming out 120x181. There is safety code that is supposed to detect this, but that code has a bug so it does not catch it. Then, subsequent code assumes all of the rasters have the same dimensions and fails when invoking a GDAL function.

The solution to this problem is to figure out how ESRI tweaked the projecting and clipping tools yet again, and code a workaround for it. (The seem to tweak these every release.)

Here is full logging output from HabModExample?2:

Executing (Predict GAM From Rasters): GAMPredictFromArcGISRasters C:\HabModExample2\Model\GAM.rdata C:\HabModExample2\OceanographyRasters\Bathymetry\etopo2v2;C:\HabModExample2\OceanographyRasters\Chl\Monthly\chl199908;C:\HabModExample2\OceanographyRasters\SST\Monthly\sst\sst199908 Bathymetry;Chlorophyll;SST C:\HabModExample2\HabitatPredictions\habitat08 GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]] "-82 25 -72 40" 8.33333333333333E-02 # true C:\HabModExample2\HabitatPredictions\stderrors08 C:\HabModExample2\HabitatPredictions\binary08 0.361423678012 true
Start Time: Thu May 28 19:53:13 2009
Running script GAMPredictFromArcGISRasters...
Logging system initialized from config file "C:\Users\Jason\AppData\Roaming\GeoEco\Logging.ini".
Python script C:\PROGRA~1\GeoEco\ARCGIS~1\Scripts\GAMPredictFromArcGISRasters.py started.
Retrieving the ArcGIS version numbers from the Windows Registry.
Checking software dependency: Python module: win32api
Imported Python module win32api successfully.
Checking software dependency: Python module: win32con
Imported Python module win32con successfully.
Attempting to instantiate the ArcGIS geoprocessor using the arcgisscripting module...
Imported the arcgisscripting Python module.
Instantiated ArcGIS geoprocessor object 0x024CB908 using arcgisscripting.create().
GeoEco will now use ArcGIS Geoprocessor object 0x024CB908 for ArcGIS operations.
This tool may run slowly due to a geoprocessing performance degradation that ESRI introduced in ArcGIS 9.3. We are following up with ESRI about this problem and will try to get them to fix it. Please contact us if you have any questions. In the mean time, you can avoid this problem by running this tool on a computer with ArcGIS 9.1 or 9.2.
This python script was invoked from an ArcGIS application.
Parameter inputModelFile = u'C:\\HabModExample2\\Model\\GAM.rdata'
Parameter inputPredictorRasters = [u'C:\\HabModExample2\\OceanographyRasters\\Bathymetry\\etopo2v2', u'C:\\HabModExample2\\OceanographyRasters\\Chl\\Monthly\\chl199908', u'C:\\HabModExample2\\OceanographyRasters\\SST\\Monthly\\sst\\sst199908']
Parameter variableNames = [u'Bathymetry', u'Chlorophyll', u'SST']
Parameter outputResponseRaster = u'C:\\HabModExample2\\HabitatPredictions\\habitat08'
Parameter coordinateSystem = u"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
Parameter extent = u'-82 25 -72 40'
Parameter cellSize = 0.083333333333333301
Parameter resamplingTechniques = None
Parameter ignoreOutOfRangeValues = True
Parameter outputErrorRaster = u'C:\\HabModExample2\\HabitatPredictions\\stderrors08'
Parameter outputBinaryResponseRaster = u'C:\\HabModExample2\\HabitatPredictions\\binary08'
Parameter cutoff = 0.36142367801199998
Parameter buildPyramids = True
Parameter overwriteExisting = True
Executing method GeoEco.Statistics.Modeling.GAM.PredictFromArcGISRasters.
Checking software dependency: ArcGIS version 9.2 or later
ArcGIS 9.3 Service Pack 2 is installed.
Checking software dependency: R version 2.5.0 or later.
R 2.8.0 is installed.
Checking software dependency: R rgdal package.
R interpreter: Evaluating statements: library(utils)
R interpreter: The last statement returned [u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
R interpreter: Evaluating statements: library(tools)
R interpreter: The last statement returned [u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
R interpreter: Evaluating statements: .packages()
R interpreter: The last statement returned [u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
The R rgdal package has not been loaded by the R interpreter.
R interpreter: Evaluating statements: installed.packages()
R interpreter: The last statement returned [[u'rgdal', u'C:\\Users\\Jason\\AppData\\Roaming\\GeoEco\\R_library_2.8.0', u'0.6-8', None, None, None, u'R (>= 2.3.0), methods, sp', None, None, None, u'2.8.1'], [u'sp', u'C:\\Users\\Jason\\AppData\\Roaming\\GeoEco\\R_library_2.8.0', u'0.9-37', None, None, None, u'R (>= 2.4.0), methods', u'utils, lattice, grid', u'RColorBrewer', None, u'2.8.1'], [u'base', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'boot', u'C:/Program Files/R/R-2.8.0/library', u'1.2-34', u'recommended', None, None, u'R (>= 2.4.0), graphics, stats', None, u'survival', None, u'2.8.0'], [u'class', u'C:/Program Files/R/R-2.8.0/library', u'7.2-44', u'recommended', u'VR', u'MASS class nnet spatial', u'R (>= 2.4.0), grDevices, graphics, stats, utils', None, u'lattice, nlme, survival', None, u'2.8.0'], [u'cluster', u'C:/Program Files/R/R-2.8.0/library', u'1.11.11', u'recommended', None, None, u'R (>= 2.5.0), stats, graphics, utils', None, None, None, u'2.8.0'], [u'codetools', u'C:/Program Files/R/R-2.8.0/library', u'0.2-1', u'recommended', None, None, u'R (>= 2.1)', None, None, None, u'2.8.0'], [u'datasets', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'foreign', u'C:/Program Files/R/R-2.8.0/library', u'0.8-29', u'recommended', None, None, u'R (>= 2.6.0), stats', u'methods, utils', None, None, u'2.8.0'], [u'gdata', u'C:/Program Files/R/R-2.8.0/library', u'2.4.2', None, None, None, u'R (>= 2.4.0)', u'gtools', None, None, u'2.8.0'], [u'gplots', u'C:/Program Files/R/R-2.8.0/library', u'2.6.0', None, None, None, u'R (>= 1.9.0), gtools, gdata, stats', None, u'gtools, gdata', None, u'2.8.0'], [u'graphics', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'grDevices', None, None, u'2.8.0'], [u'grDevices', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'grid', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'grDevices', u'lattice', None, u'2.8.0'], [u'gtools', u'C:/Program Files/R/R-2.8.0/library', u'2.5.0', None, None, None, None, None, None, None, u'2.8.0'], [u'KernSmooth', u'C:/Program Files/R/R-2.8.0/library', u'2.22-22', u'recommended', None, None, u'R (>= 2.5.0), stats', None, u'MASS', None, u'2.8.0'], [u'lattice', u'C:/Program Files/R/R-2.8.0/library', u'0.17-15', u'recommended', None, None, u'R (>= 2.5.0)', u'grid, grDevices, graphics, stats, utils', u'grid', None, u'2.8.0'], [u'MASS', u'C:/Program Files/R/R-2.8.0/library', u'7.2-44', u'recommended', u'VR', u'MASS class nnet spatial', u'R (>= 2.4.0), grDevices, graphics, stats, utils', None, u'lattice, nlme, survival', None, u'2.8.0'], [u'methods', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'utils', None, None, u'2.8.0'], [u'mgcv', u'C:/Program Files/R/R-2.8.0/library', u'1.4-1', u'recommended', None, None, u'R (>= 2.3.0)', u'graphics, stats', u'nlme (>= 3.1-64), splines', None, u'2.8.0'], ...]
The R rgdal package version 0.6-8 is already installed in the GeoEco private per-user R library C:\Users\Jason\AppData\Roaming\GeoEco\R_library_2.8.0.
Loading the R rgdal package into the R interpreter.
R interpreter: Evaluating statements: library(rgdal)
Warning: package 'rgdal' was built under R version 2.8.1
Loading required package: sp
Warning: package 'sp' was built under R version 2.8.1
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.6.0, released 2008/12/04
Path to GDAL shared files: C:\Users\Jason\AppData\Roaming\GeoEco\R_library_2.8.0/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
Path to PROJ.4 shared files: C:\Users\Jason\AppData\Roaming\GeoEco\R_library_2.8.0/rgdal/proj
R interpreter: The last statement returned [u'rgdal', u'sp', u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
The file C:\HabModExample2\Model\GAM.rdata exists.
The ArcGIS raster, raster layer, or raster band C:\HabModExample2\OceanographyRasters\Bathymetry\etopo2v2 exists.
The ArcGIS raster, raster layer, or raster band C:\HabModExample2\OceanographyRasters\Chl\Monthly\chl199908 exists.
The ArcGIS raster, raster layer, or raster band C:\HabModExample2\OceanographyRasters\SST\Monthly\sst\sst199908 exists.
The ArcGIS raster C:\HabModExample2\HabitatPredictions\habitat08 does not exist.
Directory C:\HabModExample2\HabitatPredictions will not be created because it already exists.
The ArcGIS raster C:\HabModExample2\HabitatPredictions\stderrors08 does not exist.
Directory C:\HabModExample2\HabitatPredictions will not be created because it already exists.
The ArcGIS raster C:\HabModExample2\HabitatPredictions\binary08 does not exist.
Directory C:\HabModExample2\HabitatPredictions will not be created because it already exists.
Checking software dependency: ArcGIS "spatial" extension.
R interpreter: Evaluating statements: load("C:\\HabModExample2\\Model\\GAM.rdata")
R interpreter: The last statement returned [u'model', u'rPackage', u'xVar', u'yVar', u'zVar', u'mVar', u'coordinateSystem']
R interpreter: Evaluating statements: exists("model")
R interpreter: The last statement returned True
R interpreter: Evaluating statements: class(model)
R interpreter: The last statement returned [u'gam', u'glm', u'lm']
R interpreter: Evaluating statements: exists("rPackage")
R interpreter: The last statement returned True
R interpreter: Evaluating statements: class(model)[1]
R interpreter: The last statement returned u'gam'
R interpreter: get("rPackage") returned u'mgcv'
Loaded GAM from C:\HabModExample2\Model\GAM.rdata. The model was fitted with the R mgcv package.
R interpreter: Evaluating statements: exists("rPackage")
R interpreter: The last statement returned True
R interpreter: get("rPackage") returned u'mgcv'
Checking software dependency: R mgcv package.
R interpreter: Evaluating statements: library(utils)
R interpreter: The last statement returned [u'rgdal', u'sp', u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
R interpreter: Evaluating statements: library(tools)
R interpreter: The last statement returned [u'rgdal', u'sp', u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
R interpreter: Evaluating statements: .packages()
R interpreter: The last statement returned [u'rgdal', u'sp', u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
The R mgcv package has not been loaded by the R interpreter.
R interpreter: Evaluating statements: installed.packages()
R interpreter: The last statement returned [[u'rgdal', u'C:\\Users\\Jason\\AppData\\Roaming\\GeoEco\\R_library_2.8.0', u'0.6-8', None, None, None, u'R (>= 2.3.0), methods, sp', None, None, None, u'2.8.1'], [u'sp', u'C:\\Users\\Jason\\AppData\\Roaming\\GeoEco\\R_library_2.8.0', u'0.9-37', None, None, None, u'R (>= 2.4.0), methods', u'utils, lattice, grid', u'RColorBrewer', None, u'2.8.1'], [u'base', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'boot', u'C:/Program Files/R/R-2.8.0/library', u'1.2-34', u'recommended', None, None, u'R (>= 2.4.0), graphics, stats', None, u'survival', None, u'2.8.0'], [u'class', u'C:/Program Files/R/R-2.8.0/library', u'7.2-44', u'recommended', u'VR', u'MASS class nnet spatial', u'R (>= 2.4.0), grDevices, graphics, stats, utils', None, u'lattice, nlme, survival', None, u'2.8.0'], [u'cluster', u'C:/Program Files/R/R-2.8.0/library', u'1.11.11', u'recommended', None, None, u'R (>= 2.5.0), stats, graphics, utils', None, None, None, u'2.8.0'], [u'codetools', u'C:/Program Files/R/R-2.8.0/library', u'0.2-1', u'recommended', None, None, u'R (>= 2.1)', None, None, None, u'2.8.0'], [u'datasets', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'foreign', u'C:/Program Files/R/R-2.8.0/library', u'0.8-29', u'recommended', None, None, u'R (>= 2.6.0), stats', u'methods, utils', None, None, u'2.8.0'], [u'gdata', u'C:/Program Files/R/R-2.8.0/library', u'2.4.2', None, None, None, u'R (>= 2.4.0)', u'gtools', None, None, u'2.8.0'], [u'gplots', u'C:/Program Files/R/R-2.8.0/library', u'2.6.0', None, None, None, u'R (>= 1.9.0), gtools, gdata, stats', None, u'gtools, gdata', None, u'2.8.0'], [u'graphics', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'grDevices', None, None, u'2.8.0'], [u'grDevices', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, None, None, None, u'2.8.0'], [u'grid', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'grDevices', u'lattice', None, u'2.8.0'], [u'gtools', u'C:/Program Files/R/R-2.8.0/library', u'2.5.0', None, None, None, None, None, None, None, u'2.8.0'], [u'KernSmooth', u'C:/Program Files/R/R-2.8.0/library', u'2.22-22', u'recommended', None, None, u'R (>= 2.5.0), stats', None, u'MASS', None, u'2.8.0'], [u'lattice', u'C:/Program Files/R/R-2.8.0/library', u'0.17-15', u'recommended', None, None, u'R (>= 2.5.0)', u'grid, grDevices, graphics, stats, utils', u'grid', None, u'2.8.0'], [u'MASS', u'C:/Program Files/R/R-2.8.0/library', u'7.2-44', u'recommended', u'VR', u'MASS class nnet spatial', u'R (>= 2.4.0), grDevices, graphics, stats, utils', None, u'lattice, nlme, survival', None, u'2.8.0'], [u'methods', u'C:/Program Files/R/R-2.8.0/library', u'2.8.0', u'base', None, None, None, u'utils', None, None, u'2.8.0'], [u'mgcv', u'C:/Program Files/R/R-2.8.0/library', u'1.4-1', u'recommended', None, None, u'R (>= 2.3.0)', u'graphics, stats', u'nlme (>= 3.1-64), splines', None, u'2.8.0'], ...]
The R mgcv package version 1.4-1 is already installed in the R library C:/Program Files/R/R-2.8.0/library.
Loading the R mgcv package into the R interpreter.
R interpreter: Evaluating statements: library(mgcv)
This is mgcv 1.4-1
R interpreter: The last statement returned [u'mgcv', u'rgdal', u'sp', u'tools', u'stats', u'graphics', u'grDevices', u'utils', u'datasets', u'methods', u'base']
R interpreter: get("rPackage") returned u'mgcv'
R interpreter: get("rPackage") returned u'mgcv'
The file C:\Python25\lib\site-packages\GeoEco\Statistics\SummarizeModel.r exists.
R interpreter: Evaluating statements: # SummarizeModel.r
#
# Copyright (C) 2008 Jason J. Roberts and Ben D. Best
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License (available in the file LICENSE.TXT)
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

SummarizeModel <- function(model)
{
    if (is(model, "gam"))
        s = capture.output(summary(model))
    else
        s = capture.output(summary(model), anova(model))
    s = sub("formula = f[1234567890]*", paste("formula =", as.character(model$formula)[2], as.character(model$formula)[1], as.character(model$formula)[3]), s)
    if (model$family$family == "quasi")
        s = sub("family = fam[1234567890]*", paste("family = ", model$family$family, "(link=\"", model$family$link, "\", variance=\"", model$family$varfun, "\")", sep=""), s)
    else
        s = sub("family = fam[1234567890]*", paste("family = ", model$family$family, "(link=\"", model$family$link, "\")", sep=""), s)
    return(paste(s, sep="", collapse="\n"))
}

R interpreter: The last statement returned R closure function at 0x01A5D3E0
R interpreter: Evaluating statements: writeLines("")

R interpreter: The last statement returned None
R interpreter: Evaluating statements: writeLines("MODEL SUMMARY:")
MODEL SUMMARY:
R interpreter: The last statement returned None
R interpreter: Evaluating statements: writeLines("==============")
==============
R interpreter: The last statement returned None
R interpreter: Evaluating statements: writeLines(SummarizeModel(model))

Family: binomial 
Link function: logit 

Formula:
Presence ~ log10(abs(Bathymetry)) + s(log10(Chlorophyll)) + SST

Parametric coefficients:
                       Estimate Std. Error z value Pr(>|z|)    
(Intercept)            -28.9003     9.2986  -3.108 0.001883 ** 
log10(abs(Bathymetry))  -3.3090     0.9517  -3.477 0.000507 ***
SST                      0.7800     0.1790   4.357 1.32e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Approximate significance of smooth terms:
                        edf Ref.df Chi.sq p-value
s(log10(Chlorophyll)) 5.707  6.207  8.514   0.220

R-sq.(adj) =  0.584   Deviance explained = 56.4%
UBRE score = -0.62955  Scale est. = 1         n = 315
R interpreter: The last statement returned None
R interpreter: Evaluating statements: writeLines("")

R interpreter: The last statement returned None
Created temporary directory C:\Temp\GeoEcoTemp_Jason\tmpndbrtn
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
R interpreter: Evaluating statements: all.vars(model$formula)
R interpreter: The last statement returned [u'Presence', u'Bathymetry', u'Chlorophyll', u'SST']
R interpreter: Evaluating statements: all.vars(model$formula)
R interpreter: The last statement returned [u'Presence', u'Bathymetry', u'Chlorophyll', u'SST']
Checking projections, extents, and cell sizes of predictor rasters and reprojecting and clipping as needed...
C:\HabModExample2\OceanographyRasters\SST\Monthly\sst\sst199908 must be projected because its extent (-82.001953125 25.0048828125 -71.982421875 39.990234375) does not match the output extent (-82 25 -72 40).
Checking software dependency: ArcGIS version 9.1 or later
Checking software dependency: aggregated Python module: numpy
The ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster does not exist.
Directory C:\Temp\GeoEcoTemp_Jason\tmpndbrtn will not be created because it already exists.
Creating X coordinate raster C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster...
Created temporary directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
The file C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt does not exist.
Directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw will not be created because it already exists.
Created temporary directory C:\Temp\GeoEcoTemp_Jason\tmpt9znye
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
Writing ArcInfo ASCII Grid file C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt
The file C:\Temp\GeoEcoTemp_Jason\tmpt9znye\output.txt exists.
The file C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt does not exist.
Directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw will not be created because it already exists.
Moving file C:\Temp\GeoEcoTemp_Jason\tmpt9znye\output.txt to C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt
The directory C:\Temp\GeoEcoTemp_Jason\tmpt9znye exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason\tmpt9znye
The directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw
Deleted directory C:\Temp\GeoEcoTemp_Jason\tmpt9znye
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
The file C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt exists.
The ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster does not exist.
Directory C:\Temp\GeoEcoTemp_Jason\tmpndbrtn will not be created because it already exists.
Converting C:\Temp\GeoEcoTemp_Jason\tmpbgllbw\temp.txt to ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster...
Created temporary directory C:\Temp\GeoEcoTemp_Jason\tmphemnio
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
Defining the projection...
The ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmphemnio\output exists.
The ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster does not exist.
Directory C:\Temp\GeoEcoTemp_Jason\tmpndbrtn will not be created because it already exists.
Copying ArcGIS raster C:\Temp\GeoEcoTemp_Jason\tmphemnio\output to C:\Temp\GeoEcoTemp_Jason\tmpndbrtn\snapraster...
Deleted directory C:\Temp\GeoEcoTemp_Jason\tmphemnio
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
Deleted directory C:\Temp\GeoEcoTemp_Jason\tmpbgllbw
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
C:\HabModExample2\OceanographyRasters\Chl\Monthly\chl199908 must be projected because its extent (-82.0000000000001 25 -72 40) does not match the output extent (-82 25 -72 40).
C:\HabModExample2\OceanographyRasters\Bathymetry\etopo2v2 must be projected because its extent (-82.000098 24.999885 -71.9667747 40.0332033) does not match the output extent (-82 25 -72 40).
R interpreter: Invoking assign("rastersForPredictors", {u'Bathymetry': u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\projected2', u'Chlorophyll': u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\projected1', u'SST': u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\projected0'})
Predicting...
The file C:\Python25\lib\site-packages\GeoEco\Statistics\PredictLMForArcGISRasters.r exists.
R interpreter: Evaluating statements: # PredictLMForArcGISRasters.r
#
# Copyright (C) 2008 Jason J. Roberts and Ben D. Best
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License (available in the file LICENSE.TXT)
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

PredictLMForArcGISRasters <- function(fittedLM, rastersForPredictors, outputResponseASCIIGrid, outputErrorASCIIGrid=NULL, ignoreOutOfRangeValues=FALSE, chunks=NULL)
{
    # Look up the min and max values for each predictor from the data
    # that was used to fit the model.

    minFittedPredictorValues <- list()
    maxFittedPredictorValues <- list()
    
    for (predictor in labels(rastersForPredictors))
    {
        minFittedPredictorValues[[predictor]] <- min(fittedLM$data[[predictor]], na.rm=TRUE)
        maxFittedPredictorValues[[predictor]] <- max(fittedLM$data[[predictor]], na.rm=TRUE)
    }

    # Build vectors listing the categorical and continuous predictors.

    categoricalPredictors <- names(fittedLM$xlevels)
    continuousPredictors <- labels(rastersForPredictors)[!(labels(rastersForPredictors) %in% categoricalPredictors)]

    # Initialize some variables we will use to control warnings we may
    # issue about out of range values, etc.

    warnedAboutMissingLevels <- list()
    for (predictor in categoricalPredictors)
        warnedAboutMissingLevels[[predictor]] <- FALSE

    allValuesForPredictorAreNoData <- list()
    for (predictor in labels(rastersForPredictors))
        allValuesForPredictorAreNoData[[predictor]] <- TRUE

    allValuesAreNoData <- TRUE
    
    # Load the rgdal library, which we use to read the predictor
    # rasters.

    library(rgdal)
    
    # Obtain the characteristics of the predictor rasters. For safety,
    # verify that they all have the same characteristics. The Python
    # function that generated them should guarantee this, but it is
    # cheap to check them here.

    if (is.null(rastersForPredictors) || length(rastersForPredictors) <= 0)
        stop("You must specify at least one predictor raster.", call.=FALSE)
        
    rasterInfo <- open.SpatialGDAL(rastersForPredictors[1], silent=TRUE)
    tryCatch(
    {
        if (length(rastersForPredictors) > 1)
            for (i in 2:length(rastersForPredictors))
            {
                rasterInfo2 <- open.SpatialGDAL(rastersForPredictors[i], silent=TRUE)
                tryCatch(
                {
                    if (any(rasterInfo2@grid@cells.dim != rasterInfo2@grid@cells.dim))
                        stop("All of the predictor rasters must have the same number of rows and columns.", call.=FALSE)

                    if (any(rasterInfo2@bbox != rasterInfo2@bbox))
                        stop("All of the predictor rasters must have the same geographic extent and cell size", call.=FALSE)
                }, finally=close(rasterInfo2))
            }

        rasterCols <- as.integer(round(rasterInfo@grid@cells.dim[1]))
        rasterRows <- as.integer(round(rasterInfo@grid@cells.dim[2]))
        rasterXLLCorner <- rasterInfo@bbox["x","min"]
        rasterYLLCorner <- rasterInfo@bbox["y","min"]
        rasterCellSize <- rasterInfo@grid@cellsize[1]
    }, finally=close(rasterInfo))

    # Open the output ASCII grid files and write their headers using
    # the dimensions, extent, and cell size obtained from the
    # predictor rasters. For the NoData value, use -3.4028235e+038,
    # which is the 32-bit IEEE-754 floating-point negative number that
    # is farthest from 0. This is the traditional value used by ArcGIS
    # for NoData in 32-bit floating point rasters. It is theoretically
    # possible for the predicted response from the model to take this
    # value. If it does, we will treat it like NoData.

    responseFile <- file(outputResponseASCIIGrid, "wt")
    tryCatch(
    {
        cat("ncols ", rasterCols, "\r\n", sep="", file=responseFile)
        cat("nrows ", rasterRows, "\r\n", sep="", file=responseFile)
        cat("xllcorner ", formatC(rasterXLLCorner, format="g", digits=15, width=-1), "\r\n", sep="", file=responseFile)
        cat("yllcorner ", formatC(rasterYLLCorner, format="g", digits=15, width=-1), "\r\n", sep="", file=responseFile)
        cat("cellsize ", formatC(rasterCellSize, format="g", digits=15, width=-1), "\r\n", sep="", file=responseFile)
        cat("nodata_value ", formatC(-3.4028235e+038, format="g", digits=8, width=-1), "\r\n", sep="", file=responseFile)

        if (!is.null(outputErrorASCIIGrid))
            errorFile <- file(outputErrorASCIIGrid, "wt")
        tryCatch(
        {
            if (!is.null(outputErrorASCIIGrid))
            {
                cat("ncols ", rasterCols, "\r\n", sep="", file=errorFile)
                cat("nrows ", rasterRows, "\r\n", sep="", file=errorFile)
                cat("xllcorner ", formatC(rasterXLLCorner, format="g", digits=15, width=-1), "\r\n", sep="", file=errorFile)
                cat("yllcorner ", formatC(rasterYLLCorner, format="g", digits=15, width=-1), "\r\n", sep="", file=errorFile)
                cat("cellsize ", formatC(rasterCellSize, format="g", digits=15, width=-1), "\r\n", sep="", file=errorFile)
                cat("nodata_value ", formatC(-3.4028235e+038, format="g", digits=8, width=-1), "\r\n", sep="", file=errorFile)
            }

            # Open each predictor raster as a GDAL dataset.

            datasets <- character()
            tryCatch(
            {
                datasets <- list()
                for (predictor in labels(rastersForPredictors))
                    datasets[[predictor]] <- GDAL.open(rastersForPredictors[[predictor]])

                # For each row of the predictor rasters, do a
                # prediction and write the results to the output
                # files. We do this one row at a time to minimize the
                # amount of memory required to run the tool. This is
                # slower than reading everything into memory and doing
                # the prediction all in one shot (1.5x slower in my
                # limited tests) but it is well worth it, since doing
                # it in one shot can require too much memory.

                for (row in 1:rasterRows)
                {
                    # Read this row from each predictor raster.

                    covariates <- list()
                    for (predictor in labels(rastersForPredictors))
                        covariates[[predictor]] <- getRasterData(datasets[[predictor]], offset=c(row-1,0), region.dim=c(1,rasterCols), as.is=TRUE)

                    # Determine which cells are NoData in one or more
                    # of the predictor rasters. (rgdal represents
                    # NoData as NA.)

                    anyAreNoData <- logical(rasterCols)
                    for (predictor in labels(rastersForPredictors))
                    {
                        # Determine which cells are explicitly set to
                        # NoData in this predictor's raster.
                        
                        isNoData <- is.na(covariates[[predictor]])

                        # For predictors that are categorical
                        # variables (i.e. factors), we cannot do
                        # predictions using values that were not
                        # considered by the model fitting process. For
                        # example, if the model was fitted to four
                        # land cover types, we cannot predict the
                        # response variable for a fifth land cover
                        # type that was not considered during model
                        # fitting. If there are any of these, treat
                        # them as NoData and warn the user.

                        if (predictor %in% categoricalPredictors)
                        {
                            isMissingLevel <- !(covariates[[predictor]] %in% fittedLM$xlevels[[predictor]])
                            if (any(isMissingLevel))
                            {
                                isNoData <- isNoData | isMissingLevel
                                if (!warnedAboutMissingLevels[[predictor]])
                                {
                                    warning(paste("The predictor raster provided for the categorical variable (or factor) named", predictor, "contains values (or levels) that were not present in the data used to fit the model. No predictions can be made for these values. These cells will be set to NoData in the output rasters."), call.=FALSE)
                                    warnedAboutMissingLevels[[predictor]] <- TRUE
                                }
                            }
                        }

                        # For predictors that are continuous
                        # variables, if the caller wants us to ignore
                        # values that are outside the range of values
                        # used to fit the model, these to NoData.

                        else if (ignoreOutOfRangeValues)
                            isNoData <- isNoData | covariates[[predictor]] < minFittedPredictorValues[[predictor]] | covariates[[predictor]] > maxFittedPredictorValues[[predictor]]

                        # If any cell contained data for this
                        # predictor, we do not need to warn the user
                        # that all of the cells of the output raster
                        # are NoData.

                        allValuesForPredictorAreNoData[[predictor]] <- allValuesForPredictorAreNoData[[predictor]] && all(isNoData)

                        # Cells that were NoData for this predictor
                        # cannot be predicted.
                        
                        anyAreNoData <- anyAreNoData | isNoData
                    }

                    # If any cell contained data for all predictors,
                    # we do not need to warn the user that all of the
                    # cells of the output raster are NoData.

                    allValuesAreNoData <- allValuesAreNoData && all(anyAreNoData)

                    # The predict.gam function from the R gam library
                    # will fail if we pass in NA for covariates that
                    # were fitted with the loess smoother (lo). To
                    # work around this, set the predictors to dummy
                    # values for all cells that had NoData for any
                    # predictors. For the dummy values, use the
                    # minimum values of the predictors used to fit the
                    # model. (If we pass in values outside the range
                    # of values used to fit the model, loess will
                    # report a warning on a per-cell basis, drowning
                    # the user in warnings.) These dummy predictor
                    # values will result in bogus predictions of the
                    # response variable. Later, we will ensure these
                    # are represented in the output rasters as NoData.

                    for (predictor in labels(rastersForPredictors))
                        covariates[[predictor]][anyAreNoData] <- minFittedPredictorValues[[predictor]]

                    # Do the prediction for this row of cells. If we
                    # are only predicting the response variable (not
                    # standard errors as well), we get back an array
                    # of the predicted values of the response
                    # variable. If we are predicting standard errors
                    # as well as the response variable, we get back a
                    # list with two arrays within it: one for the
                    # predicted values of the response variable, the
                    # other for the standard errors.
                    
                    predictions <- predict(fittedLM, newdata=covariates, type="response", se.fit=!is.null(outputErrorASCIIGrid))
                    if (is.null(outputErrorASCIIGrid))
                        predictedResponse <- as.vector(predictions)
                    else
                    {
                        predictedResponse <- as.vector(predictions$fit)
                        predictedError <- as.vector(predictions$se.fit)
                    }

                    # Set cells that had NoData in one or more
                    # predictor rasters to the value -3.4028235e+038,
                    # which we are using to represent NoData. This
                    # will overwrite bogus predictions that resulted
                    # from dummy values.

                    predictedResponse[anyAreNoData] <- -3.4028235e+038
                    if (!is.null(outputErrorASCIIGrid))
                        predictedError[anyAreNoData] <- -3.4028235e+038

                    # Write the row to the output ASCII files. Because
                    # the Python script will convert these to 32-bit
                    # ArcInfo binary grids, write out the 64-bit
                    # predicted values with only 8 significant digits.

                    cat(formatC(predictedResponse, digits=8, format="g", width=-1), "\r\n", sep=" ", file=responseFile)
                    if (!is.null(outputErrorASCIIGrid))
                        cat(formatC(predictedError, digits=8, format="g", width=-1), "\r\n", sep=" ", file=errorFile)
                }
            }, finally=for (ds in datasets) GDAL.close(ds))
        }, finally=if (!is.null(outputErrorASCIIGrid)) close(errorFile))
    }, finally=close(responseFile))

    # Warn the user about any predictors that were NoData for all
    # cells.

    nodataPredictors <- character()
    for (predictor in labels(rastersForPredictors))
        if (allValuesForPredictorAreNoData[[predictor]])
            nodataPredictors <- append(nodataPredictors, predictor, length(nodataPredictors))

    if (length(nodataPredictors) > 0)
        if (length(nodataPredictors) == 1)
            warning(paste("The raster provided for the predictor variable", nodataPredictors[1], "contains NoData for all cells. A response can only be predicted for a cell when all of the predictor variables have data, therefore all of the cells of the output rasters will contain NoData."), call.=FALSE)
        else
            warning(paste("The rasters provided for the following predictor variables contain NoData for all cells: ", paste(nodataPredictors, collapse=", "), ". A response can only be predicted for a cell when all of the predictor variables have data, therefore all of the cells of the output rasters will contain NoData.", sep=""), call.=FALSE)

    # Warn the user if no predictions could be performed (even though
    # the predictors each had data for at least one cell).

    else if (allValuesAreNoData)
        warning("For all of the cells of the output rasters, at least one of the corresponding predictor raster cells contained NoData. A response can only be predicted for a cell when all of the predictor variables have data, therefore all of the cells of the output rasters will contain NoData.", call.=FALSE)
}

R interpreter: The last statement returned R closure function at 0x01A5D410
R interpreter: Evaluating statements: PredictLMForArcGISRasters(model, rastersForPredictors, "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_response.txt", "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_standarderror.txt", ignoreOutOfRangeValues=TRUE)
RPy_RException: Error: 
	GDAL Error 5: Access window out of range in RasterIO().  Requested
(0,0) of size 121x1 on raster of 120x181.
---------- BEGINNING OF DEBUGGING INFORMATION ----------
Traceback (most recent call last):
  File "C:\PROGRA~1\GeoEco\ARCGIS~1\Scripts\GAMPredictFromArcGISRasters.py", line 2, in <module>
    GeoEco.ArcGIS.ExecuteMethodFromCommandLineAsArcGISTool('GeoEco.Statistics.Modeling', 'GAM', 'PredictFromArcGISRasters')
  File "C:\Python25\Lib\site-packages\GeoEco\ArcGIS.py", line 901, in ExecuteMethodFromCommandLineAsArcGISTool
    exec sourceCode in globals(), locals()
  File "<string>", line 1, in <module>
  File "C:\Python25\Lib\site-packages\GeoEco\Statistics\Modeling.py", line 177, in PredictFromArcGISRasters
    _PredictFromArcGISRasters('gam', inputModelFile, inputPredictorRasters, variableNames, outputResponseRaster, coordinateSystem, extent, cellSize, resamplingTechniques, ignoreOutOfRangeValues, outputErrorRaster, outputBinaryResponseRaster, cutoff, buildPyramids, overwriteExisting)
  File "C:\Python25\Lib\site-packages\GeoEco\Statistics\Modeling.py", line 902, in _PredictFromArcGISRasters
    r('PredictLMForArcGISRasters(model, rastersForPredictors, "%s", "%s", ignoreOutOfRangeValues=%s)' % (tempResponseASCIIGrid.replace('\\', '\\\\'), tempErrorASCIIGrid.replace('\\', '\\\\'), str(ignoreOutOfRangeValues).upper()))
  File "C:\Python25\Lib\site-packages\GeoEco\R.py", line 1082, in __call__
    Logger.LogExceptionAsError()
  File "C:\Python25\Lib\site-packages\GeoEco\AssimilatedModules\rpy\rpy.py", line 326, in __call__
    return self.eval(self.parse(text=s))
RPy_RException: Error: 
	GDAL Error 5: Access window out of range in RasterIO().  Requested
(0,0) of size 121x1 on raster of 120x181.
Local variables for stack frame: File "C:\Python25\Lib\site-packages\GeoEco\Statistics\Modeling.py", line 902, in _PredictFromArcGISRasters:
  EnvelopeTypeMetadata = <class 'GeoEco.Types.EnvelopeTypeMetadata'>
  bottom = 25.0
  buildPyramids = True
  cellSize = 0.083333333333333301
  coordinateSystem = u"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
  cutoff = 0.36142367801199998
  dependency = <GeoEco.R.RPackageDependency object at 0x026BB690>
  extent = u'-82 25 -72 40'
  gp = <weakproxy at 025D9960 to _ArcGISObjectWrapper at 026A3F90>
  ignoreOutOfRangeValues = True
  inputModelFile = u'C:\\HabModExample2\\Model\\GAM.rdata'
  inputPredictorRasters = [u'C:\\HabModExample2\\OceanographyRasters\\Bathymetry\\etopo2v2', u'C:\\HabModExample2\\OceanographyRasters\\Chl\\Monthly\\chl199908', u'C:\\HabModExample2\\OceanographyRasters\\SST\\Monthly\\sst\\sst199908']
  left = -82.0
  modelType = 'gam'
  oldLoggingLevel = False
  outputBinaryResponseRaster = u'C:\\HabModExample2\\HabitatPredictions\\binary08'
  outputErrorRaster = u'C:\\HabModExample2\\HabitatPredictions\\stderrors08'
  outputResponseRaster = u'C:\\HabModExample2\\HabitatPredictions\\habitat08'
  overwriteExisting = True
  r = <GeoEco.R.RInterpreter object at 0x026BB630>
  resamplingTechniques = None
  right = -72.0
  tempDir = <GeoEco.DataManagement.Directories.TemporaryDirectory object at 0x026BBE10>
  tempErrorASCIIGrid = u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_standarderror.txt'
  tempErrorRaster = u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\standarderror'
  tempResponseASCIIGrid = u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_response.txt'
  tempResponseRaster = u'C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\response'
  top = 40.0
  variableNames = [u'Bathymetry', u'Chlorophyll', u'SST']
Global variables for stack frame: File "C:\Python25\Lib\site-packages\GeoEco\Statistics\Modeling.py", line 902, in _PredictFromArcGISRasters:
  AddArgumentMetadata = <function AddArgumentMetadata at 0x01CCF7F0>
  AddClassMetadata = <function AddClassMetadata at 0x01CCF6F0>
  AddMethodMetadata = <function AddMethodMetadata at 0x01CCF7B0>
  AddModuleMetadata = <function AddModuleMetadata at 0x01CCF6B0>
  AddPropertyMetadata = <function AddPropertyMetadata at 0x01CCF730>
  AddResultMetadata = <function AddResultMetadata at 0x01CCF870>
  AnyObjectTypeMetadata = <class 'GeoEco.Types.AnyObjectTypeMetadata'>
  ArcGIS91DatabaseConnection = <class 'GeoEco.DatabaseAccess.ArcGIS.ArcGIS91DatabaseConnection'>
  ArcGIS91SelectCursor = <class 'GeoEco.DatabaseAccess.ArcGIS.ArcGIS91SelectCursor'>
  ArcGISDependency = <class 'GeoEco.ArcGIS.ArcGISDependency'>
  ArcGISExtensionDependency = <class 'GeoEco.ArcGIS.ArcGISExtensionDependency'>
  ArcGISFeatureClassTypeMetadata = <class 'GeoEco.Types.ArcGISFeatureClassTypeMetadata'>
  ArcGISFeatureLayerTypeMetadata = <class 'GeoEco.Types.ArcGISFeatureLayerTypeMetadata'>
  ArcGISFieldTypeMetadata = <class 'GeoEco.Types.ArcGISFieldTypeMetadata'>
  ArcGISGeoDatasetTypeMetadata = <class 'GeoEco.Types.ArcGISGeoDatasetTypeMetadata'>
  ArcGISRaster = <class 'GeoEco.DataManagement.ArcGISRasters.ArcGISRaster'>
  ArcGISRasterLayerTypeMetadata = <class 'GeoEco.Types.ArcGISRasterLayerTypeMetadata'>
  ArcGISRasterTypeMetadata = <class 'GeoEco.Types.ArcGISRasterTypeMetadata'>
  ArcGISTableTypeMetadata = <class 'GeoEco.Types.ArcGISTableTypeMetadata'>
  ArcGISTableViewTypeMetadata = <class 'GeoEco.Types.ArcGISTableViewTypeMetadata'>
  ArcGISWorkspaceTypeMetadata = <class 'GeoEco.Types.ArcGISWorkspaceTypeMetadata'>
  ArgumentMetadata = <class 'GeoEco.Metadata.ArgumentMetadata'>
  BooleanTypeMetadata = <class 'GeoEco.Types.BooleanTypeMetadata'>
  ClassInstanceTypeMetadata = <class 'GeoEco.Types.ClassInstanceTypeMetadata'>
  ClassMetadata = <class 'GeoEco.Metadata.ClassMetadata'>
  ClassOrClassInstanceTypeMetadata = <class 'GeoEco.Types.ClassOrClassInstanceTypeMetadata'>
  ClassTypeMetadata = <class 'GeoEco.Types.ClassTypeMetadata'>
  CoordinateSystemTypeMetadata = <class 'GeoEco.Types.CoordinateSystemTypeMetadata'>
  CopyArgumentMetadata = <function CopyArgumentMetadata at 0x01CCF8B0>
  CopyPropertyMetadata = <function CopyPropertyMetadata at 0x01CCF770>
  CopyResultMetadata = <function CopyResultMetadata at 0x01CCF8F0>
  DateTimeTypeMetadata = <class 'GeoEco.Types.DateTimeTypeMetadata'>
  DictionaryTypeMetadata = <class 'GeoEco.Types.DictionaryTypeMetadata'>
  DirectoryTypeMetadata = <class 'GeoEco.Types.DirectoryTypeMetadata'>
  DynamicDocString = <class 'GeoEco.DynamicDocString.DynamicDocString'>
  EnvelopeTypeMetadata = <class 'GeoEco.Types.EnvelopeTypeMetadata'>
  File = <class 'GeoEco.DataManagement.Files.File'>
  FileTypeMetadata = <class 'GeoEco.Types.FileTypeMetadata'>
  FloatTypeMetadata = <class 'GeoEco.Types.FloatTypeMetadata'>
  GAM = <class 'GeoEco.Statistics.Modeling.GAM'>
  GLM = <class 'GeoEco.Statistics.Modeling.GLM'>
  GeoprocessorManager = <class 'GeoEco.ArcGIS.GeoprocessorManager'>
  IntegerTypeMetadata = <class 'GeoEco.Types.IntegerTypeMetadata'>
  LinearUnitTypeMetadata = <class 'GeoEco.Types.LinearUnitTypeMetadata'>
  ListTypeMetadata = <class 'GeoEco.Types.ListTypeMetadata'>
  Logger = <class 'GeoEco.Logging.Logger'>
  MapAlgebraExpressionTypeMetadata = <class 'GeoEco.Types.MapAlgebraExpressionTypeMetadata'>
  Metadata = <class 'GeoEco.Metadata.Metadata'>
  MethodMetadata = <class 'GeoEco.Metadata.MethodMetadata'>
  ModelEvaluation = <class 'GeoEco.Statistics.Modeling.ModelEvaluation'>
  ModuleMetadata = <class 'GeoEco.Metadata.ModuleMetadata'>
  NoneTypeMetadata = <class 'GeoEco.Types.NoneTypeMetadata'>
  NumPyArrayTypeMetadata = <class 'GeoEco.Types.NumPyArrayTypeMetadata'>
  PointTypeMetadata = <class 'GeoEco.Types.PointTypeMetadata'>
  PropertyMetadata = <class 'GeoEco.Metadata.PropertyMetadata'>
  PythonModuleDependency = <class 'GeoEco.Dependencies.PythonModuleDependency'>
  R = <class 'GeoEco.R.R'>
  RDependency = <class 'GeoEco.R.RDependency'>
  RPackageDependency = <class 'GeoEco.R.RPackageDependency'>
  ResultMetadata = <class 'GeoEco.Metadata.ResultMetadata'>
  SQLWhereClauseTypeMetadata = <class 'GeoEco.Types.SQLWhereClauseTypeMetadata'>
  SequenceTypeMetadata = <class 'GeoEco.Types.SequenceTypeMetadata'>
  ShapefileTypeMetadata = <class 'GeoEco.Types.ShapefileTypeMetadata'>
  SpatialReferenceTypeMetadata = <class 'GeoEco.Types.SpatialReferenceTypeMetadata'>
  StoredObjectTypeMetadata = <class 'GeoEco.Types.StoredObjectTypeMetadata'>
  TemporaryDirectory = <class 'GeoEco.DataManagement.Directories.TemporaryDirectory'>
  TextFileTypeMetadata = <class 'GeoEco.Types.TextFileTypeMetadata'>
  TupleTypeMetadata = <class 'GeoEco.Types.TupleTypeMetadata'>
  TypeMetadata = <class 'GeoEco.Metadata.TypeMetadata'>
  UnicodeStringTypeMetadata = <class 'GeoEco.Types.UnicodeStringTypeMetadata'>
  _ = <function _gettext at 0x01C40670>
  _LoadDataFrameForModelFitting = <function _LoadDataFrameForModelFitting at 0x025BF270>
  _PredictFromArcGISRasters = <function _PredictFromArcGISRasters at 0x025BF4F0>
  _PreparePredictorRasters = <function _PreparePredictorRasters at 0x025BF530>
  __all__ = ['GLM', 'GAM', 'ModelEvaluation']
  __doc__ = u'Not implemented'
  __file__ = 'C:\\Python25\\lib\\site-packages\\GeoEco\\Statistics\\Modeling.pyc'
  __name__ = 'GeoEco.Statistics.Modeling'
  copy = <module 'copy' from 'C:\Python25\lib\copy.pyc'>
  os = <module 'os' from 'C:\Python25\lib\os.pyc'>
  random = <module 'random' from 'C:\Python25\lib\random.pyc'>
  sys = <module 'sys' (built-in)>
Enviornment variables:
  ALLUSERSPROFILE = 'C:\\ProgramData'
  APPDATA = 'C:\\Users\\Jason\\AppData\\Roaming'
  APP_DOMAIN_KEY = 'HKEY_LOCAL_MACHINE\\Software\\ESRI\\Raster'
  ARC83WORKSPACES = 'YES'
  ARCGISHOME = 'C:\\Program Files\\ArcGIS\\'
  ARCHOME = ''
  ARCPWD = 'c:\\program files\\arcgis\\bin'
  COMMONPROGRAMFILES = 'C:\\Program Files\\Common Files'
  COMPUTERNAME = 'JASONR-LAPTOP2'
  COMSPEC = 'C:\\Windows\\system32\\cmd.exe'
  DI_APPLICATION_CONTEXT = 'DESKTOP'
  FME_HOME = 'C:\\Program Files\\ArcGIS\\Data Interoperability Extension\\'
  FP_NO_HOST_CHECK = 'NO'
  GIO_ARCH = 'NTx86'
  GIO_ARCHM = 'NTx86'
  GIO_ARCH_MODE = ''
  GIO_BLOCKMODEL_INTERFACES_PATH = '$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\blockmodelinterfaces'
  GIO_CFG_PATH = '$GIO_HOME\\devices\\${GIO_ARCHM}\\RdoConfig;$GIO_HOME\\Arc8.x'
  GIO_DEVICES_PATH = '$GIO_HOME\\devices'
  GIO_ENVIRONMENT_KEY = 'Software\\ESRI\\Raster\\Environment'
  GIO_ETC_PATH = '$GIO_HOME\\etc'
  GIO_FONT_PATH = '$GIO_HOME\\etc\\fonts'
  GIO_FONT_SERVERS_PATH = '$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\FontServers'
  GIO_GEOMETRIC_MODELS_PATH = '$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\geometricmodels'
  GIO_HOME = 'C:\\Program Files\\Common Files\\ESRI\\Raster\\'
  GIO_PDF_PATH = '$GIO_HOME\\defaults\\$GIO_ARCH;$GIO_HOME\\defaults'
  GIO_PE_LIB = 'pe.dll'
  GIO_PREFERENCES_PATH = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\ESRI\\Raster\\Preferences'
  GIO_PROJECTIONS_PATH = '$GIO_HOME\\bin;$GIO_HOME\\etc;$GIO_HOME\\bin\\${GIO_ARCHM}'
  GIO_RASTER_FORMATS_PATH = '$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\rasterformats;$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\gridformat'
  GIO_RESAMPLE_METHODS_PATH = '$GIO_HOME\\usr\\lib\\${GIO_ARCHM}\\resamplemethods'
  GP_ENVPID_PATH = 'C:\\Users\\Jason\\AppData\\Local\\Temp\\gpEnv4676'
  GP_ERRPID_PATH = 'C:\\Users\\Jason\\AppData\\Local\\Temp\\gpError4676'
  GP_LICENSE_CODE = '60'
  GP_PIPE_NAME = '\\\\.\\pipe\\GP94676'
  GP_PROXY_OPS = 'TRUE'
  GP_VALIDATE_SCRIPT = ''
  HOME = 'C:\\Users\\Jason'
  HOMEDRIVE = 'C:'
  HOMEPATH = '\\Users\\Jason'
  LOCALAPPDATA = 'C:\\Users\\Jason\\AppData\\Local'
  LOGONSERVER = '\\\\JASONR-LAPTOP2'
  MATLAB_RESERVE_LO = '0'
  NUMBER_OF_PROCESSORS = '2'
  OS = 'Windows_NT'
  PATH = 'C:\\Program Files\\Common Files\\ESRI\\Raster\\bin\\NTx86;C:\\Program Files\\ArcGIS\\bin\\;C:\\Program Files\\Common Files\\ESRI\\Raster\\\\bin\\NTx86;C:\\Program Files\\Common Files\\ESRI\\Raster\\\\archome\\NTx86\\bin\\;C:\\Program Files\\Common Files\\ESRI\\Raster\\\\bin\\NTx86;C:\\Python25\\\\;C:\\Program Files\\ArcGIS\\Data Interoperability Extension\\;C:\\Program Files\\ArcGIS\\\\bin\\;C:\\Program Files\\ArcGIS\\bin\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Program Files\\Common Files\\Roxio Shared\\DLLShared\\;c:\\Program Files\\Microsoft SQL Server\\90\\Tools\\binn\\;C:\\Program Files\\Bin;C:\\Program Files\\SysinternalsSuite;C:\\Program Files\\MATLAB\\R2007b\\bin;C:\\Program Files\\MATLAB\\R2007b\\bin\\win32;C:\\Program Files\\ArcGIS\\bin;C:\\Program Files\\Common Files\\ESRI\\Raster\\\\ArcHome\\NTx86\\Bin\\;C:\\Program Files\\R\\R-2.8.0\\bin;C:\\Program Files\\R\\R-2.8.0\\modules;C:\\Program Files\\R\\R-2.8.0\\lib'
  PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
  PE_LIB = 'C:\\Program Files\\ArcGIS\\bin/pe.dll'
  PROCESSOR_ARCHITECTURE = 'x86'
  PROCESSOR_IDENTIFIER = 'x86 Family 6 Model 15 Stepping 6, GenuineIntel'
  PROCESSOR_LEVEL = '6'
  PROCESSOR_REVISION = '0f06'
  PROGRAMDATA = 'C:\\ProgramData'
  PROGRAMFILES = 'C:\\Program Files'
  PROMPT = '$P$G'
  PUBLIC = 'C:\\Users\\Public'
  PYTHONPATH = 'C:\\Program Files\\ArcGIS\\bin;C:\\Program Files\\GeoEco\\ArcGISToolbox\\Marine Geospatial Ecology Tools.tbx'
  ROXIOCENTRAL = 'C:\\Program Files\\Common Files\\Roxio Shared\\9.0\\Roxio Central33\\'
  RPY_RHOME = 'C:\\Program Files\\R\\R-2.8.0'
  RPY_RUSER = 'C:\\Users\\Jason'
  RPY_RVER = '2080'
  RPY_RVERSION = '2.8.0'
  R_HOME = 'C:\\Program Files\\R\\R-2.8.0'
  SESSIONNAME = 'Console'
  SYSTEMDRIVE = 'C:'
  SYSTEMROOT = 'C:\\Windows'
  TEMP = 'C:\\Users\\Jason\\AppData\\Local\\Temp'
  TMP = 'C:\\Users\\Jason\\AppData\\Local\\Temp'
  TMPDIR = 'C:\\Users\\Jason\\AppData\\Local\\Temp\\RasterProxies\\'
  USERDOMAIN = 'JASONR-LAPTOP2'
  USERNAME = 'Jason'
  USERPROFILE = 'C:\\Users\\Jason'
  VS80COMNTOOLS = 'C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\'
  WECVERSIONFORROSEBUD.1244 = '2'
  WINDIR = 'C:\\Windows'
Other variables:
  GeoEco.__version__ = u'0.7b1'
  sys.argv = ['C:\\PROGRA~1\\GeoEco\\ARCGIS~1\\Scripts\\GAMPredictFromArcGISRasters.py', 'C:\\HabModExample2\\Model\\GAM.rdata', 'C:\\HabModExample2\\OceanographyRasters\\Bathymetry\\etopo2v2;C:\\HabModExample2\\OceanographyRasters\\Chl\\Monthly\\chl199908;C:\\HabModExample2\\OceanographyRasters\\SST\\Monthly\\sst\\sst199908', 'Bathymetry;Chlorophyll;SST', 'C:\\HabModExample2\\HabitatPredictions\\habitat08', "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", '-82 25 -72 40', '8.33333333333333E-02', '#', 'true', 'C:\\HabModExample2\\HabitatPredictions\\stderrors08', 'C:\\HabModExample2\\HabitatPredictions\\binary08', '0.361423678012', 'true']
  sys.version = 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
  sys.version_info = (2, 5, 1, 'final', 0)
  sys.platform = win32
  sys.getwindowsversion() = (6, 0, 6001, 2, 'Service Pack 1')
  os.getcwd() = c:\program files\arcgis\bin
  sys.path = ['C:\\PROGRA~1\\GeoEco\\ARCGIS~1\\Scripts', 'C:\\Program Files\\ArcGIS\\bin', 'C:\\Program Files\\GeoEco\\ArcGISToolbox\\Marine Geospatial Ecology Tools.tbx', 'C:\\Windows\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Python25\\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pythonwin']
Loaded modules: ConfigParser, GeoEco, GeoEco.ArcGIS, GeoEco.AssimilatedModules, GeoEco.AssimilatedModules.GeoEco, GeoEco.AssimilatedModules.rpy, GeoEco.AssimilatedModules.rpy.UserDict, GeoEco.AssimilatedModules.rpy.__future__, GeoEco.AssimilatedModules.rpy._rpy2080, GeoEco.AssimilatedModules.rpy.atexit, GeoEco.AssimilatedModules.rpy.glob, GeoEco.AssimilatedModules.rpy.numpy, GeoEco.AssimilatedModules.rpy.os, GeoEco.AssimilatedModules.rpy.re, GeoEco.AssimilatedModules.rpy.rpy, GeoEco.AssimilatedModules.rpy.rpy_io, GeoEco.AssimilatedModules.rpy.rpy_options, GeoEco.AssimilatedModules.rpy.rpy_tools, GeoEco.AssimilatedModules.rpy.rpy_version, GeoEco.AssimilatedModules.rpy.sys, GeoEco.AssimilatedModules.rpy.threading, GeoEco.AssimilatedModules.rpy.time, GeoEco.AssimilatedModules.rpy.win32api, GeoEco.AssimilatedModules.rpy.win32con, GeoEco.BatchProcessing, GeoEco.DataManagement, GeoEco.DataManagement.ArcGISRasters, GeoEco.DataManagement.ArcInfoASCIIGridUtils, GeoEco.DataManagement.ArcInfoASCIIGrids, GeoEco.DataManagement.BinaryRasters, GeoEco.DataManagement.Directories, GeoEco.DataManagement.Fields, GeoEco.DataManagement.Files, GeoEco.DataManagement.GeoEco, GeoEco.DataManagement.Queue, GeoEco.DataManagement.array, GeoEco.DataManagement.bz2, GeoEco.DataManagement.datetime, GeoEco.DataManagement.errno, GeoEco.DataManagement.getpass, GeoEco.DataManagement.glob, GeoEco.DataManagement.gzip, GeoEco.DataManagement.inspect, GeoEco.DataManagement.math, GeoEco.DataManagement.numpy, GeoEco.DataManagement.operator, GeoEco.DataManagement.os, GeoEco.DataManagement.random, GeoEco.DataManagement.re, GeoEco.DataManagement.shutil, GeoEco.DataManagement.sys, GeoEco.DataManagement.tarfile, GeoEco.DataManagement.tempfile, GeoEco.DataManagement.threading, GeoEco.DataManagement.time, GeoEco.DataManagement.types, GeoEco.DataManagement.urlparse, GeoEco.DataManagement.zipfile, GeoEco.DatabaseAccess, GeoEco.DatabaseAccess.ArcGIS, GeoEco.DatabaseAccess.GeoEco, GeoEco.DatabaseAccess.InMemory, GeoEco.DatabaseAccess.datetime, GeoEco.DatabaseAccess.logging, GeoEco.DatabaseAccess.os, GeoEco.DatabaseAccess.types, GeoEco.Dependencies, GeoEco.DynamicDocString, GeoEco.Exceptions, GeoEco.GeoEco, GeoEco.Internationalization, GeoEco.Logging, GeoEco.Metadata, GeoEco.MetadataUtils, GeoEco.R, GeoEco.Statistics, GeoEco.Statistics.GeoEco, GeoEco.Statistics.Modeling, GeoEco.Statistics.copy, GeoEco.Statistics.os, GeoEco.Statistics.random, GeoEco.Statistics.sys, GeoEco.StringIO, GeoEco.Types, GeoEco.arcgisscripting, GeoEco.codecs, GeoEco.copy, GeoEco.datetime, GeoEco.gettext, GeoEco.inspect, GeoEco.locale, GeoEco.logging, GeoEco.new, GeoEco.numpy, GeoEco.operator, GeoEco.os, GeoEco.platform, GeoEco.re, GeoEco.repr, GeoEco.sys, GeoEco.time, GeoEco.traceback, GeoEco.types, GeoEco.weakref, GeoEco.win32api, GeoEco.win32con, GeoEco.xml, Queue, SocketServer, StringIO, UserDict, __builtin__, __future__, __main__, _codecs, _ctypes, _locale, _random, _socket, _sre, _ssl, _struct, _types, _weakref, arcgisscripting, array, atexit, binascii, bz2, cPickle, cStringIO, codecs, collections, copy, copy_reg, ctypes, ctypes._ctypes, ctypes._endian, ctypes.ctypes, ctypes.os, ctypes.struct, ctypes.sys, datetime, dis, encodings, encodings.aliases, encodings.codecs, encodings.cp1252, encodings.encodings, encodings.types, errno, exceptions, fnmatch, getpass, gettext, glob, gzip, imp, inspect, itertools, linecache, locale, logging, logging.ConfigParser, logging.SocketServer, logging.__builtin__, logging.atexit, logging.cPickle, logging.cStringIO, logging.codecs, logging.config, logging.copy_reg, logging.glob, logging.handlers, logging.logging, logging.os, logging.socket, logging.string, logging.struct, logging.sys, logging.thread, logging.threading, logging.time, logging.traceback, logging.types, math, mmap, msvcrt, new, nt, ntpath, numpy, numpy.__builtin__, numpy.__config__, numpy._import_tools, numpy.add_newdocs, numpy.core, numpy.core.__builtin__, numpy.core._dotblas, numpy.core._internal, numpy.core._sort, numpy.core.arrayprint, numpy.core.cPickle, numpy.core.ctypes, numpy.core.defchararray, numpy.core.defmatrix, numpy.core.fromnumeric, numpy.core.info, numpy.core.ma, numpy.core.memmap, numpy.core.mmap, numpy.core.multiarray, numpy.core.numeric, numpy.core.numerictypes, numpy.core.numpy, numpy.core.os, numpy.core.re, numpy.core.records, numpy.core.scalarmath, numpy.core.string, numpy.core.sys, numpy.core.types, numpy.core.umath, numpy.core.warnings, numpy.ctypes, numpy.ctypeslib, numpy.fft, numpy.fft.fftpack, numpy.fft.fftpack_lite, numpy.fft.helper, numpy.fft.info, numpy.fft.numpy, numpy.fft.types, numpy.glob, numpy.imp, numpy.lib, numpy.lib._compiled_base, numpy.lib.arraysetops, numpy.lib.function_base, numpy.lib.getlimits, numpy.lib.index_tricks, numpy.lib.info, numpy.lib.inspect, numpy.lib.machar, numpy.lib.math, numpy.lib.numpy, numpy.lib.os, numpy.lib.polynomial, numpy.lib.re, numpy.lib.scimath, numpy.lib.shape_base, numpy.lib.sys, numpy.lib.time, numpy.lib.twodim_base, numpy.lib.type_check, numpy.lib.types, numpy.lib.ufunclike, numpy.lib.utils, numpy.lib.warnings, numpy.linalg, numpy.linalg.info, numpy.linalg.lapack_lite, numpy.linalg.linalg, numpy.linalg.numpy, numpy.numpy, numpy.os, numpy.random, numpy.random.info, numpy.random.mtrand, numpy.random.numpy, numpy.sys, numpy.testing, numpy.testing.glob, numpy.testing.imp, numpy.testing.info, numpy.testing.numpy, numpy.testing.numpytest, numpy.testing.operator, numpy.testing.os, numpy.testing.re, numpy.testing.sys, numpy.testing.traceback, numpy.testing.types, numpy.testing.unittest, numpy.testing.utils, numpy.testing.warnings, numpy.version, opcode, operator, os, os.path, platform, random, re, repr, shutil, signal, site, socket, sre_compile, sre_constants, sre_parse, stat, string, strop, struct, sys, tarfile, tempfile, thread, threading, time, token, tokenize, traceback, types, unittest, urlparse, warnings, weakref, win32api, win32con, xml, xml.dom, xml.dom.domreg, xml.dom.minicompat, xml.dom.xml, zipfile, zipimport, zlib
---------- END OF DEBUGGING INFORMATION ----------
Obtaining additional debugging information. This may cause this tool to hang. If you do not see any additional messages after one minute, halt its execution.
---------- BEGINNING OF R TRACEBACK ----------
11: .Call("RGDAL_GetRasterData", raster, as.integer(c(offset, region.dim)),
        as.integer(output.dim), as.integer(interleave), PACKAGE = "rgdal")
10: getRasterData(datasets[[predictor]], offset = c(row - 1, 0),
        region.dim = c(1, rasterCols), as.is = TRUE)
9: tryCatchList(expr, classes, parentenv, handlers)
8: tryCatch({
       datasets <- list()
       for (predictor in labels(rastersForPredictors)) datasets[[predictor]] <- GDAL.open(rastersForPredictors[[predictor]])
       for (row in 1:rasterRows) {
           covariates <- list()
           for (predictor in labels(rastersForPredictors)) covariates[[predictor]] <- getRasterData(datasets[[predictor]],
               offset = c(row - 1, 0), region.dim = c(1, rasterCols),
               as.is = TRUE)
           anyAreNoData <- logical(rasterCols)
           for (predictor in labels(rastersForPredictors)) {
               isNoData <- is.na(covariates[[predictor]])
               if (predictor %in% categoricalPredictors) {
                   isMissingLevel <- !(covariates[[predictor]] %in%
                     fittedLM$xlevels[[predictor]])
                   if (any(isMissingLevel)) {
                     isNoData <- isNoData | isMissingLevel
                     if (!warnedAboutMissingLevels[[predictor]]) {
                       warning(paste("The predictor raster provided for the categorical variable (or factor) named",
                         predictor, "contains values (or levels) that were not present in the data used to fit the model. No predictions can be made for these values. These cells will be set to NoData in the output rasters."),
                         call. = FALSE)
                       warnedAboutMissingLevels[[predictor]] <- TRUE
                     }
                   }
               }
               else if (ignoreOutOfRangeValues)
                   isNoData <- isNoData | covariates[[predictor]] <
                     minFittedPredictorValues[[predictor]] | covariates[[predictor]] >
                     maxFittedPredictorValues[[predictor]]
               allValuesForPredictorAreNoData[[predictor]] <- allValuesForPredictorAreNoData[[predictor]] &&
                   all(isNoData)
               anyAreNoData <- anyAreNoData | isNoData
           }
           allValuesAreNoData <- allValuesAreNoData && all(anyAreNoData)
           for (predictor in labels(rastersForPredictors)) covariates[[predictor]][anyAreNoData] <- minFittedPredictorValues[[predictor]]
           predictions <- predict(fittedLM, newdata = covariates,
               type = "response", se.fit = !is.null(outputErrorASCIIGrid))
           if (is.null(outputErrorASCIIGrid))
               predictedResponse <- as.vector(predictions)
           else {
               predictedResponse <- as.vector(predictions$fit)
               predictedError <- as.vector(predictions$se.fit)
           }
           predictedResponse[anyAreNoData] <- -3.4028235e+38
           if (!is.null(outputErrorASCIIGrid))
               predictedError[anyAreNoData] <- -3.4028235e+38
           cat(formatC(predictedResponse, digits = 8, format = "g",
               width = -1), "\r\n", sep = " ", file = responseFile)
           if (!is.null(outputErrorASCIIGrid))
               cat(formatC(predictedError, digits = 8, format = "g",
                   width = -1), "\r\n", sep = " ", file = errorFile)
       }
   }, finally = for (ds in datasets) GDAL.close(ds))
7: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatch({
       if (!is.null(outputErrorASCIIGrid)) {
           cat("ncols ", rasterCols, "\r\n", sep = "", file = errorFile)
           cat("nrows ", rasterRows, "\r\n", sep = "", file = errorFile)
           cat("xllcorner ", formatC(rasterXLLCorner, format = "g",
               digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
           cat("yllcorner ", formatC(rasterYLLCorner, format = "g",
               digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
           cat("cellsize ", formatC(rasterCellSize, format = "g",
               digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
           cat("nodata_value ", formatC(-3.4028235e+38, format = "g",
               digits = 8, width = -1), "\r\n", sep = "", file = errorFile)
       }
       datasets <- character()
       tryCatch({
           datasets <- list()
           for (predictor in labels(rastersForPredictors)) datasets[[predictor]] <- GDAL.open(rastersForPredictors[[predictor]])
           for (row in 1:rasterRows) {
               covariates <- list()
               for (predictor in labels(rastersForPredictors)) covariates[[predictor]] <- getRasterData(datasets[[predictor]],
                   offset = c(row - 1, 0), region.dim = c(1, rasterCols),
                   as.is = TRUE)
               anyAreNoData <- logical(rasterCols)
               for (predictor in labels(rastersForPredictors)) {
                   isNoData <- is.na(covariates[[predictor]])
                   if (predictor %in% categoricalPredictors) {
                     isMissingLevel <- !(covariates[[predictor]] %in%
                       fittedLM$xlevels[[predictor]])
                     if (any(isMissingLevel)) {
                       isNoData <- isNoData | isMissingLevel
                       if (!warnedAboutMissingLevels[[predictor]]) {
                         warning(paste("The predictor raster provided for the categorical variable (or factor) named",
                           predictor, "contains values (or levels) that were not present in the data used to fit the model. No predictions can be made for these values. These cells will be set to NoData in the output rasters."),
                           call. = FALSE)
                         warnedAboutMissingLevels[[predictor]] <- TRUE
                       }
                     }
                   }
                   else if (ignoreOutOfRangeValues)
                     isNoData <- isNoData | covariates[[predictor]] <
                       minFittedPredictorValues[[predictor]] | covariates[[predictor]] >
                       maxFittedPredictorValues[[predictor]]
                   allValuesForPredictorAreNoData[[predictor]] <- allValuesForPredictorAreNoData[[predictor]] &&
                     all(isNoData)
                   anyAreNoData <- anyAreNoData | isNoData
               }
               allValuesAreNoData <- allValuesAreNoData && all(anyAreNoData)
               for (predictor in labels(rastersForPredictors)) covariates[[predictor]][anyAreNoData] <- minFittedPredictorValues[[predictor]]
               predictions <- predict(fittedLM, newdata = covariates,
                   type = "response", se.fit = !is.null(outputErrorASCIIGrid))
               if (is.null(outputErrorASCIIGrid))
                   predictedResponse <- as.vector(predictions)
               else {
                   predictedResponse <- as.vector(predictions$fit)
                   predictedError <- as.vector(predictions$se.fit)
               }
               predictedResponse[anyAreNoData] <- -3.4028235e+38
               if (!is.null(outputErrorASCIIGrid))
                   predictedError[anyAreNoData] <- -3.4028235e+38
               cat(formatC(predictedResponse, digits = 8, format = "g",
                   width = -1), "\r\n", sep = " ", file = responseFile)
               if (!is.null(outputErrorASCIIGrid))
                   cat(formatC(predictedError, digits = 8, format = "g",
                     width = -1), "\r\n", sep = " ", file = errorFile)
           }
       }, finally = for (ds in datasets) GDAL.close(ds))
   }, finally = if (!is.null(outputErrorASCIIGrid)) close(errorFile))
5: tryCatchList(expr, classes, parentenv, handlers)
4: tryCatch({
       cat("ncols ", rasterCols, "\r\n", sep = "", file = responseFile)
       cat("nrows ", rasterRows, "\r\n", sep = "", file = responseFile)
       cat("xllcorner ", formatC(rasterXLLCorner, format = "g",
           digits = 15, width = -1), "\r\n", sep = "", file = responseFile)
       cat("yllcorner ", formatC(rasterYLLCorner, format = "g",
           digits = 15, width = -1), "\r\n", sep = "", file = responseFile)
       cat("cellsize ", formatC(rasterCellSize, format = "g", digits = 15,
           width = -1), "\r\n", sep = "", file = responseFile)
       cat("nodata_value ", formatC(-3.4028235e+38, format = "g",
           digits = 8, width = -1), "\r\n", sep = "", file = responseFile)
       if (!is.null(outputErrorASCIIGrid))
           errorFile <- file(outputErrorASCIIGrid, "wt")
       tryCatch({
           if (!is.null(outputErrorASCIIGrid)) {
               cat("ncols ", rasterCols, "\r\n", sep = "", file = errorFile)
               cat("nrows ", rasterRows, "\r\n", sep = "", file = errorFile)
               cat("xllcorner ", formatC(rasterXLLCorner, format = "g",
                   digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
               cat("yllcorner ", formatC(rasterYLLCorner, format = "g",
                   digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
               cat("cellsize ", formatC(rasterCellSize, format = "g",
                   digits = 15, width = -1), "\r\n", sep = "", file = errorFile)
               cat("nodata_value ", formatC(-3.4028235e+38, format = "g",
                   digits = 8, width = -1), "\r\n", sep = "", file = errorFile)
           }
           datasets <- character()
           tryCatch({
               datasets <- list()
               for (predictor in labels(rastersForPredictors)) datasets[[predictor]] <- GDAL.open(rastersForPredictors[[predictor]])
               for (row in 1:rasterRows) {
                   covariates <- list()
                   for (predictor in labels(rastersForPredictors)) covariates[[predictor]] <- getRasterData(datasets[[predictor]],
                     offset = c(row - 1, 0), region.dim = c(1, rasterCols),
                     as.is = TRUE)
                   anyAreNoData <- logical(rasterCols)
                   for (predictor in labels(rastersForPredictors)) {
                     isNoData <- is.na(covariates[[predictor]])
                     if (predictor %in% categoricalPredictors) {
                       isMissingLevel <- !(covariates[[predictor]] %in%
                         fittedLM$xlevels[[predictor]])
                       if (any(isMissingLevel)) {
                         isNoData <- isNoData | isMissingLevel
                         if (!warnedAboutMissingLevels[[predictor]]) {
                           warning(paste("The predictor raster provided for the categorical variable (or factor) named",
                             predictor, "contains values (or levels) that were not present in the data used to fit the model. No predictions can be made for these values. These cells will be set to NoData in the output rasters."),
                             call. = FALSE)
                           warnedAboutMissingLevels[[predictor]] <- TRUE
                         }
                       }
                     }
                     else if (ignoreOutOfRangeValues)
                       isNoData <- isNoData | covariates[[predictor]] <
                         minFittedPredictorValues[[predictor]] |
                         covariates[[predictor]] > maxFittedPredictorValues[[predictor]]
                     allValuesForPredictorAreNoData[[predictor]] <- allValuesForPredictorAreNoData[[predictor]] &&
                       all(isNoData)
                     anyAreNoData <- anyAreNoData | isNoData
                   }
                   allValuesAreNoData <- allValuesAreNoData && all(anyAreNoData)
                   for (predictor in labels(rastersForPredictors)) covariates[[predictor]][anyAreNoData] <- minFittedPredictorValues[[predictor]]
                   predictions <- predict(fittedLM, newdata = covariates,
                     type = "response", se.fit = !is.null(outputErrorASCIIGrid))
                   if (is.null(outputErrorASCIIGrid))
                     predictedResponse <- as.vector(predictions)
                   else {
                     predictedResponse <- as.vector(predictions$fit)
                     predictedError <- as.vector(predictions$se.fit)
                   }
                   predictedResponse[anyAreNoData] <- -3.4028235e+38
                   if (!is.null(outputErrorASCIIGrid))
                     predictedError[anyAreNoData] <- -3.4028235e+38
                   cat(formatC(predictedResponse, digits = 8, format = "g",
                     width = -1), "\r\n", sep = " ", file = responseFile)
                   if (!is.null(outputErrorASCIIGrid))
                     cat(formatC(predictedError, digits = 8, format = "g",
                       width = -1), "\r\n", sep = " ", file = errorFile)
               }
           }, finally = for (ds in datasets) GDAL.close(ds))
       }, finally = if (!is.null(outputErrorASCIIGrid))
           close(errorFile))
   }, finally = close(responseFile))
3: PredictLMForArcGISRasters(model, rastersForPredictors, "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_response.txt",
       "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_standarderror.txt",
       ignoreOutOfRangeValues = TRUE)
2: eval(expr, envir, enclos)
1: function (expr, envir = parent.frame(), enclos = if (is.list(envir) ||
       is.pairlist(envir)) parent.frame() else baseenv())
   .Internal(eval(expr, envir, enclos))(expression(PredictLMForArcGISRasters(model,
       rastersForPredictors, "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_response.txt",
       "C:\\Temp\\GeoEcoTemp_Jason\\tmpndbrtn\\temp_standarderror.txt",
       ignoreOutOfRangeValues = TRUE)))
None
---------- END OF R TRACEBACK ----------
R interpreter: Evaluating statements: if (exists("rastersForPredictors")) rm("rastersForPredictors")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("model")) rm("model")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("rPackage")) rm("rPackage")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("xVar")) rm("xVar")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("yVar")) rm("yVar")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("zVar")) rm("zVar")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("mVar")) rm("mVar")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("coordinateSystem")) rm("coordinateSystem")
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("f20985982305")) rm("f20985982305", pos=globalenv())
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("data20985982305")) rm("data20985982305", pos=globalenv())
R interpreter: The last statement returned None
R interpreter: Evaluating statements: if (exists("fam20985982305")) rm("fam20985982305", pos=globalenv())
R interpreter: The last statement returned None
Deleted directory C:\Temp\GeoEcoTemp_Jason\tmpndbrtn
The directory C:\Temp\GeoEcoTemp_Jason exists.
Refreshed the ArcGIS catalog for directory C:\Temp\GeoEcoTemp_Jason
ERROR 000714: Error in script GAMPredictFromArcGISRasters.
Error in executing: cmd.exe /C C:\PROGRA~1\GeoEco\ARCGIS~1\Scripts\GAMPRE~1.PY  "C:\HabModExample2\Model\GAM.rdata" "C:\HabModExample2\OceanographyRasters\Bathymetry\etopo2v2;C:\HabModExample2\OceanographyRasters\Chl\Monthly\chl199908;C:\HabModExample2\OceanographyRasters\SST\Monthly\sst\sst199908" "Bathymetry;Chlorophyll;SST" "C:\HabModExample2\HabitatPredictions\habitat08" "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]" "-82 25 -72 40" "8.33333333333333E-02" "#" "true" "C:\HabModExample2\HabitatPredictions\stderrors08" "C:\HabModExample2\HabitatPredictions\binary08" "0.361423678012" "true"
("esriLocation.LocalLocatorWorkspace") A locator with this name does not exist.

Failed to execute (Predict GAM From Rasters).
End Time: Thu May 28 19:54:56 2009 (Elapsed Time: 1 minutes 43 seconds)

Change History

Changed 4 years ago by jjr8

  • status changed from new to assigned

Changed 4 years ago by jjr8

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in [404], released in MGET 0.7b1.

Changed 4 years ago by jjr8

  • type changed from Task to Defect
Note: See TracTickets for help on using tickets.