Re: Write columns

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 12 2012 - 21:51:30 MDT

In NCL 6.1.0 (will be release soon), you may use to function str_write.
See attached document for str_write.

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Apr 12, 2012, at 5:45 PM, Guilherme Martins wrote:

> 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

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

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