Closed ezaron closed 3 years ago
Thanks for the report, the documentation seems to be outdated here. For now you can use keys(nc.vars)
. In general, since the NetCDF.NcFile itself behaves like a dictionary, I think overloading Base.keys
should be the way to go instead of providing a new function. I have created this PR #143 to fix the documentation.
Thanks, Fabian.
I used keys(nc.vars), but I had to go through some gymnastics to convert a key to a string. It was not as straightforward as I imagined.
-Ed
On 2/23/21 1:20 AM, Fabian Gans wrote:
[This email originated from outside of OSU. Use caution with links and attachments.]
Thanks for the report, the documentation seems to be outdated here. For now you can use |keys(nc.vars)|. In general, since the NetCDF.NcFile itself behaves like a dictionary, I think overloading |Base.keys| should be the way to go instead of providing a new function. I have created this PR #143 https://github.com/JuliaGeo/NetCDF.jl/pull/143 to fix the documentation.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaGeo/NetCDF.jl/issues/142#issuecomment-784028204, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4FGFQMNBIRTOYLN3RBULTANXMTANCNFSM4YA7UTXQ.
--
Edward D. Zaron Associate Professor (Senior Research) College of Earth, Ocean, and Atmospheric Sciences Oregon State University edward.d.zaron@oregonstate.edu
I'm running julia 1.5.3.
The documentation says there is a NetCDF.names function which pull varnames out of an NcFile handle.
In the REPL:
using NetCDF fx = "./patchdef.nc" nc=NetCDF.open(fx,mode=NC_NOWRITE,readdimvar=true) names(nc)
ERROR: MethodError: no method matching names(::NcFile)
Closest candidates are:
names(!Matched::Module; all, imported) at reflection.jl:98
Stacktrace:
[1] top-level scope at none:1
I can see that nc is populated with header information, but I do not see how to get a list of varnames or dimensions.