The following objects are masked from 'package:base':
date, intersect, setdiff, union
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: ggplot2
The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
which was just loaded, will retire in October 2023.
Please refer to R-spatial evolution reports for details, especially
https://r-spatial.org/r/2023/05/15/evolution4.html.
It may be desirable to make the sf package available;
package maintainers should consider adding sf to Suggests:.
The sp package is now running under evolution status 2
(status 2 uses the sf package in place of rgdal)
ℹ Google's Terms of Service: <https://mapsplatform.google.com>
ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ stringr 1.5.0
✔ forcats 1.0.0 ✔ tibble 3.2.1
✔ purrr 1.0.2 ✔ tidyr 1.3.0
✔ readr 2.1.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Site Location
Longitude=-122.086666Latitude =54.53
Geocode
Based on the site location, locations have been implemented and coordinates have been obtained using geocode from Google. Additionally, elevation information has been captured using Google Maps.
# Define the location you want to geocodelocations <-c("Bear Lake, BC, Canada","McLeod Lake, BC, Canada","Prince George, BC, Canada")# Geocode the locationgeocoded_location <-geocode(locations)coord_tbl<-rbind(data.frame(site="site",lon=Longitude, lat=Latitude),data.frame(site=locations, geocoded_location)) %>%mutate(Elev=mapply(GM_elev,lon,lat,key_google=key_google))pander::pandoc.table(coord_tbl)
Based on SRK’s experience, the climatic gridded model Daymet is suitable for providing meteorological values related to precipitation and air temperature. However, it is recommended to perform bias correction of Daymet based on local records and location-specific information, such as Prince George, when available. This step was not implemented in this case but will be a part of the meteorological review for the project.
Daymet is a gridded meteorological dataset that provides daily estimates of minimum temperature, maximum temperature, precipitation, shortwave radiation, vapor pressure, and snow water equivalent over North America. The dataset is generated by merging ground-based observations with spatially interpolated weather data from multiple sources such as satellite and numerical weather models. The dataset is available for the period of 1980 to present, and it has a spatial resolution of 1km.
meteo_lst<-lapply(1:nrow(coord_tbl),FUN=function(x){ pander::pandoc.header(coord_tbl[x,1],level=2) pander::pandoc.p('') pander::pandoc.p('') daymet_info<-daymetr::download_daymet(site = coord_tbl[x,1],lat = coord_tbl[x,3],lon=coord_tbl[x,2]) daymet_date<-ymd(paste0(daymet_info$data$year,"-01-01"))+days(daymet_info$data$yday-1) daymet_info_tbl<-data.frame(date=daymet_date,daymet_info$data[,-c(1,2)]) daymet_z<-tk_zoo(daymet_info_tbl) daymet_ma_tbl<-rbind(daily2annual.avg(daymet_z$prcp..mm.day.),daily2annual.avg(daymet_z$tmax..deg.c.,FUN=mean),daily2annual.avg(daymet_z$tmin..deg.c.,FUN=mean),daily2annual.avg(0.5*daymet_z$tmax..deg.c. + daymet_z$tmin..deg.c.,FUN = mean)) %>%data.frame(parameter=c("Total Precip.","Max Air Temp.","Min Air Temp.","Avg. Air Temp."),.) pander::pandoc.table(daymet_ma_tbl,round=1,split.table=Inf,caption="Mean monthly values based on Daymet (1980 - 2022)")return(daymet_ma_tbl)})