WRF
fileIO
NCL

NCL > fileIO > ファイル読込 > dates_file = asciiread("input.tbl",-1,"string")

More than 1 year has passed since last update.
動作環境
Xeon E5-2620 v4 (8コア) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 とその-devel
mpich.x86_64 3.1-5.el6とその-devel
gcc version 4.4.7 (とgfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.1を使用。
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) 
Python 3.6.0 on virtualenv

NCL(NCAR Command Language)関連。

.nclファイルにおいて日付の文字列を扱う部分を変更しつつスクリプトを使ってきた。
変更の作業が多くなってきたので、ファイルから読込むようにしてみる。

readfile_171120.ncl
; case 1
 dates_tbl = (/\
 "20171006","20171007","20171008","20171009","20171010",\
 "20171011","20171012","20171013","20171014","20171015",\
 "20171016","20171017","20171018","20171019","20171020",\
 "20171021","20171022","20171023","20171024","20171025",\
 "20171026","20171027","20171028","20171029","20171030",\
 "20171031"\
   /)

print(dates_tbl)

; case 2
dates_file = asciiread("input.tbl",-1,"string")
print(dates_file)

データファイル

input.tbl
20171006
20171007
20171008
20171009
20171010
20171011
20171012
20171013
20171014
20171015
20171016
20171017
20171018
20171019
20171020
20171021
20171022
20171023
20171024
20171025
20171026
20171027
20171028
20171029
20171030
20171031

実行

$ncl readfile_171120.ncl
 Copyright (C) 1995-2015 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.3.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.


Variable: dates_tbl
Type: string
Total Size: 208 bytes
            26 values
Number of Dimensions: 1
Dimensions and sizes:   [26]
Coordinates: 
(0) 20171006
(1) 20171007
(2) 20171008
(3) 20171009
(4) 20171010
(5) 20171011
(6) 20171012
(7) 20171013
(8) 20171014
(9) 20171015
(10)    20171016
(11)    20171017
(12)    20171018
(13)    20171019
(14)    20171020
(15)    20171021
(16)    20171022
(17)    20171023
(18)    20171024
(19)    20171025
(20)    20171026
(21)    20171027
(22)    20171028
(23)    20171029
(24)    20171030
(25)    20171031


Variable: dates_file
Type: string
Total Size: 208 bytes
            26 values
Number of Dimensions: 1
Dimensions and sizes:   [26]
Coordinates: 
Number Of Attributes: 1
  _FillValue :  missing
(0) 20171006
(1) 20171007
(2) 20171008
(3) 20171009
(4) 20171010
(5) 20171011
(6) 20171012
(7) 20171013
(8) 20171014
(9) 20171015
(10)    20171016
(11)    20171017
(12)    20171018
(13)    20171019
(14)    20171020
(15)    20171021
(16)    20171022
(17)    20171023
(18)    20171024
(19)    20171025
(20)    20171026
(21)    20171027
(22)    20171028
(23)    20171029
(24)    20171030
(25)    20171031

読込むファイルはbashかPythonで作るようにすればNCLを覚えておかないで済む。

リンク

ファイル読込み例
https://www.ncl.ucar.edu/Applications/read_ascii.shtml#asc1