[Thread Prev][Thread Next][Index]

[ferret_users] Reading ascii file



Hi all
Simple question… 
I’m trying to read an ascii file  with 60 rows (each row is one year of data) and 19 columns : column 1 is year; columns 2 to 19 are the  same variable but different regions (18 regions).
I want to create one variable (nbp) with 18 levels, one per region.
Here is what I do, which doesn’t work :

define axis/T=1960:2019:1/units=year taxis
define axis/X=1:18:1 xaxis
define grid/T=taxis/X=xaxis mygrid

file/grid=mygrid/var= -,nbp "nbp.txt"


nbp.txt data set looks like:

1960 0.1057  0.1246  0.0017  0.0261  0.1735  0.0007  0.1255 -0.0361  0.1433  0.0259  0.2508  0.0715 -0.0019  0.0497  0.0097 -0.0506  0.0337  0.1155
1961 0.1384  0.0131  0.0600 -0.0145 -0.1744 -0.0061  0.0745  0.0995  0.0983  0.2071  0.1119 -0.0024 -0.0095  0.0683 -0.0033  0.1095  0.1027 -0.1360
1962 0.1392  0.1059 -0.0192  0.0475  0.1448 -0.1352  0.0794  0.0687  0.3754  0.0063  0.2532 -0.0055 -0.0132  0.1012  0.0167  0.0619  0.1222  0.0242
1963 0.0146  0.1110  0.0093  0.0423 -0.2498  0.0166  0.0950  0.1127  0.2832  0.1909  0.0421  0.0049  0.0688  0.0115  0.0124  0.0391 -0.0151  0.1944


When I do this I get the following, which is obviously not right.

yes? show data
     currently SET data sets:
    1> ./nbp.txt  (default)
 name     title                             I         J         K         L
 NBP      nbp                              1:18      ...       ...       1:60

 

yes? list nbp[i=1]
             VARIABLE : nbp
             FILENAME : nbp.txt
             SUBSET   : 3 points (T (YEAR))
             X        : 1
                1     
                 1
 1960   / 1:  0.1057
 1961   / 2:  0.1863
 1962   / 3:  0.2176

yes? list nbp[l=1]
             VARIABLE : nbp
             FILENAME : nbp.txt
             SUBSET   : 18 points (X)
             T (YEAR) : 1960
 1    /  1:  0.1057
 2    /  2:  0.1384
 3    /  3:  0.1392
 4    /  4:  0.0146
 5    /  5:  0.0676
 6    /  6:  0.2604
 7    /  7:  0.1093
 8    /  8:  0.1979
 9    /  9:  0.2648
 10   / 10:  0.1933
 11   / 11:  0.0309
 12   / 12:  0.0861
 13   / 13:  0.2020
 14   / 14:  0.2359
 15   / 15:  0.1868
 16   / 16:  0.2416
 17   / 17:  0.2037
 18   / 18: -0.0313



Thanks for you help.
Pierre




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement