Re: ascii writewrite

From: William Self <bill_at_nyahnyahspammersnyahnyah>
Date: Sat Oct 22 2011 - 14:28:19 MDT


You could perhaps do this by using asciiwrite to create a temporary file called nlcheng-result.tmp

Then in your script call the OS command ¡°cat¡± (assuming you¡¯re on linux) to add that tmp file to the end of nlcheng-result.txt
cat nlcheng-result.tmp >> nlcheng-result.txt

The double >> redirect symbols are needed so the contents of nlcheng-result.txt is not overwritten (to make sure it is concatenated).

Or you could read in the file and concatenate the contents before writing back out...
but that would probably depend on how big the ascii file gets.


From: cnl88
Sent: Saturday, October 22, 2011 3:30 PM
Subject: ascii writewrite

the script run one time it turns out 4 varibles that are constants
I run 12 times and i want to write the 12 lines in one file
each by each
but it only write the last line the ncl runs and all previous results are missing!

need for your help
thank you

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
big = asciiread("./nlcheng3-4chuance2.txt",(/6336,4/),"integer")
line = 6336
yy = new((/line/),integer)
hh = new((/line/),integer)
nn = new((/line/),integer)
mm = new((/line/),integer)
do x =0,11
yy(x) = big(x,0)
hh(x) = big(x,1)
nn(x)= big(x,2)
mm(x) = big(x,3)

fn = "/home/nlcheng/huatu111111111/cmaq/chou/ln/METCRO2D_"+yy(x)+".nc"
              a = addfile(fn,"r")
fon = "nlcheng-result.txt"
     PBL = a->PBL(t,0,m,n)
   TEMP2= a->TEMP2(t,0,m,n)
  WSPD10 = a->WSPD10(t,0,m,n)

nvals = 12
fmtx = "%14.6f"
title = " PBL(m) TEMP2(K) WSPD10(m/s) WDIR10(DEGREES)"
vals = sprintf(fmtx,PBL) + " " + sprintf(fmtx,TEMP2) + " " + \
        sprintf(fmtx,WSPD10) + " " + sprintf(fmtx,WDIR10)
strs = new(nvals+1,string)
strs(0) = title
strs(x+1:x+1) = vals
end do

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

Received on Sat Oct 22 14:30:14 2011

This archive was generated by hypermail 2.1.8 : Mon Oct 24 2011 - 09:29:35 MDT