libsim  Versione6.3.0

◆ v7d_v7d_transform()

subroutine v7d_v7d_transform ( type(transform_def), intent(in)  this,
type(vol7d), intent(inout)  vol7d_in,
type(vol7d), intent(out)  vol7d_out,
type(vol7d), intent(in), optional  v7d,
type(vol7d_level), dimension(:), intent(in), optional, target  lev_out,
type(vol7d), intent(in), optional  vol7d_coord_in,
character(len=*), intent(in), optional  categoryappend 
)

Performs the specified abstract transformation on the data provided.

The abstract transformation is specified by this parameter; the corresponding specifical transformation (grid_transform object) is created and destroyed internally. The output transformed object is created internally and it does not require preliminary initialisation. The success of the transformation can be checked with the c_e method: c_e(vol7d_out).

Parametri
[in]thisobject specifying the abstract transformation
[in,out]vol7d_inobject to be transformed, it is not modified, despite the INTENT(inout)
[out]vol7d_outtransformed object, it does not require initialisation
[in]v7dobject containing a list of points over which transformation has to be done (required by some transformation types)
[in]lev_outvol7d_level object defining target vertical grid, for vertical interpolations
[in]vol7d_coord_inobject providing time constant input vertical coordinate for some kind of vertical interpolations
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 2738 del file volgrid6d_class.F90.

