Class: NCObject

Inherits:
Object
  • Object
show all
Includes:
NC
Defined in:
lib/io/netcdf.rb

Direct Known Subclasses

NCDim, NCFile, NCVar

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NC

nc_decode, nc_put_att_simple, nc_put_var_all

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



62
63
64
# File 'lib/io/netcdf.rb', line 62

def attributes
  @attributes
end

Instance Method Details

#attribute(name) ⇒ Object



58
59
60
# File 'lib/io/netcdf.rb', line 58

def attribute (name)
  return @attributes[name]
end

#get_attributes(file_id, var_id) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/io/netcdf.rb', line 47

def get_attributes (file_id, var_id)
  attrs = {}
  varnatts = nc_inq_varnatts(file_id, var_id)
  varnatts.times do |i|
    attname = nc_inq_attname(file_id, var_id, i)
    value   = nc_get_att(file_id, var_id, attname) 
    attrs[attname] = value
  end
  return attrs.freeze
end