[Thread Prev][Thread Next][Index]
Re: Reading an ASCII file
Hi Graham,
For the example you give
yes? define axis/X=1:5:1 longax ; define axis/T=1:4:1 timax
yes? define grid/T=timax/X=longax gblock
yes? file/var=sst/grid=gblock/form=free/col=5 testfile
should read the data.
yes? list sst
SST
DATA SET: ./testfile
1 2 3 4 5
1 2 3 4 5
1 / 1: 1.000 2.000 3.000 4.000 5.000
2 / 2: 2.000 3.000 4.000 5.000 6.000
3 / 3: 4.000 5.000 2.000 4.000 3.000
4 / 4: 6.000 3.000 2.100 3.400 8.900
In your real world problem of a longitude axis with 90 degree increments
is the intent of having 5 rather than 4 points along the xaxis to permit a
discontinuity at -90? If so this way of defining the x-axis seems to work.
yes? can data/all
yes? sp echo '-90 0 90 180 270' >> lonin.d
yes? define grid/x=longax gx
yes? file/form=free/g=gx/col=5/var=lonval lonin.d ! this loads the 5 values
yes? def axis/from_data/mod/x/name=lnax/units=lon lonval
yes? def grid/x=lnax/t=timax gblock
then read in the data as before
yes? file/var=sst/grid=gblock/form=free/col=5 testfile
yes? list sst
SST
DATA SET: ./testfile
90W 0E 90E 180E 90W
1 2 3 4 5
1 / 1: 1.000 2.000 3.000 4.000 5.000
2 / 2: 2.000 3.000 4.000 5.000 6.000
3 / 3: 4.000 5.000 2.000 4.000 3.000
4 / 4: 6.000 3.000 2.100 3.400 8.900
and shade it
yes? shade/set sst
yes? ppl xaxis,-90,270,45 ; ppl shade
The discontinuity at 90W is apparent.
NOTE: A repeat of the -90 (rather than 270) in the definition of the x-axis
gave me a non-monotonic axis message.
If on the other hand there were not a discontinuity at 90W then the fifth
column would be a redundant repeat of the first and the x-axis would only
have FOUR points
yes? def axis/x=-90:180:90/mod/units=lon longax
yes? file/var=sst/grid=gblock/form=free/col=4 testfile
would do the trick.
Good luck, Mick
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement