[GRASS-dev] Script for converting degrees clockwise from North to GRASS convention

Moritz Lennert mlennert at club.worldonline.be
Wed Jan 23 07:55:44 PST 2013


On 23/01/13 16:32, Margherita Di Leo wrote:
> On Wed, Jan 23, 2013 at 2:54 PM, Moritz Lennert wrote:
>
>>     On 23/01/13 13:59, Margherita Di Leo wrote:
>>>         Actually this was tricky also for me, but:
>>>
>>>         Wind direction is measured in:
>>>
>>>              *
>>>
>>>                degrees clockwise from uphill (direction the wind is
>>>         pushing the fire)
>>>
>>>              *
>>>
>>>                degrees clockwise from North (direction the wind is
>>>         blowing from)
>>>
>>>         If the wind is blowing FROM north, it means that the arrow is
>>>         TOWARDS
>>>         south.. Am I wrong?
>>
>>
>>     I guess not, but this is a very specific application of angle
>>     direction. I think that if you want to create a generic module
>>     (r.convert.aspect or r.convert.angle) for transforming angles, then
>>     North should mean North. If for a specific application North means a
>>     direction a force is coming from, then the use should take that into
>>     account. In your case the original map gives the angle the wind is
>>     coming _from_, then the output should (IMHO) do the same.
>
>
> This would be of no use for me (or the user) if it doesn't match to the
> GRASS convention. So what I suppose I should do is to explain in the
> documentation that the input should be measured from SOUTH (0=SOUTH)
> clockwise.

It all depends on whether you want to create a generic module that 
transforms angles between different conventions, or whether you want a 
very specific module for wind directions (although it is interesting to 
see that in you example the original data indicates the angle of origin 
of the wind, not of direction of the wind).

In the interest of other users, it might be better to create a generic 
angle transformation tool, which just transforms the angle of origin to 
its equivalent in the other convention without trying to interpret the 
meaning of that angle. However, it could be an option to include a flag 
that "reverses" the angles (i.e. transform a North angle into a South 
angle) in order to go from (in your wind example) origin to destination.
In terms of implementation, the easiest would probably be to chose one 
internal convention for the module and then code transformation from any 
other convention to and from that internal convention. Then you could 
just code once the "reversal" of angles in that convention.

Again, you could probably simply use r.recode: 0:360:360:0.

Just my 2¢ since you asked, but I understand that it might be overkill 
for your particular problem.

Moritz


More information about the grass-dev mailing list