libsim  Versione 7.2.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 4336 del file grid_transform_class.F90.

4338 FUNCTION shapiro (z,zp) RESULT(zs)
4339 !! z_smoothed(i,j) = z(i,j) * (1-S) + S * sum(z_vicini)/N
4340 !! = z(i,j) - S/N (N*z(i,j) - sum(z_vicini))
4341 REAL,INTENT(in) :: z(:) ! Z values on the four surrounding points
4342 REAL,INTENT(in) :: zp ! Z values on the central point
4343 REAL :: zs ! Z smoothed value on the central point
4344 INTEGER:: N
4345 
4346 IF(c_e(zp))THEN
4347  n = count(c_e(z))
4348  zs = zp - 0.5* ( n*zp - sum(z, c_e(z)) )/n
4349 ELSE
4350  zs = rmiss
4351 END IF
4352 
4353 END FUNCTION shapiro
4354 
4355 
4356 ! Locate index of requested point
4357 SUBROUTINE basic_find_index(this, near, nx, ny, xmin, xmax, ymin, ymax, &
4358  lon, lat, extrap, index_x, index_y)
4359 TYPE(griddim_def),INTENT(in) :: this ! griddim object (from grid)
4360 LOGICAL,INTENT(in) :: near ! near or bilin interpolation (determine wich point is requested)
4361 INTEGER,INTENT(in) :: nx,ny ! dimension (to grid)
4362 DOUBLE PRECISION,INTENT(in) :: xmin, xmax, ymin, ymax ! extreme coordinate (to grid)
4363 DOUBLE PRECISION,INTENT(in) :: lon(:,:),lat(:,:) ! target coordinate
4364 LOGICAL,INTENT(in) :: extrap ! extrapolate
4365 INTEGER,INTENT(out) :: index_x(:,:),index_y(:,:) ! index of point requested
4366 
4367 INTEGER :: lnx, lny
4368 DOUBLE PRECISION :: x(SIZE(lon,1),SIZE(lon,2)),y(SIZE(lon,1),SIZE(lon,2))
4369 
4370 IF (near) THEN
4371  CALL proj(this,lon,lat,x,y)
4372  index_x = nint((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4373  index_y = nint((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4374  lnx = nx
4375  lny = ny
4376 ELSE
4377  CALL proj(this,lon,lat,x,y)
4378  index_x = floor((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4379  index_y = floor((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4380  lnx = nx-1
4381  lny = ny-1
4382 ENDIF
4383 
4384 IF (extrap) THEN ! trim indices outside grid for extrapolation
4385  index_x = max(index_x, 1)
4386  index_y = max(index_y, 1)
4387  index_x = min(index_x, lnx)
4388  index_y = min(index_y, lny)
4389 ELSE ! nullify indices outside grid
4390  WHERE(index_x < 1 .OR. index_x > lnx .OR. index_y < 1 .OR. index_y > lny)
4391  index_x = imiss
4392  index_y = imiss
4393  END WHERE
4394 ENDIF
4395 
4396 END SUBROUTINE basic_find_index
4397 
4398 END MODULE grid_transform_class
Module for defining transformations between rectangular georeferenced grids and between grids and spa...

Generated with Doxygen.