Friday, July 22, 2011

GRASS: Day 5

Catching up on yesterday's work - work meeting in the evening two nights in a row does challenge my blog writing skills... -

I am finally seeing some good progress in my understanding of the raster function by starting to find useful tricks... but I also came to the conclusion that I might need to be more selective in my reading because trying to understand every single page might bring me to a similar status and appearance to Mathusalem.

Again I witness today that the Python GUI (still the best thing for me to use as I couldn't get a proper display with the command line) has some command that it doesn't take however there seems to be usually alternative.

A great example of this is with the querying function for raster layers.
Mitasova and Neteler recommend the following command which enables a interactive querying methods with controls... which fails in the python GUI
d.what.rast
The manual option (again manual in my world means to option that you have to click on in the GUI) has been highlighted in circle in the screenshot below ( I had to draw a equivalent to the pointer)...

 but is it also possible to still do it through the command line with the following code (with North Carolina dataset, as usual) with the coordinates of the point.
r.what -f landuse96_28m east_north=638650.220610
(the -f flag includes the category's name)

now some other informative query codes
#numeric terrain profile
r.profile
#univariate statistic can use flag -e to show median and 90th percentile
r.univar
#statistic report, possible to use unit to ask for extra info eg. cell, hectares, percent
r.report landuse96_28m unit=c,h,p

Solution to Day 4's Problem 1

now I hope you are all well seated because... I have found the solution to yesterday problem 1, ouf, how exciting... (sorry with perspective, thinking how chuffed I was yesterday to figure that one, well, it is fairly worrying...)

So as a reminder, hell were breaking loose when  was typing this line of code...
d.rast -o elevation val=100-160
but I could do the overlay manually and in the menu they were even saying how overlay was the flag o...
well due to a mixture of desperation, genius or insanity, since I was facing a similar code problem... (sorry didn't take note of the code itself, but as you will soon see it is irrelevant)
I tried this instead.
d.rast elevation val=100-160 -o
It worked. In vernacular, I moved -o to the end, since I noticed that some code had the flag at the end and when I was doing so the GUI was giving me the o option... (which is why I like this python GUI, we are maintaining a lovely relationship now)

The quest of the missing code

A little problem I encountered today though was a missing code... Not only it didn't work in the GUI, it even wasn't in the list... and when I looked into the GRASS manual, well it was none existant... So if anyone can explain why they make quite a fuss about it in the book (maybe it only works and even show up to a chosen few) please let me know... hehe.
r.digit
(v.digit exists, but not r.digit)

But let's leave these myterious matters behind, to expose the first concrete useful thing for a archaeologist I have finally achieved on GIS...
Can you guess? Yes... That's it.
I have generated a random sampling map... WONDERFUL. (now that is exciting and even useful)
r.random.cells
Here is the masterpiece... Isn't it absolutely gorgeous? And I have even modified the Metadata about it...
Un vrai chef-d'oeuvre...

No comments:

Post a Comment