libsim  Versione8.0.0

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

2637  this%outnx=this%trans%poly%arraysize
2638  this%outny=1
2639  CALL vol7d_alloc(v7d_out, nana=this%outnx)
2640 
2641 ! setup output point list, equal to average of polygon points
2642 ! warning, in case of concave areas points may coincide!
2643  CALL poly_to_coordinates(this%trans%poly, v7d_out)
2644 
2645  this%valid = .true. ! warning, no check of subtype
2646 
2647 ELSE IF (this%trans%trans_type == 'metamorphosis') THEN
2648 
2649 ! common to all metamorphosis subtypes
2650  this%innx = SIZE(v7d_in%ana)
2651  this%inny = 1
2652 ! allocate index array
2653  ALLOCATE(this%point_index(this%innx,this%inny))
2654  this%point_index(:,:) = imiss
2655 
2656  IF (this%trans%sub_type == 'all' ) THEN
2657 
2658  CALL metamorphosis_all_setup()
2659 
2660  ELSE IF (this%trans%sub_type == 'coordbb' ) THEN
2661 
2662  ALLOCATE(lon(this%innx),lat(this%innx))
2663 
2664 ! count and mark points falling into requested bounding-box
2665  this%outnx = 0
2666  this%outny = 1
2667  CALL getval(v7d_in%ana(:)%coord,lon=lon,lat=lat)
2668  DO i = 1, this%innx
2669 ! IF (geo_coord_inside_rectang()
2670  IF (lon(i) > this%trans%rect_coo%ilon .AND. &
2671  lon(i) < this%trans%rect_coo%flon .AND. &
2672  lat(i) > this%trans%rect_coo%ilat .AND. &
2673  lat(i) < this%trans%rect_coo%flat) THEN ! improve!
2674  this%outnx = this%outnx + 1
2675  this%point_index(i,1) = this%outnx
2676  ENDIF
2677  ENDDO
2678 
2679  IF (this%outnx <= 0) THEN
2680  CALL l4f_category_log(this%category,l4f_warn, &
2681  "metamorphosis:coordbb: no points inside bounding box "//&
2682  trim(to_char(this%trans%rect_coo%ilon))//","// &
2683  trim(to_char(this%trans%rect_coo%flon))//","// &
2684  trim(to_char(this%trans%rect_coo%ilat))//","// &
2685  trim(to_char(this%trans%rect_coo%flat)))
2686  ENDIF
2687 
2688  CALL vol7d_alloc(v7d_out, nana=this%outnx)
2689 
2690 ! collect coordinates of points falling into requested bounding-box
2691  n = 0
2692  DO i = 1, this%innx
2693  IF (c_e(this%point_index(i,1))) THEN
2694  n = n + 1
2695  CALL init(v7d_out%ana(n),lon=lon(i),lat=lat(i))
2696  ENDIF
2697  ENDDO
2698  DEALLOCATE(lon, lat)
2699 
2700  this%valid = .true.
2701 
2702  ELSE IF (this%trans%sub_type == 'poly' ) THEN
2703 
2704 ! count and mark points falling into requested polygon
2705  this%outnx = 0
2706  this%outny = 1
2707  DO i = 1, this%innx
2708 ! temporary, improve!!!!
2709  CALL getval(v7d_in%ana(i)%coord,lon=lon1,lat=lat1)
2710  point = georef_coord_new(x=lon1, y=lat1)
2711  DO n = 1, this%trans%poly%arraysize
2712  IF (inside(point, this%trans%poly%array(n))) THEN ! stop at the first matching polygon
2713  this%outnx = this%outnx + 1
2714  this%point_index(i,1) = n
2715  EXIT
2716  ENDIF
2717  ENDDO
2718 ! CALL delete(point) ! speedup
2719  ENDDO
2720 
2721  IF (this%outnx <= 0) THEN
2722  CALL l4f_category_log(this%category,l4f_warn, &
2723  "metamorphosis:poly: no points inside polygons")
2724  ENDIF
2725 

Generated with Doxygen.