Class: NCDim

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

Instance Attribute Summary collapse

Attributes inherited from NCObject

#attributes

Instance Method Summary collapse

Methods included from NC

nc_decode, nc_put_att_simple, nc_put_var_all

Methods inherited from NCObject

#attribute, #get_attributes, #get_attributes!

Constructor Details

#initialize(ncfile, dim_id) ⇒ NCDim

Returns a new instance of NCDim.



330
331
332
333
334
335
336
# File 'lib/io/netcdf.rb', line 330

def initialize (ncfile, dim_id)
  @ncfile      = ncfile
  @file_id     = ncfile.file_id
  @dim_id      = dim_id
  @name        = nc_inq_dimname(@file_id, @dim_id)
  @len         = nc_inq_dimlen(@file_id, @dim_id)
end

Instance Attribute Details

#lenObject (readonly)

Returns the value of attribute len.



338
339
340
# File 'lib/io/netcdf.rb', line 338

def len
  @len
end

#nameObject (readonly)

Returns the value of attribute name.



338
339
340
# File 'lib/io/netcdf.rb', line 338

def name
  @name
end

Instance Method Details

#[](*argv) ⇒ Object



356
357
358
# File 'lib/io/netcdf.rb', line 356

def [] (*argv)
  return @ncfile[name][*argv]
end

#definitionObject



340
341
342
# File 'lib/io/netcdf.rb', line 340

def definition
  return @len
end

#inspectObject



344
345
346
# File 'lib/io/netcdf.rb', line 344

def inspect
  return "#{@name}=#{@len}"
end

#to_caObject



352
353
354
# File 'lib/io/netcdf.rb', line 352

def to_ca
  return self[]
end

#to_iObject



348
349
350
# File 'lib/io/netcdf.rb', line 348

def to_i
  return @len
end