How to import data from netCDF into 'R' platform?

 Posted by Niladri.Biswas on 5/1/2013 | Category: Others Interview questions | Views: 2891 | Points: 40
Answer:

Unidata’s netCDF (network Common Data Form) open source software contains machine-independent data formats for the creation and distribution of array-oriented scientific
data. netCDF is commonly used to store geophysical data. The ncdf and ncdf4 packages provide high-level R interfaces to netCDF data files.

The ncdf package provides support for data files created with Unidata’s netCDF library and is available for Windows, Mac OS X, and Linux platforms.

Consider this code:

library(ncdf)

nc <- nc_open("mynetCDFfile")
myarray <- get.var.ncdf(nc, myvar)


In this example, all the data from the variable myvar , contained in the netCDF file mynetCDFfile , is read and saved into an R array called myarray.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response