<div dir="ltr"><div><div><div><div>The reason why the following fails<br><br> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">x = f->lwp37_mid-high_daynight_mon<br><br></span></div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">is that NCL interprets the '-' as an algebraic operator (subtraction). Think:<br><br></span></div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"> x </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">= f->lwp37_mid <b>-</b> high_daynight_mon<br><br></span></div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">It looks for the variable 'lwp37_mid' which does not exist.<br><br>---<br></span></div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">Other examples:<br><br> x = f-><b>$"</b>ice cream+oreo-cookies...yummy!<b>"$</b> ; direct<br></span><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"><br> xNam = <b>"</b>ice cream+oreo-cookies...yummy!<b>"</b><br> x = f-><b>$</b>xNam<b>$</b><br>---<br></span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"> ; predefine desired variables<br></span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"> vars = (/"T","U","V"/) ; array of strings<br> nvar = dimsizes(vars)<br><br> do n=0,nvars-1<br> x = f-><b>$</b>vars(n)<b>$</b><br> [snip]<br> end do<br><br><br></span><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"></span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 23, 2018 at 9:48 PM, Rashed Mahmood <span dir="ltr"><<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>May be try using the $$ syntax:</div><div></div><div>e.g.</div><div><br></div><div> infil = addfile("<a href="http://abc.nc" target="_blank">abc.nc</a>","r")</div><div><br></div><div> vname = "<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">lwp37_mid-high_daynight_mon</span>"<br></div><div><br></div><div> varb = infil-><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"><span></span></span>$vname$</div><div><br></div><div><br></div><div>Cheers,</div><div>Rashed<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> <br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Jul 23, 2018 at 8:27 PM, Laura Fowler <span dir="ltr"><<a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hello:</span><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial">I am trying to read two variables in a NetCDF file. One is named "<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">lwp37_high_daynight_mon" and I do not have any issue to read it.</span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"><br></span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">The other one is named "</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">lwp37_mid-high_daynight_mon" for which ncl (6.4.0) an error message. I do not have any issue using ncdump with this variable. Does ncl has an issue reading variable that a name with a mix of "_" and "-" sign.</span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"><br></span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">This is the only thing I can think of.</span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px"><br></span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">Many thanks,</span></div><div style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:12px">Laura</span></div><span class="m_8098435298420462009HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_8098435298420462009m_-2776834865640492942gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------</font><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Laura D. Fowler </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Mesoscale and Microscale Meteorology Division (MMM) </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">National Center for Atmospheric Research<br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">P.O. Box 3000, Boulder CO 80307-3000</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">phone: 303-497-1628</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------</font><br></div></div></div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>