From 9b85239161522a1ddf8c57c5386ebb1ce2f1ded1 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Tue, 14 Nov 2023 22:32:23 +0100 Subject: [PATCH] keys and getindex for variables more specific --- src/cfvariable.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cfvariable.jl b/src/cfvariable.jl index bec17471..747f71dd 100644 --- a/src/cfvariable.jl +++ b/src/cfvariable.jl @@ -467,13 +467,13 @@ function _isrelated(v1::AbstractVariable,v2::AbstractVariable) dimnames(v1) ⊆ dimnames(v2) end -function Base.keys(v::AbstractVariable) +function Base.keys(v::AbstractNCVariable) ds = dataset(v) return [varname for (varname,ncvar) in ds if _isrelated(ncvar,v)] end -function Base.getindex(v::AbstractVariable,name::SymbolOrString) +function Base.getindex(v::AbstractNCVariable,name::SymbolOrString) ds = dataset(v) ncvar = ds[name] if _isrelated(ncvar,v)