create a new data file with specific variable name

From: Mark Chan <cym263_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 11 2014 - 05:45:58 MDT

Dear NCL helper, In the below is an NCL script, in which a file "Lind_=
wrf_W_Wind.nc" would be created. However, I want the variables name as "W30=
0", "W400" and so on, instead of "nnam" ( I hope "nnam" is a variable, whic=
h represent "W300" etc.). This moment I always got the variable name as "nn=
am" in the data file. Can any one help! Best regards, Mark =
==================== load "$NC=
ARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/nca=
rg/nclscripts/wrf/WRFUserARW.ncl" begin ; ; The WRF ARW input file=
. ; This needs to have a ".nc" appended, so just do it.    a ==
 addfile(infile,"r")    system("/bin/rm -f " + "Lind_wrf_W_Wind.nc")=

ables------------    dim_names = getvardims(a)    dim_sizes =
= getfiledimsizes(a)    dimUnlim = (/True, False, False, False, F=
alse, False, False, False, False/)    filedimdef(c, dim_names, dim_si=
zes, dimUnlim)    lat = a->XLAT    lon = a->XLONG    =
times = a->Times    fileattdef(c,a)    pres= (/300,400,5=
00,550,600,625,650,700,725,750,775,800,825,850,900,925,950,1000/)    =
Vname= (/"W300","W400","W500","W550","W600","W625","W650","W700","W725","=
W750","W775","W800","W825","W850","W900","W925","W950","W1000"/)    n=
pres=dimsizes(pres)    print(pres)    print(Vname)    c=
->Times = times    c->XLAT  = lat    c->XLONG = lon =

     ;    p  = wrf_user_getvar(a,"pressure",time) ; total=
 pressure    ; Horizontally interpolate to pressure coordinates ("=
p")    do n=0,npres-1    pressure = pres(n) ; pressure h=
Pa    wa_x = wrf_user_intrp3d(wa,p,"h",pressure,0.,False)    =
nnam= (/Vname(n)/)    print(nnam)    c->nnam = wa_x  =
            ;**************my question here *********=
*******    delete(wa_x)    delete(nnam)    end do =


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


Received on Wed Jun 11 11:46:11 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT