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

Margherita Di Leo dileomargherita at gmail.com
Tue Jan 22 08:45:45 PST 2013


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;
2) 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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130122/012f124a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.convert.aspect.py
Type: application/octet-stream
Size: 1806 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130122/012f124a/attachment.obj>


More information about the grass-dev mailing list