ESMF_CFIOSet Subroutine

public subroutine ESMF_CFIOSet(cfio, cfioObjName, varObjs, grids, grid, fName, title, source, contact, history, convention, institution, references, comment, date, begTime, timeInc, timeString, prec, attCharNames, attCharCnts, attChars, attRealNames, attRealCnts, attReals, attIntNames, attIntCnts, attInts, attCharName, attChar, attRealName, attReal, attIntName, attInt, format, expid, isCyclic, isOpen, nSteps, fNameTmplt, deflate, formatVersion, rc)

ESMF_CFIOSet – Set meta data for a CFIO object

Set meta data for a CFIO object with detailed information.

Arguments

Type IntentOptional Attributes Name
type(ESMF_CFIO), intent(inout) :: cfio

a CFIO object

character(len=*), intent(in), optional :: cfioObjName

object name

type(ESMF_CFIOVarInfo), optional :: varObjs(:)

variable objects

type(ESMF_CFIOGrid), optional :: grids(:)

grid array

type(ESMF_CFIOGrid), optional :: grid
character(len=*), intent(in), optional :: fName

File name

character(len=*), intent(in), optional :: title
character(len=*), intent(in), optional :: source

Source of data

character(len=*), intent(in), optional :: contact

Who to contact

character(len=*), intent(in), optional :: history
character(len=*), intent(in), optional :: convention

CFIO or COARDS

character(len=*), intent(in), optional :: institution

File name

character(len=*), intent(in), optional :: references
character(len=*), intent(in), optional :: comment
integer, intent(in), optional :: date

yyyymmdd

integer, intent(in), optional :: begTime

hhmmss

integer, intent(in), optional :: timeInc

time step increment

character(len=*), intent(in), optional :: timeString

string expression of date and time

integer, intent(in), optional :: prec

Desired precision of data: 0 = 32 bit; 1 = 64 bit

character(len=*), intent(in), optional :: attCharNames(:)

User defined global char attribute names

integer, intent(in), optional :: attCharCnts(:)

length of attributes

character(len=*), intent(in), optional :: attChars(:)

User defined global char attribute

character(len=*), intent(in), optional :: attRealNames(:)

User defined global real attribute names

integer, intent(in), optional :: attRealCnts(:)

length of attributes

real, intent(in), optional :: attReals(:,:)

User defined global real attribute

character(len=*), intent(in), optional :: attIntNames(:)

User defined global int attribute names

integer, intent(in), optional :: attIntCnts(:)

length of attributes

integer, intent(in), optional :: attInts(:,:)

User defined global int attribute

character(len=*), intent(in), optional :: attCharName

User defined global char attribute name

character(len=*), intent(in), optional :: attChar

User defined global char attribute

character(len=*), intent(in), optional :: attRealName

User defined global real attribute name

real, intent(in), optional :: attReal(:)

User defined global real attribute

character(len=*), intent(in), optional :: attIntName

User defined global int attribute name

integer, intent(in), optional :: attInt(:)

User defined global int attribute

character(len=*), intent(in), optional :: format
character(len=*), intent(in), optional :: expid
logical, intent(in), optional :: isCyclic
logical, intent(in), optional :: isOpen
integer, intent(in), optional :: nSteps
character(len=*), intent(in), optional :: fNameTmplt

File name

integer, intent(in), optional :: deflate
real, intent(in), optional :: formatVersion
integer, intent(out), optional :: rc

Error return code:
0 all is well
-1 can’t allocate memory for grid(s)
-2 can’t allocate memory: varObjs
-3 can’t allocate mem: attIntCnts
-4 can’t allocate mem: attIntNames
-5 can’t allocate memory: attInts
-6 can’t allocate mem: attRealCnts
-7 can’t allocate mem: attRealNames
-8 can’t allocate memory: attReals
-9 can’t allocate mem: attCharCnts
-10 can’t allocate mem: attCharNames
-11 can’t allocate memory: attChars


Calls

proc~~esmf_cfioset~~CallsGraph proc~esmf_cfioset ESMF_CFIOSet proc~addlist addList proc~esmf_cfioset->proc~addlist proc~err err proc~esmf_cfioset->proc~err proc~strtoint strToInt proc~esmf_cfioset->proc~strtoint

Called by

