Write columns

From: Guilherme Martins <jgmsantos_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 12 2012 - 17:45:42 MDT

Hi users,

I'm using the asciiwrite to save a file, but when I use this command my
file is only a vector. I want the result like the below, that is, columns.
My script is below.

Thanks,

; 0 1 2 3 4 5 6 7 8
; Sand Silt Clay Porosity FC WP bexp AEP SHC
; 0.92 0.05 0.03 0.437 0.091 0.033 1.7 0.07 5.83300E-05
; 0.81 0.12 0.07 0.437 0.125 0.055 2.1 0.09 1.69720E-05
; 0.65 0.25 0.10 0.453 0.207 0.095 3.1 0.15 7.19440E-06
; 0.42 0.40 0.18 0.463 0.270 0.117 4.5 0.11 3.66670E-06
; 0.20 0.65 0.15 0.501 0.330 0.133 4.7 0.21 1.88890E-06

begin

arquivo = asciiread("params.soi-EXER.04.QUEST.02.txt",(/11,9/),"float")

do j = 1,4

  if (j .eq. 1) then
     fator = 0.8
  end if

  if (j .eq. 2) then
     fator = 1.2
  end if

  if (j .eq. 3) then
     fator = 0.5
  end if

  if (j .eq. 4) then
     fator = 1.5
  end if

  linhas = 11
  colunas = 9

  sand = arquivo(:,0) * fator
  silt = arquivo(:,1) * fator
  clay = arquivo(:,2) * fator
  porosity = arquivo(:,3) * fator
  fc = arquivo(:,4) * fator
  wp = arquivo(:,5) * fator
  bexp = arquivo(:,6) * fator
  aep = arquivo(:,7) * fator
  shc = arquivo(:,8) * fator

  p = new( (/linhas,colunas/), typeof(sand) )

  p(:,0) = sand
  p(:,1) = silt
  p(:,2) = clay
  p(:,3) = porosity
  p(:,4) = fc
  p(:,5) = wp
  p(:,6) = bexp
  p(:,7) = aep
  p(:,8) = shc

  fmtx = "
f4.2,2x,f4.2,2x,f4.2,2x,f5.3,2x,f5.3,2x,f5.3,2x,f4.1,2x,f4.2,2x,e11.5"

  write_matrix (p, fmtx, False)
  asciiwrite("params.soi."+fator+".txt",p)

end do

end

-- 
*Guilherme Martins*
http://guilhermemartins.hd1.com.br/

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 12 17:46:34 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 13 2012 - 13:37:52 MDT