Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

list of all variable names from a NetCDF dataset, in R [duplicate]

Tags:

r

netcdf

I'm using the RNetCDF package in R. I'm trying to get a list of all variables names from an imported .nc datasets (I can easily get the vector of values from the few variables whose names I know, but I only know a small subset of all the variables names).

like image 651
user189035 Avatar asked Nov 27 '25 18:11

user189035


1 Answers

I use the ncdf pacakge which I found to be much easier to install than the RNetCDF package across operating systems (notably Linux and MacOS). To get the list of variables you simply:

library(ncdf)
nc = open.ncdf('example.nc')
variables = names(nc[['var']])
like image 57
Paul Hiemstra Avatar answered Nov 30 '25 10:11

Paul Hiemstra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!