proc~~esmf_cfioset~~CalledByGraph proc~esmf_cfioset ESMF_CFIOSet none~find~73 CFIOCollection%find none~find~73->proc~esmf_cfioset proc~esmf_cfiofileopen ESMF_CFIOFileOpen none~find~73->proc~esmf_cfiofileopen proc~esmf_cfiofilecreate ESMF_CFIOFileCreate proc~esmf_cfiofilecreate->proc~esmf_cfioset proc~esmf_cfiosdffilecreate ESMF_CFIOSdfFileCreate proc~esmf_cfiofilecreate->proc~esmf_cfiosdffilecreate proc~esmf_cfiofileopen->proc~esmf_cfioset proc~esmf_cfiosdffilecreate->proc~esmf_cfioset proc~mapl_cfiocreatewrite MAPL_CFIOCreatewrite proc~mapl_cfiocreatewrite->proc~esmf_cfioset proc~mapl_cfiocreatewrite->proc~esmf_cfiofilecreate program~test test program~test->proc~esmf_cfioset program~test->proc~esmf_cfiofileopen program~test~10 test program~test~10->proc~esmf_cfioset program~test~10->proc~esmf_cfiofilecreate program~test~11 test program~test~11->proc~esmf_cfioset program~test~11->proc~esmf_cfiofileopen program~test~12 test program~test~12->proc~esmf_cfioset program~test~12->proc~esmf_cfiofilecreate program~test~12->proc~esmf_cfiofileopen program~test~13 test program~test~13->proc~esmf_cfioset program~test~13->proc~esmf_cfiofilecreate program~test~2 test program~test~2->proc~esmf_cfioset program~test~2->proc~esmf_cfiofilecreate program~test~3 test program~test~3->proc~esmf_cfioset program~test~3->proc~esmf_cfiofilecreate program~test~4 test program~test~4->proc~esmf_cfioset program~test~4->proc~esmf_cfiofilecreate program~test~5 test program~test~5->proc~esmf_cfioset program~test~5->proc~esmf_cfiofilecreate program~test~6 test program~test~6->proc~esmf_cfioset program~test~6->proc~esmf_cfiofilecreate program~test~7 test program~test~7->proc~esmf_cfioset program~test~7->proc~esmf_cfiofileopen program~test~8 test program~test~8->proc~esmf_cfioset program~test~8->proc~esmf_cfiofilecreate proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->none~find~73 proc~mapl_cfioopenwrite MAPL_CFIOOpenWrite proc~mapl_cfioopenwrite->proc~esmf_cfiofileopen proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~73 program~test~14 test program~test~14->proc~esmf_cfiofilecreate

Source Code

      subroutine ESMF_CFIOSet(cfio, cfioObjName, varObjs, grids, grid,      &
                              fName, title, source, contact, history,       &
                              convention, institution, references, comment, &
                              date, begTime, timeInc, timeString, prec,     &
                              attCharNames, attCharCnts, attChars,          &
                              attRealNames, attRealCnts, attReals,          &
                              attIntNames, attIntCnts, attInts,             &
                              attCharName, attChar, attRealName, attReal,   &
                              attIntName, attInt, format,           &
                              expid, isCyclic, isOpen, nSteps, fNameTmplt,  &
                              deflate, formatVersion,                    rc )
       implicit NONE

