MAPL_ease_extent Subroutine

public subroutine MAPL_ease_extent(EASELabel, cols, rows, cell_area, ll_lon, ll_lat, ur_lon, ur_lat, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: EASELabel
integer, intent(out) :: cols
integer, intent(out) :: rows
real, intent(out), optional :: cell_area
real, intent(out), optional :: ll_lon
real, intent(out), optional :: ll_lat
real, intent(out), optional :: ur_lon
real, intent(out), optional :: ur_lat
integer, intent(out), optional :: rc

Calls

proc~~mapl_ease_extent~~CallsGraph proc~mapl_ease_extent MAPL_ease_extent interface~mapl_assert MAPL_Assert proc~mapl_ease_extent->interface~mapl_assert proc~mapl_ease_inverse MAPL_ease_inverse proc~mapl_ease_extent->proc~mapl_ease_inverse proc~mapl_return MAPL_Return proc~mapl_ease_extent->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_ease_extent->proc~mapl_verify proc~mapl_ease_inverse->interface~mapl_assert proc~mapl_ease_inverse->proc~mapl_return proc~mapl_ease_inverse->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

  subroutine MAPL_ease_extent (EASELabel, cols, rows, cell_area, ll_lon, ll_lat, ur_lon, ur_lat, rc)

    ! get commonly used EASE grid parameters

    character*(*),           intent(in)  :: EASELabel
    integer,                 intent(out) :: cols, rows  ! number of grid cells in lon and lat direction, resp.
    real,          optional, intent(out) :: cell_area   ! [m^2]
    real,          optional, intent(out) :: ll_lon      ! lon of grid cell boundary in lower left  corner
    real,          optional, intent(out) :: ll_lat      ! lat of grid cell boundary in lower left  corner
    real,          optional, intent(out) :: ur_lon      ! lon of grid cell boundary in upper right corner
    real,          optional, intent(out) :: ur_lat      ! lat of grid cell boundary in upper right corner
    integer,       optional, intent(out) :: rc
    ! ---------------------------------------------------------------------

    real(kind=REAL64)  :: map_scale_m, CELL_km, r0, s0, Rg
    real               :: tmplon
    character(3)       :: grid
    integer            :: status

    if (     index(EASELabel,'M36') /=0 ) then
       grid='M36'
    else if (index(EASELabel,'M25') /=0 ) then
       grid='M25'
    else if (index(EASELabel,'M09') /=0 ) then
       grid='M09'
    else if (index(EASELabel,'M03') /=0 ) then
       grid='M03'
    else if (index(EASELabel,'M01') /=0 ) then
       grid='M01'
    else
       _FAIL("MAPL_ease_extent(): unknown grid projection and resolution: "//trim(EASELabel)//"  STOPPING.")
    endif

    if(     index(EASELabel,'EASEv2') /=0) then

       call easeV2_get_params(grid, map_scale_m, cols, rows, r0, s0, _RC)

       if(present(cell_area)) cell_area = map_scale_m**2

    else if(index(EASELabel,'EASEv1') /=0) then

       call easeV1_get_params(grid, CELL_km, cols, rows, r0, s0, Rg, _RC)

       if(present(cell_area)) cell_area = CELL_km**2 * 1000. * 1000.

    else
       _FAIL("MAPL_ease_extent(): unknown grid version: "//trim(EASELabel)//"  STOPPING.")
    endif

    ! get lat/lon of corner grid cells
    !
    ! recall that EASE grid indexing is zero-based

    if (present(ll_lat))  call MAPL_ease_inverse(EASElabel, 0., rows-0.5, ll_lat, tmplon, _RC)
    if (present(ur_lat))  call MAPL_ease_inverse(EASElabel, 0.,     -0.5, ur_lat, tmplon, _RC)

    if (present(ll_lon))  ll_lon = -180.
    if (present(ur_lon))  ur_lon =  180.

    _RETURN(_SUCCESS)

  end subroutine MAPL_ease_extent