next up previous contents
Next: areaovr Up: Fortran: Module Interface areaMod Previous: areaave   Contents

areamap


INTERFACE:

   subroutine areamap (nlon_i   , nlat_i   , nlon_o , nlat_o ,  &
                       lon_i    , lat_i    , lon_o  , lat_o  ,  &
                       numlon_i , numlon_o , mask_i , mx_ovr ,  &
                       n_ovr    , i_ovr    , j_ovr  , w_ovr  ,  &
                       fland_o  , area_o   )
DESCRIPTION:

   Weights and indices for area of overlap between grids
   Get indices and weights for area-averaging between input and output grids.
   For each output grid cell find:
      o number of input grid cells that overlap with output grid cell (n_ovr)
      o longitude index (1 <= i_ovr <= nlon_i) of the overlapping input grid cell
      o latitude index  (1 <= j_ovr <= nlat_i) of the overlapping input grid cell
      o fractional overlap of input grid cell (w_ovr)
   so that for
   field values fld_i on an  input grid with dimensions nlon_i and nlat_i
   field values fld_o on an output grid with dimensions nlon_o and nlat_o are
   fld_o(io,jo) = 
   fld_i(i_ovr(io,jo,     1),j_ovr(io,jo,     1)) * w_ovr(io,jo,     1) +
                               ... + ... +
   fld_i(i_ovr(io,jo,mx_ovr),j_ovr(io,jo,mx_ovr)) * w_ovr(io,jo,mx_ovr) 
   Note: mx_ovr is some number greater than n_ovr. Weights of zero are 
   used for the excess points
ARGUMENTS:
     implicit none
     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 longitude points for lat
     real(r8),intent(inout) :: lon_i(nlon_i+1,nlat_i)  !input grid : cell longitude, west edge (deg)
     real(r8),intent(in) :: lat_i(nlat_i+1)            !input grid : cell latitude,  south edge (deg)
     real(r8),intent(in) :: mask_i(nlon_i,nlat_i)      !input grid : mask (0, 1) 
     integer ,intent(in) :: nlon_o                     !output grid: max number of longitude points
     integer ,intent(in) :: nlat_o                     !output grid: number of latitude points
     integer ,intent(in) :: numlon_o(nlat_o)           !output grid: number longitude points for lat
     real(r8),intent(in) :: lon_o(nlon_o+1,nlat_o)     !output grid: cell longitude, west edge  (deg)
     real(r8),intent(in) :: lat_o(nlat_o+1)            !output grid: cell latitude,  south edge (deg)
     real(r8),intent(in) :: fland_o(nlon_o,nlat_o)     !output grid: fraction that is land
     real(r8),intent(in) :: area_o(nlon_o,nlat_o)      !output grid: cell area
     integer ,intent(in) :: mx_ovr                     !max num input cells that overlap output cell
     integer ,intent(out):: n_ovr(nlon_o,nlat_o)       !number of overlapping input cells
     integer ,intent(out):: i_ovr(nlon_o,nlat_o,mx_ovr)!lon index, overlapping input cell
     integer ,intent(out):: j_ovr(nlon_o,nlat_o,mx_ovr)!lat index, overlapping input cell
     real(r8),intent(out):: w_ovr(nlon_o,nlat_o,mx_ovr)!overlap weights for input cells
REVISION HISTORY:
   Created by Gordon Bonan



Mariana Vertenstein 2003-01-14