11.G.vi. Importing into the U.S. Army Corps of Engineers' GRASS
Two procedures are presented for importing the DEM and source/lineage files (GUNZIP decompressed) into GRASS: (1) importing GLOBE data using a sample GRASS data base, and (2) importing GLOBE data into your own GRASS data base.
11.G.vi.a.Importing GLOBE Data Using a Sample GRASS Data Base
For convenience, a sample GRASS data base for GLOBE is provided. This data base is in a global 30" latitude-longitude "projection." It contains GRASS cell header (cellhd), cell miscellaneous (cell_misc), and color (colr) directories
and files for GLOBE data and source tiles. It also contains an empty cell directory, into which GLOBE tiles may be placed.
-
Copy the grasglob.tar file from /data/elev/grass/grasstar/ or /data/source/grass/grasstar/ (the files are identical) to a directory on your Unix workstation. To "un-tar" the file, run the following command (or similar for your
environment)
tar -xvf grass.tar
-
Copy the binary data from the GLOBE Web site or CD-ROMs into the grass/user/cell directory. You may wish to "mv" the directory structure so that the "user" becomes your login name, thus making a grass/yourlogin/cell directory.
Go to that directory.
-
GUNZIP any data files containing a .gz extension (see Section 11.G.ii)
-
To keep track of your files, rename all data tiles with a .pc extension. For example, "mv a10g a10g.pc".
-
Byte-swap the data for most Unix workstations.
dd if=a10g.pc of=a10g.ux conv=swab
-
Delete the a10g.pc file. For example, "rm a10g.pc".
-
Start GRASS. Make sure that there is no mask, by interactively executing the r.mask command and removing the current mask (if any).
-
Set the GRASS region to the region of the data file by executing the following GRASS command:
g.region rast=a10g.ux
-
GRASS' multibyte format handles signed integers differently from traditional 16-bit integers used in GLOBE. Therefore, if you are importing a DEM file such as the a10g file, the following command must be executed:
r.mapcalc 'a10g=if(a10g.ux-32768,a10g.ux-65536,a10g.ux,a10g.ux)'
where a10g is the final name for this GLOBE DEM file. This step is not necessary when importing source/lineage files from the source/data directory since these files contain 8-bit values.
-
If you are importing a DEM file such as the a10g file, remove the temporary file by executing the following GRASS command:
g.remove a10g.ux
-
If you are importing a source/lineage file such as the a10s file, uncompress the files (which are compressed on the CDs and the Web site) in your grass/yourlogin/cell directory using one of the following:
unzip a10s.gz
gzip -d a10s.gz
where a10s is the final name for this GLOBE source/lineage file.
-
You may want to GRASS-compress the DEM and source/lineage files to reduce the sizes of the files. To shrink the file without changing its name, execute the following GRASS command:
r.compress a10g
r.compress a10s
-
You can now display the a10g and a10s files using the GRASS color palette files provided.
-
NOTE: You can automate the ingest of many GLOBE DEM files by scripting this procedure. Sample scripts are provided in the /data/elev/grass/script/ and /data/source/grass/script/ directories.
11.G.vi.b. Importing GLOBE Data into Your Own GRASS Data Base
-
Copy the a10g.ux and a10s GRASS cell header files (described in Section 11.F.iii) into your GRASS cellhd directory. Also copy the a10g and a10s color
palette files (described in Section 11.F.iii) into your GRASS colr directory.
-
Follow the same procedures described in the previous section except omit the first step (un-tarring the grasglob.tar file).
Return to Report Introduction.
|