[GRASS-dev] Re: [GRASS GIS] #498: r.sun2 out of sync / broken svn history

GRASS GIS trac at osgeo.org
Wed Aug 12 08:23:41 EDT 2009


#498: r.sun2 out of sync / broken svn history
---------------------+------------------------------------------------------
  Reporter:  hamish  |       Owner:  hamish          
      Type:  defect  |      Status:  assigned        
  Priority:  major   |   Milestone:  6.4.0           
 Component:  Raster  |     Version:  svn-develbranch6
Resolution:          |    Keywords:  r.sun           
  Platform:  Linux   |         Cpu:  x86-32          
---------------------+------------------------------------------------------
Comment (by hamish):

 r.sun2 seems safe to background without worrying if it will clobber the
 region settings, so a poor-man's multi-threading script is used to help
 speed things up on the quad-core.

 The next tests are summing a whole bunch of Mode 1 steps with r.series +
 r.mapcalc and see how it compares to the Mode 2 daily sum map. Trying with
 a time step of 0.01 from sunrise to sunset on day 355:

 {{{
 r.info from Mode 2 beam_rad map:
 Sunrise time min-max (hr.):     7.68
 Sunset time min-max (hr.):     16.32
 }}}

 {{{
 ### mode 1 loop ###
 SUNRISE=7.67
 SUNSET=16.33
 STEP=0.01
 # | wc -l   867
 CORES=4

 for TIME in `seq $SUNRISE $STEP $SUNSET` ; do
    echo "time=$TIME"
    CMD="r.sun -s elevin=gauss day=$DAY time=$TIME \
          beam_rad=rad1_test.355_${TIME}_beam --quiet"

    # poor man's multi-threading for a multi-core CPU
    MODULUS=`echo "$TIME $STEP $CORES" | awk '{print $1 % ($2 * $3)}'`
    if [ "$MODULUS" = "$STEP" ] ; then
       # stall to let the background jobs finish
       $CMD
       sleep 2
    else
      $CMD &
    fi

 done


 for TIME in `seq $SUNRISE $STEP $SUNSET` ; do
    r.colors rad1_test.355_${TIME}_beam col=rules --quiet << EOF
      0 white
      0.000001 blue
      33.333% cyan
      66.667% yellow
      100% red
 EOF
 done
 }}}


 ... in progress ...


 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/498#comment:12>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list