NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Problem writing character arrays using netCDF v3.5.1 compiled using

Hi There,

I just recently recompiled my netCDF v3.5.1 Fortran API with the latest
PGI v5.2-1 f95 compiler. I'm now having problem with some Fortran90 code
I wrote that has been working up till now. I thought I'd ask this group
in case someone else has had a similar problem and has some sort of work
around.

I have a character array, each element of which is 512 characters in
length, that I want to write to a netCDF file,

INTEGER, PARAMETER :: PDSL = 512
CHARACTER( PDSL ), DIMENSION( : ), ALLOCATABLE :: Description

How I do this, after allocating the array to some length, e.g.

ALLOCATE( Description( n_Profiles ) )

is to first define the dimensions:

  ! -- The number of profiles
  NF90_Status = NF90_DEF_DIM( NC_FileID, &
                              PROFILE_DIMNAME, &
                              n_Profiles, &
                              Profile_DimID )
  ! -- The string length
  NF90_Status = NF90_DEF_DIM( NC_FileID, &
                              DESCRIPTION_DIMNAME, &
                              PDSL, &
                              PD_StrLen_DimID )

Then I would define the variable itself,

  NF90_Status = NF90_DEF_VAR( NC_FileID, &
                              DESCRIPTION_VARNAME, &
                              NF90_CHAR, &
                              DimIDs = (/ PD_StrLen_DimID, Profile_DimID /), &
                              VarID  = VarID )

In my old files, the description variable appears like so from ncdump:

netcdf UMBC.AtmProfile {
dimensions:
        n_profiles = 48 ;
        pdsl = 512 ;
variables:
        char profile_description(n_profiles, pdsl) ;
                profile_description:long_name = "Description of profile" ;
...etc...

where I've taken into account the difference in dimension ordering
between Fortran and C.

Now, when I run this code linking to the PGI v5.2-1 compiler library,
the NF90_DEF_VAR() function call fails with the error:
  "NC_UNLIMITED in the wrong index"

When I run the code linking to the Lahey lf95 v6.2 compiled library, the
code generates no such error.

I run on linux systems running under Red Hat Enterprise WSE3.0

Does anyone there have any ideas about what could be causing this error
so I can try a work around with the PGI compiler?

cheers,

paulv




--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC


  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: