ESMF_CFIOVarInfoSet Subroutine

public subroutine ESMF_CFIOVarInfoSet(varObj, vName, grid, vTitle, vUnits, twoDimVar, validRange, amiss, addOffSet, scaleFactor, standardName, attCharNames, vAttCharCnts, varAttChars, attRealNames, vAttRealCnts, varAttReals, attIntNames, vAttIntCnts, varAttInts, ordering, attCharName, attChar, attRealName, attReal, attIntName, attInt, packingRange, timAve, aveMethod, cellMthd, ChunkSize, rc)

ESMF_CFIOVarInfoSet – Set meta data for a CFIO variable

Arguments

Type IntentOptional Attributes Name
type(ESMF_CFIOVarInfo), intent(inout) :: varObj

variable obj

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

variable name

type(ESMF_CFIOGrid), intent(in), optional :: grid

grid

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

variable long name

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

variable units

logical, optional :: twoDimVar

True for 2D

real, intent(in), optional :: validRange(2)

Variable valid range

real, intent(in), optional :: amiss

FILL value

real, intent(in), optional :: addOffSet
real, intent(in), optional :: scaleFactor
character(len=*), intent(in), optional :: standardName
character(len=*), intent(in), optional :: attCharNames(:)
integer, intent(in), optional :: vAttCharCnts(:)

length of attributes

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

length of attributes

real, intent(in), optional :: varAttReals(:,:)
character(len=*), intent(in), optional :: attIntNames(:)
integer, intent(in), optional :: vAttIntCnts(:)

length of attributes

integer, intent(in), optional :: varAttInts(:,:)
character(len=*), optional :: ordering

(time, lev, lat, lon) (default) can be any combination of xyzt

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

User defined variable attribute name

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

User defined variable char attribute

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

User defined variable real attribute name

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

User defined variable real attribute

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

User defined variable int attribute name

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

User defined variable int attribute

real, intent(in), optional :: packingRange(2)

Variable valid range

logical, optional :: timAve

True for time average

character(len=1), optional :: aveMethod

‘c’: center, ‘d’: downstream ‘u’: upstream

character(len=*), optional :: cellMthd

Cell methmod units

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

User defined Chunksize int

integer, intent(out), optional :: rc

0 all is well
-1 Allocation for attCharCnts failed
-2 Allocation for attRealCnts failed
-3 Allocation for attIntCnts failed
-4 Allocation for varAttChars failed
-5 Allocation for varAttReals failed
-6 Allocation for varAttInts failed
-7 Allocation for attCharNames failed
-8 Allocation for attRealNames failed
-9 Allocation for attIntNames failed


Calls

proc~~esmf_cfiovarinfoset~~CallsGraph proc~esmf_cfiovarinfoset ESMF_CFIOVarInfoSet proc~addlist addList proc~esmf_cfiovarinfoset->proc~addlist proc~err err proc~esmf_cfiovarinfoset->proc~err

Called by

proc~~esmf_cfiovarinfoset~~CalledByGraph proc~esmf_cfiovarinfoset ESMF_CFIOVarInfoSet program~test~10 test program~test~10->proc~esmf_cfiovarinfoset program~test~12 test program~test~12->proc~esmf_cfiovarinfoset program~test~13 test program~test~13->proc~esmf_cfiovarinfoset program~test~14 test program~test~14->proc~esmf_cfiovarinfoset program~test~5 test program~test~5->proc~esmf_cfiovarinfoset program~test~7 test program~test~7->proc~esmf_cfiovarinfoset program~test~8 test program~test~8->proc~esmf_cfiovarinfoset program~test~9 test program~test~9->proc~esmf_cfiovarinfoset

Source Code

      subroutine ESMF_CFIOVarInfoSet (varObj, vName, grid, vTitle, vUnits,  &
                              twoDimVar, validRange, amiss, addOffSet,      &
                              scaleFactor, standardName, attCharNames,      &
                              vAttCharCnts, varAttChars, attRealNames,      &
                              vAttRealCnts, varAttReals, attIntNames,       &
                              vAttIntCnts, varAttInts, ordering,            &
                              attCharName, attChar, attRealName, attReal,   &
                              attIntName, attInt, packingRange, timAve,     &
                              aveMethod, cellMthd, ChunkSize, rc )
       implicit NONE

