How to extract variable names from a netCDF file in R?

后端 未结 2 844
旧巷少年郎
旧巷少年郎 2021-01-11 12:12

I am writing a function in R to extract some air quality modelling data from netCDF files. I have the Package \"ncdf\" installed.

In order to allow other users or my

2条回答
  •  余生分开走
    2021-01-11 13:11

    If your ncdf object is called nc, then quite simply:

    names(nc$var)
    

    With an example, using the dataset downloaded here, for instance (since you didn't provide with one):

    nc <- open.ncdf("20130128-ABOM-L4HRfnd-AUS-v01-fv01_0-RAMSSA_09km.nc")
    names(nc$var)
    [1] "analysed_sst"     "analysis_error"   "sea_ice_fraction" "mask"   
    

提交回复
热议问题