INTERFACE:
subroutine areaovr_point (io , jo , nlon_i , nlat_i , numlon_i , &
lon_i , lat_i , nlon_o , nlat_o , lon_o , &
lat_o , n_ovr , i_ovr , j_ovr , w_ovr )
DESCRIPTION:
Find area of overlap between grid cells
For each output grid cell: find overlapping input grid cell and area of
input grid cell that overlaps with output grid cell. Cells overlap if:
southern edge of input grid < northern edge of output grid AND
northern edge of input grid > southern edge of output grid
western edge of input grid < eastern edge of output grid AND
eastern edge of input grid > western edge of output grid
lon_o(io,jo) lon_o(io+1,jo)
| |
--------------------- lat_o(jo+1)
| |
| |
xxxxxxxxxxxxxxx lat_i(ji+1) |
x | x |
x input | x output |
x cell | x cell |
x ii,ji | x io,jo |
x | x |
x ----x---------------- lat_o(jo )
x x
xxxxxxxxxxxxxxx lat_i(ji )
x x
lon_i(ii,ji) lon_i(ii+1,ji)
The above diagram assumes both grids are oriented South to North. Other
combinations of North to South and South to North grids are possible:
Input Grid Output Grid
-------------------------
(1) S to N S to N
(2) N to S N to S
(3) S to N N to S
(4) N to S S to N
The code has been modified to allow for North to South grids. Verification
that these changes work are:
o (1) and (4) give same results for output grid
o (2) and (3) give same results for output grid
o (2) and (4) give same results for output grid when output grid inverted
ARGUMENTS:
implicit none
integer , intent(in) :: io !output grid lon index
integer , intent(in) :: jo !output grid lat index
integer , intent(in) :: nlon_i !input grid : max number of longitude points
integer , intent(in) :: nlat_i !input grid : number of latitude points
integer , intent(in) :: numlon_i(nlat_i) !input grid : number of lon points for lat
real(r8), intent(in) :: lon_i(nlon_i+1,nlat_i) !input grid : cell longitude, W edge (deg)
real(r8), intent(in) :: lat_i(nlat_i+1) !input grid : cell latitude, S edge (deg)
integer , intent(in) :: nlon_o !output grid: max number of longitude points
integer , intent(in) :: nlat_o !output grid: number of latitude points
real(r8), intent(in) :: lon_o(nlon_o+1,nlat_o) !output grid: cell longitude, W edge (deg)
real(r8), intent(in) :: lat_o(nlat_o+1) !output grid: cell latitude, S edge (deg)
integer , intent(inout) :: n_ovr !number of overlapping input cells
integer , intent(inout) :: i_ovr(maxovr) !lon index, overlapping input cell
integer , intent(inout) :: j_ovr(maxovr) !lat index, overlapping input cell
real(r8), intent(inout) :: w_ovr(maxovr) !area of overlap for input cells
REVISION HISTORY:
Created by Gordon Bonan