[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 971223: netcdf/solaris questions



> From: address@hidden (Barry Schwartz)
> Subject: 971223: netcdf/solaris questions
> To: address@hidden
> Date: Tue, 23 Dec 1997 14:59:09 -0700 (MST)
> Cc: address@hidden (Stan Benjamin), address@hidden

Hi Barry,

> It has been a long time since I needed to make contact with you.
> We are switching (unfortunately) over to a solaris OS here and
> I'm finding things in netcdf-2 not compatable with netcdf-3.
> 
> I just got my hands on a netcdf3 manual and according to it, everything
> is suppose to be backwards compatable to netcdf2. Do you remember
> the routine I wrote call gennet? It produces FORTRAN code to read
> a netCDF data file if you run itr and supply a file as input.
> Anyway, I tried writing a routine with gennet to read our metar data
> with gennet and the output program from gennet compiles and runs successfully
> on our regular SUN OS. However, when I try running it on our new and
> improved SUN with solaris, the program compiles but bombs on a call to ncvgtc.
> 
> Someone around here tells me that the problem with solaris and the new netcdf
> version 3 lies in declaring variables as bytes (or character*1).

There should be no difference in the behavior of netCDF version 3
between SunOS 4.x and SunOS 5.x (Solaris 2.x).  If you have a newer
Fortran compiler on your Solaris platform or are trying to use Fortran90
instead of Fortran77, you may see a difference related to the different
compiler, but things should still work OK if you use the right compiler
flags with Fortran90.  It would help if you could send us
(address@hidden) a small example that demonstrated the
difference, so we could reproduce the problem here and diagnose it.

> Is this true? If so, how does one try to retrieve the character variable
> as defined from our cdl file below:
> 
> 
>  char stationName(recNum, maxStaNamLen) ;
>                 stationName:long_name = "alphanumeric station identification" 
> ;
>                 stationName:reference = "station table" 
> 
> where maxstanamlen = 5. Personally, I think our facilities people
> would have made life alot easier to define it as: 
> character*5 stationname(recNum) but that's neither here or there.
> 
> I sort of think I'm forced into thefollowing at the top of the generated
> FORTRAN program (output of gennet):
> 
> character*1 stationname(nrec,5).
> 
> The code that bombed is:
> 
>       DO  20 J=1,NVDIM
>       CALL NCDINQ(NCID,VDIMS(J),DUMMY,NDSIZE,RCODE)
>       LENSTR=LENSTR*NDSIZE
>       START(J)=1
>       COUNT(J)=NDSIZE
>   20  CONTINUE
>       CALL NCVGTC(NCID,ivarid,START,COUNT,
>      +stationName                    ,LENSTR,RCODE)
> C
> c     fix station name
> c
>       do 24 k = 1,nrecs
>       do 22 j = 1,5
>       ival = ichar(stationname(j,k))
>       if(ival.gt.32.and.ival.lt.127) then
>                                      call(k)(j:j) = stationname(j,k)
>                                      else
>                                      call(k)(j:j) = ' '
>                                      endif
>  22   continue
>  24   continue
> 
> It bombed at the call to ncvgtc. And, as I said earlier, it ran
> under regular SUN OS so I know the "segmentation fault" has nothing to
> do with the value of LENSTR. Here is the error I get when I run
> the executable on solaris:
> 
> pinky:~/util > gennet
> 
> *** TERMINATING  a.out
> *** Received signal 11 SIGSEGV
> Segmentation fault (core dumped)
> pinky:~/util >

There's not quite enough information here to reproduce the problem or
deduce what is going on.  For example, do you initialize LENSTR to 1
before the DO 20 loop?  We need a small but complete example that we can
run here.

> Do you have any ideas where I should start to correct the problem?
> Somehow, I'm hoping you know about this and can explain to me what it is
> so I can fix our code to work on solaris.

Sorry, but there really shouldn't be any difference related to Solaris
vs. SunOS.  All our extensive Fortran interface tests for both the
netCDF-2 and netCDF0-3 interfaces run identically on both platforms.

> Anything you can do to help us would be great. Thanks alot Russ!
> By the way, if we can figure this out, I will rewrite 
> gennet in netcdf3 to be compatable with solaris OS.
> 
>                        Regards,
> 
> 
> 
>                        Barry
> 
> P.S. Do you have any bound copies of the latest NetCDF manual?
> Could you drop 1 or 2 in the mail for me (I realize I can get it over
> the web but I prefer the nice bound copy). Txs!

Nope, sorry, we haven't printed any bound copies yet, because until
recently we were still trying to improve the appearance of the printed
manual.  I hope to get some printed in the next month or so, maybe after
the AMS meeting ...

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu