libsim  Versione 7.1.6

◆ grid_transform_v7d_grid_compute()

subroutine grid_transform_v7d_grid_compute ( type(grid_transform), intent(in)  this,
real, dimension(:,:), intent(in)  field_in,
real, dimension(:,:,:), intent(out)  field_out,
type(vol7d_var), intent(in), optional  var,
real, dimension(:,:,:), intent(in), optional, target  coord_3d_in 
)

Compute the output data array from input data array according to the defined transformation.

The grid_transform object this must have been properly initialised, so that it contains all the information needed for computing the transformation. This is the sparse points-to-grid and sparse points-to-sparse points version.

Parametri
[in]thisgrid_tranform object
[in]field_ininput array
[out]field_outoutput array
[in]varphysical variable to be interpolated, if provided, some ad-hoc algorithms may be used where possible
[in]coord_3d_ininput vertical coordinate for vertical interpolation, if not provided by other means

Definizione alla linea 4151 del file grid_transform_class.F90.

4153 END FUNCTION hbilin
4154 
4155 
4156 ! Shapiro filter of order 2
4157 FUNCTION shapiro (z,zp) RESULT(zs)
4158 !! z_smoothed(i,j) = z(i,j) * (1-S) + S * sum(z_vicini)/N
4159 !! = z(i,j) - S/N (N*z(i,j) - sum(z_vicini))
4160 REAL,INTENT(in) :: z(:) ! Z values on the four surrounding points
4161 REAL,INTENT(in) :: zp ! Z values on the central point
4162 REAL :: zs ! Z smoothed value on the central point
4163 INTEGER:: N
4164 
4165 IF(c_e(zp))THEN
4166  n = count(c_e(z))
4167  zs = zp - 0.5* ( n*zp - sum(z, c_e(z)) )/n
4168 ELSE
4169  zs = rmiss
4170 END IF
4171 
4172 END FUNCTION shapiro
4173 
4174 
4175 ! Locate index of requested point
4176 SUBROUTINE basic_find_index(this, near, nx, ny, xmin, xmax, ymin, ymax, &
4177  lon, lat, extrap, index_x, index_y)
4178 TYPE(griddim_def),INTENT(in) :: this ! griddim object (from grid)
4179 logical,INTENT(in) :: near ! near or bilin interpolation (determine wich point is requested)
4180 INTEGER,INTENT(in) :: nx,ny ! dimension (to grid)
4181 DOUBLE PRECISION,INTENT(in) :: xmin, xmax, ymin, ymax ! extreme coordinate (to grid)
4182 DOUBLE PRECISION,INTENT(in) :: lon(:,:),lat(:,:) ! target coordinate
4183 LOGICAL,INTENT(in) :: extrap ! extrapolate
4184 INTEGER,INTENT(out) :: index_x(:,:),index_y(:,:) ! index of point requested
4185 
4186 INTEGER :: lnx, lny
4187 DOUBLE PRECISION :: x(SIZE(lon,1),SIZE(lon,2)),y(SIZE(lon,1),SIZE(lon,2))
4188 
4189 IF (near) THEN
4190  CALL proj(this,lon,lat,x,y)
4191  index_x = nint((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4192  index_y = nint((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4193  lnx = nx
4194  lny = ny
4195 ELSE
4196  CALL proj(this,lon,lat,x,y)
4197  index_x = floor((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4198  index_y = floor((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4199  lnx = nx-1
4200  lny = ny-1
4201 ENDIF
4202 
4203 IF (extrap) THEN ! trim indices outside grid for extrapolation
4204  index_x = max(index_x, 1)
4205  index_y = max(index_y, 1)
4206  index_x = min(index_x, lnx)
4207  index_y = min(index_y, lny)
4208 ELSE ! nullify indices outside grid
4209  WHERE(index_x < 1 .OR. index_x > lnx .OR. index_y < 1 .OR. index_y > lny)
4210  index_x = imiss
4211  index_y = imiss
4212  END WHERE
4213 ENDIF
4214 
4215 END SUBROUTINE basic_find_index
4216 
4217 END MODULE grid_transform_class
Module for defining transformations between rectangular georeferenced grids and between grids and spa...

Generated with Doxygen.