Next: 7.2.3 Loading the Equation
Up: 7.2 CO5BOLD Data in
Previous: 7.2.1 Loading the Parameter
Contents
Index
IDL> modelfile='/home/user/mymodel.full' & n=0
IDL> ful=uio_dataset_rd(modelfile,n=n)
First the name and full path (if not in the actual directory) of the
model file and the wanted time step should be defined. Here, time
step means the consecutive number of the model snapshot in the file.
Declaring a time step number greater than the number of snapshots
contained in the file will cause an error.
Otherwise all data of the particular time step n
will be provided in the structure
FUL
.
Loading more than one timestep from the same file could be achieved as
follows:
IDL> uio_openrd, nc, modelfile, outstr, ierr
IDL> for i=0,ntime-1 do begin &$
IDL> ful=uio_dataset_rd(modelfile, channel=nc,ierr=ierr, outstr=err_msg) &$
IDL> endfor &$
IDL> uio_closrd, nc
Again, this operation would cause an error if the wanted time step is
not contained in the file.
Via checking the error flag ierr
of the routine uio_dataset_rd
such errors can be avoided.
This way it is unnecessary to know exactly of how many time steps the
model file consists.
IDL> uio_openrd, nc, modelfile, outstr, ierr
IDL> i=0
IDL> repeat begin &$
IDL> ful=uio_dataset_rd(modelfile, channel=nc, ierr=ierr) &$
IDL> if (ierr eq 0) then begin &$
IDL> ;-- Do the data processing here --
IDL> i=i+1 &$
IDL> endif else begin &$
IDL> print,'IDL> Reached EOF.' &$
IDL> endelse &$
IDL> endrep until (ierr ne 0) or (EOF(nc))
IDL> uio_closrd, nc
To read a number of entries from a list of files in sequence the routine
uio_datasetlist_rd.pro
(see Sect. 4.7.3) is appropriate.
Next: 7.2.3 Loading the Equation
Up: 7.2 CO5BOLD Data in
Previous: 7.2.1 Loading the Parameter
Contents
Index