## NAME

m.dem.extract - Extracts USGS Digital Elevation Model (DEM) data from 1/2-inch magnetic tape.
(GRASS Data Import/Processing Program)

## SYNOPSIS

m.dem.extract
m.dem.extract help
m.dem.extract input=name output=name blocksize=value start=value end=value

## DESCRIPTION

m.dem.extract extracts USGS Digital Elevation Model (DEM) elevation data that fits into the user's current geographic region from the input file input, in blocks of blocksize bytes. If no input file is specified by the user, input is taken from /dev/rmt0, by default. Results are placed in the named output file, and stored beneath the cell directory of the user's current mapset. m.dem.extract will only extract data that fall within the boundaries of the user's current geographic region. Data falling outside this region will be ignored. m.dem.extract will not complain if the input file does not cover the entire geographic region. The user should run m.dem.extract without specifying output file (which only examines the input file) prior to extracting the data to determine the size of the geographic region needed. If the block size is unknown, run the command m.examine.tape .

The user can run this program either non-interactively or interactively. The program will be run non-interactively if the user specifies program arguments on the command line, using the form:

  m.dem.extract input=name [output=name] [blocksize=value] [start=value] [end=value]

Alternately, the user can simply type m.dem.extract on the command line, without program arguments. In this case, the user will be prompted for needed parameter values using the standard GRASS interface described in the manual entry for parser .

### Parameters:

input=name
  The full path name of tape device or file from which DEM data are to be extracted.
  Default: /dev/rmt0
output=name
  The name to be assigned to the output file containing raster DEM data extracted from 1/2-inch tape.
blocksize=value
  The physical block size (record length) of each each record, in bytes. m.examine.tape can be used to determine block size.
start=value
  First DEM quad to look at (default 1).
end=value
  Last DEM quad to look at (default 9999999).

## NOTES

The user should check the boundaries and resolution of the current region setting (see g.region ) BEFORE extracting data, since m.dem.extract will only extract the data that falls within these boundaries and only use the set resolution during extraction.

Warning: This program assumes that the tape has ONLY DEM data. If the tape contains other files (DLG, for example) the program will not skip over them. In this case, forward the tape to the first DEM file. Use the appropriate UNIX commands (mt to forward the tapes past the non-DEM files, and dd to extract and copy the correct files) on the tape on another machine first to extract the non-DEM data from the tape.

USGS Tapes: This version of m.dem.extract is sensitive to formatting errors. If the format on a tape is wrong, the program exits with the error message: "The file with incorrect data format encountered ..." Nevertheless, the program continues. In this case, run the program without specifying input files. If the program exits again with the same error message, there is an inconsistency in the data format.

The format error: Each USGS Dem file consists of A and B, and sometimes C, records--
type A record header
type B record collection of profiles with various numbers of elevations
type C record accuracy

This new version of m.dem.extract cannot skip over any records to the end of a DEM file. It first determines how many records there are in a file, reads those records, and then proceeds to the header (record A) of the next file. Thus it is very important for the program to know whether or not there is a C record to be read at the end of each file. This information is given in the file's header record (type A) which has a field set to 1 when a C-record exits, and to 0 when a C-record does not exist.

In some DEM files, the accuracy field is set to 0, even though a C-record does exist. Because of this error, when the program tries to read the data, it will not try to read the C-record, but instead attempts to go on to the next file and read its header--a type A record. This results in the format error because type A records and type C records have different formats, and the program is trying to read a type A record when the tape is presenting a type C record.

When this format error in a file is encountered, forward the tape to the next file.

## SEE ALSO

g.region
m.examine.tape
r.rescale
r.support
parser

## AUTHOR

Andrew Heekin, U.S. Army Construction Engineering Research Laboratory

Improvements to program code were made for GRASS 4.0 by
David Satnik, Central Washington University

Major enhancements for GRASS 4.1 to allow the input to be a file or tape were made by
Olga Waupotitsch, U.S.Army Construction Engineering Research Laboratory

Last changed: $Date: 2002/01/25 05:45:33 $