I have created a map with the flow directions using the d.rast.arrow. Can i query on the map to know where the direction of the arrows are? I am going to use the arrow directions in an algorithm. Or, is there a way to store the arrow directions in a text file so that I can import it in my code? Thanks!
The arrows directions are the Z value in the aspect map. The display (d.####) commands like d.rast.arrows only output to the display. You can export the aspect map as a text file, so you will have a file with coordinates and directiction of the flow.
Why don't you just run your algorithm directly on the map you used to create the arrows? If it's an aspect map, it will already contain the direction in degrees counter-clockwise from east.
You can save the aspect map to a text file using
r.out.ascii input=aspectMap output=aspect.txt dp=2 null=*
dp is the number of significant digits, and
null is the character to be used in the ascii file when a value is not defined.
Depending on how you're implementing your algorithm, you can also do the calculations directly in GRASS using
r.mapcalc. For example, to create a map that has the value 1 for all pixels with a north western aspect and 0 for all others, use
r.mapcalc "quadrant=if(aspect>90 && aspect <180,1,0)"
The mapcalc manual might be of interest to you.