This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden >From: "Paquita Zuidema" <address@hidden> >Subject: 20041118: netCDF Fortran (77 + 90) - array size limitation >Organization: CU/CIRES >Keywords: 200411182221.iAIMLur5029116 netCDF MacOS-X Paquita, > Thanks for your detailed reply. > > I'm using an Absoft fortran 90 interface. I get the > error from calling a netcdf function, it occurs at > line 35 in the attached file "read_sonia.f95" - so > I have a valid file and variable identifier, but, I > get the message "segmentation violation" within the > absoft fx debugger, and a "segmentation fault" > if I run it outside the debugger on the command line. > > I'm also attaching two files, one which read_sonia.f95 > can read successfully, named sonia2_homo.opt, and > the other that read_sonia.f95 can't - sonia1_homo.opt. > > One obvious thought was that I lacked enough static > storage - I increased it on the mac, and also compile > read_sonia with a static flag, to no avail. I've attached > the makefile ("sonia_Makefile","make.common") I doubt if that is the problem, but can't be sure, because I don't have access yet to Absoft Fortran on a Mac OS X platform. I've applied for a trial copy, but it may be 48 hours before I get the necessary key to download and install it. In the meantime, I think you should be checking the return status of your netCDF calls, just to make sure nothing is going wrong before the segmentation violation. If the returned status from any call is not equal to nf90_error, you should print out the associated error message. For example: status=nf90_Inquire_Dimension(ncid,dimid,len=nXedges) if (status /= nf90_noerr) print *, trim(nf90_strerror(status)) > I wonder if perhaps I have installed netcdf correctly? > I have attached the output from "make test" as "test.log". > I did not see a binary that stated it would work w/ > absoft fortran, hence installed it myself. Note the > last line of "test.log" - 2 files don't quite compare. > Is this telling me/us something ? Yes, the output you sent from "make test" indicates a problem with the C library, on which the Fortran 90 library depends. Where you see: > Making `test' in directory /Users/pz/netcdf-3.5.1/src/libsrc > > ar cru libnetcdf.a attr.o dim.o error.o libvers.o nc.o ncio.o ncx.o putget.o > string.o v1hpg.o v2i.o var.o > ranlib libnetcdf.a > acc -o t_nc -O t_nc.o -L. -lnetcdf > ./t_nc > dimrename: IXX > nc_close ret = 0 > > reopen id = 6 for filename test.nc > NC done > GATTR VAR VATTR > VATTR > VATTR > VATTR > VATTR > VATTR > fill_seq indices 0 1 0 8.000000 != > 9969209968386868600000000000000000000.000000 > indices 0 1 1 9.000000 != 9969209968386868600000000000000000000.000000 > indices 0 1 2 10.000000 != > 9969209968386868600000000000000000000.000000 ... > indices 7 6 5 445.000000 != > 9969209968386868600000000000000000000.000000 > indices 7 6 6 446.000000 != > 9969209968386868600000000000000000000.000000 > indices 7 6 7 447.000000 != > 9969209968386868600000000000000000000.000000 > Done > got val = 3.250000 > got val = 0.000000 > got val = 2.718282 > got val = 82555 > got val = 97 > got NC_CHAR val = A (0x41) > got NC_CHAR val = B (0x42) > got NC_CHAR val = "The red death had long devastated the country." > got val = A (0x41) > got val = B (0x42) > got val = "The red death had long devastated the country." > got vals = 0.000000 ... 9969209968386868600000000000000000000.000000 > re nc_close ret = 0 > cmp test.nc test_nc.sav > test.nc test_nc.sav differ: char 2113, line 5 you should instead see something like this: Making `test' in directory /home/russ/netcdf/build/mort-36b4/src/libsrc ar cru libnetcdf.a attr.o dim.o error.o libvers.o nc.o ncio.o ncx.o putget.o string.o v1hpg.o v2i.o var.o ranlib libnetcdf.a cc -o t_nc -O t_nc.o -L. -lnetcdf ./t_nc dimrename: IXX nc_close ret = 0 reopen id = 7 for filename test.nc NC done GATTR VAR VATTR VATTR VATTR VATTR VATTR VATTR fill_seq indices 1 2 3 75.000000 != 2.718282 Done got val = 3.250000 got val = 0.000000 got val = 2.718282 got val = 82555 got val = 97 got NC_CHAR val = A (0x41) got NC_CHAR val = B (0x42) got NC_CHAR val = "The red death had long devastated the country." got val = A (0x41) got val = B (0x42) got val = "The red death had long devastated the country." got vals = 0.000000 ... 447.000000 re nc_close ret = 0 cmp test.nc test_nc.sav *** Success *** > If you tell me you can read "sonia1_homo.opt" just fine > w/ read_sonia.f95, that is a good clue too that I didn't > install netcdf quite right. On a Sun/Solaris 5.8 system, I was able to read "sonia1_homo.opt" just fine w/ read_sonia.f95 using the Sun f95 compiler and version 3.5.1 of netCDF. > Thanks for your time, I really appreciate it. > > If I did the installation incorrectly, may I run what I did > by you ? Sure. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu/staff/russ