[ncl-talk] Write ascii file and convert row to column
소윤영
yyso at ncam.kr
Wed Apr 21 23:46:42 MDT 2021
Hello All,
I am trying to write ascii file from wrfout file. and I want to
convert axis that row to column text.
This script write values in row, how should i convert this to column?
(I want to change from horizontal to vertical text form)
here is my script.
Bold text need to be change. I dont know how to change it.
==============================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
a = "/home/wrfout/"+domain+"/"
adirs = systemfunc ("ls "+a)
startday = ind(str_get_cols(adirs,0,7).eq.start)
nt=24*12+1
it=ispan(1,nt,1)
*SWDOWN= new((/dimsizes(lampdirs)+1,nt+1/),"string")*
*SWDOWN(0,0)= "SWDOWN"*
*SWDOWN(0,1:nt)= it*
*SWDOWNstring = new(dimsizes(lampdirs)+1,"string")*
*SWDOWNstring(0)=SWDOWN(0,0)+" "*
*do ith=1,nt*
*SWDOWNstring(0) = SWDOWNstring(0)+SWDOWN(0,ith)+" "end do*
write_table(outdir+"SWDOWN_ONION_"+station+".txt","w",[/SWDOWNstring(0)/],"%s")
===================================================================
i=startday
fils = systemfunc ("ls "+a+adirs(i)+"/wrfout*")
afi = addfiles(fils,"r")
aref = addfile(fils(0),"r")
ListSetType(afi,"cat")
opt = True
opt at returnInt = True
locij = wrf_user_ll_to_ij(aref, slon, slat, opt)
locij = locij-1
locX = locij(0)
locY = locij(1)
input_utim=wrf_user_getvar(afi, "times", -1)
ntim=dimsizes(input_utim)
swdown=wrf_user_getvar(lampfi, "SWDOWN", -1)
swdown_point= swdown(:, locY, locX)
===CREATE FILE=====================================================
*SWDOWN(i+1,0) = lampdirs(i)*
*SWDOWN(i+1,1:dimsizes(swdown_point)) = swdown_point*
*SWDOWNstring(i+1)= SWDOWN(0,i+1)+" "*
do ith=1,nt
*SWDOWNstring(i+1) = SWDOWNstring(i+1)+SWDOWN(i+1,ith)+" "*
end do
==================================================================
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210422/547aab29/attachment.html>
More information about the ncl-talk
mailing list