libsim  Versione 7.1.8

◆ grid_transform_vol7d_grid_init()

subroutine grid_transform_class::grid_transform_vol7d_grid_init ( type(grid_transform), intent(out)  this,
type(transform_def), intent(in)  trans,
type(vol7d), intent(in)  v7d_in,
type(griddim_def), intent(in)  out,
character(len=*), intent(in), optional  categoryappend 
)
private

Constructor for a grid_transform object, defining a particular sparse points-to-grid transformation.

It defines an object describing a transformation from a set of sparse points to a rectangular grid; the abstract type of transformation is described in the transformation object trans (type transform_def) which must have been properly initialised. The additional information required here is the list of the input sparse points in the form of a vol7d object (parameter v7d_in), which can be the same volume that will be successively used for interpolation, or a volume with just the same coordinate data, and the description of the output grid griddim (a griddim_def object).

The generated grid_transform object is specific to the sparse point list and grid provided. The function c_e can be used in order to check whether the object has been successfully initialised, if the result is .FALSE., it should not be used further on.

Parametri
[out]thisgrid transformation object
[in]transtransformation object
[in]v7d_invol7d object with the coordinates of the sparse point to be used as input (only information about coordinates is used)
[in]outgriddim object defining target grid
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 2548 del file grid_transform_class.F90.

2549  ENDIF
2550  ENDDO
2551  ENDDO
2552 
2553  this%outnx=this%trans%poly%arraysize
2554  this%outny=1
2555  CALL vol7d_alloc(v7d_out, nana=this%outnx)
2556 
2557 ! setup output point list, equal to average of polygon points
2558 ! warning, in case of concave areas points may coincide!
2559  CALL poly_to_coordinates(this%trans%poly, v7d_out)
2560 
2561  this%valid = .true. ! warning, no check of subtype
2562 
2563 ELSE IF (this%trans%trans_type == 'metamorphosis') THEN
2564 
2565 ! common to all metamorphosis subtypes
2566  this%innx = SIZE(v7d_in%ana)
2567  this%inny = 1
2568 ! allocate index array
2569  ALLOCATE(this%point_index(this%innx,this%inny))
2570  this%point_index(:,:) = imiss
2571 
2572  IF (this%trans%sub_type == 'all' ) THEN
2573 
2574  CALL metamorphosis_all_setup()
2575 
2576  ELSE IF (this%trans%sub_type == 'coordbb' ) THEN
2577 
2578  ALLOCATE(lon(this%innx),lat(this%innx))
2579 
2580 ! count and mark points falling into requested bounding-box
2581  this%outnx = 0
2582  this%outny = 1
2583  CALL getval(v7d_in%ana(:)%coord,lon=lon,lat=lat)
2584  DO i = 1, this%innx
2585 ! IF (geo_coord_inside_rectang()
2586  IF (lon(i) > this%trans%rect_coo%ilon .AND. &
2587  lon(i) < this%trans%rect_coo%flon .AND. &
2588  lat(i) > this%trans%rect_coo%ilat .AND. &
2589  lat(i) < this%trans%rect_coo%flat) THEN ! improve!
2590  this%outnx = this%outnx + 1
2591  this%point_index(i,1) = this%outnx
2592  ENDIF
2593  ENDDO
2594 
2595  IF (this%outnx <= 0) THEN
2596  CALL l4f_category_log(this%category,l4f_warn, &
2597  "metamorphosis:coordbb: no points inside bounding box "//&
2598  trim(to_char(this%trans%rect_coo%ilon))//","// &
2599  trim(to_char(this%trans%rect_coo%flon))//","// &
2600  trim(to_char(this%trans%rect_coo%ilat))//","// &
2601  trim(to_char(this%trans%rect_coo%flat)))
2602  ENDIF
2603 
2604  CALL vol7d_alloc(v7d_out, nana=this%outnx)
2605 
2606 ! collect coordinates of points falling into requested bounding-box
2607  n = 0
2608  DO i = 1, this%innx
2609  IF (c_e(this%point_index(i,1))) THEN
2610  n = n + 1
2611  CALL init(v7d_out%ana(n),lon=lon(i),lat=lat(i))
2612  ENDIF
2613  ENDDO
2614  DEALLOCATE(lon, lat)
2615 
2616  this%valid = .true.
2617 
2618  ELSE IF (this%trans%sub_type == 'poly' ) THEN
2619 
2620 ! count and mark points falling into requested polygon
2621  this%outnx = 0
2622  this%outny = 1
2623  DO i = 1, this%innx
2624 ! temporary, improve!!!!
2625  CALL getval(v7d_in%ana(i)%coord,lon=lon1,lat=lat1)
2626  point = georef_coord_new(x=lon1, y=lat1)
2627  DO n = 1, this%trans%poly%arraysize
2628  IF (inside(point, this%trans%poly%array(n))) THEN ! stop at the first matching polygon
2629  this%outnx = this%outnx + 1
2630  this%point_index(i,1) = n
2631  EXIT
2632  ENDIF
2633  ENDDO
2634 ! CALL delete(point) ! speedup
2635  ENDDO
2636 
2637  IF (this%outnx <= 0) THEN

Generated with Doxygen.