<div dir="ltr">Thank you for your quick reply! To clarify, what did you accomplish by submitting the JIRA ticket? Also, when I run your modified script, I am now getting an error that some vector subscripts need to be integers. Did you run into this as well?<div><br></div><div>Thanks again,</div><div><br></div><div>Michelle</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Michelle Serino<div>M.S. Candidate</div><div><span style="font-size:small">Texas A&M University</span><br></div><div>Atmospheric Sciences Dept.</div><div>Eller O&M, Suite 1017</div><div>College Station, TX 77843<br></div><div>(484) 769-0949</div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Oct 22, 2015 at 6:55 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My speculation is that different grib tables are being accessed.<br>
<br>
JIRA-2297<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Oct 22, 2015 at 5:36 PM, Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br>
> There appears to be a naming error.<br>
><br>
> When I do<br>
><br>
> %> ncl_filedump ruc2anl_252_20090605_2000_000.grb | less<br>
><br>
> I get the variable names you use.<br>
><br>
> ===<br>
><br>
> When I execute your script I ran into errors. I inserted a<br>
><br>
> f = addfile(...)<br>
> print(f) ; should match ncl_filedump BUT they don't<br>
> ... NCL need to fix<br>
><br>
> The variable names and dimension names are changed from the ncl_filedump.<br>
><br>
> I will fill out a JIRA ticket.<br>
><br>
> However, we can use the variable names from the 'print(f)', the script<br>
> works correctly.<br>
><br>
><br>
> ===<br>
> See attached<br>
><br>
><br>
><br>
><br>
><br>
> On Thu, Oct 22, 2015 at 4:55 PM, Michelle Serino <<a href="mailto:mmserino@tamu.edu">mmserino@tamu.edu</a>> wrote:<br>
>> Good afternoon,<br>
>><br>
>> I am modifying one of NCAR's scripts (skewt_6.ncl) to plot a skew-T with<br>
>> RUC2 Analysis data in grib1 format. I have modified the script accordingly<br>
>> to reflect the change in file type and to apply to the case I am studying,<br>
>> but most everything else I have left as it was originally. I am receiving<br>
>> an error that, after some extensive research and attempts, I have been<br>
>> unable to fix, so I appreciate any help that anyone can provide.<br>
>><br>
>> My code:<br>
>><br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
>><br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
>><br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"<br>
>><br>
>><br>
>> begin<br>
>><br>
>><br>
>> ; --- Read RUC GRIB file------------;<br>
>><br>
>> dir = "/atmomounts/home/grad/mserino/Desktop/"<br>
>><br>
>> fil = "ruc2anl_252_20090605_2000_000.grb"<br>
>><br>
>><br>
>> ; force a 'time' dimension<br>
>><br>
>> setfileoption("grb","SingleElementDimensions","Initial_time")<br>
>><br>
>><br>
>> f = addfile(dir+fil,"r")<br>
>><br>
>> p = int2flt(f->lv_ISBL2) ; ( lv_ISBL2 )<br>
>><br>
>> time = f->initial_time0_encoded ; yyyymmddhh.hh_frac<br>
>><br>
>><br>
>> ; RUC grid point locations<br>
>><br>
>> lat2d = f->gridlat_252 ; ( ygrid_0, xgrid_0 )<br>
>><br>
>> lon2d = f->gridlon_252<br>
>><br>
>> print("lat2d: min="+min(lat2d)+" ; max="+max(lat2d))<br>
>><br>
>> print("lon2d: min="+min(lon2d)+" ; max="+max(lon2d))<br>
>><br>
>><br>
>> ;p = p*0.01 ; change units<br>
>><br>
>> p@units = "hPa" ; skewT, mixhum_ptrh use mb (hPa)<br>
>><br>
>><br>
>> ; --- Specify one or more locations<br>
>><br>
>><br>
>> lat = (/ 37.25 , 43.25 /)<br>
>><br>
>> lon = (/-107.75 ,-101.75 /)<br>
>><br>
>> npts = dimsizes(lat)<br>
>><br>
>><br>
>> ; create plot(s)<br>
>><br>
>><br>
>> skewtOpts = True<br>
>><br>
>> skewtOpts@DrawColAreaFill = True ; default is False<br>
>><br>
>><br>
>> dataOpts = True<br>
>><br>
>> dataOpts@PrintZ = True<br>
>><br>
>><br>
>> do n=0,npts-1 ; loop over each grid pt<br>
>><br>
>><br>
>> ; find grid point nearest the user specified location<br>
>><br>
>> nm = getind_latlon2d (lat2d,lon2d, lat(n), lon(n))<br>
>><br>
>> nn = nm(0,0)<br>
>><br>
>> mm = nm(0,1)<br>
>><br>
>> print("location=("+lat(n)+","+lon(n)+")<br>
>> grid=("+lat2d(nn,mm)+","+lon2d(nn,mm)+")")<br>
>><br>
>><br>
>><br>
>> tk = f->TMP_252_ISBL(0,:,nn,mm)<br>
>><br>
>> z = f->HGT_P0_252_ISBL(0,:,nn,mm)<br>
>><br>
>> rh = f->R_H_P0_252_ISBL(0,:,nn,mm)<br>
>><br>
>> u = f->U_GRD_252_ISBL(0,:,nn,mm)<br>
>><br>
>> v = f->V_GRD_252_ISBL(0,:,nn,mm)<br>
>><br>
>><br>
>> ; change units and calculate needed variables<br>
>><br>
>> tc = tk - 273.15<br>
>><br>
>> tc@units= "degC"<br>
>><br>
>><br>
>> q = mixhum_ptrh (p, tk, rh, 2)<br>
>><br>
>> q@units = "kg/kg"<br>
>><br>
>><br>
>> tdc = dewtemp_trh(tk,rh) - 273.15<br>
>><br>
>> tdc@units = "degC"<br>
>><br>
>><br>
>> wspd = sqrt(u^2 + v^2)<br>
>><br>
>> wdir = wind_direction(u,v,0)<br>
>><br>
>><br>
>> itime= toint(time)<br>
>><br>
>> skewtOpts@tiMainString = "RUC: "+itime+":<br>
>> ("+lat(n)+","+lon(n)+")"<br>
>><br>
>><br>
>> ; each location will have a different file name<br>
>><br>
>> wks = gsn_open_wks ("png",<br>
>> "ruc2anl_skewt_"+itime+"_"+sprinti("%0.3i",n))<br>
>><br>
>> skewt_bkgd = skewT_BackGround (wks, skewtOpts)<br>
>><br>
>> skewt_data = skewT_PlotData (wks, skewt_bkgd, p,tc,tdc,z,<br>
>> wspd,wdir, dataOpts)<br>
>><br>
>> draw (skewt_bkgd)<br>
>><br>
>> draw (skewt_data)<br>
>><br>
>> frame(wks)<br>
>><br>
>> end do<br>
>><br>
>><br>
>> end<br>
>><br>
>><br>
>> The error I get regards the lines in red:<br>
>><br>
>> Either file (f) isn't defined or variable (lv_ISBL2) is not a variable in<br>
>> the file<br>
>><br>
>><br>
>> The correct file, f, is defined because I am able to print its contents.<br>
>> The variable "lv_ISBL2" is also a defined variable in the file, so I am not<br>
>> sure why it is not recognized. My code is attached, and the RUC2 data are<br>
>> available at the link below. Thank you again, and I look forward to hearing<br>
>> from you.<br>
>><br>
>><br>
>> ruc2anl_252_20090605_2000_000.grb<br>
>><br>
>><br>
>> Best regards,<br>
>><br>
>><br>
>> Michelle Serino<br>
>> M.S. Candidate<br>
>> Texas A&M University<br>
>> Atmospheric Sciences Dept.<br>
>> Eller O&M, Suite 1017<br>
>> College Station, TX 77843<br>
>> (484) 769-0949<br>
>><br>
>><br>
>> _______________________________________________<br>
>> ncl-talk mailing list<br>
>> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>><br>
</div></div></blockquote></div><br></div>