Class: NetCDF::Group

Inherits:
CDMNode show all
Defined in:
lib/netcdf/group.rb

Overview

A Group is a logical collection of Variables. The Groups in a Dataset form a hierarchical tree, like directories on a disk. A Group has a name and optionally a set of Attributes. There is always at least one Group in a dataset, the root Group, whose name is the empty string.

Immutable if setImmutable() was called.

Direct Known Subclasses

GroupWriter

Instance Attribute Summary

Attributes inherited from CDMNode

#netcdf_elmt

Instance Method Summary collapse

Methods inherited from CDMNode

#get_full_name, #get_short_name, #initialize

Constructor Details

This class inherits a constructor from NetCDF::CDMNode

Instance Method Details

#attributesObject




94
95
96
97
98
99
100
101
102
103
# File 'lib/netcdf/group.rb', line 94

def attributes

  java_attributes = @netcdf_elmt.getAttributes()
  attributes = Array.new
  java_attributes.each do |att|
    attributes << NetCDF::Attribute.new(att)
  end
  attributes

end

#common_parent(group) ⇒ Object




39
40
41
# File 'lib/netcdf/group.rb', line 39

def common_parent(group)
  @netcdf_elmt.commomParent(group.netcdf_elmt)
end

#find_attribute(name, ignore_case = false) ⇒ Object




47
48
49
50
51
52
53
# File 'lib/netcdf/group.rb', line 47

def find_attribute(name, ignore_case = false)
  if (ignore_case)
    NetCDF::Attribute.new(@netcdf_elmt.findAttributeIgnoreCase(name))
  else
    NetCDF::Attribute.new(@netcdf_elmt.findAttribute(name))
  end
end

#find_dimension(name, local = false) ⇒ Object


Retrieve a Dimension using its (short) name. If local is true, then retrieve a Dimension using its (short) name, in this group only.



60
61
62
63
64
65
66
# File 'lib/netcdf/group.rb', line 60

def find_dimension(name, local = false)
  if (local)
    NetCDF::Dimension.new(@netcdf_elmt.findDimensionLocal(name))
  else
    NetCDF::Dimension.new(@netcdf_elmt.findDimension(name))
  end
end

#find_group(name) ⇒ Object


Retrieve the Group with the specified (short) name.



72
73
74
# File 'lib/netcdf/group.rb', line 72

def find_group(name)
  NetCDF::Group.new(@netcdf_elmt.findGroup(name))
end

#find_variable(name, local = true) ⇒ Object




80
81
82
83
84
85
86
87
88
# File 'lib/netcdf/group.rb', line 80

def find_variable(name, local = true)

  if (local)
    NetCDF::Variable.new(@netcdf_elmt.findVariable(name))
  else
    NetCDF::Variable.new(@netcdf_elmt.findVariableOrInParent(name))
  end

end

#to_stringObject




109
110
111
# File 'lib/netcdf/group.rb', line 109

def to_string
  @netcdf_elmt.toString()
end