plot package and ncl linking problem

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
asujrpv

plot package and ncl linking problem

#1 Unread post by asujrpv »

Hello everybody,
I have results from my ROMS simulation and generated netcdf files ocean_avg.nc,
ocean_his.nc, ocean_rst.nc, etc.

I would like to plot the results and I tried the roms_gui but did not load properly, not even the nc files from the default sample problem upstream. Anyway, I am trying now the roms tools that I downloaded from svn checkout https://www.myroms.org/svn/src/plot

I installed the ncl version 6 and seems to work. But when I try the makefile in the plot tools I got the following error:

I would be grateful if someone can guide me to solve this problem and/or telling me of another plotting tool that I can use to view my results.

Thanks!
Rafael


/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
cnt.o cpmpxy2d.o mapeod.o stumsl.o stumxy.o vvumxy.o -o /home/rpacheco/PLOTROMS/bin/cntG \
libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/X11R6/lib64 -lX11 -L/opt/gfortransoft/s_netcdf4/lib -lnetcdf -L/opt/gfortransoft/s_hdf5/lib -lhdf5_hl -lhdf5 -lz
/usr/bin/ld: Warning: size of symbol `mapcm1_' changed from 28 in libUTIL.a(hbackground.o) to 40 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm2_' changed from 60 in libUTIL.a(cnt_frame.o) to 128 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm4_' changed from 128 in libUTIL.a(hbackground.o) to 224 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: skipping incompatible /usr/local/lib/libhdf5_hl.a when searching for -lhdf5_hl
/usr/bin/ld: skipping incompatible /usr/local/lib/libhdf5.a when searching for -lhdf5
/usr/bin/ld: skipping incompatible /usr/local/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/local/lib/libz.a when searching for -lz
libUTIL.a(crash.o): In function `crash':
/home/rpacheco/PLOTROMS/src/crash.f90:1562: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1563: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1575: undefined reference to `nf_strerror_'
libUTIL.a(get_nc2dat.o): In function `get_nc2dat':

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: plot package and ncl linking problem

#2 Unread post by shchepet »

Pay attention to this:

