GIS-LAB

Geographic information systems and Remote sensing

Batch import of raster data into GRIDs and postprocessing using Arcinfo Workstation

Description for several tools designed for fast conversion and processing of raster data in Arcinfo Workstation

Обсудить в форуме Комментариев — 0

Introduction

It is possible to use Arcinfo Workstation for high-preformance import of raster data in TIF, BSQ/BIL/BIP formats into GRID format, used for the analysis and calculations in Arcinfo, Arcview, ArcGIS such scripts can also help to carry out several processing operations on GRIDs in the batch mode. Script is creating a list of files for conversion or processing and perform necessary operations. Arcinfo Workstation is the unbeaten in terms of speed and reliability software which ideally can solve this kind of tasks.

All raster files (any number of them) in BIL or TIF format should be located in the same directory.

For all scripts mentioned here, input folder where all the files to be processed are located and output folder where the results will be put should be specified. If output folder parameter is omited, script will be using input folder for storing outputs. For output folder, relative to input path can be used. For example: if input folder is set to be c:\work\, then setting result\ as an output will mean that full path to output folder will be c:\work\result\. Both input and output folder parameters must have trailing slashes (end with "\").

Running arc and Setting the environment

To start Arcinfo Workstation you need either to type arc in Start\Run... or select Start\Programs\ArcGIS\ArcInfo Workstation\Arc or something similar. After you see the console, you'll have to enter all commands manually into it, commands are entered after arc: prompt, in all the examples below, system prompt is omitted. To start working, it is better to specify the path to the folder, where all your scripts are located, doing it, you want have to specify full path to the tools each time you run it. This can be done by &workspace command:

&workspace c:\work\myscripts\ 

To check if command run correctly just put w into the system prompt, to have something like Current location: c:\work\myscripts as a responce from Arcinfo.

w

We recommend to store all the scripts in one folder, this is will make it easy to run them one after the other.

Scripts

To start working with GRID data, usually you have to convert some other data to GRID format, you can do it with image2grid.aml tool which will do the work. To run the script, you'll need to enter this command in Arcinfo Workstation console:

&run image2grid.aml input output
or
&run image2grid.aml c:\work\ d:\result\
            

If your input rasters have signed 16-bit format, then you'll have to make one more step to correct them after importing using con2.aml:

&run con2.aml input output
or
&run con2.aml c:\work\ d:\result\

The result of this script work will be new set of GRIDs with "c" prefix for initial name, files generated after first step of import (using image2grid) will be removed.

Opposite operation is export from GRID back to BIL format, it can be also batched using grid2bil.aml. Files in BIL format can be used to load data into other software, like for example TIMESAT.

&run grid2bil.aml input output
or
&run grid2bil.aml c:\work\ ..\result\

To get rid of certain values, you can set certain values of raster equal to NODATA, this often used for remote sensing data, where certain negative value is used for boundary of the image and don't carry any meaningful information. Usual raster formats (TIF, BIL and others) doesn't have an ability to store NODATA value, while GRID can. To use set certain value or range to NODATA, use setnull.aml script.

&run setnull.aml input output
or
&run setnull.aml c:\work\ d:\result\

To set certain values, you need to find a line in the script, using any text editor, which contains a condition which should be true to set value to NODATA, by default this line contains %current% <= - 3000 condition, you can change to something else, depending on what data are you using, for example, you can turn in NODATA, only values, which are exactly equal to -3000: %current% == -3000.

This script will result in new set of files in GRID format, with "z" prefix to a GRID's name. Files which were used as a source will be deleted.

%output% = setnull(%current% <= -3000, %current%)
or
%output% = setnull(%current% == -3000, %current%)

or
%output% = setnull(%current% <= -3000 and %current% >= -5000, %current%)

To clip all grids using some clipping coverage clip-all.aml script can be used. To work with it, clipping coverage first need to be created and should contain a polygon which will be used for clipping. This coverage can be located in the same folder as source files, in this case it will be enough just to use its name without path in the console.

&run clip-all.aml clipcover input output
or
&run clip-all.aml clipper c:\work\data\ ..\result\

If clipping coverage is located in any other directory, then that with source files, full path to clipping coverage should be specified, for example:

&run clip-all.aml c:\temp\clipcover input output
or
&run clip-all.aml c:\temp\clipcover c:\work\data\ ..\result\

After multiple operation on files, their names can become hard to read or meaningless. To change all the names at once using certain susbstitution for substrings you can use rename.aml script:

&run rename.aml sourcedir findstr replacestr
or
&run rename.aml c:\work\data\ znc

To run this script, you need to specify source folder, where GRIDs to rename are stored - sourcedir, findstr - fragment of text to find in GRID's name, replacestr - text on which substring found will be substituted, this parameter can be omitted, then substring found wil be simple deleted from the name of the GRID.

These scripts are relatively easy to modify to make them do any other operation on any number of input GRIDs or files.

Download scripts : image2grid.aml, con2.aml, grid2bil.aml, setnull.aml, grid2bil.aml, clip-all.aml.

Обсудить в форуме Комментариев — 0

Последнее обновление: September 09 2021

Дата создания: 08.08.2006
Автор(ы): Максим Дубинин