[seek-dev] RE: garp tools

Pereira, Ricardo Scachetti rpereira at ku.edu
Fri Jan 30 09:26:22 PST 2004


	Hi, Chad.
	Here it is the AVENUE script that executes step (1a). It's is in
attachement.
	Unfortunatelly, I don't know exactly how you can integrate
ArcView into Kepler. Some people at earlier SEEK-BEAM working group
meetings mentioned that ArcView would be a candidate for integration in
the pipelines, but I don't know exactly how. There is also the problem
with ArcView lincensing.
	The best solution would be to implement the same processing step
on GRASS and have that one integrated. 
	The best candidate for doing the job in GRASS are both r.region
and r.resample commands. Command r.region sets the extent and resolution
of the output layers and r.resample resamples the input layers. Then it
would be a matter of formating the grids to ASCII raster format.
	I'll do some more research on the GRASS script itself.
	Still need to come up with the code for step (1b).
	I'll be in touch.
	Regards,

Ricardo


-----Original Message-----
From: Chad Berkley [mailto:berkley at nceas.ucsb.edu] 
Sent: Monday, January 26, 2004 6:43 PM
To: Pereira, Ricardo Scachetti
Cc: seek-dev at ecoinformatics.org
Subject: Re: garp tools

Hi Ricardo,

could you send me the AVENUE script that you use for 1a?  It's possible
I can execute arcView from within kepler.  if not, i may rewrite it in
GRASS or something else.

for 1b, creating the actor is trivial.  would you mind sending me a c++
implementation of the vb code?  if you don't have time (I know you're
out of town), I can probably figure it out, but it would be more
efficient for you to do it.

thanks,
chad

Pereira, Ricardo Scachetti wrote:
> 	Chad,
> 
> 	Here it is the expansion of "Layer Integration" step that is
SPECIFIC 
> to GARP nowadays.
> 	I'm assuming you are looking at the file 
> /seek/projects/beam/niche-modeling/garp/GarpPipelineNative.jpg on CVS.
> Correct me if I'm wrong.
> 	In your current implementation of GARP pipeline in Kepler, you
have 
> already implemented the analytical steps (2), (3) and (4). Now you 
> will implement A.S. #(1): "Env Layer cliping and resampling".
> 	Here is the procedure, broke down to smaller analytical steps.
> Let me know if you need something else.
> 
> 	
> ==================================================================
> 	1a) Layer clipping and resampling
> 
> 	Description:
> 		In this processing step, a set of environmental layers
is clipped 
> and resampled so they all have the same extent and cell size.
> 		It is assumed that all layers are stored in the same
coordinate 
> system.
> 		Currently, this step is executed inside ArcView 3.x
using an AVENUE 
> script.
> 		Can be implemented in other GIS, but that will require
development 
> of other custom scripts that comply to GIS available API.
> 
> 	Inputs: 
> 		- LAYERS: set of environmental layers (files) that will
be used in 
> the modeling (in a format that your GIS API can read);
> 		- EXT: extent of the area of interest. Defined as 2 pair
of 
> coordinates, i.e., a (x, y) pair for upper-left corner and another for

