More Related Content
Similar to “R” statistical tool for engineering environment-hydrology students (20)
More from Ramesh Dhungel (10)
“R” statistical tool for engineering environment-hydrology students
- 3. 2/26/2016 “R” Statistical Tool for Engineering/Environment/Hydrology Students | Ramesh Dhungel | LinkedIn
https://www.linkedin.com/pulse/rstatisticaltoolsengineeringstudentrameshdhungel?trk=pulse_spockarticles 3/31
Figure 2. Daily average K based on the grass reference from the original FAO56
model and the FAO56 (skin) and from the Hydrus1D for silt loam using h = 3
m compared against lysimeter measurements near Kimberly, Idaho during
August and September, 1977
b) Analyzing and plotting (Water consumption, economic and policy
analysis)
Now, I have to plot multiple crops in multiple counties with irrigated crop areas
with a massive data set in multiple formats. I was already known to R, so I
started looking how it can be done, because this kind of work can be complicated
on excel too. Exploring multiple packages in R, I was able to analyze, write a code
and compile the results. I started thinking, R seems helpful as well as powerful.
My earlier hard work to learn R had paid a little bit.
# Code example
library(MASS)
library(calibrate)
p ggplot( data = DAU_monthly, aes(x=County, y=ICA)) +
geom_boxplot(aes(fill=Crop),outlier.size=6,outlier.colour="green",notch=FALSE)
p + facet_wrap( ~ County, scales="free") +
xlab ("County") +
ylab ("ICA (1000 acres)")+
guides(fill=guide_legend(title="Crop", size=10)) +
theme(axis.text=element_text(size=20),
axis.title=element_text(size=20,face="bold"))
- 4. 2/26/2016 “R” Statistical Tool for Engineering/Environment/Hydrology Students | Ramesh Dhungel | LinkedIn
https://www.linkedin.com/pulse/rstatisticaltoolsengineeringstudentrameshdhungel?trk=pulse_spockarticles 4/31
Figure 3. Irrigated Crop area (ICA in 1000 acres) for DAUs within California
counties, USA of 20 proxy crops (2005)
c) 3d Plot (Ground water and surface management, interactions and
policy analysis)
Now, I am thinking, I want to show something interesting in 3D, a more
interesting result, right. Yes, I think, I did it.
# Code example
Plot1=cloud(as.matrix(Plot_data1), panel.3d.cloud = panel.3dbars,
#trellis.par.set("axis.line",list(col="transparent")),
xbase =0.4, ybase = 0.4,
zlim = c(0, max(Plot_data1),cex=1),
scales = list(arrows = FALSE, just = "right",
x=list(cex=1, at =
c(1:40),lab=c("",212.00,213.00,214.00,215.00,233.00,234.00,240.00,242.00,243.00,256.0
y=list(cex=1),z=list(cex=1) ),
xlab = list("DAU",cex=1),
ylab = NULL,
zlab=NULL,
main = list(" a) % GW Contribution (2012)", cex = 1.5,inset = c(50,.81)),
col.facet = level.colors(as.matrix(Plot_data1), at =
do.breaks(range(Plot_data1), 10),
- 5. 2/26/2016 “R” Statistical Tool for Engineering/Environment/Hydrology Students | Ramesh Dhungel | LinkedIn
https://www.linkedin.com/pulse/rstatisticaltoolsengineeringstudentrameshdhungel?trk=pulse_spockarticles 5/31
col.regions = terrain.colors,
colors = TRUE),
aspect = c(0.8, 0.4),check.overlap = TRUE, par.settings =
list(layout.heights=list(xlab.key.padding=1)), colorkey = list(col =
terrain.colors, width = 1.8, height = 0.6,at = do.breaks(range(Plot_data1), 20),
space = 'right',labels=list(cex=2),draw=TRUE), screen = list(z = 50, x =60 ))
Plot1
Figure 4. Ground water contribution to certain DAUs of Central Valley,
California, USA
d) Complicated 2d plots (Environmental management, ecosystem
services and water quality)
Finally, I want to do something different. I want to plot a water temperature
profile of each layer in different hypothetical pools for an entire season of the San
Joaquin River, California, USA.
# Code example
levelplot_DNB_1levelplot(as.matrix(z_DNB),col.regions=rgb.palette,
scales=list(x=list(at=seq(1,36009, by = 1800),labels=seq(100, 300,
- 6. 2/26/2016 “R” Statistical Tool for Engineering/Environment/Hydrology Students | Ramesh Dhungel | LinkedIn
https://www.linkedin.com/pulse/rstatisticaltoolsengineeringstudentrameshdhungel?trk=pulse_spockarticles 6/31
by=10),cex=1.5),
y=list(at=seq(1,23, by = 2),
labels=round(seq(0.28, 7.02, by=0.61272),2), cex=1.5)),
par.settings = list(layout.heights=list(xlab.key.padding=1)),
xlab=list(label="Julian Day",cex=1),
ylab=list(label="Depth (23 levels of 6m pool)",cex=1.2),
main=list(label="Simulated Temperature for DNB (oC)", cex=2.5),
aspect="fill",colorkey=list(space="bottom"))
Figure 5. Water temperature profile of hypothetical pool in San Joaquin River,
California
e) Dynamic modeling (statistical tools for water resources
management and policy analysis)
One day, I have to plot the vector auto regression model results with literally
1000s of coefficients. I need to write a fine dynamic code to accompanying these
coefficients. Without thinking too much, I realized that R can be powerful. I
worked long hours to develop this code where I virtually developed a dynamic
daily discharge forecasting model for the San Joaquin River with various
exogenous and endogenous gauging stations. A big relief. Now I am thinking, how
can be this achieved without R. Woo, yes, it can be a very good friend to
engineering students too.
# Code example (Very long and complicated Not shown)
to that first job
Valerie Jarrett
Pulse Publish a post
Home Profile My Network Jobs Interests Business Services Try Premium for free
Advanced
1
Search for people, jobs, companies, and more...