## Program to read in Ks etc. First, we need to read the header and the ## temperature profile used to calculate the Ks ## You don't need this, but you could use it as an a-priori if you liked. ksfile <- "/home/hcp/wrk/invth_pract/nadout.dat" hdr <- scan(file=ksfile,nlines=1) nfreq<-hdr[1] nlevs<-hdr[2] zspacing<-hdr[3] tmpdat <- scan(file=ksfile,nlines=nlevs,skip=1) dim(tmpdat) <- c(3,nlevs) zeta <- tmpdat[1,] z <- tmpdat[2,] tem.l <- tmpdat[3,] ## read in the actual Ks int kfns. The file also contains the transmissivities, ## these are read into tau but you don't need them. y.l <- 0 kfns <- matrix(0,nrow=nfreq,ncol=nlevs) tau <- kfns for(j in 1:nfreq){ y.l[j] <- scan(file=ksfile,nlines=1,skip=j*(nlevs+1)) tmpdat <- scan(file=ksfile,nlines=nlevs,skip=j*(nlevs+1)+1) dim(tmpdat) <- c(2,nlevs) kfns[j,] <- tmpdat[2,] tau[j,] <- tmpdat[1,] }