> the bottom-right corner of the area of interest;
> 		- CS: cell size to be used in the analysis
> 
> 	Outputs:
> 		- set of layers in ESRI ASCII Raster Grid format, all
with the same 
> extent (EXT) and cell size (CS). Note: EXT and CS need to be exactly 
> the same for all layers, to the last decimal digit!!
> 
> 
> 	Note: This step can probably be broken down to smaller pieces,
but 
> that will depend on the GIS API you are using.
> 
> 
> 	
> ==================================================================
> 	1b) Scaling of environmental layer values and packaging of GARP 
> dataset
> 
> 	Description:
> 		In this step, each ASCII raster grid obtained in step 1a
is 
> converted to native GARP dataset format. Each layer has its cell 
> values scaled to fit a byte. This is a requirement for the original 
> GARP algorithm as designed by David Stockwell.
> 		Each layer has its maximum (max) and minimum (min) cell
value 
> extracted. The following expression is then applied to each of the 
> layer cells:
> 
> 			scale_coeficient = (max - min) / 253;
> 			new_scaled_value = (int)( ( (original_value -
> min) / scale_coeficient) + 1);
> 
> 		The reverse operation is (just FYI): 			
> 		
> 			new_original_value = ( ( (double)
> new_scaled_value - 1) * scale_coeficient ) + min
> 
> 		After scaling occurs, the cell values assume values
between 1 and 
> 254 (0 and 255 are reserved values)
> 		This step is currently implemented in a separate Visual
Basic 
> application. Below there is the source code (in VB!!) that does the 
> processing. I can translate it to C++ when you have the actor and the 
> right method signitures (JNI) in place.
> 
> 	Input:
> 		- set of ASCII Raster grids from step 1a
> 
> 	Outputs:
> 		- a directory containing: i) the environmental layer
scaled values 
> (scaled to fit a byte), one .raw file per layer;
> 		- a GARP dataset file (.dxl) containing the description
(original 
> values, extent, etc) of each layer in the dataset.
> 
> 	
> ==================================================================
> 
> 
> 
> Visual Basic Code (extract from VB Application source code)
> 
> Dim m_oDS As GARPLib.CoEnvLayerSet  ' VB version of EnvLayerSet cpp 
> object
> Dim m_oLyr As GARPLib.CoEnvLayer    ' VB version of EnvLayer cpp
object
> Dim strFile as String               ' ASCII Raster file name (without
> extention .asc)
> 
>     Set m_oLyr = CreateObject("Garp.EnvLayer")
>     m_oLyr.strId = strFile
>     m_oLyr.strTitle = strFile
>     m_oLyr.strFilename = ""
>     m_oLyr.strMatrixFilename = strFile & ".raw"
>     Call m_oLyr.useRawByteMatrixInDisk
>     Call m_oLyr.fromAsciiGrid(strFile * ".asc")
> 
>     If (LCase(strFile) <> "mask") Then
>         Call m_oDS.Add(m_oLyr)
>     Else
>         Call m_oDS.addAsMask(m_oLyr)
>     End If
> 
>     ' check for error: It will raise an error if extents or cell size 
>     ' of this layer is different from the other layers
>     If m_oDS.intLastErrorCode <> 0 Then
>         Call Err.Raise(1, "Ascii Raster Grid Batch Load", _
>                 "Could not add layer to the dataset """ & oFile.Name &
_
>                 """ (Garp message: " & m_oDS.strLastErrorMessage &
")")
>     End If
> 
> 
> 
> 
>  
> 
> -----Original Message-----
> From: Chad Berkley [mailto:berkley at nceas.ucsb.edu]
> Sent: Tuesday, January 20, 2004 12:47 PM
> To: Ricardo Scachetti Pereira
> Cc: seek-dev at ecoinformatics.org
> Subject: garp tools
> 
> Hi Ricardo (and others),
> 
> Now that I think that GARP is working from kepler, matt and I thought 
> it would be a good idea to implement the tools necessary to go from 
> raw data to the input formats that are in the example data files.  We 
> would like to be able to implement a pipeline that goes from a digir 
> (ecogrid) query to a garp prediction to rendered output.
> 
> What I need from you (and maybe deana as well) is to know exactly what

> this entails and if any of it is implemented in a way that I could 
> harness in kepler or if I need to implement it.  I believe this 
> process is what is grouped together under "Layer Integration" in the 
> original ppt garp pipeline that came out of BEAM. Could you possibly 
> expand "Layer Integration" so I know exactly what the steps are within

> that process?  Are any of these processes implemented in GeoTools or
GRASS?
> 
> thanks,
> chad
> 
> 
> --
> -----------------------
> Chad Berkley
> National Center for
> Ecological Analysis
> and Synthesis (NCEAS)
> berkley at nceas.ucsb.edu
> -----------------------
> 


--
-----------------------
Chad Berkley
National Center for
Ecological Analysis
and Synthesis (NCEAS)
berkley at nceas.ucsb.edu
-----------------------


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ClipDatasetScriptIndented.txt
Url: http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/seek-dev/attachments/20040130/65584dc6/ClipDatasetScriptIndented.txt


More information about the Seek-dev mailing list