2738  CALL vol7d_copy(vol7d_in, vol7d_tmpana, &
2739  lana=point_mask, lnetwork=(/.true./), &
2740  ltime=(/.false./), ltimerange=(/.false./), llevel=(/.false./))
2741  CALL vol7d_append(vol7d_out, vol7d_tmpana)
2742  ENDIF
2743  ENDIF
2744 
2745  ELSE
2746  CALL l4f_log(l4f_error, 'v7d_v7d_transform: transformation not valid')
2747  CALL raise_error()
2748  ENDIF
2749 
2750 ENDIF
2751 
2752 CALL delete (grid_trans)
2753 IF (.NOT. PRESENT(v7d)) CALL delete(v7d_locana)
2754 
2755 END SUBROUTINE v7d_v7d_transform
2756 
2757 
2765 subroutine vg6d_wind_unrot(this)
2766 type(volgrid6d) :: this
2767 
2768 integer :: component_flag
2769 
2770 call get_val(this%griddim,component_flag=component_flag)
2771 
2772 if (component_flag == 1) then
2773  call l4f_category_log(this%category,l4f_info, &
2774  "unrotating vector components")
2775  call vg6d_wind__un_rot(this,.false.)
2776  call set_val(this%griddim,component_flag=0)
2777 else
2778  call l4f_category_log(this%category,l4f_info, &
2779  "no need to unrotate vector components")
2780 end if
2781 
2782 end subroutine vg6d_wind_unrot
2783 
2784 
2790 subroutine vg6d_wind_rot(this)
2791 type(volgrid6d) :: this
2792 
2793 integer :: component_flag
2794 
2795 call get_val(this%griddim,component_flag=component_flag)
2796 
2797 if (component_flag == 0) then
2798  call l4f_category_log(this%category,l4f_info, &
2799  "rotating vector components")
2800  call vg6d_wind__un_rot(this,.true.)
2801  call set_val(this%griddim,component_flag=1)
2802 else
2803  call l4f_category_log(this%category,l4f_info, &
2804  "no need to rotate vector components")
2805 end if
2806 
2807 end subroutine vg6d_wind_rot
2808 
2809 
2810 ! Generic UnRotate the wind components.
2811 SUBROUTINE vg6d_wind__un_rot(this,rot)
2812 TYPE(volgrid6d) :: this ! object containing wind to be (un)rotated
2813 LOGICAL :: rot ! if .true. rotate else unrotate
2814 
2815 INTEGER :: i, j, k, l, a11, a12, a21, a22, stallo
2816 double precision,pointer :: rot_mat(:,:,:)
2817 real,allocatable :: tmp_arr(:,:)
2818 REAL,POINTER :: voldatiu(:,:), voldativ(:,:)
2819 INTEGER,POINTER :: iu(:), iv(:)
2820 
2821 IF (.NOT.ASSOCIATED(this%var)) THEN
2822  CALL l4f_category_log(this%category, l4f_error, &
2823  "trying to unrotate an incomplete volgrid6d object")
2824  CALL raise_fatal_error()
2825 ! RETURN
2826 ENDIF
2827 
2828 CALL volgrid6d_var_hor_comp_index(this%var, iu, iv)
2829 IF (.NOT.ASSOCIATED(iu)) THEN
2830  CALL l4f_category_log(this%category,l4f_error, &
2831  "unrotation impossible")
2832  CALL raise_fatal_error()
2833 ! RETURN
2834 ENDIF
2835 
2836 ! Temporary workspace
2837 ALLOCATE(tmp_arr(this%griddim%dim%nx, this%griddim%dim%ny),stat=stallo)
2838 IF (stallo /= 0) THEN
2839  CALL l4f_category_log(this%category, l4f_fatal, "allocating memory")
2840  CALL raise_fatal_error()
2841 ENDIF
2842 ! allocate once for speed
2843 IF (.NOT.ASSOCIATED(this%voldati)) THEN
2844  ALLOCATE(voldatiu(this%griddim%dim%nx, this%griddim%dim%ny), &
2845  voldativ(this%griddim%dim%nx, this%griddim%dim%ny))
2846 ENDIF
2847 
2848 CALL griddim_unproj(this%griddim)
2849 CALL wind_unrot(this%griddim, rot_mat)
2850 
2851 a11=1
2852 if (rot)then
2853  a12=2
2854  a21=3
2855 else
2856  a12=3
2857  a21=2
2858 end if
2859 a22=4
2860 
2861 DO l = 1, SIZE(iu)
2862  DO k = 1, SIZE(this%timerange)
2863  DO j = 1, SIZE(this%time)
2864  DO i = 1, SIZE(this%level)
2865 ! get data
2866  CALL volgrid_get_vol_2d(this, i, j, k, iu(l), voldatiu)
2867  CALL volgrid_get_vol_2d(this, i, j, k, iv(l), voldativ)
2868 ! convert units forward
2869 ! CALL compute(conv_fwd(iu(l)), voldatiu)
2870 ! CALL compute(conv_fwd(iv(l)), voldativ)
2871 
2872 ! multiply wind components by rotation matrix
2873  WHERE(voldatiu /= rmiss .AND. voldativ /= rmiss)
2874  tmp_arr(:,:) = real(voldatiu(:,:)*rot_mat(:,:,a11) + &
2875  voldativ(:,:)*rot_mat(:,:,a12))
2876  voldativ(:,:) = real(voldatiu(:,:)*rot_mat(:,:,a21) + &
2877  voldativ(:,:)*rot_mat(:,:,a22))
2878  voldatiu(:,:) = tmp_arr(:,:)
2879  END WHERE
2880 ! convert units backward
2881 ! CALL uncompute(conv_fwd(iu(l)), voldatiu)
2882 ! CALL uncompute(conv_fwd(iv(l)), voldativ)
2883 ! put data
2884  CALL volgrid_set_vol_2d(this, i, j, k, iu(l), voldatiu)
2885  CALL volgrid_set_vol_2d(this, i, j, k, iv(l), voldativ)
2886  ENDDO
2887  ENDDO
2888  ENDDO
2889 ENDDO
2890 
2891 IF (.NOT.ASSOCIATED(this%voldati)) THEN
2892  DEALLOCATE(voldatiu, voldativ)
2893 ENDIF
2894 DEALLOCATE(rot_mat, tmp_arr, iu, iv)
2895 
2896 END SUBROUTINE vg6d_wind__un_rot
2897 
2898 
2899 !!$ try to understand the problem:
2900 !!$
2901 !!$ case:
2902 !!$
2903 !!$ 1) we have only one volume: we have to provide the direction of shift
2904 !!$ compute H and traslate on it
2905 !!$ 2) we have two volumes:
2906 !!$ 1) volume U and volume V: compute H and traslate on it
2907 !!$ 2) volume U/V and volume H : translate U/V on H
2908 !!$ 3) we have tree volumes: translate U and V on H
2909 !!$
2910 !!$ strange cases:
2911 !!$ 1) do not have U in volume U
2912 !!$ 2) do not have V in volume V
2913 !!$ 3) we have others variables more than U and V in volumes U e V
2914 !!$
2915 !!$
2916 !!$ so the steps are:
2917 !!$ 1) find the volumes
2918 !!$ 2) define or compute H grid
2919 !!$ 3) trasform the volumes in H
2920 
2921 !!$ N.B.
2922 !!$ case 1) for only one vg6d (U or V) is not managed, but
2923 !!$ the not pubblic subroutines will work but you have to know what you want to do
2924 
2925 
2942 subroutine vg6d_c2a (this)
2943 
2944 TYPE(volgrid6d),INTENT(inout) :: this(:)
2945 
2946 integer :: ngrid,igrid,jgrid,ugrid,vgrid,tgrid
2947 doubleprecision :: xmin, xmax, ymin, ymax
2948 doubleprecision :: xmin_t, xmax_t, ymin_t, ymax_t
2949 doubleprecision :: step_lon_t,step_lat_t
2950 character(len=80) :: type_t,type
2951 TYPE(griddim_def):: griddim_t
2952 
2953 ngrid=size(this)
2954 
2955 do igrid=1,ngrid
2956 
2957  call init(griddim_t)
2958 
2959  call get_val(this(igrid)%griddim,xmin=xmin_t, xmax=xmax_t, ymin=ymin_t, ymax=ymax_t,proj_type=type_t)
2960  step_lon_t=(xmax_t-xmin_t)/dble(this(igrid)%griddim%dim%nx-1)
2961  step_lat_t=(ymax_t-ymin_t)/dble(this(igrid)%griddim%dim%ny-1)
2962 
2963  do jgrid=1,ngrid
2964 
2965  ugrid=imiss
2966  vgrid=imiss
2967  tgrid=imiss
Distruttori per le 2 classi.
Costruttori per le classi datetime e timedelta.

Generated with Doxygen.