[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dennou-ruby:003733] Re: GPhys.join での associate coordinate
- To: Dennou-ruby <dennou-ruby@xxxxxxxxxxx>
- Subject: [dennou-ruby:003733] Re: GPhys.join での associate coordinate
- From: Seiya Nishizawa <seiya@xxxxxxxxxxxxxx>
- Date: Mon, 9 Jun 2014 20:34:16 +0900
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20120113;        h=mime-version:sender:in-reply-to:references:from:date:message-id         :subject:to:content-type:content-transfer-encoding;        bh=mfuWCY4gJ5I69ZzwaNnYA1LzQWRsD5ZVgdbu51hIJEw=;        b=TxxakAyNJt25TdkyetJbK8Pgth6zp9bUFS2uWZ9w386/Qgyt+89tfUuFpVX11BemF2         +88fdIVH86mdy+dzU0L6XgkIaMAlpkC3WctdulGLfP0d9S40RH8CdIRvYcF2MXAy2waA         RTHYMDCX46O7PjxuTMR9UJp1rDY/8rRL0IyCpcujyc3DjJcdJkZuaUH4Sv8XWsWC5M3V         u3cWfkOR6Ese2/njfmfxJMfDzEB5RpTMdFmUZ8tymg+ggkGe0uIKmPeOEBi0JRVqNtWt         nOIpiC07GT4DnSACsWuC8k6yYvWLpwJYVCII2Gp1F1+uHm2aj5DwT/PiMKDjjJ7kMbH5         CRsg==
- Sender: seiyani@xxxxxxxxx
�Ƿ��
�Ф��������ޤ���
#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