#Get some model data outputted by ReadGrib
#This data is from late July and covers the state of North Carolina and nearby regions
data(GFS)
#Make it into an array
gfs.array <- ModelGrid(gfs.model.data, 0.5, 0.5)
#What variables and levels we have
print(gfs.array$levels)
print(gfs.array$variables)
#Find minimum temperature at the ground surface, and where it is
min.temp <- min(gfs.array$z[2, 1,,] - 273.15)
sprintf("%.1f", min.temp) #in Celsius
ti <- which(gfs.array$z[2, 1,,] == min.temp + 273.15, arr.ind = TRUE)
#Turns out two locations get the minimum temperature prize.
#One of them is near Cumberland, Kentucky.
lat <- gfs.array$y[ti[1,2]]
lon <- gfs.array$x[ti[1,1]]
#Find maximum relative humidity at ground level
max.rh <- max(gfs.array$z[2, 2,,])
sprintf("%.1f", max.rh)
#Find maximum temperature at 100 mb atmospheric pressure
max.temp <- max(gfs.array$z[1, 1,,]) - 273.15
sprintf("%.1f", max.temp) #Brrr!
Run the code above in your browser using DataLab