[GRASS-dev] d.polar: optional EPS output added

Hamish hamish_nospam at yahoo.com
Wed Jun 21 01:27:48 EDT 2006


Markus wrote:

> I have added a new "eps=" parameter to d.polar. This
> writes the output to an EPS file instead of launching
> 'xgraph' (which isn't available on all systems by default).
> 
> Description:
>  Draws polar diagram of angle map such as aspect or flow directions
> Usage:
>  d.polar map=name [undef=value] [eps=string]
> Parameters:
>     map   Name of raster angle map
>   undef   Pixel value to be interpreted as undefined (different from NULL)
>     eps   Name of optional EPS output file
> 
> My colleague Brune Caprile wrote a LISP program for
> me to generate the EPS code from the d.polar raw data,
> I rewrite it to SHELL :-)
> 
> Now you can generate high quality polar diagrams.

(great!)



It would be nice if the xgraph part could be changed to use d.graph,
here is a start:


RADIUS_COEFF=`echo "$TOTALNUMBER $TOTALVALIDNUMBER $MAXRADIUS" | \
  awk '{printf "%.8f", $1/$2 * $3}'`

# ${TMP}_sine_cosine_replic
# ${TMP}_vector
# ${TMP}_outercircle

RING=0.95
cat ${TMP}_sine_cosine_replic | tail +2 | awk -v RING=$RING -v MAX=$MAXRADIUS \
    '{printf "%f %f\n", (($1 / MAX * RING) +1)*50, (($2 / MAX * RING)+1)*50}' \
       > ${TMP}_sine_cosine_replic_normalized

VECT=`cat ${TMP}_vector | tail -n 1 | awk -v RING=$RING -v MAX=$MAXRADIUS \
    '{printf "%f %f\n", (($1 / MAX * RING) +1)*50, (($2 / MAX * RING)+1)*50}'`


d.erase
d.graph << EOF
  # draw the goods
  color red
  polygon
   `cat ${TMP}_sine_cosine_replic_normalized`

  # draw axes
  color black
  width 0
  move 0 50
  draw 100 50
  move 50 0
  draw 50 100

  # draw circle
  #   mandatory as drawing proportional to non-square frame

  # draw vector
  color green
  width 2
  move 50 50
  draw $VECT

  # draw compass text
  color black
  width 2
  move 50.5 95
  text N
#  move 50.5 1
#  text S
#  move 1 50.5
#  text W
#  move 95 50.5
#  text E
EOF



Hamish




More information about the grass-dev mailing list