[R] Lake Analyzer Help

Kyle Wittmaier wittmaierk at gmail.com
Wed Jul 13 18:43:10 CEST 2016


Below is the code that was used. The packages that were included are
rLakeAnalyzer, lattice, matrix, manipulate. The same script and data files
works perfectly on a colleagues computer. On my computer it runs fine with
no error messages however there gaps in the plots that it produces. Any
help that can be provided would be extremely appreciated. Thank you.





area = 12755360 #Area of lake in m^2

wnd.height = 2 #Height of lake anemometer

bathy = load.bathy("cbr_bth.txt")

head(bathy)

temp = load.ts("cbr_wtr.txt", tz = "EST")

wind = load.ts("cbr_wnd.txt", tz = "EST")

head(temp[,1:5])

head(wind)

temp.dly = aggregate(temp[,-1],by=list(as.Date(temp[,1])),FUN=mean)

names(temp.dly) = names(temp)



wind.dly = aggregate(wind[,-1],by=list(as.Date(wind[,1])),FUN=mean)

names(wind.dly) = names(wind)

temp.1 = as.numeric(temp.dly[temp.dly$datetime == "2014-07-07",-1])

wind.1 = as.numeric(wind.dly[wind.dly$datetime == "2014-07-07",-1])

depths = get.offsets(temp.dly)

depths

t.d = thermo.depth(temp.1, depths)

cat('Thermocline depth is:', t.d)

m.d = meta.depths(temp.1, depths)

cat('The top depth of the metalimnion is:', m.d[1])

cat('The bottom depth of the metalimnion is:', m.d[2])

meta.temp = layer.temperature(m.d[1],m.d[2],temp.1,

                  depths,bathy$areas,bathy$depths)

cat('The average temperature of the metalimnion is:', meta.temp)

dens = water.density(temp.1)

plot(temp.1, dens, xlab="Temp(deg C)", ylab="Density(kg/m^3)")

epi.dens = layer.density(0,m.d[1],temp.1,

                  depths,bathy$areas,bathy$depths)

hypo.dens = layer.density(m.d[2],max(depths),temp.1,

                  depths,bathy$areas,bathy$depths)

SS = schmidt.stability(temp.1, depths, bathy$areas,bathy$depths)

SS

uS = uStar(wind.1,wnd.height,epi.dens)

uS

LN = lake.number(bathy$areas, bathy$depths, uS, SS, m.d[1], m.d[2], hypo.dens)

LN

WN = wedderburn.number(hypo.dens - epi.dens, m.d[1],

                           uS, area, hypo.dens)

WN

ts.TD = ts.thermo.depth(temp.dly)

ts.MD = ts.meta.depths(temp.dly)



plot(ts.TD$datetime, -ts.TD$thermo.depth, type='l', ylab='Depth (m)',
xlab='Date')

lines(ts.MD$datetime, -ts.MD$top, col='red')

lines(ts.MD$datetime, -ts.MD$bottom, col='red')



ts.SS = ts.schmidt.stability(temp.dly, bathy)

ts.uS = ts.uStar(temp.dly, wind.dly, wnd.height, bathy)

ts.LN = ts.lake.number(temp.dly, wind.dly, wnd.height, bathy)

plot(ts.LN$datetime, ts.LN$lake.number, type='l', ylab='Lake Number',
xlab='Date')

meta.temp = ts.layer.temperature(temp.dly, ts.MD$top, ts.MD$bottom, bathy)

plot(meta.temp$datetime, meta.temp$layer.temp, type='l',

ylab='Volumetrically averaged lake temperature', xlab='Date')

# buoyancy.freq

buoyancy.freq(as.numeric(temp.dly[1,-1]), depths)



# ts.buoyancy.freq

N2 = ts.buoyancy.freq(temp.dly, seasonal=FALSE)

SN2 = ts.buoyancy.freq(temp.dly, seasonal=TRUE)



plot(N2, type='l', ylab='Buoyancy Frequency', xlab='Date')

lines(SN2, col='red')

ts.WN = ts.wedderburn.number(temp.dly, wind.dly, wnd.height, bathy, area)

plot(ts.WN$datetime, ts.WN$wedderburn.number, type='l',

     ylab='Wedderburn Number', xlab='Date')

schmidt.plot(temp.dly,bathy)

lake.number.plot(temp.dly,wind.dly,wnd.height,bathy)

wtr.plot.temp(temp.dly)

wtr.heat.map(temp.dly)

wtr.heatmap.layers(temp.dly)

wtr.lineseries(temp.dly, ylab = "Temperature C")



On Wed, Jul 13, 2016 at 10:44 AM, Thierry Onkelinx <thierry.onkelinx at inbo.be
> wrote:

> Please keep the mailing list in cc.
>
> See http://adv-r.had.co.nz/Reproducibility.html for some instructions.
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2016-07-13 16:38 GMT+02:00 Kyle Wittmaier <wittmaierk at gmail.com>:
>
>> would providing the script be the most efficient means to show an example?
>>
>> On Wed, Jul 13, 2016 at 10:34 AM, Thierry Onkelinx <
>> thierry.onkelinx at inbo.be> wrote:
>>
>>> This will be very hard to answer without a reproducible example.
>>>
>>> ir. Thierry Onkelinx
>>> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>>> and Forest
>>> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>>> Kliniekstraat 25
>>> 1070 Anderlecht
>>> Belgium
>>>
>>> To call in the statistician after the experiment is done may be no more
>>> than asking him to perform a post-mortem examination: he may be able to say
>>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>>> The plural of anecdote is not data. ~ Roger Brinner
>>> The combination of some data and an aching desire for an answer does not
>>> ensure that a reasonable answer can be extracted from a given body of data.
>>> ~ John Tukey
>>>
>>> 2016-07-13 15:50 GMT+02:00 Kyle Wittmaier <wittmaierk at gmail.com>:
>>>
>>>> I am using LakeAnalyzer in Rstudio to produce heat maps and plots using
>>>> data from constant monitoring buoys. I have a prewritten script that is
>>>> functioning on a colleagues computer perfectly. I am using Rstudio
>>>> 0.99.902
>>>> and R 3.3.1. I have added four packages to the project (lattice,
>>>> manipulate, matrix, and rLakeAnalyzer). I am using the exact same data
>>>> files and process as my colleague. When I run the script no error
>>>> messages
>>>> appear and everything appears to work perfectly, except there are
>>>> significant gaps in the data shown on the plots. Any ideas?
>>>>
>>>> Thank you
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>
>>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list