Hi Szymon,
The FILE command (an alias for SET DATA/EZ) only initializes the
dataset. It checks that it can open the file, and stores the
definitions of the variables and grids that you give in the FILE
command. It does not read any data or do anything to see what's in
the file. This means that each FILE command is just redefining the
contents of the dataset.
My suggestion would be to read each variable and save it to a netCDF
file. Then you would have them together in a dataset that's easy to
work with. You could also use SET VAR commands at that point to add
units, title, or bad-data flags for your variables.
file/skip=2/format=(132f12.4)/columns=132/grid=grid_xlon_ylat/var=hs
WAM_IOUG_20120114000000.txt
set var/bad=-999 hs ! and /units/title etc
save/clobber/file=filename.nc hs
file/skip=14/format=(132f12.4)/columns=132/grid=grid_xlon_ylat/var=mdirx
WAM_IOUG_20120114000000.txt
set var/bad=-999 mdirx
save/append/file=filename.nc mdirx
...
can data/all
use filename.nc
Or, if there are no header lines between the different blocks of
data that represent the variables, you could probably define a grid
to contain ALL the data from all three variables, read a single
input variable from the ascii file and then define hs, mdirx, mdiry
as subsets of that input variable.
Ansley
On 4/4/2012 9:14 AM, Szymon Roziewski wrote:
Hello,
I am trying to read 3 variables from one ASCII file.
But I cannot use more than 1 variable.
The question is why is that?
This is my easy script
set windows/size=10/aspect=`0.2`
SET VIEWPORT FULL
CANCEL MODE LOGO
!DEFINE AXIS/X=1:132:1/unit=degree xlon
!DEFINE AXIS/Y=1:10:1/unit=degree ylat
DEFINE AXIS/X=-5.6666666667:5.25:0.0833333333/unit=degree xlon
DEFINE AXIS/Y=-1.916666667:-1.166666667:0.0833333333/unit=degree
ylat
DEFINE GRID/x=xlon/y=ylat grid_xlon_ylat
file/skip=2/format=(132f12.4)/columns=132/grid=grid_xlon_ylat/var=hs
WAM_IOUG_20120114000000.txt
file/skip=14/format=(132f12.4)/columns=132/grid=grid_xlon_ylat/var=mdirx
WAM_IOUG_20120114000000.txt
file/skip=26/format=(132f12.4)/columns=132/grid=grid_xlon_ylat/var=mdiry
WAM_IOUG_20120114000000.txt
set var/bad=-999 hs[d=1]
set var/bad=-999 mdirx[d=2]
set var/bad=-999 mdiry[d=3]
shade/lev=(0.0,5.0,0.25)(7.,10,.5)(inf)/pal=fin_swh/title="Data
for x" hs[d=1]
But it can't see the hs, mdirx variables and I come up with error.
Please help me.
I attach WAM_IOUG_20120114000000.txt
Best regards,
Szymon Roziewski
|