[GRASS-user] Re: [GRASS-dev] Changes to r.sun made Feb 2006 [resolved]

Dylan Beaudette dylan.beaudette at gmail.com
Tue Dec 5 18:12:58 EST 2006


Hi Hamish:

On Sunday 03 December 2006 22:46, Hamish wrote:
> Dylan Beaudette wrote:
> > I can think of a couple of things to be added to the manual page: much
> > of which I would be happy to write.
>
> may I suggest we prepare the draft in a Wiki page. A 28 page long man
> page isn't useful (too much info to quickly find what you need). A
> concise man page with a link to "the r.sun users' guide" (pdf/html)
> would be much better IMO.

Good point. Lets try and do it this way.

> H:
> > > Did you extract the Linke turbidity values from the app. on the EU
> > > web site, derive it from measured in situ values, or are you
> > > tweaking that variable as a calibration to get r.sun to match your
> > > measured radiation values?
>
> D:
> > I used the 'rural' values from the r.sun manual page as a starting
> > point, and then modified according to my observations of the local
> > climate + tweaking to make r.sun match the weather station: i.e. i
> > need a more robust approach!
>
> I thought the SoDa page used to be linked from the r.sun page, but no
> longer I guess as the link has changed.

Looks like it.

> Get local Linke values from the SoDa Solar radiation Databases
>   http://www.soda-is.com/

Tried this, and got unrealistic values for my site.

> --
> Java applet:   (old link, no longer works)
>   http://prime.jrc.it/SoDa/SoDa.html
>   SoDa Prototype -> Climatological Data & Derived -> Climatological Data
>       -> Monthly values of the Linke turbidity factor [double-click]
> --
>
> Now you extract local values with a PHP script:
>   http://www.soda-is.com/eng/services/climat_eng.html
> info:  (+ links to worldwide monthly maps)
>   http://stratus.meteotest.ch/soda_tl/soda_tl.html
>
> the worldwide database was available for purchase, I'm not sure of the
> current state of that.
>
> other useful links:
> Jaro's talk at the 2002 GRASS conference:
> http://www.ing.unitn.it/~grass/conferences/GRASS2002/proceedings/proceeding
>s/pdfs/Hofierka_Jaroslav.pdf Video of the presentation:
>  http://www.jus.unitn.it/services/arc/2002/0911/7.ram

thanks. had this on file, and forgot about it.

> > > I see you have a bit of sawtooth noise in your plots. FWIW to avoid
> > > introducing this monthly jump I wrote a little app some time ago
> > > which interpolated daily Linke value from the monthly Linke averages
> > > (for use in r.sun bash script loop) [assume monthly averages are for
> > > day 15 of each month and interpolate for the days in between]. I'd
> > > have to dig it out, & it's probably a mix of Matlab+C. Maybe
> > > something for the wiki add-ons.
> >
> > Indeed! I am using a constant value for the entire month. this
> > approach is a  step in the right direction, but introduces those
> > sawtooth artifacts. Since I  am working in R most of the time (for
> > numerical operations at least), I think  that i might implement it
> > there, and then save the results for use in a bash  script - which
> > invokes r.sun.
> >
> > Did your code look something like this;
> > # define monthly averages
> > l <- c(5.9,5.8,5.6,5.6,5.3,5.0,4.8,5.0,5.0,5.2,5.4,5.6)
> > # use periodic spline interpolation to fill in the 365 days of the
> > # year
> > l.s <- spline(l, method="periodic", n=365)
> > # plot results:
> > plot(l, xlab="month", ylab="Linke Turbidity")
> > lines(l.s)
> >
> > note that this is not quite correct as it interpolates from the
> > *start* of the  month, as opposed to the middle. Doing that would
> > require knowing the day of  the middle of the month- i'll cook up that
> > example shortly.
>
> something like that (I don't understand much R syntax). I didn't bother
> to figure out if the middle of the month was day 14|14.5|15|15.5, I just
> figured day 15 was close enough -- we shouldn't fool ourselves into
> thinking the interpolated values will be high precision data.

Ok. Here is some more sample code, with annotation- this time associating the 
mean monthly values with the center of each month:

# same monthly estimates
ld <- c(5.9,5.8,5.6,5.6,5.3,5.0,4.8,5.0,5.0,5.2,5.4,5.6)

# approximate month centers: pretend months are always 30.41 days long
d <- seq(15,365, by=30.41)

# combine into matrix, by column
ldd <- cbind(d,ld)

# spline interpolation;
ldd.s <- spline(ldd, method="periodic", n=365)

# plot
plot(ldd, xlab="Day of the Year", ylab="Linke Turbidity")
lines(ldd.s)


# dump daily interpolated values in a script-friendly format:
write.table(paste('linke[', 1:365, ']=', round(ldd.s$y,3), sep=''), 
row.names=F, quote=F)


> I am not familiar with "linke_monthly[1]=5.9" in bash. Is that legal??
>

I am not sure if it is legal, but it seems to work for me.

Thanks for the tips,

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list