!
! !INPUT PARAMETERS:
!
       character(len=*), intent(in), OPTIONAL :: cfioObjName !! object name
       type(ESMF_CFIOVarInfo), OPTIONAL :: varObjs(:)!! variable objects 
       type(ESMF_CFIOGrid), OPTIONAL :: grids(:)     !! grid array
       type(ESMF_CFIOGrid), OPTIONAL :: grid         

       character(len=*), intent(in), OPTIONAL :: fName      !! File name
       character(len=*), intent(in), OPTIONAL :: fNameTmplt !! File name
       character(len=*), intent(in), OPTIONAL :: title      
       character(len=*), intent(in), OPTIONAL :: source     !! Source of data
       character(len=*), intent(in), OPTIONAL :: contact    !! Who to contact 
       character(len=*), intent(in), OPTIONAL :: history    !!
       character(len=*), intent(in), OPTIONAL :: convention !! CFIO or COARDS
       character(len=*), intent(in), OPTIONAL :: institution!! File name
       character(len=*), intent(in), OPTIONAL :: references
       character(len=*), intent(in), OPTIONAL :: comment

       integer, intent(in), OPTIONAL :: date          !! yyyymmdd
       integer, intent(in), OPTIONAL :: begTime       !! hhmmss
       integer, intent(in), OPTIONAL :: timeInc       !! time step increment
       character(len=*), intent(in), OPTIONAL :: timeString !! string expression of date and time  
       integer, intent(in), OPTIONAL :: prec      !! Desired precision of data:
                                                  !! 0 = 32 bit; 1 = 64 bit

       character(len=*), intent(in), OPTIONAL :: attCharNames(:) !! User defined global char attribute names
       character(len=*), intent(in), OPTIONAL :: attRealNames(:) !! User defined global real attribute names 
       character(len=*), intent(in), OPTIONAL :: attIntNames(:) !! User defined global int attribute names
       integer, intent(in), OPTIONAL :: attCharCnts(:) !! length of attributes
       integer, intent(in), OPTIONAL :: attRealCnts(:) !! length of attributes
       integer, intent(in), OPTIONAL :: attIntCnts(:)  !! length of attributes

       character(len=*), intent(in), OPTIONAL :: attChars(:) !! User defined global char attribute 
       real,      intent(in), OPTIONAL :: attReals(:,:) !! User defined global real attribute 
       integer,   intent(in), OPTIONAL :: attInts(:,:) !! User defined global int attribute 

       character(len=*), intent(in), OPTIONAL :: attCharName !! User defined global char attribute name
       character(len=*), intent(in), OPTIONAL :: attRealName !! User defined global real attribute name
       character(len=*), intent(in), OPTIONAL :: attIntName !! User defined global int attribute name
       character(len=*), intent(in), OPTIONAL :: attChar !! User defined global char attribute 
       real,    intent(in), OPTIONAL :: attReal(:) !! User defined global real attribute 
       integer, intent(in), OPTIONAL :: attInt(:) !! User defined global int attribute 
       character(len=*), intent(in), OPTIONAL :: format
       character(len=*), intent(in), OPTIONAL :: expid
       logical, intent(in), OPTIONAL :: isCyclic
       logical, intent(in), OPTIONAL :: isOpen
       integer, intent(in), OPTIONAL :: nSteps
       integer, intent(in), OPTIONAL :: deflate
       real,    intent(in), OPTIONAL :: formatVersion
!
! !OUTPUT PARAMETERS:
!
       integer, intent(out), OPTIONAL :: rc  !! Error return code:      
                                    !! 0   all is well      
                                    !! -1  can't allocate memory for grid(s)      
                                    !! -2  can't allocate memory: varObjs      
                                    !! -3  can't allocate mem: attIntCnts     
                                    !! -4  can't allocate mem: attIntNames    
                                    !! -5  can't allocate memory: attInts      
                                    !! -6  can't allocate mem: attRealCnts     
                                    !! -7  can't allocate mem: attRealNames    
                                    !! -8  can't allocate memory: attReals    
                                    !! -9  can't allocate mem: attCharCnts    
                                    !! -10  can't allocate mem: attCharNames    
                                    !! -11  can't allocate memory: attChars    
! !INPUT/OUTPUT PARAMETERS:
!
       type(ESMF_CFIO), intent(inout) :: cfio    !! a CFIO object
!
!------------------------------------------------------------------------------
       integer :: iCnt, jCnt, count, rtcode

!      set required global meta data

       if ( present(cfioObjName) ) cfio%cfioObjName = cfioObjName
       if ( present(fName) ) cfio%fName = fName
       if ( present(fNameTmplt) ) cfio%fNameTmplt = fNameTmplt
       if ( present(title) ) cfio%title = title
       if ( present(source) ) cfio%source = source
       if ( present(contact) ) cfio%contact = contact
       if ( present(history) ) cfio%history = history
       if ( present(convention) ) cfio%convention = convention
       if ( present(institution) ) cfio%institution = institution
       if ( present(references) ) cfio%references = references
       if ( present(comment) ) cfio%comment = comment
       if ( present(date) ) cfio%date = date    
       if ( present(begTime) ) cfio%begTime = begTime 
       if ( present(timeInc) ) cfio%timeInc = timeInc 
       if ( present(format) ) cfio%format = format
       if ( present(expid) ) cfio%expid = expid
       if ( present(isCyclic) ) cfio%isCyclic = isCyclic
       if ( present(isOpen) ) cfio%isOpen = isOpen
       if ( present(nSteps) ) cfio%tSteps = nSteps
       if ( present(deflate) ) cfio%deflate = deflate
       if ( present(formatVersion) ) cfio%formatVersion = formatVersion

       if ( present(timeString) ) then
          call strToInt(timeString, cfio%date, cfio%begTime)
       end  if
       if ( present(prec) ) cfio%prec = prec

