[ncl-talk] shapefile woes
Matt Flournoy
mflournoy37 at gmail.com
Mon Jun 6 09:35:12 MDT 2016
Thank you Rick and Mary,
Yes, I think the pathname was the original error. I am able to open the
file interactively using the commands that Rick sent. When I tried that, I
didn't get any error messages while interactively running NCL.
Mary, thanks for running it and sending the png file! However, I'm still
not able to reproduce that image and continue to get the following error:
(0) Error: gsn_add_shapefile_polylines: Can't open shapefile
'/home/matt.flournoy/PECAN/overview/July06/new_shp/south-dakota_shps/roads.shp'
(0) No shapefile information will be added.
Here's the exact script that I'm using now:
On Fri, Jun 3, 2016 at 2:22 PM, Mary Haley <haley at ucar.edu> wrote:
> Hi Matt,
>
> Rick is out for a few days, so I'll try to help.
>
> You didn't indicate what the new problem was, but it looks to me like your
> code is working now. I had to replace the "USA_adms2.shp" with
> "USA_adm2.shp", and then I turned off NCL's map outlines so the plot was
> cleaner.
>
> Since you provided the south-dakota shapefiles, I went ahead and added
> these, using the script you provided earlier. It's important to use a
> unique variable name every time you call gsn_add_shapefile_polyline.
>
> I drew the USA outlines in blue, and SD roads in red so you could see the
> difference.
>
> See attached.
>
> --Mary
>
>
>
> On Fri, Jun 3, 2016 at 10:52 AM, Matt Flournoy <mflournoy37 at gmail.com>
> wrote:
>
>> Hi Rick,
>>
>> The path may have been the original issue and why I wasn't getting a file
>> extension error, because NCL couldn't find the file in the first place. So
>> that's relatively embarrassing. But now I'm sure I have the correct path.
>> I've attached the shapefiles that I'm using. USA_adm_shp.zip contains the
>> shapefiles with USA county borders, and south-dakota-latest.shp.zip
>> contains shapefiles with South Dakota road networks.
>>
>> Thanks,
>> Matt
>> USA_adm_shp.zip
>> <https://drive.google.com/file/d/0BxjU3NJc2C4dTFVBMWowREw4LVU/view?usp=drive_web>
>>
>> south-dakota-latest.shp.zip
>> <https://drive.google.com/file/d/0BxjU3NJc2C4dTFg1SFZTT2c3UXM/view?usp=drive_web>
>>
>>
>> On Fri, Jun 3, 2016 at 9:05 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
>>
>>> That's odd -- what has changed to now introduce the file-extension
>>> error? In any case, are you able to send me the shapefiles in question so
>>> that I can check it out -- perhaps they are corrupt or something?
>>>
>>>
>>>
>>> On Fri, Jun 3, 2016 at 7:18 AM, Matt Flournoy <mflournoy37 at gmail.com>
>>> wrote:
>>>
>>>> Hi Rick,
>>>>
>>>> Thanks! I'm absolutely sure it's the correct path, and I now get a file
>>>> extension error as well:
>>>>
>>>> ---
>>>>
>>>> fatal:["FileSupport.c":4159]:(/home/matt.flournoy/PECAN/overview/July06/new_shp/USA_county_shps/USA_adms2.shp)
>>>> has no file extension, can't determine type of file to open
>>>>
>>>> (0) Error: gsn_add_shapefile_polylines: Can't open shapefile
>>>> '/home/matt.flournoy/PECAN/overview/July06/new_shp/USA_county_shps/USA_adms2.shp'
>>>>
>>>> (0) No shapefile information will be added.
>>>>
>>>> ---
>>>>
>>>> The .shp, .shx, and .dbf files are all in the same directory
>>>> (.../USA_county_shps/), and all of them have the "USA_adm2" prefix.
>>>>
>>>> Thanks,
>>>>
>>>> Matt
>>>>
>>>> On Thu, Jun 2, 2016 at 4:29 PM, Rick Brownrigg <brownrig at ucar.edu>
>>>> wrote:
>>>>
>>>>> Hi Matt,
>>>>>
>>>>> The error says "...can't open shapefile...", so I'm not sure its a
>>>>> projection issue. Are you absolutely positive you've got the correct path?
>>>>> And you have the requisite 3 files at that path -- the .shp, the .shx, and
>>>>> the .dbf file, all with the same "USA_adm2" prefix.
>>>>>
>>>>> Rick
>>>>>
>>>>> On Thu, Jun 2, 2016 at 2:56 PM, Matt Flournoy <mflournoy37 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Kacie!!
>>>>>>
>>>>>> Thanks for the suggestions. I tried gsn_add_shapefile_polygons, but
>>>>>> got the same error as when I used polylines. I'm not sure how to check the
>>>>>> map projections for the shapefiles, but I'll look into that.
>>>>>>
>>>>>> Thanks!
>>>>>> Matt
>>>>>>
>>>>>> On Thu, Jun 2, 2016 at 3:37 PM, Kacie Shourd <Kacie.Shourd at dri.edu>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Matty (<3),
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I’ve never plotted shapefiles in NCL before, so bear with me.
>>>>>>> Looking at your code, I would suggest you try using
>>>>>>> gsn_add_shapefile_polygons like you use gsn_add_shapefile_polylines.
>>>>>>> Similar to how you are attempting to add the road polylines, try to add the
>>>>>>> polygons in this way as well?? The map you are calling in the create_SD_map
>>>>>>> function you have defined doesn’t draw these as far as I can tell.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Another thing to check would be that your map projections are
>>>>>>> matching between the shapefiles and the map you have called using NCL.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hopefully this helps, or someone else can guide you further.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> Kacie
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---
>>>>>>>
>>>>>>> Kacie N. Shourd
>>>>>>>
>>>>>>> 드림
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Graduate Research Assistant
>>>>>>>
>>>>>>> Desert Research Institute
>>>>>>>
>>>>>>> Kacie.Shourd at dri.edu
>>>>>>>
>>>>>>> Work: (775) 674-7049
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *From:* ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu]
>>>>>>> *On Behalf Of *Matt Flournoy
>>>>>>> *Sent:* Thursday, June 02, 2016 12:59 PM
>>>>>>> *To:* ncl-talk at ucar.edu
>>>>>>> *Subject:* [ncl-talk] shapefile woes
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I'm trying to plot a simple map of a few counties and roads in South
>>>>>>> Dakota using NCL 6.3.0. To do this, I've downloaded USA county shapefiles
>>>>>>> (from "http://www.gadm.org/country") and SD road network shapefiles
>>>>>>> (from "http://download.geofabrik.de/north-america.html"). Then, I
>>>>>>> use gsn_add_shapefile_polylines to add the USA counties to an existing map
>>>>>>> in my code, but I get this error message:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> (0) Error: gsn_add_shapefile_polylines: Can't open shapefile
>>>>>>> '/home/matt.flournoy/PECAN/overview/July06/new_shp/USA_adm_shp/USA_adm2.shp'
>>>>>>>
>>>>>>> (0) No shapefile information will be added.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I get the same error if I try inputing the road network shapefile,
>>>>>>> except that the directory in the first error message is the directory where
>>>>>>> the road network shapefile is. The map is plotted when I run the code, but
>>>>>>> the shapefile information is not on them.
>>>>>>>
>>>>>>> Does anyone know what may be causing this issue? I've attached the
>>>>>>> code that I'm using, which is very similar to the NCL example online about
>>>>>>> reading in USA county shapefiles from the same site as above.
>>>>>>>
>>>>>>> Thank you,
>>>>>>>
>>>>>>> Matt
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Matthew Flournoy
>>>>>>>
>>>>>>> M.S. Meteorology Student, University of Oklahoma
>>>>>>>
>>>>>>> B.S. Meteorology, Penn State University
>>>>>>>
>>>>>>> PUBLIC RECORDS NOTICE: In accordance with NRS Chapter 239, this
>>>>>>> email and responses, unless otherwise made confidential by law, may be
>>>>>>> subject to the Nevada Public Records laws and may be disclosed to the
>>>>>>> public upon request.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Matthew Flournoy
>>>>>> M.S. Meteorology Student, University of Oklahoma
>>>>>> B.S. Meteorology, Penn State University
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Matthew Flournoy
>>>> M.S. Meteorology Student, University of Oklahoma
>>>> B.S. Meteorology, Penn State University
>>>>
>>>
>>>
>>
>>
>> --
>> Matthew Flournoy
>> M.S. Meteorology Student, University of Oklahoma
>> B.S. Meteorology, Penn State University
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
--
Matthew Flournoy
M.S. Meteorology Student, University of Oklahoma
B.S. Meteorology, Penn State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160606/0d2d2920/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shp_woes.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 79194 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160606/0d2d2920/attachment.bin
More information about the ncl-talk
mailing list