I am learning to use ERA-interim in my work. I need to analyze a two-year series for a meteorological station that is a point in shapefile format and also visualize the data for a basin. So far I have read the netcdf file and declared variables
rm(list=ls())
graphics.off()
library(raster)
library(ncdf4)
library(maps)
library(maptools)
library(rgdal)
library(tidyverse)
library(reticulate)
library(ggthemes)
library(viridis)
setwd("C:/Users/TPPC/Desktop")
rutas <- list.files(path=getwd())
ncin<-nc_open("interim_2t_20152016.nc")
lat=ncvar_get(ncin,'latitude')
lon=ncvar_get(ncin,'longitude')
t<- ncvar_get(ncin, "time")
tunits<-ncatt_get(ncin,'time')
tunits$units
tustr<- strsplit(tunits$units, " ")
timestamp = as.POSIXct(t*3600,tz='GMT',origin=tustr[[1]][3])
data<-data_frame(name=attributes(ncin$var)$names) %>%
bind_cols(map_df(.$name,ncatt_get,nc=ncin)) %>%
mutate(values=map(name,ncvar_get,nc=ncin))
nc_close(ncin)
data
df<-expand.grid(lon=lon-360,lat=lat,timestamp=timestamp,name=data$name) %>%
mutate(coord=factor(paste(lon,lat,'/')))
*But in this last line I get the next error Error: cannot allocate vector of size 645.2 Mb