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