ITCHy GRASS problem with DEM tapework

Steffen Meyer sm646601 at longs.lance.colostate.edu
Wed Mar 25 10:23:07 EST 1992


Since my original request for assistance regarding DEM tapework
on 3/21 to  grassu-list, IDS staff have examined and made a small 
modification to the m.dem.extract tool.

This modification permits reading a USGS DEM file format that was
extracted from tape.  The solution involves modifying code.  
Once the fix is in place, a two step process permits bring
USGS 7.5 min. DEM data in GRASS4.0

                ---------

For the programmers:
Modifications to the code:

   You need to edit the file main.c in directory 
   grass4.0/src/misc/m.dem.extract.
  
   In the CERL delivered form, line ~37 of main.c reads:

     blocksize = sscanf(opt3->answer, "%d", &blocksize) ;

   when we tried in dbx to look at the value of blocksize it always was 1.  
   The following fix was implemented in main.c.
    
     Add the local variable:
       char *blocktemp;

     Modify line ~37 with the following two lines of code:
       blocktemp = opt3->answer;
       sscanf(blocktemp, "%d", &blocksize) ;

   Compile the code appropriately.

This modification removes the restriction describe in the man page, that
rmt0 is the only supported driver.  I would welcome any experiences 
so that CERL might consider this small improvement in pending fixes.
Note this work was done on sun sparc 2 environments, but should be
applicable elsewhere as well.  :-)

                ---------

For the non-programmers:

The following sequence of commands were used.  You will need to adjust
this for the blocksize provide on your tape.  The example illustrated
is documented in detail in grassu-list 3/21/92.from tape

1. Retreive the file from tape using dd and tape block size.
   
   dd if=/dev/<appropriate_tape_driver> 
      of=file1 
      ibs=<appropriate number, in our case 8192)

   This reads the next file from tape.  For reading multiple files from
   a single tape you need to use an `n` leading your device driver, e.g.
   /dev/nrst17.  This avoids rewinding the tape after each read.  

2. Read the files into a new structure that m.dem.extract will be able to 
   access.  This new structure is obtained by reading the original
   files with dd and converting them to a new format the command is the
   following:

   dd if=(file name, e.g. file1) 
      of=<output file name, e.g. file1.out>
      ibs=<blocksize of step 1, e.g. 8192>
      obs=<blocksize larger than any single record in your dem, e.g.4096>
      conv=sync,block

   This prepares a file that the modified m.dem.extract can read.

3. You are ready to use the modified m.dem.extract.  Set a region large 
   enough to encompass your data from tape, and execute m.dem.extract.
   (see man pages on m.dem.extract)

   m.dem.extract
      input=<name,  e.g. file1.out>
      output=<output, dem1 (or actual quad name)>
      blocksize=<value,  e.g. 4096>


We were successful with four adjacent quads of 7.5 min USGS DEM data
retreived using a SCSI device driver (as described 3/21 grassu).  
If you have any questions, pleasecontact us at Integrated Decision 
Support group (IDS), Center for Water Resources Engineering and Science.

PS:  Thanks Michael, how do we best post this series on inquiries to
      grassp-list  retroactively


Dr. Luis Garcia and
Steffen Meyer


- -----------------------------------------------------------------
Steffen Meyer           Integrated Decsion Support Group -- CWRES
phone: (303) 491-7620      Engineering, Colorado State University
fax:   (303) 491-2293           Fort Collins, Colorado 80523  USA
email: sm646601.longs.LANCE.ColoState.EDU         (129.82.109.16)
- -----------------------------------------------------------------

------- End of Unsent Draft




More information about the grass-user mailing list