!      set grid information
       if ( present(grids) ) then
          cfio%mGrids = size(grids) 
          allocate( cfio%grids(cfio%mGrids), stat = rtcode)
          if (err("can't allocate memory for grids",rtcode,-1) .lt. 0 ) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          cfio%grids = grids   
          cfio%isGridSet = .true.
       end if
       if ( present(grid) ) then
          cfio%mGrids = 1
          allocate( cfio%grids(cfio%mGrids), stat = rtcode)
          if (err("can't allocate memory for grid",rtcode,-1) .lt. 0 ) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          cfio%grids = grid   
          cfio%isGridSet = .true.
       end if

!      set variable
       if ( present(varObjs) ) then
          cfio%mVars = size(varObjs) 
          allocate( cfio%varObjs(cfio%mVars), stat = rtcode)
          if (err("can't allocate memory: varObjs",rtcode,-2) .lt. 0 ) then
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%varObjs = varObjs 
       end if

!      set integer names, counts and data
       if ( present(attIntCnts) )  then 
          allocate(cfio%attIntCnts(size(attIntCnts)), stat=rtcode)
          if (err("can't allocate mem: attIntCnts",rtcode,-3) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attIntCnts = attIntCnts 
          cfio%nAttInt = size(attIntCnts)
       end if
       if ( present(attIntNames) )  then 
          cfio%nAttInt = size(attIntNames)
          allocate(cfio%attIntNames(cfio%nAttInt), stat=rtcode)
          if (err("can't allocate mem: attIntNames",rtcode,-4) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attIntNames = attIntNames
       end if
       if ( present(attInts) )  then 
          iCnt = size(cfio%attIntCnts)
          jCnt = size(attInts)/size(cfio%attIntCnts)
          allocate(cfio%attInts(iCnt, jCnt), stat=rtcode)
          rtcode = err("can't allocate memory for attInts", rtcode, -1)
          if (err("can't allocate memory: attInts",rtcode,-5) .lt. 0) then   
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attInts= attInts
       end if

!      set real names, counts and data with array
       if ( present(attRealCnts) )  then 
          allocate(cfio%attRealCnts(size(attRealCnts)), stat=rtcode)
          rtcode = err("can't allocate memory for attRealCnts", rtcode, -1)
          if (err("can't allocate mem: attRealCnts",rtcode,-6) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attRealCnts = attRealCnts 
          cfio%nAttReal = size(attRealCnts)
       end if
       if ( present(attRealNames) )  then 
          cfio%nAttReal = size(attRealNames)
          allocate(cfio%attRealNames(cfio%nAttReal), stat=rtcode)
          if (err("can't allocate mem: attRealNames",rtcode,-7) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attRealNames = attRealNames
       end if
       if ( present(attReals) )  then 
          iCnt = size(cfio%attRealCnts)
          jCnt = size(attReals)/size(cfio%attRealCnts)
          allocate(cfio%attReals(iCnt, jCnt), stat=rtcode)
          if (err("can't allocate memory: attReals",rtcode,-8) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attReals= attReals
       end if

!      set character names, counts and data with array
       if ( present(attCharCnts) )  then 
          allocate(cfio%attCharCnts(size(attCharCnts)), stat=rtcode)
          if (err("can't allocate mem: attCharCnts",rtcode,-9) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attCharCnts = attCharCnts 
          cfio%nAttChar = size(attCharCnts)
       end if
       if ( present(attCharNames) )  then 
          cfio%nAttChar = size(attCharNames)
          allocate(cfio%attCharNames(cfio%nAttChar), stat=rtcode)
          if (err("can't allocate mem: attCharNames",rtcode,-10) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attCharNames = attCharNames
       end if
       if ( present(attChars) )  then 
          allocate(cfio%attChars(cfio%nAttChar), stat=rtcode)
          if (err("can't allocate memory: attChars",rtcode,-11) .lt. 0) then   
             if ( present(rc) ) rc = rtcode
             return
          end if

          cfio%attChars= attChars
       end if

!      set integer name, count and data into a list
       if ( present(attRealName) .and. present(attReal) ) then
          count = size(attReal)
          call addList(attRealName, count, attReal=attReal, &
                       rList=cfio%rList)
       end if

!      set real attribute name, count and data into a list
       if ( present(attIntName) .and. present(attInt) ) then
          count = size(attInt)
          call addList(attIntName, count, attInt=attInt, &
                       iList=cfio%iList)
       end if

!      set character attribute name, count and data into a list
       if ( present(attCharName) .and. present(attChar) ) then
          call addList(attCharName, len(attChar), attChar=attChar, &
                       cList=cfio%cList)
       end if

       rtcode = 0
       if ( present(rc) ) rc = rtcode

      end subroutine ESMF_CFIOSet