[ncl-talk] Unable to read shapefile attribute table correctly

Peirong Lin peironglinlin at gmail.com
Tue Aug 5 15:33:04 MDT 2014


Hi Rick and Dave,

Thanks for replying. I've uploaded the shapefile to the ftp site. It's a
very simple one, with "x" and "y" and "COMID" (and some other variables)
being its variables.

If I used "X = f->x", and print(X), all the values can be correctly read.
But when I used "COMIDs = f->COMID", it just simple read as value "0".
Looks forward to your reply.

Peirong


On Tue, Aug 5, 2014 at 3:25 PM, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Never mind, it looks like you already used one of the print statements to
> find that COMID is a defined file variable.
>
> --Dave
>
> On Tue, Aug 5, 2014 at 3:19 PM, Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> Peirong,
>>
>> You should start debugging something like this with printVarSummary (f)
>> and print(f), not getfilevarnames (f).
>>
>> --Dave
>>
>>
>> On Tue, Aug 5, 2014 at 3:13 PM, Peirong Lin <peironglinlin at gmail.com>
>> wrote:
>>
>>> Dear NCL,
>>>
>>> I am using the following NCL code to read a shapefile attribute table
>>> (which allows further computation), but when I printed out all the
>>> "COMIDs", they are all "0". But when I open the shapefile in ArcGIS, the
>>> COMIDs can be correctly shown. Can anybody provide some hints to resolve
>>> this?
>>>
>>>
>>> *begin*
>>>
>>> *shp_file        = "./NHDFlowline.shp"*
>>>
>>> *f       = addfile(shp_file,"r")*
>>>
>>> *varnames        = getfilevarnames(f)*
>>>
>>> *print("varnames = "+varnames)*
>>>
>>> *COMIDs  = f->COMID*
>>>
>>> *print(COMIDs)*
>>>
>>> *end*
>>>
>>> I've already made sure the COMID is a variable in the shapefile, but the
>>> values just cannot be read correctly. Thank you in advance for replying!!
>>>
>>> Best,
>>> Peirong
>>>
>>>
>>> --
>>> *Peirong Lin* (Ms.)
>>> Graduate Research Assistant (JGB 5.322)
>>> Jackson School of Geosciences
>>> The University of Texas at Austin
>>> Contact: 512-201-3731
>>> prlin at utexas.edu; peironglinlin at gmail.com
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>


-- 
*Peirong Lin* (Ms.)
Graduate Research Assistant (JGB 5.322)
Jackson School of Geosciences
The University of Texas at Austin
Contact: 512-201-3731
prlin at utexas.edu; peironglinlin at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140805/b1ddd163/attachment.html 


More information about the ncl-talk mailing list