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

2013-01-23 Thread Moritz Lennert

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
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

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

2013-01-23 Thread Margherita Di Leo
Moritz,

I really thank you for taking the time to discuss this.

On Wed, Jan 23, 2013 at 2:54 PM, Moritz Lennert <
mlenn...@club.worldonline.be> wrote:

> On 23/01/13 13:59, Margherita Di Leo wrote:
>
>> Hi Moritz,
>>
>> thank you for your reply,
>>
>> On Wed, Jan 23, 2013 at 12:21 PM, Moritz Lennert
>> > >
>> wrote:
>>
>>
>> If we call WIND the direction map which uses the convention
>> degrees
>> clockwise from North, and GRASS the output map, the rule that I
>> applied is:
>>
>> IF 0 <= WIND < 270 ; GRASS = 270 - WIND
>> IF WIND = 270;  GRASS = 360
>> IF 270 < WIND < 360   ;  GRASS 630 - 0
>> IF WIND = null ; GRASS = 0
>> NULL otherwise (this latter I have added to check if there is
>> any error.
>>
>>
>> This is not correct.
>>
>> WIND = 0 means North.
>>
>>
>> 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.

Thanks!

Madi

>
> Moritz
>



-- 
Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES). Unit H03 – FRC
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-...@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

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

2013-01-23 Thread Moritz Lennert

On 23/01/13 13:59, Margherita Di Leo wrote:

Hi Moritz,

thank you for your reply,

On Wed, Jan 23, 2013 at 12:21 PM, Moritz Lennert
mailto:mlenn...@club.worldonline.be>> wrote:


If we call WIND the direction map which uses the convention degrees
clockwise from North, and GRASS the output map, the rule that I
applied is:

IF 0 <= WIND < 270 ; GRASS = 270 - WIND
IF WIND = 270;  GRASS = 360
IF 270 < WIND < 360   ;  GRASS 630 - 0
IF WIND = null ; GRASS = 0
NULL otherwise (this latter I have added to check if there is
any error.


This is not correct.

WIND = 0 means North.


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.


Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


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

2013-01-23 Thread Margherita Di Leo
Hi Moritz,

thank you for your reply,

On Wed, Jan 23, 2013 at 12:21 PM, Moritz Lennert <
mlenn...@club.worldonline.be> wrote:

>
>> If we call WIND the direction map which uses the convention degrees
>> clockwise from North, and GRASS the output map, the rule that I applied
>> is:
>>
>> IF 0 <= WIND < 270 ; GRASS = 270 - WIND
>> IF WIND = 270;  GRASS = 360
>> IF 270 < WIND < 360   ;  GRASS 630 - 0
>> IF WIND = null ; GRASS = 0
>> NULL otherwise (this latter I have added to check if there is any error.
>>
>
> This is not correct.
>
> WIND = 0 means North.


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?


-- 
Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES). Unit H03 – FRC
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-...@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

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

2013-01-23 Thread Moritz Lennert

On 22/01/13 17:45, Margherita Di Leo wrote:

Hi,

I figured out that sometimes it would be useful to have a script for
converting a direction map which uses the convention degrees clockwise
from North, into the GRASS convention, which is as you well know degrees
from East counterclockwise [1]. The aim is to deal with wind direction
maps for example, which often use the above mentioned convention [2],
but also some other software.
I wrote a short tentative of such conversion tool in the form of a grass
addon for myself, enclosed. I would like to know:

1) if would be of interest for anyone here, i.e. worth to be published
in the addon repo;


+1, once it is correct.


2) if you have any idea how to make the several time nested r.mapcalc
expression less awful :-)


For me it looks ok as is (with below corrections). Or maybe you could 
simply use r.recode with rules such as:


0:89.999:90:0.999
90:360:360:90

(probably need a better way to treat the special role of '0' in GRASS).

Give it a try.



If we call WIND the direction map which uses the convention degrees
clockwise from North, and GRASS the output map, the rule that I applied is:

IF 0 <= WIND < 270 ; GRASS = 270 - WIND
IF WIND = 270;  GRASS = 360
IF 270 < WIND < 360   ;  GRASS 630 - 0
IF WIND = null ; GRASS = 0
NULL otherwise (this latter I have added to check if there is any error.


This is not correct.

WIND = 0 means North. North in GRASS convention is 90, but 270 - 0 <> 90.

Same with WIND = 270 which is West IIUC, so this should be 180 in GRASS 
convention, not 360.


This should work I think:

IF 0 <= WIND < 90 ; GRASS = 90-WIND
IF 90 <= WIND <= 360 ; GRASS = 450 - WIND

Moritz

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


[GRASS-dev] [GRASS GIS] #1860: v.extract should support 'group by' sql statement

2013-01-23 Thread GRASS GIS
#1860: v.extract should support 'group by' sql statement
-+--
 Reporter:  lucadelu |   Owner:  grass-dev@…  
 Type:  enhancement  |  Status:  new  
 Priority:  normal   |   Milestone:  7.0.0
Component:  Vector   | Version:  svn-trunk
 Keywords:   |Platform:  All  
  Cpu:  All  |  
-+--
 v.extract should have a option to use the SQL statement 'group by'. As for
 'where' we could have an option 'group' and the parameters should by a
 string with all the fields, comma separated, to use in 'group by'
 statement.

 It could be used with 'where' option

 thanks
 Luca

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev