Class: NumRu::NetCDF

Inherits:
Object
  • Object
show all
Defined in:
lib/numru/gphys/gpcommon.rb

Overview

————- Copy global attributes (only for NetCDF file) ——–

Instance Method Summary collapse

Instance Method Details

#copy_global_att(gp) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/numru/gphys/gpcommon.rb', line 43

def copy_global_att(gp)
  ncfiles = gp.data.file 
  # for gphys consisting of multiple files 
  if /NArray/  =~ ncfiles.class.to_s  
    ncfile = ncfiles[0]
  else
    ncfile = ncfiles
  end
  # Check whether gphys is a NetCDF file or not
  if /NetCDF/  =~ ncfile.class.to_s
    ncfile.each_att{|att|
      att.copy(self)
    }
  end
end