Hi,
> I want to write some global attributes into a netcdf file. The type of those
> attributes are different, such as character, integer, real, double
> presicion.
> How can I write those with
> nf90_put_att(ncid, varid, name, values)
> Is varid set as nf90_global, name set as attributes' name?
Yes, for a global attribute (or a group attribute for netCDF-4 data)
use NF90_GLOBAL as the variable ID.
> And how to set values to different type?
The Fortran-90 interface uses overloading, so the single function
nf90_put_att serves the purpose of multiple functions with different
parameter types. If you call it with a character string value, it will
create an attribute that is a one-dimensional array of NF90_CHAR type.
If you call it with a double precision value, it creates an attribute of
type NF90_DOUBLE.
--Russ