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

Re: 20000511: gennet.f?



>To: address@hidden
>cc: address@hidden (Xiangdong Zhang)
>From: Xiangdong Zhang <address@hidden>
>Subject: gennet.f?
>Organization: UCAR/Unidata
>Keywords: 200005111848.e4BImd403793

Hi Xiangdong,

> i would like to enquire a question regarding netcdf. i have been using
> "gennet.f" to produce a forturn code reading netcdf data for several
> years. but recently i move to iarc to work and i am using sgi o2. the
> code generated by "gennet.f" for reading netcdf data does not work. a
> latest version of netcdf has been installed on my workstation. the error
> information is:
> 
> NCAGT: : Attempt to convert between text & numbers
> 
> could you please help to fix this problem? thanks a lot.

GENNET generates calls to the netCDF Fortran interface, which in turn
calls the netCDF-3 C interface.  I'm guessing that GENNET must be
generating a call to the NCAGT function to read what should be one or
more numeric attribute values, but the attribute values it is trying
to read are actually text characters.  I see the following FORMAT
statement in GENNET.F, for example:

 1510 format(6x,'call ncagt(ncid,j,',1h','long_name',1h',
     *',name(j),mtlen,rcode)')

that would generate a call to NCAGT to read the character string for
the text-valued attribute "long_name".

The netCDF-3 interface tries to prevent reading values as numbers that
are really text characters, so if the external type of the attribute
you are trying to read is NF_CHAR (character string), GENNET should
generate a call to NCAGTC (used for reading character attribute
values) instead of NCAGT (used for reading numeric attribute values).
Perhaps you can fix the problem by just changing the NCAGT call to
NCAGTC instead, adjusting the arguments as necessary.

It's possible that this worked with an earlier version of the netCDF
library because NCAGT read the attribute values as if they were of
type NF_BYTE (an 8-bit numeric value) into a character array without
conversion, even though this is an example of a numeric to text
conversion that is not supported in netCDF-3 interfaces.

GENNET is a contributed program that was not written here so we don't
maintain it, but if this turns out to be the problem, you might
contact the author, Barry Schwartz, to see if it is practical to
provide a fix.

--Russ

_____________________________________________________________________

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