<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> Dear NCL help,</div><div>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>regards</div><div>Ramchandra</div><div><br></div><div> ; -------------- LOAD FUNCTIONS AND PROCEDURES ----------------</div><div><br></div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div><br></div><div> ; -------------- BEGINING OF NCL SCRIPT ----------------</div><div>begin</div><div>DATADir = "/mnt/gpfs1/data/private/fgvy024/Build_WRF/WRFV6/run/"</div><div>FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d03* ")</div><div>numFILES = dimsizes(FILES)</div><div>a = addfiles(FILES+".nc","r")</div><div>times = wrf_user_list_times(a) ; get times in the file</div><div>ntimes = dimsizes(times) ; number of times in the file or 1584 for domain1 4750</div><div><br></div><div>;new parameters naming</div><div>temp = new(ntimes,float) </div><div>rain_expp = new(ntimes,float) </div><div>rain_conn = new(ntimes,float) </div><div>rain_tot = new(ntimes,float)</div><div>wspd = new(ntimes,float)</div><div>wdir = new(ntimes,float)</div><div>snoww_eq = new(ntimes,float)</div><div>snowh_h = new(ntimes,float)</div><div>;rhh = new(ntimes,float)</div><div><br></div><div>;******************************* time loop</div><div>do it = 0, ntimes-1 </div><div>time = it</div><div><br></div><div> ;************************************************</div><div><span style="font-size: 12pt;">do ip = 0, 18 ;loop for number of station locations</span></div><div>ip_lats = (/ 27.3081, 27.6331,<span class="Apple-tab-span" style="white-space:pre">        </span>27.86,<span class="Apple-tab-span" style="white-space:pre">        </span>27.959167, \</div><div> 27.696667, 27.8024,<span class="Apple-tab-span" style="white-space:pre">        </span>27.8953, 27.99,<span class="Apple-tab-span" style="white-space:pre">        </span>27.9818, \ </div><div> 27.90506667, 27.89671667, 27.901, 27.8987, \</div><div> 27.89261111, 27.87828333, 27.85911111, \</div><div> 27.60111, 27.74661, 27.85722 /)</div><div>ip_lons = (/ 86.5042, 86.2331, 86.46, 86.81278, 86.721389, 86.7144, \</div><div> 86.8188, 86.83, 86.7649, 86.37536667, 86.37428333, 86.37625, 86.37911667, \</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> 86.37594444,<span class="Apple-tab-span" style="white-space:pre">        </span>86.43361667, 86.43388889, 86.74028, 86.713, 86.79417 /)</div><div>res = True </div><div>res@returnInt = True </div><div>point = wrf_user_ll_to_ij(a, ip_lons(ip), ip_lats(ip), True)</div><div>x = point(0) - 1</div><div>y = point(1) - 1 </div><div><br></div><div><span style="font-size: 12pt;">tc2 = wrf_user_getvar(a,"T2",it) ; temp extraction</span></div><div>tc2 = tc2 -273.16</div><div>temp(it) = tc2(y,x) ; temperature extraction for station location</div><div>rain_exp = wrf_user_getvar(a,"RAINNC",it) </div><div>rain_con = wrf_user_getvar(a,"RAINC",it) </div><div>rain_expp(it) = rain_exp(y,x)</div><div>rain_conn(it) = rain_con(y,x)</div><div>rain_tot(it) = rain_exp(y,x) + rain_con(y,x)</div><div>u10 = wrf_user_getvar(a,"U10",it) ; u at 10 m, mass point</div><div>v10 = wrf_user_getvar(a,"V10",it) ; v at 10 m, mass point</div><div>wspd(it) = ndtooned( sqrt(u10(y,x)^2 + v10(y,x)^2) )</div><div>wdir(it) = ndtooned( atan2(u10(y,x),v10(y,x))/0.01745329 +180. ) </div><div><span style="font-size: 12pt;">snow_eq = wrf_user_getvar(a,"SNOW",it)</span></div><div>snow_h = wrf_user_getvar(a,"SNOWH",it)</div><div>snoww_eq(it) = snow_eq(y,x)</div><div>snowh_h (it) = snow_h(y,x)</div><div><br></div><div>end do ; end of station loop</div><div>end do ; end of time loop</div><div><br></div><div> npts=ntimes</div><div> fName = ip+"T2oben_1kmtemp_rainnonc_rainc_raintot_wspd_wdir_snow_snowh.txt"</div><div> data = new( npts, "string") </div><div> ;print(" Time temp ")</div><div> ip = 0, 18</div><div> do it = 0,ntimes-1 ;ntimes-1</div><div> data (it)= (sprintf("%5.0f",it) +" " \</div><div> +sprintf("%21.2f", temp(it)) +" " \</div><div> +sprintf("%22.2f", rain_expp(it)) +" " \</div><div> +sprintf("%23.2f", rain_conn(it)) +" " \</div><div> +sprintf("%24.2f", rain_tot(it)) +" " \</div><div> +sprintf("%17.2f", wspd(it)) +" " \ </div><div> +sprintf("%25.2f", wdir(it)) +" " \ </div><div> +sprintf("%18.2f", snoww_eq(it)) +" " \</div><div> +sprintf("%19.2f", snowh_h(it)) +" " )</div><div> end do ; end of time loop</div><div> asciiwrite (fName , data)</div><div>end</div><div><br></div><div><br></div><div><i><br></i></div>                                            </div></body>
</html>