You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a netcdf file and I want to programmatically determine the list of variables contained in the file. The only utility I could identify is NetCDF.info but it just prints a bunch of info to screen.
The text was updated successfully, but these errors were encountered:
The NcFile type returned by NetCDF.open contains a dict holding paris of variable names and NcVar diskarrays. You can extract the variable names as follow:
nc = NetCDF.open(p)
varnames =keys(nc.vars)
This will include all variables including dimension variables. Also, if you want to make sure the NetCDF file gets immediately closed after the query and not only when gc is triggered you can use the do-syntax. So the following would return all variable names that are not a dimension name at the same time and make sure the file is immediately closed again.
NetCDF.open(p) do nc
setdiff(keys(nc.vars),keys(nc.dim))
end
I have a netcdf file and I want to programmatically determine the list of variables contained in the file. The only utility I could identify is NetCDF.info but it just prints a bunch of info to screen.
The text was updated successfully, but these errors were encountered: