<div dir="ltr"><div>re: "f is undefined"</div><div><br></div><div>?? This indicates that the file pointer is not correct<br></div><div><br></div><div>The script loops over one or more files:</div><div><br></div><div><pre>do nf=0,nfili-1
pthi = diri+fili(nf)
f = addfile(pthi, "r")
</pre></div><div><pre>f is a pointer to a file.<br>======================================<br><br></pre><pre>You should go into 'debug mode'<br><br>print(diri) ; data path<br>print("=====") <br>print(fili) ; print names of one or more files<br>print("=====")<br>print("nfili="+nfili) ; number of files<br>print("=====")<br><br>:<br>:<br>do nf=0,nfili-1 ; loop over each file
pthi = diri+fili(nf)
</pre><pre> print(pthi)<br> print("=====")<br><br> f = addfile(pthi, "r") <br></pre><pre> print(f) ; equivalent to 'ncdump -h '
</pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 18, 2022 at 4:50 AM Setareh Rahimi <<a href="mailto:setareh.rahimi@gmail.com">setareh.rahimi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Dennis,</div><div>So many thanks for your help, but after running the script it said: "f<span style="background-color:rgb(241,194,50)"> is undefined</span>" !!</div><div>Why does this happen, please?</div><div>Best wishes,<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 17, 2022 at 10:49 PM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Looks like I 'somehow' deleted a line</div><div>====</div><div>Note the script has the following at the top: <br><pre>TEST = False <br>=====<br></pre><pre>The published script should be:<br><br></pre><pre> if (TEST) then ; <======= This was inadvertently deleted by 'someone' :;-)<br> ; <br> ndvi = short2flt(f->NDVI(:,::50,::25)) ; original unpacked values
else
ndvi = short2flt(f->NDVI) ; original unpacked values
end if
</pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 17, 2022 at 4:03 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear all,</div><div>I would like to use this example "<a href="https://www.ncl.ucar.edu/Applications/Scripts/ndvi_3.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/ndvi_3.ncl</a>", available at: <a href="https://www.ncl.ucar.edu/Applications/ndvi.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/ndvi.shtml</a></div><div>to plot NDVI from Advanced Very High-Resolution Radiometer (AVHRR) sensor. But, I got the following error:</div><div><br></div><div><span style="background-color:rgb(241,194,50)">fatal:error in statement<br>fatal:syntax error: line 55 in file ndvi before or near else <br> else<br>-----^<br><br>fatal:error in statement<br>fatal:syntax error: line 57 in file ndvi before or near if <br> end if<br>-------^</span><br></div><div>, "IF" statement is not complete. I do not know what condition has been considered for the "IF" statement. Would you please kindly advise me?<br></div><div>Thanks in advance,</div><div>Best wishes,<br></div><div><br></div><div><br></div><div><br></div><div>-- <br><div dir="ltr">S.Rahimi<br><br></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">S.Rahimi<br><br></div>
</blockquote></div>