Re: NCEP Grib Conversion problem with NCL 5.2.0.

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 16 2011 - 19:12:39 MST

Hi Chris,
The issue is not whether the grib2c library is compiled in 64-bit mode. It's that there has to be a define called __64BIT__ set during the compile.
The Makefile in the g2clib-1.x.x directory should have a line like the following at the top when compiled for a 64 bit architecture:

DEFS=-DUSE_JPEG2000 -DUSE_PNG -D__64BIT__

The jpeg and png defines are somewhat optional, depending on the type of GRIB2 files you need to read, but the 64BIT flag must be set.

I would also note that we use a slightly modified version of the grib2c library code that corrects a few errors (although the newest version has incorporated many of our changes).
We can give you our version if you like.
 -dave

On Feb 16, 2011, at 6:51 PM, Chris Edsall wrote:

> Hi Mary, Dave,
>
> I'm a sysadmin at Michael's site.
>
>> I noticed that you have a slightly different location of your GRIB2 code
>> tables, so I'm guessing that your NCL installation came from a LINUX package
>> installer, and not from us. If that's the case, then it's possible that your
>> environment is set up incorrectly, or else the wrong files are installed.
>
> Indeed, the NCL we are using is from a package.
>
> I started with ncl-5.2.0-2.el6 from the EPEL repository.
> ( http://koji.fedoraproject.org/koji/buildinfo?buildID=181055 )
> I rebuilt that on RHEL5.5. However since we require NetCDF4 support I
> pointed the build at a local version of netcdf rather then the RHEL5.5 one.
>
> The changes are:
>
> [edsall@cli-dev ncl]$ svn diff --old=.@22 --new=.@65
> Index: ncl.spec
> ===================================================================
> --- ncl.spec (revision 22)
> +++ ncl.spec (revision 65)
> @@ -1,6 +1,6 @@
> Name: ncl
> Version: 5.2.0
> -Release: 2%{?dist}
> +Release: 3%{?dist}
> Summary: NCAR Command Language and NCAR Graphics
>
> Group: Applications/Engineering
> @@ -44,7 +44,7 @@
> Patch15: ncl-5.0.0-udunits.patch
> BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
>
> -BuildRequires: /bin/csh, gcc-gfortran, netcdf-devel
> +BuildRequires: /bin/csh, gcc-gfortran, netcdf-niwa-devel
> BuildRequires: hdf-static, hdf-devel >= 4.2r2, libjpeg-devel
> BuildRequires: g2clib-static, g2clib-devel, librx-devel, atlas-devel
> # imake needed for makedepend
> Index: Site.local.ncl
> ===================================================================
> --- Site.local.ncl (revision 22)
> +++ Site.local.ncl (revision 65)
> @@ -4,8 +4,8 @@
> #define SharePath $(DESTDIR)@datadir@
>
> #define BuildWithF90 TRUE
> -#define IncSearch -I/usr/include/netcdf -I/usr/include/udunits2
> -#define LibSearch -L@libdir@/hdf
> +#define IncSearch -I/usr/local/include/netcdf -I/usr/include/udunits2
> +#define LibSearch -L/usr/local/lib64 -L@libdir@/hdf
>
> #define BuildNetCDF4 1
> #define NetCDF4lib -lnetcdf
>
>> When you installed V5.2.0, did you get a new set of GRIB2 code tables, or
>> are you using ones from an older installation? If you are using files from an
>> older installation, this might be a problem.
>
> They are the ones from the package (which are the ones from ncl_ncarg_src-5.2.0.tar.gz)
>
>> Meanwhile, I've attached the list of grib2 code tables that are a part of
>> 5.2.0, in case you want to compare it to what you have in
>> /usr/share/ncarg/grib2_codetables on your RHEL5.5 system.
>
> Thanks.
>
> [edsall@fc-2 ~]$ cd /usr/share/ncarg/
> [edsall@fc-2 ncarg]$ find grib2_codetables -type f |sort > ~/codetables.niwa.txt
> [edsall@fc-2 ncarg]$ cd
> [edsall@fc-2 ~]$ sort grib2.5.2.0.txt > grib2.5.2.0.sort.txt
> [edsall@fc-2 ~]$ diff --report-identical-files grib2.5.2.0.sort.txt ~/codetables.niwa.txt
> Files grib2.5.2.0.sort.txt and /home/edsall/codetables.niwa.txt are identical
>
> So we do have the up to date codetables.
>
>> Dave Brown pointed out that you may have gotten an NCL that was compiled
>> against a grib2 library that didn't have a necessary 64-bit flag set when it
>> was compiled.
>
> The link line is:
>
> g++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
> -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic \
> -fPIC -rdynamic -o ncl Ncl.o io.o NclHLUObj.o scanner.o parser.o \
> MathFuncs.o NclTypedouble.o NclTypefloat.o clTypeint.o NclTypelogical.o \
> clTypelong.o NclTypeobj.o clTypeshort.o NclTypestring.o clTypeint64.o \
> NclTypeuint64.o clTypeushort.o NclTypeuint.o NclTypeulong.o clTypebyte.o \
> NclTypechar.o TypeSupport.o clMultiDValData.o AddFileFormats.o \
> AttSupport.o DataSupport.o GetGrids.o itData.o Memory.o NclAtt.o \
> NclCCM.o clCoordVar.o NclData.o NclFile.o NclFileVar.o clGRIB.o \
> NclHDF.o NclMultiDValnclfileData.o clNetCdf.o NclOneDValCoordData.o \
> NclType.o clTypelist.o NclVar.o VarSupport.o qu2reg3.o rowina3.o \
> scm0.o ncepcode.o NclGRIB2.o AddBuiltIns.o AddHLUObjs.o trinsics.o \
> Execute.o e.o OpsFuncs.o Printtoken.o SrcTree.o Translate.o clHLUVar.o \
> HLUSupport.o clMultiDValHLUObjData.o Support.o BuiltInFuncs.o cs.o \
> cs.o ctions.o yywrap.o craybin.o e.o sysunix.o ListSupport.o clList.o \
> NclMultiDVallistData.o fortranio.o -L../../.././ni/src/lib/nfp \
> -lnfp -L../../.././ni/src/lib/nfpfort -lnfpfort \
> -L../../.././ni/src/lib/hlu -lhlu -L../../.././ncarg2d/src/libncarg \
> -lncarg -L../../.././ncarg2d/src/libncarg_gks -lncarg_gks \
> -L../../.././common/src/libncarg_c -lncarg_c -L../../.././ngmath/src/lib \
> -lngmath -L/usr/lib64/ncarg -L/usr/local/lib64 -L/usr/lib64/hdf -lcurl \
> -lrx -lpthread -lnetcdf -lmfhdf -ldf -ljpeg -lz -ludunits2 -lgrib2c \
> -ljasper -lpng -lz -lpng -lz -L../../.././external/sphere3.1_dp \
> -lsphere3.1_dp -L../../.././external/fftpack5_dp -lfftpack5_dp \
> -L/usr/lib64/atlas -llapack -latlas -L/usr/lib64/atlas -lcblas -lf77blas \
> -lptf77blas -lX11 -lXext -lgfortran -lm -ldl
>
> The important bit in there is -lgrib2c. That links against
>
> [edsall@fc-2 ~]$ locate grib2c.a
> /usr/lib/libgrib2c.a
> /usr/lib64/libgrib2c.a
> [edsall@fc-2 ~]$ rpm -qf /usr/lib{,64}/libgrib2c.a
> g2clib-devel-1.2.0-1.el5
> g2clib-devel-1.2.0-1.el5
> [edsall@fc-2 ~]$ ls -l /usr/lib{,64}/libgrib2c.a
> -rw-r--r-- 1 root root 261536 Apr 16 2010 /usr/lib64/libgrib2c.a
> -rw-r--r-- 1 root root 166088 Apr 16 2010 /usr/lib/libgrib2c.a
>
> So there is 64-bit GRIB library available at least.
>
>> I could try giving you a 5.2.1 "ncl" executable to try on your RHEL system.
>> First, I need to know what version of gcc you are running there, "gcc
>> --version".
>
> [edsall@fc-2 ~]$ gcc --version
> gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
>
>
> Thanks again,
> Chris Edsall
>
> Please consider the environment before printing this email.
>
> NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.
> _______________________________________________
> 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 Wed Feb 16 19:12:46 2011

This archive was generated by hypermail 2.1.8 : Thu Feb 17 2011 - 22:00:17 MST