[ncl-talk] variable name in netCDF file
Dennis Shea
shea at ucar.edu
Tue Jul 24 06:48:44 MDT 2018
The reason why the following fails
x = f->lwp37_mid-high_daynight_mon
is that NCL interprets the '-' as an algebraic operator (subtraction).
Think:
x = f->lwp37_mid *-* high_daynight_mon
It looks for the variable 'lwp37_mid' which does not exist.
---
Other examples:
x = f->*$"*ice cream+oreo-cookies...yummy!*"$* ; direct
xNam = *"*ice cream+oreo-cookies...yummy!*"*
x = f->*$*xNam*$*
---
; predefine desired variables
vars = (/"T","U","V"/) ; array of strings
nvar = dimsizes(vars)
do n=0,nvars-1
x = f->*$*vars(n)*$*
[snip]
end do
On Mon, Jul 23, 2018 at 9:48 PM, Rashed Mahmood <rashidcomsis at gmail.com>
wrote:
> May be try using the $$ syntax:
> e.g.
>
> infil = addfile("abc.nc","r")
>
> vname = "lwp37_mid-high_daynight_mon"
>
> varb = infil->$vname$
>
>
> Cheers,
> Rashed
>
>
>
>
>
>
>
>
> On Mon, Jul 23, 2018 at 8:27 PM, Laura Fowler <laura at ucar.edu> wrote:
>
>> Hello:
>>
>> I am trying to read two variables in a NetCDF file. One is named "lwp37_high_daynight_mon"
>> and I do not have any issue to read it.
>>
>> The other one is named "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.
>>
>> This is the only thing I can think of.
>>
>> Many thanks,
>> Laura
>>
>>
>> --
>> !-----------------------------------------------------------
>> --------------------------------------------------
>> Laura D. Fowler
>>
>> Mesoscale and Microscale Meteorology Division (MMM)
>> National Center for Atmospheric Research
>> P.O. Box 3000, Boulder CO 80307-3000
>>
>> e-mail: laura at ucar.edu
>> phone: 303-497-1628
>>
>> !-----------------------------------------------------------
>> --------------------------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> 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/20180724/ac4b8277/attachment.html>
More information about the ncl-talk
mailing list