[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20020710: nf90_inquire_variable(...) and nf90_open(...) problems
- Subject: 20020710: nf90_inquire_variable(...) and nf90_open(...) problems
- Date: Wed, 10 Jul 2002 09:37:43 -0600
Verena,
>Date: Wed, 10 Jul 2002 15:34:31 +0200
>From: Verena Cals <address@hidden>
>Organization: ICG I: Stratosphäre
>To: Steve Emmerson <address@hidden>
>Subject: two more questions
>Keywords: 200207101334.g6ADYca23737
The above message contained the following:
...
> rcode=nf90_inquire_variable(ncid,varid,dimids=dim_array)
...
> In our Linux-cluster it works (and using the old version of netcdf it
> works on cray too), but using our tinkered-netcdf-3.5.0-cray-version on
> the cray the sequence of the above netcdf-statements doesn't work. Up to
> inclusive the statement
> rcode=nf90_inquire_variable(ncid,varid,dimids=dim_array) it works, but
> the values read on text_len and dim_len are wrong.
There is a bug in the Fortran-90 function nf90_inquire_variable(...)
in the current release: the dimension identifier vector isn't handled
correctly. The enclosed replacement for file f90/netcdf_variables.f90
should fix this problem.
> My second question applys to the cray too.
> In one of our programs we want to open an file, which can be an
> ascii-file or an netcdf-file. Up to now we did the following:
>
> rcode=nf90_open(o3dat, nf90_nowrite, ncid)
> if (rcode == 0) then
> ! o3dat is a Netcdf file
> ...
> rcode = nf90_close(ncid)
> else
> ! no Netcdf file, read in ascii O3 profile data
>
> ! open the data file.
> open(1, file=o3dat, status="old", position="asis")
> ...
>
> In our Linux-cluster this way works, but if the file is an ascii-file on
> the cray the program crashes on opening the ascii-file with the normal
> fortran 90 open-statement. The following error occurs:
>
> lib-1069 chem: UNRECOVERABLE library error
> The file cannot be opened for FORMATTED I/O.
>
> Encountered during an OPEN of unit 1
> Fortran unit 1 is not connected
> Error initiated at line 761 in routine '_f_open'.
> Abort
>
> Beginning of Traceback:
> Interrupt at address 577463a in routine '_lwp_killm'.
> Called from line 32 (address 574152a) in routine 'raise'.
> Called from line 127 (address 502263d) in routine 'abort'.
> Called from line 59 (address 1112533c) in routine '_ferr'.
> Called from line 761 (address 1142421b) in routine '_f_open'.
> Called from line 380 (address 1144425c) in routine '__OPN'.
> Called from line 417 (address 1144617b) in routine '_OPEN'.
> Called from line 3691 (address 101027a) in routine 'READO3_in_DISSOC'.
> Called from line 3514 (address 74524d) in routine
> 'INIPHOTO_in_DISSOC'.
> Called from line 103 (address 121614d) in routine 'DISSOC'.
> Called from line 130 (address 207250a) in routine 'PHOTOL'.
> Called from line 196 (address 47175c) in routine 'CDRIVE'.
> Called from line 339 (address 2100c) in routine 'CHEM'.
> Called from line 350 (address 524115c) in routine '$START$'.
> End of Traceback.
> boxtest_fam.job[77]: 97936 Abort(coredump)
>
> The error has to do something with the temporary .assign file, in which
> an entry occurs by using the nf90_open statement. The path and the name
> of the file opened by nf90_open is recorded in .assign. During the
> failed nf90_open the name of the ascii-file is recorded in .assign,
> whereby normal fortran 90 open is not able to open this ascii-file.
> Using the old netcdf on the cray this failure doesn't occured. Du you
> know, why this failure occurs now?
I'm afraid that I don't know enough about Fortran I/0 on the Cray
to know what the problem is. I can tell you that, on a Cray, the
nf90_open(...) function eventually calls the function ncio_create(...)
in the file libsrc/ffio.c. This function calls ncio_ffio_assign(char*)
in the same file to perform the assignment, which calls Cray routine
ASNQFILE. When closing a netCDF file, the function nf90_close(...)
eventually calls the function ncio_close(...) in the same file and that
function doesn't appear to perform any deassignment.
If you can tell us what to do to deassign the file (i.e. the logical
reverse of ASNQFILE) then we could add it to ncio_close(...).
...
> Regards,
> Verena Cals
>
>
> --
>
> Verena Cals
>
> ICG I: Stratosphäre
> Forschungszentrum Jülich GmbH
> EMail: address@hidden
Regards,
Steve Emmerson <http://www.unidata.ucar.edu>
! -----
! Variable definitions and inquiry
! -----
function nf90_def_var_Scalar(ncid, name, xtype, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, intent(out) :: varid
integer :: nf90_def_var_Scalar
! Dummy - shouldn't get used
integer, dimension(1) :: dimids
nf90_def_var_Scalar = nf_def_var(ncid, name, xtype, 0, dimids, varid)
end function nf90_def_var_Scalar
! -----
function nf90_def_var_oneDim(ncid, name, xtype, dimids, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, intent( in) :: dimids
integer, intent(out) :: varid
integer :: nf90_def_var_oneDim
nf90_def_var_oneDim = nf_def_var(ncid, name, xtype, 1, dimids, varid)
end function nf90_def_var_oneDim
! -----
function nf90_def_var_ManyDims(ncid, name, xtype, dimids, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, dimension(:), intent( in) :: dimids
integer, intent(out) :: varid
integer :: nf90_def_var_ManyDims
nf90_def_var_ManyDims = nf_def_var(ncid, name, xtype, size(dimids), dimids,
varid)
end function nf90_def_var_ManyDims
! -----
function nf90_inq_varid(ncid, name, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent(out) :: varid
integer :: nf90_inq_varid
nf90_inq_varid = nf_inq_varid(ncid, name, varid)
end function nf90_inq_varid
! -----
function nf90_Inquire_Variable(ncid, varid, name, xtype, ndims, dimids, nAtts)
integer, intent( in) :: ncid, varid
character (len = *), optional, intent(out) :: name
integer, optional, intent(out) :: xtype, ndims
integer, dimension(:), optional, intent(out) :: dimids
integer, optional, intent(out) :: nAtts
integer :: nf90_Inquire_Variable
! Local variables
character (len = nf90_max_name) :: varName
integer :: externalType, numDimensions
integer, dimension(nf90_max_var_dims) :: dimensionIDs
integer :: numAttributes
nf90_Inquire_Variable = nf_inq_var(ncid, varid, varName, externalType, &
numDimensions, dimensionIDs,
numAttributes)
if (nf90_Inquire_Variable == nf90_noerr) then
if(present(name)) name = trim(varName)
if(present(xtype)) xtype = externalType
if(present(ndims)) ndims = numDimensions
if(present(dimids)) then
if (size(dimids) .ge. numDimensions) then
dimids(:numDimensions) = dimensionIDs(:numDimensions)
else
nf90_Inquire_Variable = nf90_einval
endif
endif
if(present(nAtts)) nAtts = numAttributes
endif
end function nf90_Inquire_Variable
! -----
function nf90_rename_var(ncid, varid, newname)
integer, intent( in) :: ncid, varid
character (len = *), intent( in) :: newname
integer :: nf90_rename_var
nf90_rename_var = nf_rename_var(ncid, varid, newname)
end function nf90_rename_var
! -----