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

[dennou-ruby:003733] Re: GPhys.join での associate coordinate



�Ƿ��

�Ф��������ޤ���
#cut ��[] ���ʾ�����ˡ�associate coordinate �����������Ƥ��ʤ��ä��Τǽ�����ޤ�����

diff --git a/lib/numru/gphys/assoccoords.rb b/lib/numru/gphys/assoccoords.rb
index 7cfd707..cf85ecd 100644
--- a/lib/numru/gphys/assoccoords.rb
+++ b/lib/numru/gphys/assoccoords.rb

@@ -230,7 +230,12 @@ module NumRu
         end
       end

-      ret = self.class.new( new_assoc_crds, @axnames )
+      axnames = Array.new
+      args.each_with_index do |a, i|
+        axnames.push @axnames[i] unless Numeric === a
+      end
+
+      ret = self.class.new( new_assoc_crds, axnames )
       ret
     end



�ޤ���#mean �ʤɤ����ˤ�����ư��Ƥ��ʤ��ä��Τǽ�����ޤ�����

--- a/lib/numru/gphys/grid.rb
+++ b/lib/numru/gphys/grid.rb
@@ -410,7 +410,18 @@ module NumRu
        newgrid = self.class.new( *newaxes )
        newgrid.set_lost_axes( @lost_axes.dup )
         if @assoc_coords
-          newgrid.assoc_coords=@assoc_coords.subset_having_axnames(newgrid.axnames)
+          if deleted_by
+            assoc_coords = Array.new
+            assoccoordnames.each do |aname|
+              g = assoc_coord_gphys(aname)
+              args = at.find_all{|i| g.axnames.include?(@axnames[i])}
+              g = g.mean(*args) unless args.empty?
+              assoc_coords.push g if GPhys === g
+            end
+            newgrid.set_assoc_coords assoc_coords
+          else
+            newgrid.assoc_coords =
@assoc_coords.subset_having_axnames(newgrid..axnames)
+          end
         end

        if !deleted_by


���������ꤤ�������ޤ���


�߷��

2014ǯ6���0 Seiya Nishizawa <seiya@xxxxxxxxxxxxxx>:
> �Ƿ��
>
> GPhys.join �������ˡ� associate coordinate �������Ǥ�����
> ���Ƥߤޤ�����
> GPhys.join ��äƤ����Ǹ��ǤϤʤ��������ޤ�����
> �Ȥꤢ����ư��Ƥ������Ǥ���
>
> ��̵�������Ǥ����������������ޤ��Ǥ��礦����
> ���������ꤤ�������ޤ���
>
> # gphys �Υ��ߥåȥݥꥷ�����������Ƥ��ޤ��󤬡�
> # ���Τ褦�˥᡼���ѥå���������褤�Ǥ��礦��?
> # ������eature branch ��äơ����ߥåȡ��᡼�����������������Ǥ��礦����
>
>
> �߷��
>
>
>
> --- a/lib/numru/gphys/gphys.rb
> +++ b/lib/numru/gphys/gphys.rb
> @@ -1145,6 +1145,12 @@ module NumRu
>          grid = Grid.new(*axes)
>          # ** Develpment Note (2013-03-02, horinout)**  joining assoc_coords
>          # is yet to be supported; not difficult but cumbersome
> +        if gp0.assoc_coords
> +          assoc_coord = gp0.assoccoordnames.collect do |aname|
> +            GPhys.join( gpnary.collect{|gp| gp.assoc_coord_gphys(aname)} )
> +          end
> +          grid.set_assoc_coords(assoc_coord)
> +        end
>
>          #< data >
>          data = VArrayComposite.new( gpnary.collect{|gp| gp.data} )
>
> --
> Seiya Nishizawa
> RIKEN Advanced Institute for Computational Science
> Tel: +81-78-940-5754, Fax: +81-78-304-4972
> 7-1-26, Minatojima-minami-machi, Chuo-ku, Kobe, Hyogo 650-0047, Japan



-- 
Seiya Nishizawa
RIKEN Advanced Institute for Computational Science
Tel: +81-78-940-5754, Fax: +81-78-304-4972
7-1-26, Minatojima-minami-machi, Chuo-ku, Kobe, Hyogo 650-0047, Japan