Faultlines in DTM with GRASS GIS

For the analyses of the excavation at HLO1 I created a digital terrain model of the site. A problem I encountered was caused by the wadi edge west of the site (see picture).

Wadi Edge at HLO1 (seen from nort)
Wadi Edge at HLO1 (seen from north)

For the surface interpolation I have measured hundreds of points all over the site and down towards the wadi. I have also measured the edge of the wadi terrace. As software I used GRASS-GIS (Version 6.4). Using all the points in one step yielded a Digital Terrain Model (DTM), where the edge of the Wadi is smoothed. Therefore I decided to do the interpolation in two steps.

Measured points and faultline in red

In the next step I used QGIS do digitest a close vector polygon (blue in the next picture) which includes all the points west of the faultline. This polygon I imported back in GRASS. You can also do this step directly in GRASS.

fault_lines2

In the next step I wanted to use this polygon to create an vector mask. Before I could do this I had to run v.category on the vector layer with the polygon.

Now I could run v.to.rast to get a raster out of the close polygon. I used this raster as a mask with the command r.mask. Because of the mask the calculation in the next step is limited to the mask.

Last but not least I could calculate the surface west of the fault line. I used for example v.surf.rest to create an DTM from the west part.

West part
West part

In the next step I had to use again the r.mask command but now with the -i flag to get an inverse Mask; Then we get a mask from the rest of the map and can calculate the DTM again.

East part
East part

To combine the two raster files we have just created, we can use r.patch to get one big raster file from the whole site.

And here is the result:

Final result
Final result

 

 

Bash – Working recursive through folders

If you use the bash to create or modify files, it could be necessary to process all subfolders. For testing I produced the following folders in a dircetory:

> tree
.
├── folder
└── folder with whitespace

2 directories, 0 files

My first idea was to use the find command in a for-loop. Here you see an example which prints out all folders on in the terminal.

If you run this short bash script and you have folders (files) with whitespaces you will run in trouble.

./for_find.sh
.
./folder
./folder
with
whitespace

So my second try was a find command piped into a while loop.

If you run this script the folders are shown in the right way.

> ./while_find.sh 
.
./folder
./folder with whitespace
>

The find command gives you the opportunity to limit the commands in your script to particular files in your folder (and your subfolders). The following find command will only show files which end on csv