<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> Dear NCL help,</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">I am trying to extract multiple stations time series (ascci output for each stations) from wrfoutput file but i could not succeed in doing so. Would you please kindly guide me to get the solution?</div></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> ; -------------- LOAD FUNCTIONS AND PROCEDURES ----------------</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> ; -------------- BEGINING OF NCL SCRIPT ----------------</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">begin</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">DATADir = "/mnt/gpfs1/data/private/fgvy024/Build_WRF/WRFV6/run/"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d03* ")</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">numFILES = dimsizes(FILES)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">a = addfiles(FILES+".nc","r")</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">times = wrf_user_list_times(a) ; get times in the file</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">ntimes = dimsizes(times) ; number of times in the file or 1584 for domain1 4750</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">;new parameters naming</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">temp = new(ntimes,float) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_expp = new(ntimes,float) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_conn = new(ntimes,float) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_tot = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">wspd = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">wdir = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">snoww_eq = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">snowh_h = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">;rhh = new(ntimes,float)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">;******************************* time loop</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">do it = 0, ntimes-1 </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">time = it</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> ;************************************************</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><span style="line-height: 22.72px; font-size: 12pt;">do ip = 0, 18 ;loop for number of station locations</span></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">ip_lats = (/ 27.3081, 27.6331,<span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span>27.86,<span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span>27.959167, \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> 27.696667, 27.8024,<span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span>27.8953, 27.99,<span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span>27.9818, \ </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> 27.90506667, 27.89671667, 27.901, 27.8987, \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> 27.89261111, 27.87828333, 27.85911111, \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> 27.60111, 27.74661, 27.85722 /)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">ip_lons = (/ 86.5042, 86.2331, 86.46, 86.81278, 86.721389, 86.7144, \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> 86.8188, 86.83, 86.7649, 86.37536667, 86.37428333, 86.37625, 86.37911667, \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span> 86.37594444,<span class="ecxApple-tab-span" style="line-height: 21.3px; white-space: pre;">        </span>86.43361667, 86.43388889, 86.74028, 86.713, 86.79417 /)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">res = True </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">res@returnInt = True </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">point = wrf_user_ll_to_ij(a, ip_lons(ip), ip_lats(ip), True)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">x = point(0) - 1</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">y = point(1) - 1 </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><span style="line-height: 22.72px; font-size: 12pt;">tc2 = wrf_user_getvar(a,"T2",it) ; temp extraction</span></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">tc2 = tc2 -273.16</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">temp(it) = tc2(y,x) ; temperature extraction for station location</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_exp = wrf_user_getvar(a,"RAINNC",it) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_con = wrf_user_getvar(a,"RAINC",it) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_expp(it) = rain_exp(y,x)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_conn(it) = rain_con(y,x)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">rain_tot(it) = rain_exp(y,x) + rain_con(y,x)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">u10 = wrf_user_getvar(a,"U10",it) ; u at 10 m, mass point</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">v10 = wrf_user_getvar(a,"V10",it) ; v at 10 m, mass point</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">wspd(it) = ndtooned( sqrt(u10(y,x)^2 + v10(y,x)^2) )</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">wdir(it) = ndtooned( atan2(u10(y,x),v10(y,x))/0.01745329 +180. ) </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><span style="line-height: 22.72px; font-size: 12pt;">snow_eq = wrf_user_getvar(a,"SNOW",it)</span></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">snow_h = wrf_user_getvar(a,"SNOWH",it)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">snoww_eq(it) = snow_eq(y,x)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">snowh_h (it) = snow_h(y,x)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">end do ; end of station loop</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">end do ; end of time loop</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br style="line-height: 21.3px;"></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> npts=ntimes</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> fName = ip+"T2oben_1kmtemp_rainnonc_rainc_raintot_wspd_wdir_snow_snowh.txt"</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> data = new( npts, "string") </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> ;print(" Time temp ")</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> do ip = 0, 18</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> do it = 0,ntimes-1 ;ntimes-1</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> data (it)= (sprintf("%5.0f",it) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%21.2f", temp(it)) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%22.2f", rain_expp(it)) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%23.2f", rain_conn(it)) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%24.2f", rain_tot(it)) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%17.2f", wspd(it)) +" " \ </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%25.2f", wdir(it)) +" " \ </div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%18.2f", snoww_eq(it)) +" " \</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> +sprintf("%19.2f", snowh_h(it)) +" " )</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">end do</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> end do ; end of time loop</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"> asciiwrite (fName , data)</div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);"><br></div><div style="line-height: 21.3px; color: rgb(68, 68, 68); font-size: 15px; background-color: rgb(255, 255, 255);">end</div><div><br></div><div><i><br></i></div>                                            </div></body>
</html>