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