R/getNARRforBioCro.R

#'  This functions return NARR climate data from for a given latitude/longitude and year to simulate BioCro
#'  
#'  @param Latitude
#'  @param Longitude
#'  @year year
#'  @return Data frame containing climate data to be used with BioCro
#'  @export
#'  
getNARRforBioCro<-function(lat,lon,year){
  USlayer<-read.table("/home/groups/ebimodeling/met/NARR/ProcessedNARR/NARRindex.txt")
  index=which.min((lat-USlayer$Latt)^2+(lon-USlayer$Lonn)^2)
  i=USlayer$Iindex[index]
  j=USlayer$Jindex[index]
  filename=paste("/home/groups/ebimodeling/met/NARR/ProcessedNARR/",year,formatC(i,width=3,flag=0),formatC(j,width=3,flag=0),".RData",sep="")
  load(filename)
  return(dat)
}
djaiswal/BioCroRegional documentation built on May 15, 2019, 8:53 a.m.