[ncl-talk] confusion with reading attributes

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Thu Nov 21 16:36:55 MST 2019


Mark has a netcdf file with an "at sign" embedded in a variable name.  This
is quite odd, but it is legal netcdf.

This needs special quoting in NCL, because the "at sign" is an active NCL
operator.  Special quoting is needed.  This should work:

 lats = ndtooned (obsfile->$"latitude at MetaData"$(:))


On Thu, Nov 21, 2019 at 4:27 PM Rick Brownrigg via ncl-talk <
ncl-talk at ucar.edu> wrote:

> I for one don't understand this line:
>
>   float latitude at MetaData(nlocs) ;
>
> Could you perhaps open the file and provide the output from
> "printVarSummary(obsfile)" ??
>
> Rick
>
>
> On Thu, Nov 21, 2019 at 4:02 PM M P via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hello,
>>
>> I have a file in the following format
>> netcdf aod_viirs_obs_2018041500_f {
>> dimensions:
>>         nvars = 1 ;
>>         nlocs = UNLIMITED ; // (27545 currently)
>> variables:
>>          ....
>>         float latitude at MetaData(nlocs) ;
>>
>> with  latitude at MetaData just being a variable name
>>
>> That is falsely being read as an attribute with a code
>>
>>  obsfile   = addfile("./indata/aod_viirs_obs_2018041500_s.nc4","r")
>>  ; lons, lats, AOD
>>  lats  =   ndtooned(obsfile->latitude at MetaData(:))    ; Pull off lat
>>
>> and warning/error
>>
>> warning:["NclAdvancedFile.c":5317]:AdvancedFileReadVarAtt: (MetaData) is
>> not an attribute of (latitude)
>>
>> How to correct it so that the variable latitude at MetaData is read
>> properly?
>>
>> Thanks,
>>
>> Mark
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191121/50de611e/attachment.html>


More information about the ncl-talk mailing list