!
! !INPUT PARAMETERS:
!
       character(len=*), intent(in), OPTIONAL :: vName  !! variable name 
       type(ESMF_CFIOGrid), intent(in), OPTIONAL :: grid  !! grid 
       character(len=*), intent(in), OPTIONAL :: vTitle !! variable long name 
       character(len=*), intent(in), OPTIONAL :: vUnits !! variable units      
       logical, OPTIONAL :: twoDimVar                 !! True for 2D
       logical, OPTIONAL :: timAve                    !! True for time average
       character, OPTIONAL :: aveMethod  !! 'c': center, 'd': downstream
                                         !! 'u': upstream
       character(len=*), OPTIONAL :: cellMthd    !! Cell methmod units
       real, intent(in), OPTIONAL :: validRange(2)    !! Variable valid range
       real, intent(in), OPTIONAL :: packingRange(2)  !! Variable valid range
       real, intent(in), OPTIONAL :: amiss            !! FILL value
       real, intent(in), OPTIONAL :: addOffSet    
       real, intent(in), OPTIONAL :: scaleFactor
       character(len=*), intent(in), OPTIONAL :: standardName 

       character(len=*), intent(in), OPTIONAL :: attCharNames(:)
       character(len=*), intent(in), OPTIONAL :: attRealNames(:)
       character(len=*), intent(in), OPTIONAL :: attIntNames(:)

       integer, intent(in), OPTIONAL :: vAttCharCnts(:) !! length of attributes
       integer, intent(in), OPTIONAL :: vAttRealCnts(:) !! length of attributes
       integer, intent(in), OPTIONAL :: vAttIntCnts(:)  !! length of attributes

       character(len=*), intent(in), OPTIONAL :: varAttChars(:)
       real, intent(in), OPTIONAL :: varAttReals(:,:)
       integer, intent(in), OPTIONAL :: varAttInts(:,:)
       
       character(len=*), OPTIONAL :: ordering 
                                 !! (time, lev, lat, lon) (default)
                                 !! can be any combination of xyzt

       character(len=*), intent(in), OPTIONAL :: attCharName
                                 !! User defined variable attribute name
       character(len=*), intent(in), OPTIONAL :: attRealName
                                 !! User defined variable real attribute name
       character(len=*), intent(in), OPTIONAL :: attIntName
                                 !! User defined variable int attribute name
       character(len=*), intent(in), OPTIONAL :: attChar
                                 !! User defined variable char attribute
       real,    intent(in), OPTIONAL :: attReal(:)
                                 !! User defined variable real attribute
       integer, intent(in), OPTIONAL :: attInt(:)
                                 !! User defined variable int attribute
       integer, intent(in), OPTIONAL :: ChunkSize(:)
                                 !! User defined Chunksize int 

!
! !OUTPUT PARAMETERS:
!
       integer, intent(out), OPTIONAL :: rc   !! 0  all is well   
                                 !! -1 Allocation for attCharCnts failed   
                                 !! -2 Allocation for attRealCnts failed   
                                 !! -3 Allocation for attIntCnts failed   
                                 !! -4 Allocation for varAttChars failed   
                                 !! -5 Allocation for varAttReals failed   
                                 !! -6 Allocation for varAttInts failed   
                                 !! -7 Allocation for attCharNames failed   
                                 !! -8 Allocation for attRealNames failed   
                                 !! -9 Allocation for attIntNames failed   
                                               

! !INPUT/OUTPUT PARAMETERS:
!
       type(ESMF_CFIOVarInfo), intent(inout) :: varObj        !! variable obj 
 
!
!------------------------------------------------------------------------------
       integer :: iCnt, jCnt, count, rtcode = 0
                                                                  
       if ( present(vName) ) varObj%vName = vName
       if ( present(grid) ) then
          varObj%grid = grid 
          varObj%isGridSet = .true.
       end if
       if ( present(vTitle) ) varObj%vTitle = vTitle
       if ( present(vUnits) ) varObj%vUnits = vUnits
       if ( present(twoDimVar) ) varObj%twoDimVar = twoDimVar
       if ( present(timAve) ) varObj%timAve = timAve
       if ( present(aveMethod) ) varObj%aveMethod = aveMethod
       if ( present(cellMthd) ) varObj%cellMthd = trim(cellMthd) 
       if ( present(validRange) ) varObj%validRange = validRange
       if ( present(packingRange) ) varObj%packingRange = packingRange
       if ( present(amiss) ) varObj%amiss = amiss
       if ( present(addOffSet) ) varObj%addOffSet = addOffSet
       if ( present(scaleFactor) ) varObj%scaleFactor = scaleFactor
       if ( present(standardName) )  varObj%standardName = standardName
       if ( present(ordering) ) varObj%ordering = ordering 
       
