Layout of routine setup_pout
SUBROUTINE SETUP_POUT
......
#include "netcdf.inc"
INTEGER IDIMID1(1),IDIMID2(2),IDIMID3(3),IDIMID4(4),
& ISTART1(1),ICOUNT1(1)
REAL,ALLOCATABLE:: ZVAL(:)
REAL*4 ZMISS
ZMISS=RMISS
!* -- open NetCDF file for prognostic quantities
NPOSGG = NCCRE('o_gg.nc', NCCLOB, IERR)
WRITE(NULOUT,*)'NETCDF-FILE o_gg.nc OPENED ON UNIT ',NPOSGG
NPOS = NPOSGG
!* -- output accuracy
IF (NACCUR.EQ.1) THEN
IACCUR=NCFLOAT
ELSEIF (NACCUR.EQ.2) THEN
IACCUR=NCDOUBLE
ENDIF
!* -- create dimensions
NLATID = NCDDEF(NPOS, 'y', NLAT, IERR)
NLONID = NCDDEF(NPOS, 'x', NLON, IERR)
NLEVSID = NCDDEF(NPOS, 'nlevs', NCSS, IERR)
NTIMID = NCDDEF(NPOS, 'time', NCUNLIM, IERR)
!* -- create variables
! latitude
IDIMID1(1) = NLATID
NVARID = NCVDEF (NPOS, 'lat', NCDOUBLE, 1, IDIMID1, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 13,
+ 'degrees_north', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 8,
+ 'latitude', IERR)
! longitude
IDIMID1(1) = NLONID
NVARID = NCVDEF (NPOS, 'lon', NCDOUBLE, 1, IDIMID1, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 12,
+ 'degrees_east', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 9,
+ 'longitude', IERR)
! soil levels
IDIMID1(1) = NLEVSID
NLEVSLID = NCVDEF (NPOS, 'nlevs', NCDOUBLE, 1, IDIMID1, IERR)
CALL NCAPTC (NPOS, NLEVSLID, 'units', NCCHAR, 1,
+ 'm', IERR)
CALL NCAPTC (NPOS, NLEVSLID, 'long_name', NCCHAR, 17,
+ 'soil level bottom', IERR)
! time
IDIMID1(1) = NTIMID
NVARID = NCVDEF (NPOS, 'time', NCDOUBLE, 1, IDIMID1, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 7,
+ 'seconds', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 16,
+ 'Time in seconds', IERR)
CALL NCAPTC (NPOS, NVARID, 'Time_label', NCCHAR, 24,
+ 'Start of output interval', IERR)
! timestep
IDIMID1(1) = NTIMID
NVARID = NCVDEF (NPOS, 'timestp', NCLONG, 1, IDIMID1, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 1,
+ '-', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 15,
+ 'model time step', IERR)
CALL NCAPTC (NPOS, NVARID, 'Time_label', NCCHAR, 24,
+ 'Start of output interval', IERR)
! model identification
CALL NCAPTC (NPOS, NCGLOBAL, 'modelID', NCCHAR, 20,
+ CMODID, IERR)
! run version
CALL NCAPTC (NPOS, NCGLOBAL, 'versionID', NCCHAR, 20,
+ CVERID, IERR)
! model startup
CALL NCAPT (NPOS, NCGLOBAL, 'start_day', NCLONG, 1,
+ NINDAT, IERR)
CALL NCAPT (NPOS, NCGLOBAL, 'start_hour', NCLONG, 1,
+ NSSSSS, IERR)
! sign convention
CALL NCAPTC (NPOS, NCGLOBAL, 'SurfSgn_convention', NCCHAR, 12,
+ 'Mathematical', IERR)
! skin temperature
IDIMID3(1) = NLONID
IDIMID3(2) = NLATID
IDIMID3(3) = NTIMID
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'AvgSurfT','K',
& 'average skin temperature','time y x',ZMISS,RMISS)
! skin depth
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'CanopInt','kg/m^2',
& 'interception layer depth','time y x',ZMISS,RMISS)
! soil temperature
IDIMID4(1) = NLONID
IDIMID4(2) = NLATID
IDIMID4(3) = NLEVSID
IDIMID4(4) = NTIMID
NVARID = NCVDEF (NPOS, 'SoilTemp', IACCUR, 4, IDIMID4, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 1,
+ 'K', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 16,
+ 'soil temperature', IERR)
CALL NCAPTC (NPOS, NVARID, 'associate', NCCHAR, 14,
+ 'time nlevs y x', IERR)
IF(IACCUR.EQ.NCFLOAT)THEN
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,ZMISS, IERR)
ELSE
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,RMISS, IERR)
ENDIF
! soil water content
NVARID = NCVDEF (NPOS, 'SoilMoist', IACCUR, 4, IDIMID4, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 6,
+ 'kg/m^2', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 31,
+ 'soil moisture content per layer', IERR)
CALL NCAPTC (NPOS, NVARID, 'associate', NCCHAR, 14,
+ 'time nlevs y x', IERR)
IF(IACCUR.EQ.NCFLOAT)THEN
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,ZMISS, IERR)
ELSE
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,RMISS, IERR)
ENDIF
! sea ice temperature
NVARID = NCVDEF (NPOS, 'icetemp', IACCUR, 4, IDIMID4, IERR)
CALL NCAPTC (NPOS, NVARID, 'units', NCCHAR, 1,
+ 'K', IERR)
CALL NCAPTC (NPOS, NVARID, 'long_name', NCCHAR, 19,
+ 'sea ice temperature', IERR)
CALL NCAPTC (NPOS, NVARID, 'associate', NCCHAR, 14,
+ 'time nlevs y x', IERR)
IF(IACCUR.EQ.NCFLOAT)THEN
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,ZMISS, IERR)
ELSE
CALL NCAPT (NPOS, NVARID, 'missing_value',IACCUR,
+ 1,RMISS, IERR)
ENDIF
! snow depth
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'SWE','kg/m^2',
& 'snow mass water eq','time y x',ZMISS,RMISS)
! snow temperature
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'SnowT','K',
& 'snow temperature','time y x',ZMISS,RMISS)
! snow albedo
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'SAlbedo','-',
& 'snow albedo','time y x',ZMISS,RMISS)
! snow density
CALL CDF_ENCODE(NPOS,IACCUR,IDIMID3,'snowdens','kg/m3',
& 'snow density','time y x',ZMISS,RMISS)
!* -- return to data mode
CALL NCENDF(NPOS, IERR)
RETURN
END SUBROUTINE SETUP_POUT