[R] Problems trying to make a time series using NetCDF file

r@i@1290 m@iii@g oii @im@com r@i@1290 m@iii@g oii @im@com
Sat Mar 16 18:50:46 CET 2019


Hi there,
I am using climate model data in attempt to create a time series for a specific location. Getting longitude and latitude is fine. However, I am receiving the following error when using the "ncvar_get" function in trying to derive the "time" dimension:
Error in nc$dim[[idobj$list_index]] : 
  attempt to select more than one element in get1index <real>
What could be causing this?
-This is what I have done so far:
#CanESM2 plotting for specified yearncfname<-"MaxPrecCCCMACanESM2rcp45.nc"
Prec<-raster(ncfname)
print(Prec)
Model<-nc_open(ncfname)longitude<-ncvar_get(Model, "lon") #Works fine
latitude<-ncvar_get(Model, "lat") #Works fine
time<-ncvar_get(Model, "time") #Error in nc$dim[[idobj$list_index]] : attempt to select more than one element in get1index <real>


Here is the structure of the file after using "nc_open":
File MaxPrecCCCMACanESM2rcp45.nc (NC_FORMAT_NETCDF4):

     3 variables (excluding dimension variables):
        double onedaymax[lon,lat,time]   (Contiguous storage)  
            units: mm/day
        double fivedaymax[lon,lat,time]   (Contiguous storage)  
            units: mm/day
        short Year[time]   (Contiguous storage)  

     3 dimensions:
        time  Size:95
        lat  Size:64
            units: degree North
        lon  Size:128
            units: degree East
What could be causing this error? 
Thanks in advance, and I look forward to your response!
	[[alternative HTML version deleted]]



More information about the R-help mailing list