!      user provide int/real/char attribute counts as arrays 
       if ( present(vAttCharCnts) ) then
          allocate(varObj%attCharCnts(size(vAttCharCnts)), stat=rtcode)
          if (err("Allocation for attCharCnts failed",rtcode,-1) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if

          varObj%attCharCnts = vAttCharCnts
       end if
       if ( present(vAttRealCnts) ) then
          allocate(varObj%attRealCnts(size(vAttRealCnts)), stat=rtcode)
          if (err("Allocation for attRealCnts failed",rtcode,-2) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%attRealCnts = vAttRealCnts
          varObj%nVarAttReal = size(vAttRealCnts)
       end if
       if ( present(vAttIntCnts) ) then
          allocate(varObj%attIntCnts(size(vAttIntCnts)), stat=rtcode)
          if (err("Allocation for attIntCnts failed",rtcode,-3) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%attIntCnts = vAttIntCnts
          varObj%nVarAttInt = size(vAttIntCnts)
       end if

!      user provide int/real/char attribute data as arrays 
       if ( present(varAttChars) ) then
          allocate(varObj%varAttChars(size(varAttChars)), stat=rtcode)
          if (err("Allocation for varAttChars failed",rtcode,-4) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%varAttChars = varAttChars
          varObj%nVarAttChar = size(vAttCharCnts)
       end if
       if ( present(varAttReals) ) then
          iCnt = size(varObj%attRealCnts)
          jCnt = size(varAttReals)/size(varObj%attRealCnts)
          allocate(varObj%varAttReals(iCnt, jCnt), stat=rtcode)
          if (err("Allocation for varAttReals failed",rtcode,-5) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%varAttReals = varAttReals
       end if
       if ( present(varAttInts) ) then
          iCnt = size(varObj%attIntCnts)
          jCnt = size(varAttInts)/size(varObj%attIntCnts)
          allocate(varObj%varAttInts(iCnt, jCnt), stat=rtcode)
          if (err("Allocation for varAttInts failed",rtcode,-6) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%varAttInts = varAttInts  
       end if
    
!      user provide int/real/char attribute names as arrays 
       if ( present(attCharNames)) then
          allocate(varObj%attCharNames(size(attCharNames)), stat=rtcode)
          if (err("Allocation for attCharNames failed",rtcode,-7) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%attCharNames = attCharNames
       end if
       if ( present(attRealNames)) then
          allocate(varObj%attRealNames(size(attRealNames)), stat=rtcode)
          if (err("Allocation for attRealNames failed",rtcode,-8) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%attRealNames = attRealNames
       end if
       if ( present(attIntNames)) then
          allocate(varObj%attIntNames(size(attIntNames)), stat=rtcode)
          if (err("Allocation for attIntNames failed",rtcode,-9) .lt. 0) then
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%attIntNames = attIntNames
       end if

!      set ChunkSize array
       if( present(ChunkSize) ) then
          allocate(varObj%ChunkSize(size(ChunkSize)), stat=rtcode)
          if (err("can't allocate mem: ChunkSize",rtcode,-12) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if
          varObj%ChunkSize=ChunkSize
       end if


!      user provides real attribute name and data. Put them into rList
       if ( present(attRealName) .and. present(attReal) ) then
          count = size(attReal)
          call addList(attRealName, count, attReal=attReal, &
                       rList=varObj%rList)
       end if

!      user provides int attribute name and data. Put them into iList
       if ( present(attIntName) .and. present(attInt) ) then
          count = size(attInt)
          call addList(attIntName, count, attInt=attInt, &
                       iList=varObj%iList)
       end if

!      user provides char attribute name and data. Put them into cList
       if ( present(attCharName) .and. present(attChar) ) then
          call addList(attCharName, len(attChar), attChar=attChar, &
                       cList=varObj%cList)
       end if

       if ( present(rc) ) rc = rtcode

      end subroutine ESMF_CFIOVarInfoSet