convertCart2Sph Subroutine

public subroutine convertCart2Sph(lons, lats, units)

Arguments

Type IntentOptional Attributes Name
real(kind=ESMF_KIND_R8), pointer :: lons(:)
real(kind=ESMF_KIND_R8), pointer :: lats(:)
character(len=*) :: units

Source Code

  subroutine convertCart2Sph(lons, lats, units)

    real(ESMF_KIND_R8), pointer :: lons(:)
    real(ESMF_KIND_R8), pointer :: lats(:)
    character(*) :: units

    real(ESMF_KIND_R8) :: scale

    ! This is a very primitive and incorrect convertion. The purpose
    ! is to generate some values that can be used to generate synthetic
    ! field values using the same equation used when the coordinates are
    ! in radians
    
    if (units(1:1) .eq. 'm') then
      scale = 1.0d0/6.371d6
    else
      scale = 1.0d0/6.371d3
    endif
    lons=lons*scale
    lats=lats*scale
  end subroutine convertCart2Sph