Fortran-90 MODULE MODNCFIO

Contents

Declarations for netCDF and PnetCDF

CREATENC()
Create a new "raw netCDF" file.

DESCNCVAR()
Return the list of variables for a "raw netCDF" file, together with their units, types, and dimension-info.

READNCVAR()
Read a variable, or a timestep of a variable, from a "raw netCDF" file.

WRITENCVAR()
Write a variable, or a timestep of a variable, to a "raw netCDF" file.

Summary

New for I/O API-3.2!!

Developed from (extends, and resolves inconsistencies in) the I/O API/netCDF/PnetCDF INCLUDE-files NETCDF.EXT and pnetcdf.inc (which declare [p]netCDF routines and related constants). Also includes new routines for creating, inquiring about, reading, and writing variables to/from "raw" netCDF files. These routines all follow the pattern of

  1. Open the file with the indicated logical name;
  2. Perform appropriate error-checking
  3. Perform the indicated task
  4. When CDFID is not an argument: Close the indicated file.
(in contrast with the MPAS-format-netCDF I/O routines in MODULE MODMPASFIO which maintain files in an opened state until closed (partly necessitated by the extreme complexity of the repeated setup and error checking that would be needed there).

Note that if you wish to create "raw netCDF" files following the CF Metadata Conventions, you will have quite a bit of additional work to do manually, setting up all the CF data structures in routine CREATENC(), and then writing the metadata using WRITENCVAR.(). This is in contrast to the situation within the I/O API proper, where an INITCF() call turns on the creation of CF-convention metadata, and all the extra work is performed automatically, "behind the scenes".

See also MODULE MODATTS3, MODULE MODWRFIO and MODULE MODMPASFIO.

Declarations

This module is mostly a "declarations-module", which is used to resolve various incompatibilities between different versions of netCDF and (if PnetCDF/MPI distributed I/O is enabled)_PnetCDF INCLUDE-files. The options are controlled by preprocessor symbols at libioapi.a build-time: This of course leads to four (link-incompatible!) distinct netCDF-version related versions of the I/O API library (and the additional option for PVM-enabled or not, as distinguished by preprocessor symbol IOAPICPL defined in Makefile.cpl, turns it into a total of 8 versions in all).

This module also provides routines for describing "raw" netCDF files, and for reading either entire variables or entire time steps of variables from them.

It is also hoped that the source code for this module is somewhat more readable than the original INCLUDE-files :-)

Back to Contents


New Routines:

CREATENC()

    LOGICAL FUNCTION  CREATENC( FNAME,  FHIST,  FDESC,                      &
                                NDIMS,  DNAMES, DSIZES,                     &
                                NVARS,  VNAMES, VTYPES, VNDIMS, VDNAME,     &
                                VUNITS, VLONGS, VDESCS )
    LOGICAL FUNCTION  CREATENC( FNAME,  FHIST,  FDESC,                      &
                                NDIMS,  DNAMES, DSIZES,                     &
                                NVARS,  VNAMES, VTYPES, VNDIMS, VDNAME,     &
                                VUNITS, VLONGS, VDESCS                      &
                                CDFID )
        CHARACTER*(*), INTENT(IN   ) :: FNAME                !!  logical file name
        CHARACTER*(*), INTENT(IN   ) :: FHIST                !!  attribute  "history"
        CHARACTER*(*), INTENT(IN   ) :: FDESC                !!  attribute  "description"
        INTEGER      , INTENT(IN   ) :: NDIMS                !!  number of dimensions used
        CHARACTER*(*), INTENT(IN   ) :: DNAMES( NDIMS )      !!  dimension-names
        INTEGER      , INTENT(IN   ) :: DSIZES( NDIMS )      !!  dimension-values
        INTEGER      , INTENT(IN   ) :: NVARS                !!  number of (extra) output variables
        CHARACTER*(*), INTENT(IN   ) :: VNAMES(   NVARS )    !!  variable-names
        INTEGER      , INTENT(IN   ) :: VTYPES(   NVARS )    !!  variable-type M3REAL, etc...)
        INTEGER      , INTENT(IN   ) :: VNDIMS(   NVARS )    !!  rank (number of dimensions)
        CHARACTER*(*), INTENT(IN   ) :: VDNAME( 7,NVARS )    !!  names for dimensions used for the variables
        CHARACTER*(*), INTENT(IN   ) :: VUNITS(   NVARS )    !!  attribute  "units"
        CHARACTER*(*), INTENT(IN   ) :: VTITLE(   NVARS )    !!  attribute  "long_name"
        CHARACTER*(*), INTENT(IN   ) :: VDESCS(   NVARS )    !!  attribute  "description"
        INTEGER      , INTENT(  OUT) :: CDFID                !!  netCDF file ID
    
