I am currently trying to create a time series of precipitation data from the CRU global land precipitation data. The file I am working has 60 time slices, from 2011-2015.
My code so far is:
b<-brick('/Volumes/LDRIVE2/Masters/Dissertation/Global Surface Water Explorer/UEA_rainfall/cru_ts4.00.2011.2015.pre.dat.nc/cru_ts4.00.2011.2015.pre.dat.nc')
lon<-c(26.25,27.75)
lat<-c(-16.25,-15.25)
points<-SpatialPoints(cbind(lat,lon))
points_data <- b
raster::extract(points, df = T) %>%
gather(date, value, -ID) %>%
spread(ID, value) %>%
mutate(date = ymd(str_sub(names(b),2))) %>%
as_tibble()
plot(points_data$date,points_data$`1`)
The following error appears when I try to run this:
'Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf'
As you can see from above I am trying to create a timeseries for a range of coordinates, if it is simpler to find an average of these points and then plot a timeseries I would but also having difficulties with this. This is my first time trying to netCDF files so I not overly confident with it, any suggestions of how to do this would be greatly appreciated!