- 积分
- 1901
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-1-6
- 最后登录
- 1970-1-1
|
发表于 2016-9-13 08:38:56
|
显示全部楼层
我没用过ascii文件的功能,所以具体不是很清楚。但是这些例子都有详细注解,而且运行过没有报错。
等候ascii达人解释下~~
-------------------------------------------------------------------------------------------------------------------------------------
这个网页下面有注释,可以仔细看下。部分原文如下:
Lines 92-94:
ascii_file = "data.asc"
system("/bin/rm -f " + ascii_file)
asciiwrite(ascii_file,temp(7:3:2,0:4))
Write a subset of the temperature data to an ASCII file using asciiwrite. The first argument of asciiwrite is the file name to which the data will be written, and the second argument is the data to write. The syntax "7:3:2" selects indices 7 to 3 with a stride of 2, so only indices "7", "5", and "3" are selected for the first dimension (in that order).
The system call takes a string as an argument and executes a UNIX system command from NCL. In this case, it is being used to remove the file before writing to it. The "+" symbol, in addition to being used as an arithmetic operator, is also used in NCL to concatenate strings.
For more information on asciiwrite, system, and other NCL functions and procedures, see the list of built-in NCL functions and procedures.
----------------------------------------------------------------
这个例子我运行了下,没有错误。运行结果如下:
#ncl gsun02n.ncl
Copyright (C) 1995-2014 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.2.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
Variable: temp (subsection)
Type: float
Total Size: 48 bytes
12 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 4] x [lon | 3]
Coordinates:
lat: [22.5..26.25]
lon: [-122.5..-117.5]
Number Of Attributes: 6
_FillValue : -9999
valid_range : ( 0, 400 )
units : (C)
long_name : temperature
frtime : 0
level : 1000
(0,0) -30.31982
(0,1) -30.31982
(0,2) -30.31982
(1,0) -31.31982
(1,1) -31.81982
(1,2) -31.81982
(2,0) -31.31982
(2,1) -31.81982
(2,2) -31.81982
(3,0) -28.31982
(3,1) -28.81982
(3,2) -28.81982
(0) lat
(0) lon
(0) temperature
(0) (C)
Variable: lat (coordinate)
Type: float
Total Size: 132 bytes
33 values
Number of Dimensions: 1
Dimensions and sizes: [lat | 33]
Coordinates:
Number Of Attributes: 2
long_name : latitude
units : degrees_north
(0) 20
(1) 21.25
(2) 22.5
(3) 23.75
(4) 25
(5) 26.25
(6) 27.5
(7) 28.75
(8) 30
(9) 31.25
(10) 32.5
(11) 33.75
(12) 35
(13) 36.25
(14) 37.5
(15) 38.75
(16) 40
(17) 41.25
(18) 42.5
(19) 43.75
(20) 45
(21) 46.25
(22) 47.5
(23) 48.75
(24) 50
(25) 51.25
(26) 52.5
(27) 53.75
(28) 55
(29) 56.25
(30) 57.5
(31) 58.75
(32) 60
Variable: lon (coordinate)
Type: float
Total Size: 144 bytes
36 values
Number of Dimensions: 1
Dimensions and sizes: [lon | 36]
Coordinates:
Number Of Attributes: 2
long_name : longitude
units : degrees_east
(0) -140
(1) -137.5
(2) -135
(3) -132.5
(4) -130
(5) -127.5
(6) -125
(7) -122.5
(8) -120
(9) -117.5
(10) -115
(11) -112.5
(12) -110
(13) -107.5
(14) -105
(15) -102.5
(16) -100
(17) -97.5
(18) -95
(19) -92.5
(20) -90
(21) -87.5
(22) -85
(23) -82.5
(24) -80
(25) -77.5
(26) -75
(27) -72.5
(28) -70
(29) -67.5
(30) -65
(31) -62.5
(32) -60
(33) -57.5
(34) -55
(35) -52.5
|
|