Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(FileMetadata), | intent(inout) | :: | metadata | |||
type(ESMF_Field), | intent(in) | :: | field | |||
integer, | intent(out), | optional | :: | rc |
subroutine add_variable(metadata, field, rc) type(ESMF_Field), intent(in) :: field type(FileMetaData), intent(inout) :: metadata integer, intent(out), optional :: rc integer :: status type(Variable) :: v character(len=:), allocatable :: variable_dim_names type(ESMF_TYPEKIND_FLAG) :: typekind character(len=:), allocatable :: short_name character(len=:), allocatable :: units character(len=:), allocatable :: long_name character(len=:), allocatable :: standard_name type(ESMF_Geom) :: geom integer :: pfio_type variable_dim_names = get_variable_dim_names(field, geom, _RC) call MAPL_FieldGet(field, short_name=short_name, typekind=typekind, _RC) pfio_type = esmf_to_pfio_type(typekind ,_RC) v = Variable(type=pfio_type, dimensions=variable_dim_names) ! Attributes call MAPL_FieldGet(field, units=units, long_name=long_name, standard_name=standard_name, _RC) if (allocated(units))then call v%add_attribute('units', units) end if if (allocated(long_name)) then call v%add_attribute('long_name', long_name) end if if (allocated(standard_name)) then call v%add_attribute('standard_name', standard_name) end if call metadata%add_variable(short_name, v, _RC) _RETURN(_SUCCESS) end subroutine add_variable