Given a netCDF file definition, in terms of the dimension-definition and variable-definition arguments, create a new netCDF file with logical name FNAME. Closes the file (with a well=defined header but no data) before returning to the caller.

Where attribute-arguments (FHIST, FDESC, VUNITS(V), VLONGS(V), VDESCS(V)) are blank, does not create the corresponding attribute in the output file (for that varaible, where the attribute is variable-dependent). Note that the netCDF best practices document says that all these attributes should be present.

Preconditions::

See Also

CREATEMPAS() for creating new MPAS-format-netCDF output files.
Back to Contents


DESCNCVAR()

    LOGICAL FUNCTION DESCNCVAR( FNAME, MXVAR, NVARS, VNAMES, VTYPES, VNDIMS, VDIMS )
    LOGICAL FUNCTION DESCNCVAR( FNAME, CDFID, MXVAR, NVARS, VNAMES, VTYPES, VNDIMS, VDIMS )
        CHARACTER*(*), INTENT(IN   ) :: FNAME           !!  logical file name
        INTEGER      , INTENT(IN   ) :: CDFID           !!  netCDF file ID
        INTEGER      , INTENT(IN   ) :: MXVAR           !!  max # of vbles returned
        INTEGER      , INTENT(  OUT) :: NVARS           !!  min( MXVAR, actual # of vbles )
        CHARACTER*(*), INTENT(  OUT) :: VNAMES( MXVAR ) !!  variable names
        CHARACTER*(*), INTENT(  OUT) :: VUNITS( MXVAR ) !!  variable units
        INTEGER      , INTENT(  OUT) :: VTYPES( MXVAR ) !!  types (M3REAL, M3INT, etc.)
        INTEGER      , INTENT(  OUT) :: VNDIMS( MXVAR ) !!  ranks (number of dimensions)
        INTEGER      , INTENT(  OUT) :: VDIMS(7,MXVAR ) !!  dimensions
    
For a given netCDF file with logical name FNAME and maximum list-size MXVAR, returns lists giving the names, data-types, numbers of dimensions, and dimensions for the variables in that file. Opens the file before inquiring from its header, and closes it before return to the caller.

Preconditions::

  • setenv <logical-name> <path-name>
  • Make sure the string-length for VNAMES(*) is long enough to hold the variable-names that occur in the file.
  • Presumes that the file follows standard netCDF conventions, and does have a units attribute for each variable (which MPAS fails to do, by the way).

See Also

DESCMPAS() for describing MPAS-format-netCDF files.
Back to Contents


READNCVAR()

Generic cases:
    LOGICAL FUNCTION READNCVAR( FNAME, [ISTEP,] VNAME, [NCOLS, [NROWS, [NLAYS, [NSPCS, ]]]] GRID )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, IGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, SGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, BGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, RGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, DGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, IVEC2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, SVEC2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, BVEC2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, RVEC2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, DVEC2 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, IVEC3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, SVEC3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, BVEC3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, RVEC3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, DVEC3 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IVEC4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SVEC4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BVEC4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RVEC4 )
    LOGICAL FUNCTION READNCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DVEC4 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, SGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, BGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, RGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, DGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, SGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, BGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, RGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, DGRID0 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION READNCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
        CHARACTER*(*), INTENT(IN   ) :: FNAME                       !!  logical file name
        CHARACTER*(*), INTENT(IN   ) :: VNAME                       !!  variable name
        INTEGER      , INTENT(IN   ) :: CDFID                       !!  netCDF file-ID
        INTEGER      , INTENT(IN   ) :: ISTEP                       !!  time-step number (1,2,3,...)
        INTEGER      , INTENT(IN   ) :: NCOLS, NROWS, NLAYS, NSPCS  !!  dimensions
        <type>       , INTENT(  OUT) ::  GRID ( NCOLS, [NROWS, [NLAYS,[NSPCS]]] )
        INTEGER      , INTENT(  OUT) :: IGRID0
        REAL         , INTENT(  OUT) :: RGRID0
        REAL*8       , INTENT(  OUT) :: DGRID0
        INTEGER      , INTENT(  OUT) :: IGRID1( NCOLS )
        INTEGER*2    , INTENT(  OUT) :: SGRID1( NCOLS )
        INTEGER*1    , INTENT(  OUT) :: BGRID1( NCOLS )
        REAL         , INTENT(  OUT) :: RGRID1( NCOLS )
        REAL*8       , INTENT(  OUT) :: DGRID1( NCOLS )
        INTEGER      , INTENT(  OUT) :: IGRID2( NCOLS, NROWS )
        INTEGER*2    , INTENT(  OUT) :: SGRID2( NCOLS, NROWS )
        INTEGER*1    , INTENT(  OUT) :: BGRID2( NCOLS, NROWS )
        REAL         , INTENT(  OUT) :: RGRID2( NCOLS, NROWS )
        REAL*8       , INTENT(  OUT) :: DGRID2( NCOLS, NROWS )
        INTEGER      , INTENT(  OUT) :: IGRID3( NCOLS, NROWS, NLAYS )
        INTEGER*2    , INTENT(  OUT) :: SGRID3( NCOLS, NROWS, NLAYS )
        INTEGER*1    , INTENT(  OUT) :: BGRID3( NCOLS, NROWS, NLAYS )
        REAL         , INTENT(  OUT) :: RGRID3( NCOLS, NROWS, NLAYS )
        REAL*8       , INTENT(  OUT) :: DGRID3( NCOLS, NROWS, NLAYS )
        INTEGER      , INTENT(  OUT) :: IGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER*2    , INTENT(  OUT) :: SGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER*1    , INTENT(  OUT) :: BGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        REAL         , INTENT(  OUT) :: RGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        REAL*8       , INTENT(  OUT) :: DGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER      , INTENT(  OUT) ::  IVEC2( NCOLS*NROWS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC2( NCOLS*NROWS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC2( NCOLS*NROWS )
        REAL         , INTENT(  OUT) ::  RVEC2( NCOLS*NROWS )
        REAL*8       , INTENT(  OUT) ::  DVEC2( NCOLS*NROWS )
        INTEGER      , INTENT(  OUT) ::  IVEC3( NCOLS*NROWS*NLAYS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC3( NCOLS*NROWS*NLAYS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC3( NCOLS*NROWS*NLAYS )
        REAL         , INTENT(  OUT) ::  RVEC3( NCOLS*NROWS*NLAYS )
        REAL*8       , INTENT(  OUT) ::  DVEC3( NCOLS*NROWS*NLAYS )
        INTEGER      , INTENT(  OUT) ::  IVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        REAL         , INTENT(  OUT) ::  RVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        REAL*8       , INTENT(  OUT) ::  DVEC4( NCOLS*NROWS*NLAYS*NSPCS )
    
Generic routine for opening the indicated netCDF file, reading either entire-array or timestep-slice of 0-D, 1-D, 2-D, 3-D, and 4-D NF_INT1, NF_INT2, M3INT, M3REAL and M3DBLE variables from "raw" netCDF files, and then closing the file afterwards.

Preconditions and Limitations::

Note that the time stepped forms have a somewhat-unexpected FNAME, ISTEP, VNAME, ... order of arguments; this is a consequence of the need to have unique argument-list specifications for the compiler to be able to distinguish which specific function-version is appropriate.

See Also

JSTEP3() for determining time step numbers in "regular" time step sequences; and
FIND2() for determining time step numbers in "non-regular" time step sequences.
READMPAS() for reading MPAS-format-netCDF files.
WRITEMPAS() for writing MPAS-format-netCDF files.
Back to Contents


WRITENCVAR()

Generic cases:
    LOGICAL FUNCTION WRITENCVAR( FNAME, [ISTEP,] VNAME, [NCOLS, [NROWS, [NLAYS, [NSPCS, ]]]] GRID )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, IGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, SGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, BGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, RGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, DGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, IVEC2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, SVEC2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, BVEC2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, RVEC2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, DVEC2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, IVEC3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, SVEC3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, BVEC3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, RVEC3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, DVEC3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IVEC4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SVEC4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BVEC4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RVEC4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DVEC4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, SGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, BGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, RGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, DGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, SGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, BGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, RGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, DGRID0 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, IGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, SGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, BGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, RGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, DGRID1 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, IGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, SGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, BGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, RGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, DGRID2 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, IGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, SGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, BGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, RGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, DGRID3 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, IGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, SGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, BGRID4 )
    LOGIC4L FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, RGRID4 )
    LOGICAL FUNCTION WRITENCVAR( FNAME, CDFID, ISTEP, VNAME, NCOLS, NROWS, NLAYS, NSPCS, DGRID4 )
        CHARACTER*(*), INTENT(IN   ) :: FNAME                       !!  logical file name
        CHARACTER*(*), INTENT(IN   ) :: VNAME                       !!  variable name
        INTEGER      , INTENT(IN   ) :: CDFID                       !!  netCDF file-ID
        INTEGER      , INTENT(IN   ) :: ISTEP                       !!  time-step number (1,2,3,...)
        INTEGER      , INTENT(IN   ) :: NCOLS, NROWS, NLAYS, NSPCS  !!  dimensions
        <type>       , INTENT(  OUT) ::  GRID ( NCOLS, [NROWS, [NLAYS,[NSPCS]]] )
        INTEGER      , INTENT(  OUT) :: IGRID0
        REAL         , INTENT(  OUT) :: RGRID0
        REAL*8       , INTENT(  OUT) :: DGRID0
        INTEGER      , INTENT(  OUT) :: IGRID1( NCOLS )
        INTEGER*2    , INTENT(  OUT) :: SGRID1( NCOLS )
        INTEGER*1    , INTENT(  OUT) :: BGRID1( NCOLS )
        REAL         , INTENT(  OUT) :: RGRID1( NCOLS )
        REAL*8       , INTENT(  OUT) :: DGRID1( NCOLS )
        INTEGER      , INTENT(  OUT) :: IGRID2( NCOLS, NROWS )
        INTEGER*2    , INTENT(  OUT) :: SGRID2( NCOLS, NROWS )
        INTEGER*1    , INTENT(  OUT) :: BGRID2( NCOLS, NROWS )
        REAL         , INTENT(  OUT) :: RGRID2( NCOLS, NROWS )
        REAL*8       , INTENT(  OUT) :: DGRID2( NCOLS, NROWS )
        INTEGER      , INTENT(  OUT) :: IGRID3( NCOLS, NROWS, NLAYS )
        INTEGER*2    , INTENT(  OUT) :: SGRID3( NCOLS, NROWS, NLAYS )
        INTEGER*1    , INTENT(  OUT) :: BGRID3( NCOLS, NROWS, NLAYS )
        REAL         , INTENT(  OUT) :: RGRID3( NCOLS, NROWS, NLAYS )
        REAL*8       , INTENT(  OUT) :: DGRID3( NCOLS, NROWS, NLAYS )
        INTEGER      , INTENT(  OUT) :: IGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER*2    , INTENT(  OUT) :: SGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER*1    , INTENT(  OUT) :: BGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        REAL         , INTENT(  OUT) :: RGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        REAL*8       , INTENT(  OUT) :: DGRID4( NCOLS, NROWS, NLAYS, NSPCS )
        INTEGER      , INTENT(  OUT) ::  IVEC2( NCOLS*NROWS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC2( NCOLS*NROWS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC2( NCOLS*NROWS )
        REAL         , INTENT(  OUT) ::  RVEC2( NCOLS*NROWS )
        REAL*8       , INTENT(  OUT) ::  DVEC2( NCOLS*NROWS )
        INTEGER      , INTENT(  OUT) ::  IVEC3( NCOLS*NROWS*NLAYS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC3( NCOLS*NROWS*NLAYS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC3( NCOLS*NROWS*NLAYS )
        REAL         , INTENT(  OUT) ::  RVEC3( NCOLS*NROWS*NLAYS )
        REAL*8       , INTENT(  OUT) ::  DVEC3( NCOLS*NROWS*NLAYS )
        INTEGER      , INTENT(  OUT) ::  IVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        INTEGER*2    , INTENT(  OUT) ::  SVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        INTEGER*1    , INTENT(  OUT) ::  BVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        REAL         , INTENT(  OUT) ::  RVEC4( NCOLS*NROWS*NLAYS*NSPCS )
        REAL*8       , INTENT(  OUT) ::  DVEC4( NCOLS*NROWS*NLAYS*NSPCS )
    
Generic routine for opening the indicated netCDF file, writing either entire-file or timestep-slice of 0-D, 1-D, 2-D, 3-D, and 4-D NF_INT1, NF_INT2, M3INT, M3REAL and M3DBLE variables to "raw" netCDF files, and then closing the file afterwards.

Preconditions and Limitations::

Note that the time stepped forms have a somewhat-unexpected FNAME, ISTEP, VNAME, ... or FNAME, CDFID, ISTEP, VNAME, ... order of arguments; this is a consequence of the need to have unique argument-list specifications for the compiler to be able to distinguish which specific function-version is appropriate.

See Also

CREATNC() for creating new output netCDF files;
JSTEP3() for determining time step numbers in "regular" time step sequences; and
FIND2() for determining time step numbers in "non-regular" time step sequences.
READMPAS() for reading MPAS-format-netCDF files.
WRITEMPAS() for writing MPAS-format-netCDF files.
Back to Contents


To: Models-3/EDSS I/O API: The Help Pages

Send comments to

Carlie J. Coats, Jr.
carlie@jyarborough.com