This function is used to read in files that contain ASCII representations of basic data types.
function asciiread( filepath[1]:string, dimensions[*]:integer, datatype[1]:string )
An error message is generated whenever the number of elements read is less than the number implied by the dimensions parameter.
If -1 is given for the dimension sizes, all values in the file will be read into a single dimension variable. The dimension size of this variable will be equal to the number of elements in the file.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.then you can read it various ways as shown with the following ncl script:
begin z1 = asciiread("data.asc",(/5,3/),"float") z2 = asciiread("data.asc",(/4,2/),"float") endThe results of z1 and z2 would be:
z1(0,0) = 1. z1(0,1) = 2. z1(0,2) = 3. z1(1,0) = 4. z1(1,1) = 5. z1(1,2) = 6. z1(2,0) = 7. . . . z1(4,0) = 13. z1(4,1) = 14. z2(0,0) = 1. z2(0,1) = 2. z2(1,0) = 3. z2(1,1) = 4. z2(2,0) = 5. z2(2,1) = 6. z2(3,0) = 7. z2(3,1) = 8.Example of using -1:
begin z3 = asciiread("data.asc",-1,"float") end
z3(0) = 1. z3(1) = 2. z3(2) = 3. . . .
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?