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

[dennou-ruby:003963] Re: [dennou-ruby:003962] NetCDF に書き出す際にデータの型が変わる



�������
���Ǥ����Х���𤢤꤬�Ȥ��������ޤ�����

�Х��θ������������Τǡ����줫�齤��ˡ������ޤ���
��ypecode�ο��˻ȤäƤ������������ä��Τ���������
���β����Ƥϡ��񤭽Ф����opy�򶴤���������Ǥ���

GPhys::NetCDF_IO.write(outfile, tmp.copy)

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

On 2016/06/24 21:03, Fumitaka MATSUBA wrote:
������(Cc: �Ǿ Ruby �Τߤʤ��� : ������ݳظ��漼 M2 �ξ���Ǥ���

Ruby-NuSDaS �ͭ�θ��ݤʤΤ��������������󤬡�NuSDaS �ǡ������> ����> ���� NetCDF �˽񤭽Ф��ȡ��ǡ����η�������Ȥ����ɾ���Ƥ��ޤ���
�񤭽Ф����Ȥ��������η���������ߤ����櫓�ʤΤǤ��������� �Ϥɤ�����
���饯���ΤǤ��礦����

����륹�����Ȥϰʲ��Ǥ�������ɬ��ʥǡ����Ϥ�����̤�������Τǡ�
�����������򤪴ꤤ���ޤ���
https://www.dropbox.com/s/os0gfr4oyuepf1w/fcst_phy2m.nus.tar.gz?dl=0

---------- �������饹������----------
require 'numru/gphys'
include NumRu

# �ǡ�����ɤ߹���> file = 'fcst_phy2m.nus' # 2����ʪ�����

var = '_RLUTsrf'        # ��������>
tmp = GPhys::IO.open(file, var)[false, 18..-1]
p tmp.val
p tmp.val.typecode  #=> 4: NArray::SFLOART


# NetCDF �˽񤭽Ф�
outname = "#{var}.nc"
outfile = NetCDF.create(outname)
GPhys::NetCDF_IO.write(outfile, tmp)
outfile.close

# NetCDF �˽񤭽Ф����ǡ�����߹��� tmp = GPhys::IO.open(outname, var)
p tmp.val
p tmp.val.typecode #=> 1: NArray::BYTE
---------- �����ޤǥ�������----------

�ʲ����¹Է�:
$ ruby test.rb
NArray.sfloat(115,103,55):
[ [ [ 295.561, 295.561, 295.784, 296.314, 296.262, 290.73, 291.428, ... ],
    [ 295.561, 295.561, 295.784, 296.314, 296.262, 290.73, 291.428, ... ],
    [ 294.403, 294.403, 294.366, 295.442, 295.455, 290.483, 291.145, ... ],
    [ 294.391, 294.391, 294.354, 295.452, 295.439, 290.651, 291.288, ... ],
    [ 292.513, 292.513, 292.434, 293.672, 293.8, 289.959, 290.511, ... ],
    [ 292.562, 292.562, 292.364, 293.69, 294.019, 290.114, 290.608, ... ],
    [ 290.694, 290.694, 290.2, 292.233, 292.876, 289.112, 289.508, ... ],
    [ 290.483, 290.483, 290.419, 293.208, 294.638, 289.179, 289.557, ... ],
    [ 288.447, 288.447, 287.865, 290.325, 292.077, 287.139, 287.472, ... ],
    [ 287.834, 287.834, 288.017, 292.007, 292.138, 287.158, 287.487, ... ],
 ...
4
NArray.byte(115,103,55):
[ [ [ 39, 39, 39, 40, 40, 34, 35, 37, 37, 38, 38, 39, 39, 40, 40, 40,
... ],
    [ 39, 39, 39, 40, 40, 34, 35, 37, 37, 38, 38, 39, 39, 40, 40, 40,
... ],
    [ 38, 38, 38, 39, 39, 34, 35, 36, 37, 37, 38, 38, 39, 39, 39, 40,
... ],
    [ 38, 38, 38, 39, 39, 34, 35, 37, 37, 38, 38, 39, 39, 39, 39, 40,
... ],
    [ 36, 36, 36, 37, 37, 33, 34, 36, 36, 36, 36, 37, 37, 38, 38, 39,
... ],
    [ 36, 36, 36, 37, 38, 34, 34, 36, 36, 36, 36, 37, 37, 38, 38, 39,
... ],
    [ 34, 34, 34, 36, 36, 33, 33, 34, 34, 34, 34, 36, 36, 37, 37, 37,
... ],
    [ 34, 34, 34, 37, 38, 33, 33, 34, 34, 34, 34, 36, 36, 37, 37, 37,
... ],
    [ 32, 32, 31, 34, 36, 31, 31, 31, 31, 32, 32, 35, 35, 37, 37, 32,
... ],
    [ 31, 31, 32, 36, 36, 31, 31, 31, 31, 32, 32, 35, 35, 37, 37, 32,
... ],
 ...
1

�ȤäƤ���uby-NuSDaS ��git �������Ƥ�������Ǥ���

�����Ǥ�����������Ĵ�٤Ƥ�������ʤ��Ǥ��礦����
���������ꤤ�������ޤ���

--
��� �˹�Fumitaka MATSUBA)
��������� ��ظ��� �����ʳ�칶
�����ض��� ���ݳظ��漼 M2
E-mail: matsuba@xxxxxxxxxxxxxxxxxx <mailto:matsuba@xxxxxxxxxxxxxxxxxx>



--
���� (Shigenori OTSUKA)
����泫ȯˡ���������׻��ʳظ��浡��(AICS)
�ǡ���Ʊ�����������650-0047ʼ�˸���ͻ������Į7-1-26
��078-940-5814
shigenori.otsuka@xxxxxxxx