[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dennou-ruby:001797] Re: GrADS_Gridded#each_att



��߷����

�Х�ɥ�Ǥ�˻�����Ȥ������ߤޤ���

> ���ĤǤ���
...
> >   �ȤʤäƤ���ʬ�򡢰ʲ��Τ褦�ˤ��������
> > 
> >             f.att_names.each{|name|
> >               val = f.get_att(name)
> 
> �긵��/usr/local/bin/gave�򤳤Τ褦�ˤ��Ƥߤ��������ư��ޤ�����

��������������ǺѤޤʤ��Ȥ���������ޤ�����

�ʲ��Υѥå���ư���褦�ˤʤ�ޤ������ߥåȤ��Ƥ����Ǥ�����

��Ƿ��
--------------------------------------------------------------------
--- gave~       Tue Jul 13 09:44:01 2004
+++ gave        Thu Jul 15 13:28:19 2004
@xxxxxx@xxxxxx -1005,13 +1005,23 @xxxxxx@xxxxxx
               open_var(gphys, fn, filetype)
             }
             attr_list = List.new
-            f.each_att{|att|
-              val = att.get
-              if val.class==NArray then
-                val = att.get.to_a.join(",")
-              end
-              attr_list.set_item(att.name, val)
-            }
+            if( f.respond_to?(:each_att) )
+             f.each_att{|att|
+               val = att.get
+               if val.class==NArray then
+                 val = att.get.to_a.join(",")
+               end
+               attr_list.set_item(att.name, val)
+             }
+           else
+             f.att_names.each{|name|
+               val = f.get_att(name)
+               if val.class==NArray then
+                 val = att.get.to_a.join(",")
+               end
+               attr_list.set_item(name, val)
+             }
+            end
             attr_list.add_note(@xxxxxx, _("global")+" (#{File.basename(fn)})")
           ensure
             f.close
@xxxxxx@xxxxxx -1025,13 +1035,23 @xxxxxx@xxxxxx
           end
         }
         attr_list = List.new
-        file.each_att{|att|
-          val = att.get
-          if val.class==NArray then
-            val = att.get.to_a.join(",")
-          end
-          attr_list.set_item(att.name, val)
-        }
+       if( file.respond_to?(:each_att) )
+         file.each_att{|att|
+           val = att.get
+           if val.class==NArray then
+             val = att.get.to_a.join(",")
+           end
+           attr_list.set_item(att.name, val)
+         }
+       else
+         file.att_names.each{|name|
+           val = file.get_att(name)
+           if val.class==NArray then
+             val = att.get.to_a.join(",")
+           end
+           attr_list.set_item(name, val)
+         }
+       end
         attr_list.add_note(@xxxxxx, _("global"))
         file.close
       end