No subject

Michael Camann camann at athena.cs.uga.edu
Sat Aug 15 16:04:16 EDT 1992


	This is a follow-up message to my earlier plea for help with 
m.dem.extract.  I've arrived at a solution, although an inelegant one, 
that I want to throw out for net comments.  Here's the background:

	I have a tape from the USDA Forest Service containing 21 USGS 
DEMs from central Georgia, USA.  I read the first three DEMs using the
m.dem.extract program, but was unable to continue beyond the third 
because of a record format problem, presumably the unexpected presence 
or absence of a type C record at the end of the third DEM file, as 
described in the README file accompanying the latest incarnation of 
m.dem.extract.  I tried the temporary fix discussed in the README file, 
without success.

	Here is a partial solution, presented for the fourth DEM on the 
tape:

	First, run m.examine.tape to get the block sizes and record 
counts for the DEMs on the tape.  The report for the first four DEMs 
on my tape was:

	file 1
		 len:	records
		4096:	1 - 295
	file 2
		 len:	records
		4096:	1 - 295
	file 3
		 len:	records
		4096:	1 - 295
	file 4
		 len:	records
		4096:	1 - 294
	...etc.

	The next step is to get the fourth DEM off the tape and into a 
disk file.  I used dd for this, but skipped the first 3 * (295 + 1) 
records before copying from the tape.  I invoked dd with:

dd if=/dev/rmt8 of=/usr/gis/DEM/quad_name.dem bs=4096 skip=888 files=1

The dd output was:

	294+0 records in
	294+0 records out

	If you get a dd report that lists a number of records different 
from that obtained for file 4 by m.examine.tape, then your skip 
parameter is probably set wrong.  In any event, you should check to 
make sure that the first line of the resultant file contains the name of
the USGS quad in the first field.  That way you know you got the whole 
thing.

	To create a raster file, set your geographic region by running 
m.dem.examine on the tape to find the UTM coords of each quad boundary, 
then run g.region, then do:

	m.dem.extract input=/usr/gis/DEM/quad_name.dem \
	output=quad_name.dem blocksize=4096

	This is just like in the DEM data extraction tutorial except 
that the DEM file is now on disk, instead of tape.

	Finally, run r.support.  This process can be repeated for 
however many DEM files you have on the tape.

	Ok, this works, but it's tedious.  Furthermore, it's only useful
for extracting single quads.  It won't work for multiple DEMs that need 
to be extracted into a single region, say an 8 quad block.  To do this, 
we either need to fix the incorrect field in the DEM type A record or 
we need a more bullet-proof m.dem.extract.  The first option SOUNDS 
easy, but it's really not.  At the very least, every offending DEM file 
from the tape would have to be written out with dd and then written 
back after editing.  I would feel safer copying out the whole tape, 
editing, and then re-writing (or just running m.dem.extract on the 
repaired file).  This could take lots of disk space to accomplish, 
however.

	Comments, please?  And can anyone tell me which field in the 
Type A record is the one that needs to be changed?

		Mike Camann
		camann at athena.cs.uga.edu



More information about the grass-user mailing list