Layout of routine cdf_encode
SUBROUTINE CDF_ENCODE(
& NPOS,
& IACCUR,
& IDIMID3,
& CNAM,
& CUNIT,
& CLNAM,
& CASSOC,
& RMISS4,
& RMISS
& )
C ***********************************************************************
C This routine creates a netCDF header of a new 3D variable in an output
C file. Input arguments are:
C
C NPOS INT netCDF output file unit
C IACCUR INT output accuracy flag (equal to NCFLOAT or NCDOUBLE)
C IDIMID3 INT(3) array size (lon,lat,time)
C CNAM CHAR parameter ID
C CUNIT CHAR units
C CLNAM CHAR field full name
C CASSOC CHAR dimension association attribute
C RMISS4 FLOAT missing value (single precision)
C RMISS DOUBLE missing value (double precision)
C
C Author: Bart vd Hurk, KNMI
C ***********************************************************************
#include "netcdf.inc"
integer, intent(in) :: IACCUR
integer, intent(in) :: IDIMID3(3)
character(len=*), intent(in) :: cnam,cunit,clnam,cassoc
real*4, intent(in) :: rmiss4
real, intent(in) :: rmiss
NVARID = NCVDEF (NPOS, CNAM, IACCUR, 3, IDIMID3, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, len_trim(CUNIT),
+ trim(CUNIT), IERR)
call NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, len_trim(CLNAM),
+ trim(CLNAM), IERR)
CALL NCAPTC (NPOS, NVARID, 'associate', NCCHAR, len_trim(CASSOC),
+ trim(CASSOC), IERR)
IF(IACCUR.EQ.NCFLOAT)THEN
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,RMISS, IERR)
ELSE
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,RMISS4, IERR)
ENDIF
END SUBROUTINE CDF_ENCODE