"Fossies" - the Fresh Open Source Software Archive

Member "netcdf-fortran-4.4.5/fortran/netcdf_variables.f90" (31 Jan 2019, 3802 Bytes) of package /linux/misc/netcdf-fortran-4.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Fortran 90 source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "netcdf_variables.f90" see the Fossies "Dox" file reference documentation.

    1   ! ----- 
    2   ! Variable definitions and inquiry
    3   ! ----- 
    4   function nf90_def_var_Scalar(ncid, name, xtype, varid)
    5     integer,               intent( in) :: ncid
    6     character (len = *),   intent( in) :: name
    7     integer,               intent( in) :: xtype
    8     integer,               intent(out) :: varid
    9     integer                            :: nf90_def_var_Scalar
   10     
   11     ! Dummy - shouldn't get used
   12     integer, dimension(1) :: dimids
   13     
   14     nf90_def_var_Scalar = nf_def_var(ncid, name, xtype, 0, dimids, varid)
   15   end function nf90_def_var_Scalar
   16   ! ----- 
   17   function nf90_def_var_oneDim(ncid, name, xtype, dimids, varid)
   18     integer,               intent( in) :: ncid
   19     character (len = *),   intent( in) :: name
   20     integer,               intent( in) :: xtype
   21     integer,               intent( in) :: dimids
   22     integer,               intent(out) :: varid
   23     integer                            :: nf90_def_var_oneDim
   24     
   25     integer, dimension(1) :: dimidsA
   26     dimidsA(1) = dimids
   27     nf90_def_var_oneDim = nf_def_var(ncid, name, xtype, 1, dimidsA, varid)
   28   end function nf90_def_var_oneDim
   29   ! ----- 
   30   function nf90_def_var_ManyDims(ncid, name, xtype, dimids, varid)
   31     integer,               intent( in) :: ncid
   32     character (len = *),   intent( in) :: name
   33     integer,               intent( in) :: xtype
   34     integer, dimension(:), intent( in) :: dimids
   35     integer,               intent(out) :: varid
   36     integer                            :: nf90_def_var_ManyDims
   37     
   38     nf90_def_var_ManyDims = nf_def_var(ncid, name, xtype, size(dimids), dimids, varid)
   39   end function nf90_def_var_ManyDims
   40   ! ----- 
   41   function nf90_inq_varid(ncid, name, varid)
   42     integer,             intent( in) :: ncid
   43     character (len = *), intent( in) :: name
   44     integer,             intent(out) :: varid
   45     integer                          :: nf90_inq_varid
   46     
   47     nf90_inq_varid = nf_inq_varid(ncid, name, varid)
   48   end function nf90_inq_varid
   49   ! ----- 
   50   function nf90_inquire_variable(ncid, varid, name, xtype, ndims, dimids, nAtts)
   51     integer,                         intent( in) :: ncid, varid
   52     character (len = *),   optional, intent(out) :: name
   53     integer,               optional, intent(out) :: xtype, ndims 
   54     integer, dimension(:), optional, intent(out) :: dimids
   55     integer,               optional, intent(out) :: nAtts
   56     integer                                      :: nf90_inquire_variable
   57     
   58     ! Local variables
   59     character (len = nf90_max_name)       :: varName
   60     integer                               :: externalType, numDimensions
   61     integer, dimension(nf90_max_var_dims) :: dimensionIDs
   62     integer                               :: numAttributes
   63     
   64     nf90_inquire_variable = nf_inq_var(ncid, varid, varName, externalType, &
   65                                        numDimensions, dimensionIDs, numAttributes)
   66     if (nf90_inquire_variable == nf90_noerr) then
   67         if(present(name))   name                   = trim(varName)
   68         if(present(xtype))  xtype                  = externalType
   69         if(present(ndims))  ndims                  = numDimensions
   70         if(present(dimids)) then
   71             if (size(dimids) .ge. numDimensions) then
   72                 dimids(:numDimensions) = dimensionIDs(:numDimensions)
   73             else
   74                 nf90_inquire_variable = nf90_einval
   75             endif
   76         endif
   77         if(present(nAtts))  nAtts                  = numAttributes
   78     endif
   79   end function nf90_inquire_variable
   80   ! ----- 
   81   function nf90_rename_var(ncid, varid, newname)
   82     integer,             intent( in) :: ncid, varid
   83     character (len = *), intent( in) :: newname
   84     integer                          :: nf90_rename_var
   85     
   86     nf90_rename_var = nf_rename_var(ncid, varid, newname)
   87   end function nf90_rename_var
   88   ! -----