Re: Shapefile Example Not Working

From: Illston, Bradley G. <illston_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 30 2010 - 22:43:19 MDT

Rick,

Sorry for the delay. We took majors steps (perhaps too much, but it solved other non-NCL related issues) to solve the problem. Basically we upgraded the server from Red Hat 4 to Red Hat 5 and then reinstalled NCL. Here is what the sys-admin did with respect to NCL:

*****************************************

The ncl packages from Fedora EPEL5:
ncl.x86_64 5.1.1-3
ncl-common.x86_64 5.1.1-3
ncl-devel.x86_64 5.1.1-3
ncl-examples.x86_64 5.1.1-3

don't include GDAL support for ESRI shape files. I downloaded the source rpm package: ncl-5.1.1-3.el5.src.rpm and installed it using 'rpm -ivh ncl-5.1.1-3.el5.src.rpm'

I installed gdal and gdal-devel using: 'yum install gdal.$ARCH gdal-devel.$ARCH'

I also downloaded 'triangle' as a ZIP file from: http://www.cs.cmu.edu/~quake/triangle.research.html

In /usr/src/redhat/SOURCES/Site.local.ncl I set:
#define BuildTRIANGLE 1
#define BuildGDAL 1
and modified the line:
#define IncSearch -I/usr/include/netcdf-3
to read:
#define IncSearch -I/usr/include/netcdf-3 -I/usr/include/gdal

I untarred ncl_ncarg_src-5.1.1.tar.gz to include the files from triangle.zip. I unzipped triangle.zip into a temporary directory and removed 'makefile' and 'README' as they conflict with files in the destination directory: '/usr/src/redhat/SOURCES/ncl_ncarg-5.1.1/ni/src/lib/hlu/' where I copied the remaining files from triangle.zip.

And, for my dirtiest hack of the day... To avoid compiling triangle.zip into separate RPMS, triangle and triangle-devel, as they should be; I modified /usr/src/redhat/SOURCES/ncl_ncarg-5.1.1/ni/src/lib/hlu/CnTriMeshRenderer.c on line 33 to include an absolute reference to triangle.h so that it reads:
#include </usr/src/redhat/BUILD/ncl_ncarg-5.1.1/ni/src/lib/hlu/triangle.h>

Then I tarred the sources back up from /usr/src/redhat/SOURCES/ with: 'tar -zcvf ncl_ncarg_src-5.1.1.tar.gz ./ncl_ncarg-5.1.1'

Then I cd'd over to /usr/src/redhat/SPECS. I added 'BuildRequires: gdal-devel' to ncl.spec which should require both gdal and gdal-devel as the former is required by the latter. I then executed 'rpmbuild -bb ncl.spec' and after about 20 minutes, the RPMs were waiting in /usr/src/redhat/RPMS/$ARCH where our $ARCH is x86_64. From that directory I ran 'rpm -Uvh ./ncl* --force' to make it replace the installed packages from EPEL.

Ideally, I should find away to make this package distinct from ncl-5.1.1-3.el* either by incrementing the version number or declaring that it conflicts with ncl and give it a new name. Then it should be properly submitted to EPEL. However, that might violate the license terms on triangle. gdal shouldn't be of concern, since those packages were already included in EPEL. For local use we have the RPMs installed and should be able to make the appropriate changes to future releases of the source RPM to keep it up to date.

*****************************************

As you can see, there was some trickery done, but it worked. Thank you all for the help.

Brad Illston

From: Rick Brownrigg [mailto:brownrig@ucar.edu]
Sent: Tuesday, April 20, 2010 10:13 AM
To: Illston, Bradley G.
Cc: ncl-talk forum
Subject: Re: Shapefile Example Not Working

Hi Brad,

I have to echo Mary's comments here: shapefile support is optional in NCL, and it looks as though you have an installation without it. Was NCL installed from precompiled binaries, or built from source? If it was built from source, to enable shapefile support requires having the GDAL libraries present (www.gdal.org<http://www.gdal.org>).

If it was installed from binaries, let me know and we'll try and figure out what's going on.

Rick

Begin forwarded message:

From: Mary Haley <haley@ucar.edu<mailto:haley@ucar.edu>>
Date: April 20, 2010 8:18:24 AM MDT
To: "Illston, Bradley G." <illston@ou.edu<mailto:illston@ou.edu>>
Cc: ncl-talk forum <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: Re: Shapefile Example Not Working

My apologies, I didn't read the error closely enough! I think you
may have
a version of NCL that was built without shapefile support. I'm not
sure I understand
this, though, because I thought all the 5.1.1. precompiled Linux
binaries had
shapefile support built in.

Do you know if you are running a version of NCL that was compiled
from source
code? If so, it's possible that shapefile support was turned off.

I'll keep quiet now, because I just read an email that says Rick will
try to
help you. :-)

--Mary

On Apr 20, 2010, at 7:36 AM, Mary Haley wrote:

Hi Brad,

When you downloaded the "st_str.tar.gz" file, did you gunzip and
untar the file first:

   gunzip sa_str.tar.gz
   tar -xf sa_str.tar

Once you do this, you will see the following files:

sa.readme sa_str.prj sa_str.shp.xml
sa_str.dbf sa_str.shp sa_str.shx

and you should now be able to run that example.

--Mary

On Apr 19, 2010, at 5:15 PM, Illston, Bradley G. wrote:

Greetings,

I have been trying to get shapefiles to load into NCL and have been
unsuccessful. I decided to just try and duplicate on of the
examples you have on the website.

http://www.ncl.ucar.edu/Applications/Scripts/shapefiles_3.ncl

I am using that script unaltered and I have downloaded/gunzip/
untarred the shapefile data from the given website. When I run the
script, I get the following output:

Copyright (C) 1995-2009 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 5.1.1
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
fatal:An internal error has occurred. The file format requested
does not appear to be supported, could not open (sa_str.shp)
fatal:Either file (f) isn't defined or variable (segments) is not a
variable in the file
fatal:Execute: Error occurred at or near line 37 in file
ncl_Shapefile.ncl

As you can see, I am running NCL v5.1.1, which chould support
shapefiles. I am running the following system:

"Linux {server name} 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST
2006 x86_64 x86_64 x86_64 GNU/Linux"

Can you provide any guidance on how to open a basic shapefile and
overlay that onto my plotted data?

Thanks,
Brad Illston
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 30 22:43:55 2010

This archive was generated by hypermail 2.1.8 : Mon May 03 2010 - 14:51:25 MDT