libsim Versione 7.2.4

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

4311
4312z5 = (z4-z1)*p2+z1
4313z6 = (z3-z2)*p2+z2
4314
4315zp = (z6-z5)*(p1)+z5
4316
4317END FUNCTION hbilin
4318
4319
4320! Shapiro filter of order 2
4321FUNCTION shapiro (z,zp) RESULT(zs)
4322!! z_smoothed(i,j) = z(i,j) * (1-S) + S * sum(z_vicini)/N
4323!! = z(i,j) - S/N (N*z(i,j) - sum(z_vicini))
4324REAL,INTENT(in) :: z(:) ! Z values on the four surrounding points
4325REAL,INTENT(in) :: zp ! Z values on the central point
4326REAL :: zs ! Z smoothed value on the central point
4327INTEGER:: N
4328
4329IF(c_e(zp))THEN
4330 n = count(c_e(z))
4331 zs = zp - 0.5* ( n*zp - sum(z, c_e(z)) )/n
4332ELSE
4333 zs = rmiss
4334END IF
4335
4336END FUNCTION shapiro
4337
4338
4339! Locate index of requested point
4340SUBROUTINE basic_find_index(this, near, nx, ny, xmin, xmax, ymin, ymax, &
4341 lon, lat, extrap, index_x, index_y)
4342TYPE(griddim_def),INTENT(in) :: this ! griddim object (from grid)
4343LOGICAL,INTENT(in) :: near ! near or bilin interpolation (determine wich point is requested)
4344INTEGER,INTENT(in) :: nx,ny ! dimension (to grid)
4345DOUBLE PRECISION,INTENT(in) :: xmin, xmax, ymin, ymax ! extreme coordinate (to grid)
4346DOUBLE PRECISION,INTENT(in) :: lon(:,:),lat(:,:) ! target coordinate
4347LOGICAL,INTENT(in) :: extrap ! extrapolate
4348INTEGER,INTENT(out) :: index_x(:,:),index_y(:,:) ! index of point requested
4349
4350INTEGER :: lnx, lny
4351DOUBLE PRECISION :: x(SIZE(lon,1),SIZE(lon,2)),y(SIZE(lon,1),SIZE(lon,2))
4352
4353IF (near) THEN
4354 CALL proj(this,lon,lat,x,y)
4355 index_x = nint((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4356 index_y = nint((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4357 lnx = nx
4358 lny = ny
4359ELSE
4360 CALL proj(this,lon,lat,x,y)
4361 index_x = floor((x-xmin)/((xmax-xmin)/dble(nx-1)))+1
4362 index_y = floor((y-ymin)/((ymax-ymin)/dble(ny-1)))+1
4363 lnx = nx-1
4364 lny = ny-1
4365ENDIF
4366
4367IF (extrap) THEN ! trim indices outside grid for extrapolation
4368 index_x = max(index_x, 1)
4369 index_y = max(index_y, 1)
4370 index_x = min(index_x, lnx)
4371 index_y = min(index_y, lny)
4372ELSE ! nullify indices outside grid
4373 WHERE(index_x < 1 .OR. index_x > lnx .OR. index_y < 1 .OR. index_y > lny)
4374 index_x = imiss
4375 index_y = imiss
4376 END WHERE
4377ENDIF
4378
4379END SUBROUTINE basic_find_index
4380
4381END MODULE grid_transform_class
Module for defining transformations between rectangular georeferenced grids and between grids and spa...

Generated with Doxygen.