libsim Versione 8.0.0

◆ 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 )
private

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 4390 del file grid_transform_class.F90.

4392
4393z5 = (z4-z1)*p2+z1
4394z6 = (z3-z2)*p2+z2
4395
4396zp = (z6-z5)*(p1)+z5
4397
4398END FUNCTION hbilin
4399
4400
4401! Shapiro filter of order 2
4402FUNCTION shapiro (z,zp) RESULT(zs)
4403!! z_smoothed(i,j) = z(i,j) * (1-S) + S * sum(z_vicini)/N
4404!! = z(i,j) - S/N (N*z(i,j) - sum(z_vicini))
4405REAL,INTENT(in) :: z(:) ! Z values on the four surrounding points
4406REAL,INTENT(in) :: zp ! Z values on the central point
4407REAL :: zs ! Z smoothed value on the central point
4408INTEGER:: N
4409
4410IF(c_e(zp))THEN
4411 n = count(c_e(z))
4412 zs = zp - 0.5* ( n*zp - sum(z, c_e(z)) )/n
4413ELSE
4414 zs = rmiss
4415END IF
4416
4417END FUNCTION shapiro
4418
4419
4420! Locate index of requested point
4421SUBROUTINE basic_find_index(this, near, nx, ny, xmin, xmax, ymin, ymax, &
4422 lon, lat, extrap, index_x, index_y)
4423TYPE(griddim_def),INTENT(in) :: this ! griddim object (from grid)
4424LOGICAL,INTENT(in) :: near ! near or bilin interpolation (determine wich point is requested)
4425INTEGER,INTENT(in) :: nx,ny ! dimension (to grid)
4426DOUBLE PRECISION,INTENT(in) :: xmin, xmax, ymin, ymax ! extreme coordinate (to grid)
4427DOUBLE PRECISION,INTENT(in) :: lon(:,:),lat(:,:) ! target coordinate
4428LOGICAL,INTENT(in) :: extrap ! extrapolate
4429INTEGER,INTENT(out) :: index_x(:,:),index_y(:,:) ! index of point requested
4430
4431INTEGER :: lnx, lny
4432DOUBLE PRECISION :: x(SIZE(lon,1),SIZE(lon,2)),y(SIZE(lon,1),SIZE(lon,2))
4433
4434IF (near) THEN
4435 CALL proj(this,lon,lat,x,y)
4436 index_x = nint((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4437 index_y = nint((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4438 lnx = nx
4439 lny = ny
4440ELSE
4441 CALL proj(this,lon,lat,x,y)
4442 index_x = floor((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4443 index_y = floor((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4444 lnx = nx-1
4445 lny = ny-1
4446ENDIF
4447
4448IF (extrap) THEN ! trim indices outside grid for extrapolation
4449 index_x = max(index_x, 1)
4450 index_y = max(index_y, 1)
4451 index_x = min(index_x, lnx)
4452 index_y = min(index_y, lny)
4453ELSE ! nullify indices outside grid
4454 WHERE(index_x < 1 .OR. index_x > lnx .OR. index_y < 1 .OR. index_y > lny)
4455 index_x = imiss
4456 index_y = imiss
4457 END WHERE
4458ENDIF
4459
4460END SUBROUTINE basic_find_index
4461
4462END MODULE grid_transform_class
Module for defining transformations between rectangular georeferenced grids and between grids and spa...

Generated with Doxygen.