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:
- if would be of interest for anyone here, i.e. worth to be published in the addon repo;
- if you have any idea how to make the several time nested r.mapcalc expression less awful
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.
If you are willing to countercheck my assumptions I’d appreciate.
cheers,
madi
[1] http://grass.osgeo.org/grass64/manuals/r.slope.aspect.html
[2] http://www.firewords.net/definitions/Wind_direction.htm
–
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-leo@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.
(attachments)
r.convert.aspect.py (1.76 KB)