/usr/bin/ld: Warning: size of symbol `mapcm1_' changed from 28 in libUTIL.a(hbackground.o) to 40 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm2_' changed from 60 in libUTIL.a(cnt_frame.o) to 128 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm4_' changed from 128 in libUTIL.a(hbackground.o) to 224 in /usr/local/lib/libncarg.a(mapbd.o)
this means that your used code (i.e., Hernan's plotting package) attempts to access common blocks
of NCL/NCARG libraries. It is a standard practice when using NCAR graphics in a fairly advanced
mode. Unfortunately sometimes NCAR graphics people change these common blocks internally by adding
more variables. When your code is designed to work with a certain version of NCAR graphics
library may not be consistent with a newer version. It did happened before.mapcm4_

The only way to fix this is to find declarations of common blocks "mapcm1", "mapcm2", and "mapcm4"
inside the source code of NCAR graphics libraries (I guess, these are somewhere within areas package
inside ncarg2d and them modify parts of your own code to bring sequence of variables in the common
block be exactly the same as inside NCAR graphics libraries. It is tedious, but there is no way around.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: plot package and ncl linking problem

#3 Unread post by kate »

In Hernan's plotting package, there are cpp defs for the NCARG versions, set in the Makefile. You should see which versions he supports and pick the newest one (but I doubt it's version 6).

asujrpv

Re: plot package and ncl linking problem

#4 Unread post by asujrpv »

Thank you all for your comments. I think ncar4.2.2 is supported, but I cannot access it through the website anymore, only up to version 5.


Does anyone had success with the newer versions? My operating system is x86_64 and cpp (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5

Thanks!
Rafael

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: plot package and ncl linking problem

#5 Unread post by kate »

I wasn't suggesting that you use an old NCL, just that you might need to lie about the NCL version if Hernan doesn't explicitly support version 6.

asujrpv

Re: plot package and ncl linking problem

#6 Unread post by asujrpv »

shchepet wrote:Pay attention to this:

/usr/bin/ld: Warning: size of symbol `mapcm1_' changed from 28 in libUTIL.a(hbackground.o) to 40 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm2_' changed from 60 in libUTIL.a(cnt_frame.o) to 128 in /usr/local/lib/libncarg.a(mapbd.o)
/usr/bin/ld: Warning: size of symbol `mapcm4_' changed from 128 in libUTIL.a(hbackground.o) to 224 in /usr/local/lib/libncarg.a(mapbd.o)
this means that your used code (i.e., Hernan's plotting package) attempts to access common blocks
of NCL/NCARG libraries. It is a standard practice when using NCAR graphics in a fairly advanced
mode. Unfortunately sometimes NCAR graphics people change these common blocks internally by adding
more variables. When your code is designed to work with a certain version of NCAR graphics
library may not be consistent with a newer version. It did happened before.mapcm4_

The only way to fix this is to find declarations of common blocks "mapcm1", "mapcm2", and "mapcm4"
inside the source code of NCAR graphics libraries (I guess, these are somewhere within areas package
inside ncarg2d and them modify parts of your own code to bring sequence of variables in the common
block be exactly the same as inside NCAR graphics libraries. It is tedious, but there is no way around.
I solved the problem above by contacting the ncar staff, they sent me the common blocks (see at the very bottom, which I hope will be useful). However, there is another problem of linking, please see below. I will definitely appreciate your help. Here is the error message.

rpacheco@mexico~/PLOTROMS/src > make
/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
cnt.o cpmpxy2d.o mapeod.o stumsl.o stumxy.o vvumxy.o -o /home/rpacheco/PLOTROMS/bin/cntG \
libUTIL.a -L/usr/local/bin/lib -lncarg -lncarg_gks -lncarg_c -L/usr/X11R6/lib64 -lX11 -L/opt/gfortransoft/s_netcdf4/lib -lnetcdf -L/opt/gfortransoft/s_hdf5/lib -lhdf5_hl -lhdf5 -lz
libUTIL.a(crash.o): In function `crash':
/home/rpacheco/PLOTROMS/src/crash.f90:1562: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1563: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1575: undefined reference to `nf_strerror_'


=================== common blocks =====================

COMMON /MAPCM1/ COSO,COSR,SINO,SINR,IPRJ,IROD
DOUBLE PRECISION COSO,COSR,SINO,SINR
INTEGER IPRJ,IROD

COMMON /MAPCM2/ BLAM,BLOM,PEPS,SLAM,SLOM,UCEN,UMAX,UMIN,UOFF,
+ URNG,VCEN,VMAX,VMIN,VOFF,VRNG,ISSL
DOUBLE PRECISION BLAM,BLOM,PEPS,SLAM,SLOM,UCEN,UMAX,UMIN,UOFF,
+ URNG,VCEN,VMAX,VMIN,VOFF,VRNG
INTEGER ISSL

COMMON /MAPCM4/ GRDR,GRID,GRLA,GRLO,GRPO,OTOL,PDRE,PLA1,PLA2,
+ PLA3,PLA4,PLB1,PLB2,PLB3,PLB4,PLNO,PLTO,ROTA,
+ SRCH,XLOW,XROW,YBOW,YTOW,IDOT,IDSH,IDTL,ILCW,
+ ILTS,JPRJ,ELPF,INTF,LBLF,PRMF
DOUBLE PRECISION GRDR,GRID,GRLA,GRLO,GRPO,OTOL,PDRE,PLA1,PLA2,
+ PLA3,PLA4,PLB1,PLB2,PLB3,PLB4,PLNO,PLTO,ROTA,
+ SRCH,XLOW,XROW,YBOW,YTOW
INTEGER IDOT,IDSH,IDTL,ILCW,ILTS,JPRJ
LOGICAL ELPF,INTF,LBLF,PRMF

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: plot package and ncl linking problem

#7 Unread post by shchepet »


...... -L/opt/gfortransoft/s_netcdf4/lib -lnetcdf -L/opt/gfortransoft/s_hdf5/lib -lhdf5_hl -lhdf5 -lz
resulted in

/home/rpacheco/PLOTROMS/src/crash.f90:1562: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1563: undefined reference to `nf_close_'
/home/rpacheco/PLOTROMS/src/crash.f90:1575: undefined reference to `nf_strerror_'
and I presume many similar errors complaining about standard nf_ functions missing.

It looks like you are using very recent version of netCDF library.

What I found that recently (version 4.1.3, and, I believe 4.1.2, but
not earlier) that netCDF people decided to separate all Fotran-callable
functions into a special library called "libnetcdff" (with double "ff" at
the end), while the standard single-f "libnetcdf" contains only C-callable
nc_ functions, but no-longer nf_.

So inspect the content of your directory /opt/gfortransoft/s_netcdf4/lib
and check whether you have libnetcdff.a or libnetcdff.so there (they
also switched to generating shared libraries by default, unless you
specifically configure netCDF package before compiling it and ask for
non-shared).

If "ff" is present, add -lnetcdff into your compiling line in addition
to -lnetcdf which you already have.

Also if libnetcdf.a and libnetcdff.a are present you can use UNIX "nm"
command to see what objects are present inside these libraries to make sure.

asujrpv

Re: plot package and ncl linking problem

#8 Unread post by asujrpv »

I do appreciate your help, I was able to compile using the following:


/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
cnt.o cpmpxy2d.o mapeod.o stumsl.o stumxy.o vvumxy.o -o /home/rpacheco/PLOTROMS/bin/cntG \
libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/lib64 -lX11 -L/usr/local/lib -lnetcdff
/usr/bin/cpp -P -traditional -I/usr/local/include -DLinux -Dx86_64 -Dgfortran -DNCARG441 -Drmdocinc -IInclude -IUtility Drivers/ccnt.F > ccnt.f90
Bin/cpp_clean ccnt.f90
/usr/bin/gfortran -c -frepack-arrays -g -fbounds-check ccnt.f90
/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
ccnt.o cpmpxy2d.o mapeod.o stumsl.o stumxy.o vvumxy.o -o /home/rpacheco/PLOTROMS/bin/ccntG \
libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/lib64 -lX11 -L/usr/local/lib -lnetcdff
/usr/bin/cpp -P -traditional -I/usr/local/include -DLinux -Dx86_64 -Dgfortran -DNCARG441 -Drmdocinc -IInclude -IUtility Drivers/sec.F > sec.f90
Bin/cpp_clean sec.f90
/usr/bin/gfortran -c -frepack-arrays -g -fbounds-check sec.f90
/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
sec.o cpmpxz2d.o -o /home/rpacheco/PLOTROMS/bin/secG libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/lib64 -lX11 -L/usr/local/lib -lnetcdff
/usr/bin/cpp -P -traditional -I/usr/local/include -DLinux -Dx86_64 -Dgfortran -DNCARG441 -Drmdocinc -IInclude -IUtility Drivers/csec.F > csec.f90
Bin/cpp_clean csec.f90
/usr/bin/gfortran -c -frepack-arrays -g -fbounds-check csec.f90
/usr/bin/gfortran -frepack-arrays -g -fbounds-check \
csec.o cpmpxz2d.o -o /home/rpacheco/PLOTROMS/bin/csecG libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/lib64 -lX11 -L/usr/local/lib -lnetcdff


I will now check if this will work, since I did not compile with hdf5 ... thanks!
Rafael

Post Reply