<div dir="ltr"><div dir="ltr"><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">The type of the _FillValue attribute should be the same as the variable eith which it is associated.<br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b></b></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b><br></b></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b>???</b></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b><br></b></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b><br></b></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b>typeVarGrib = getfilevartypes( f, varGrib )</b><br></font></span></span></span></div><div><b><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">if ( isfilevaratt( f, varGrib, "_FillValue" ) ) then<br> fill = f->$varGrib$@_FillValue<br>else<br> fill = default_fillvalue( typeVarGrib ) ; <=====<br>end if</font></span></span></span></b></div><div><br></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/default_fillvalue.shtml"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/default_fillvalue.shtml</b></a><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 11, 2018 at 6:28 AM, Mateus da Silva Teixeira <span dir="ltr"><<a href="mailto:mateusstex@gmail.com" target="_blank">mateusstex@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 dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thank you Dennis and Toni for support.</div><div><br></div><div>I had forgotten I could use "attValue = f-><span style="color:rgb(0,0,255)"><b>$</b></span>varname<span style="color:rgb(0,0,255)"><b>$</b></span><span style="color:rgb(255,0,0)"><b>@</b></span><span style="color:rgb(0,0,255)"><b>$</b></span>attname<span style="color:rgb(0,0,255)"><b>$</b><span style="background-color:rgb(255,255,255)"><span><font color="#000000">", directly, without load variable previously.</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">So, with this tip, I write:</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><b>typeVarGrib = getfilevartypes( f, varGrib )</b><br></font></span></span></span></div><div><b><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">if ( isfilevaratt( f, varGrib, "_FillValue" ) ) then<br> fill = f->$varGrib$@_FillValue<br>else<br> fill = default_fillvalue( typeof( typeVarGrib ) )<br>end if<br></font></span></span></span></b></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">It works ok if <b>_FillValue</b> exist, but if it doesn't, I can't pass the type of grib file variable obtained with <b>getfilevartypes</b>, even using $ with <b>typeVarGrib</b> variable.</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">Is there a way to pass the content of <b>typeVarGrib</b> to <b>typeof</b> function?</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">Thanks,</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000">Mateus</font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"><br></font></span></span></span></div><div><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><span><font color="#000000"></font></span></span><br></span></div><div><span style="color:rgb(0,0,255)"><b></b></span></div></div></div></div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">Em seg, 10 de set de 2018 às 20:03, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Maybe, the following is what you want?<br></div><div><br></div><div><b>load</b> "./getvaratt_value" ; attached<br></div><div><br></div><div>;---- TEST ----<br></div><div> f = addfile("FOO.nc", "r")<br><br> fill = <b>getfilevaratt_value</b>(f, "phooey", "_FillValue")<br> print(fill)<br><br> g = addfile("FOO.grb", "r")<br> FILL = <b>getfilevaratt_value</b>(g, "PHOOEY, "_FillValue")<br> print(FILL)</div><div><br></div><div>====================</div><div>You don't 'need' a function but I'd suggest it for error checking and, in some sense, clarity.</div><div><br></div><div>You could do it directly .... IF the variable and IF the attribute exist<br></div><div><br></div><div>attValue = f-><span style="color:rgb(0,0,255)"><b>$</b></span>varname<span style="color:rgb(0,0,255)"><b>$</b></span><span style="color:rgb(255,0,0)"><b>@</b></span><span style="color:rgb(0,0,255)"><b>$</b></span>attname<span style="color:rgb(0,0,255)"><b>$</b></span><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 10, 2018 at 3:08 PM, Toni Klemm <span dir="ltr"><<a href="mailto:toni-klemm@tamu.edu" target="_blank">toni-klemm@tamu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hm, I’m not familiar with GRIB files. But generally, don’t you *have* to load the content from all files if you want to aggregate content from multiple files into one? Or are the files too large to load them all at once?<div><br></div><div><span>Toni<br><div>
<div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word;line-break:after-white-space"><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"><br></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><b>Toni Klemm, Ph.D.<br></b>Postdoctoral Research Associate</font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Department of Ecosystem Science and Management</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">College of Agriculture and Life Sciences</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Texas A&M University, College Station, TX</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri">Contributor to the <a href="http://www.eccforum.org" target="_blank">Early Career Climate Forum</a><br><a href="http://www.toni-klemm.de" target="_blank">www.toni-klemm.de</a> | <a href="http://twitter.com/toniklemm" target="_blank">@toniklemm</a></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div></div></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline">
</div>
</span><div><div class="m_8736428376191178363m_6002462981317498560h5"><div><br><blockquote type="cite"><div>On Sep 10, 2018, at 4:01 PM, Mateus da Silva Teixeira <<a href="mailto:mateusstex@gmail.com" target="_blank">mateusstex@gmail.com</a>> wrote:</div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909Apple-interchange-newline"><div><div dir="ltr"><div><div>Sorry about grammatical error: ... not <b>be more</b> specific.<br><br></div>Best regards,<br><br></div><span id="m_8736428376191178363m_6002462981317498560m_8244075755109096909:5o5.10">Mateus</span><br><br></div><br><div class="gmail_quote"><div dir="ltr">Em seg, 10 de set de 2018 às 17:57, Mateus da Silva Teixeira <<a href="mailto:mateusstex@gmail.com" target="_blank">mateusstex@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Toni,<br><br></div>Thank you for your reply.<br><br></div>Sorry for not being more specific. Actually, I have more than 30 GRIB 1/2 files and I would like to define a single variable (with new function) to hold data from all files. Part of these files are in GRIB 1 format and other part is in GRIB 2. Also, variable name changes from GRIB 1 to GRIB 2 format, even the files coming from same source (GFS ANL). So, I want, after working with these differences, to put all data into the same array.<br><br></div>Thanks,<br><br></div>mateus<br><br></div><br><div class="gmail_quote"><div dir="ltr">Em seg, 10 de set de 2018 às 17:47, Toni Klemm <<a href="mailto:toni-klemm@tamu.edu" target="_blank">toni-klemm@tamu.edu</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hi Mateus,<div><br></div><div>I imagine there are more elegant ways, but if you don’t have too many files (or if they have the same variable type (int, float, …), you can run the command </div><div><font face="Courier"><br></font></div><div><font face="Courier">ncdump -h file/path/and/<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__filename.nc&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=QNHQY-Rg2SD7O4tjt83KFOLSP78h3Xsi7Gp8DZC4XjQ&s=nGgX5SBhjflILx1upQjtPTbXH-SW2BKF3RylaoX5oeM&e=" target="_blank">filename.nc</a></font></div><div><br></div><div>which will give you the metadata to each variable, and copy-paste the _FillValue value of your variable directly into your NCL script. Another way is to view the file in a viewer like Panoply and get the _FillValue that way.</div><div><br></div><div>Hope that helps,</div><div>Toni</div><div>
<div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word;line-break:after-white-space"><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"><br></font></div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><b>Toni Klemm, Ph.D.<br></b>Postdoctoral Research Associate</font></div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Department of Ecosystem Science and Management</div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">College of Agriculture and Life Sciences</div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Texas A&M University, College Station, TX</div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri">Contributor to the <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=QNHQY-Rg2SD7O4tjt83KFOLSP78h3Xsi7Gp8DZC4XjQ&s=QUEh_u_3pzFgPJlCLTXhCDGj-D3g91zg-BqeSy81OCs&e=" target="_blank">Early Career Climate Forum</a><br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=QNHQY-Rg2SD7O4tjt83KFOLSP78h3Xsi7Gp8DZC4XjQ&s=VU_wO4xhSNGiMrxkh2cdBDlVDCFdstJTeeISiPDr1zs&e=" target="_blank">www.toni-klemm.de</a> | <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=QNHQY-Rg2SD7O4tjt83KFOLSP78h3Xsi7Gp8DZC4XjQ&s=vCNxBBWrfi20WfSVT8WwtxB8Z5Y1OLH3Am8YgLAefPs&e=" target="_blank">@toniklemm</a></font></div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div><div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div></div></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"></div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline">
</div>
<div><br><blockquote type="cite"><div>On Sep 10, 2018, at 3:34 PM, Mateus da Silva Teixeira <<a href="mailto:mateusstex@gmail.com" target="_blank">mateusstex@gmail.com</a>> wrote:</div><br class="m_8736428376191178363m_6002462981317498560m_8244075755109096909m_-8923431039586834761m_8309689789431859241Apple-interchange-newline"><div><div dir="ltr"><div><div><div><div>Hi,<br><br></div>Is there a way to get _FillValue attribute from a file variable without loading that variable?<br><br></div>I found <i>getFillValue</i> function, but I think it won't work like I expect. Also, function <i>getfilevaratts</i> only gives a list of the attributes. I would like to directly access the content of this attribute.<br><br></div>Thanks,<br><br></div>Mateus<br><br></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="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=QNHQY-Rg2SD7O4tjt83KFOLSP78h3Xsi7Gp8DZC4XjQ&s=hVrZrwQef20v6y6LLb2lxqeSgfcc8A3CzN-mfZ61YyY&e=" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></blockquote></div>
</blockquote></div>
</div></blockquote></div><br></div></div></div></div><br>______________________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div>
</div></div></blockquote></div><br></div>