0

I have many .nc files with a variable "skt". What I want to do is to load all these files in R as raster brick and have apart from the variable, the time, too. I tried to do this with levels, but with no success. I would really appreciate any help.

list.files(pattern="*.nc")
list_all=list.files(pattern="*.nc")
skt_all<- brick(list_all,varname="skt",levels=4)


Warning messages:
1: In if (x == "" | x == ".") { :
  the condition has length > 1 and only the first element will be used
2: In if (!start %in% c("htt", "ftp")) { :
  the condition has length > 1 and only the first element will be used
3: In if (fileext %in% c(".GRD", ".GRI")) { :
  the condition has length > 1 and only the first element will be used
4: In if (!file.exists(x)) { :
  the condition has length > 1 and only the first element will be used
5: In if ((fileext %in% c(".HE5", ".NC", ".NCF", ".NC4", ".CDF", ".NCDF",  :
  the condition has length > 1 and only the first element will be used
geo_dd
  • 283
  • 1
  • 5
  • 22
  • 1
    you cannot provide multiple files to `brick`. Create several RasterBricks or use `stack` instead? – Robert Hijmans Mar 18 '19 at 15:26
  • Hi @RobertHijmans. I assume that is because brick accepts onlly one level (is that correct?). In the case of stack though, can I have multiple levels? e.g. the variable I want and the time. – geo_dd Mar 18 '19 at 16:36
  • 1
    It is not directly related to ncdf and levels. You can simply only use one file, and you are providing multiple files. – Robert Hijmans Mar 18 '19 at 20:40

0 Answers0