subroutine userm1_run(comp, importState, exportState, clock, rc)
type(ESMF_GridComp) :: comp
type(ESMF_State) :: importState, exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc
type(ESMF_VM) :: vm
integer :: petCount, status, myPet
character(ESMF_MAXSTR) :: name3, name2, value32, convESMF, purpGen
character(ESMF_MAXSTR) :: name_to_add, value_to_add
type(ESMF_Field) :: field
type(ESMF_FieldBundle) :: fieldbundle
type(ESMF_AttPack) :: attpack
rc = ESMF_SUCCESS
convESMF = 'ESMF'
purpGen = 'General'
name2 = 'StandardName'
name3 = 'LongName'
value32 = 'CHANGED!!'
name_to_add = "new_attribute"
value_to_add = "new_att_value"
call ESMF_GridCompGet(comp, vm=vm, rc=status)
if (status .ne. ESMF_SUCCESS) return
call ESMF_VMGet(vm, petCount=petCount, localPet=myPet, rc=status)
if (status .ne. ESMF_SUCCESS) return
call ESMF_StateGet(exportState, "fieldbundle", fieldbundle, rc=rc)
if (rc/=ESMF_SUCCESS) return
call ESMF_FieldBundleGet(fieldbundle, fieldname="field", field=field, rc=rc)
if (rc/=ESMF_SUCCESS) return
! it's actually the CF/Extended (nested) package that contains "StandardName"
call ESMF_AttributeGetAttPack(field, "ESMF", "General", attpack=attpack, rc=status)
if (rc/=ESMF_SUCCESS) return
call ESMF_AttributeRemove(field, name=name2, attpack=attpack, rc=status)
if (rc/=ESMF_SUCCESS) return
end subroutine userm1_run