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.



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

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.



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

def len
  @len
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#[](*argv) ⇒ Object



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

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

#definitionObject



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

def definition
  return @len
end

#inspectObject



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

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

#to_caObject



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

def to_ca
  return self[]
end

#to_iObject



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

def to_i
  return @dim_id
end