Error message

  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in book_prev() (line 775 of /home3/gardeoi3/public_html/iamrandom/modules/book/book.module).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home3/gardeoi3/public_html/iamrandom/includes/common.inc).

Converting Netcdf files to R

Occasionally, I need to open .nc files. The names command does not work quite as I expected. Instead there is a names command to see all of the variables in the dataset.

library(ncdf)
data = open.ncdf(filename.nc)
print(data)  #gives an overview of some of the contents of the netcdf file
names(data$var)   #gives the actual variable names
var1_R=get.var.ncdf(data, "var1")   ## assume var1 is one of the variables in the dataset

Tags: