[ncl-talk] _FillValue directly from a file variable
Dennis Shea
shea at ucar.edu
Mon Sep 10 17:03:17 MDT 2018
Maybe, the following is what you want?
*load* "./getvaratt_value" ; attached
;---- TEST ----
f = addfile("FOO.nc", "r")
fill = *getfilevaratt_value*(f, "phooey", "_FillValue")
print(fill)
g = addfile("FOO.grb", "r")
FILL = *getfilevaratt_value*(g, "PHOOEY, "_FillValue")
print(FILL)
====================
You don't 'need' a function but I'd suggest it for error checking and, in
some sense, clarity.
You could do it directly .... IF the variable and IF the attribute exist
attValue = f->*$*varname*$**@**$*attname*$*
On Mon, Sep 10, 2018 at 3:08 PM, Toni Klemm <toni-klemm at tamu.edu> wrote:
> 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?
>
> Toni
>
>
>
> *Toni Klemm, Ph.D.*Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> College of Agriculture and Life Sciences
> Texas A&M University, College Station, TX
> Contributor to the Early Career Climate Forum <http://www.eccforum.org>
> www.toni-klemm.de | @toniklemm <http://twitter.com/toniklemm>
>
>
>
>
>
>
>
>
> On Sep 10, 2018, at 4:01 PM, Mateus da Silva Teixeira <
> mateusstex at gmail.com> wrote:
>
> Sorry about grammatical error: ... not *be more* specific.
>
> Best regards,
>
> Mateus
>
>
> Em seg, 10 de set de 2018 às 17:57, Mateus da Silva Teixeira <
> mateusstex at gmail.com> escreveu:
>
>> Hi Toni,
>>
>> Thank you for your reply.
>>
>> 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.
>>
>> Thanks,
>>
>> mateus
>>
>>
>> Em seg, 10 de set de 2018 às 17:47, Toni Klemm <toni-klemm at tamu.edu>
>> escreveu:
>>
>>> Hi Mateus,
>>>
>>> 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
>>>
>>> ncdump -h file/path/and/filename.nc
>>> <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=>
>>>
>>> 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.
>>>
>>> Hope that helps,
>>> Toni
>>>
>>>
>>>
>>> *Toni Klemm, Ph.D.*Postdoctoral Research Associate
>>> Department of Ecosystem Science and Management
>>> College of Agriculture and Life Sciences
>>> Texas A&M University, College Station, TX
>>> Contributor to the Early Career Climate Forum
>>> <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=>
>>> www.toni-klemm.de
>>> <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=>
>>> | @toniklemm
>>> <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=>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sep 10, 2018, at 3:34 PM, Mateus da Silva Teixeira <
>>> mateusstex at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> Is there a way to get _FillValue attribute from a file variable without
>>> loading that variable?
>>>
>>> I found *getFillValue* function, but I think it won't work like I
>>> expect. Also, function *getfilevaratts* only gives a list of the
>>> attributes. I would like to directly access the content of this attribute.
>>>
>>> Thanks,
>>>
>>> Mateus
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>> <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=>
>>>
>>>
>>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180910/b7c3a90e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getfilevaratt_value.ncl
Type: application/octet-stream
Size: 607 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180910/b7c3a90e/attachment.obj>
More information about the ncl-talk
mailing list