|
◆ vg6d_c2a()
subroutine, public volgrid6d_class::vg6d_c2a |
( |
type(volgrid6d), dimension(:), intent(inout) |
this | ) |
|
Convert grids type C to type A.
Use this to interpolate data from grid type C to grid type A Grids type are defined by Arakawa.
We need to find these types of area in a vg6d array T area of points with temterature etc. U area of points with u components of winds V area of points with v components of winds
this method works if it finds two volumes: 1) volume U and volume V: compute H and traslate on it 2) volume U/V and volume H : translate U/V on H three volumes: translate U and V on H
try to work well on more datasets at once - Parametri
-
[in,out] | this | vettor of volumes volgrid6d to elaborate |
Definizione alla linea 3146 del file volgrid6d_class.F90.
3147 step_lat=(ymax-ymin)/dble(this%griddim%dim%ny-1)
3148 ymin=ymin-step_lat/2.d0
3149 ymax=ymax-step_lat/2.d0
3150 call set_val(this%griddim, ymin=ymin, ymax=ymax)
3152 CALL griddim_setsteps(this%griddim)
3156 call l4f_category_log(this%category,l4f_fatal, "C grid type not known")
3157 call raise_fatal_error ()
3164 call griddim_unproj(this%griddim)
3167 end subroutine vg6d_c2a_grid
3170 subroutine vg6d_c2a_mat(this,cgrid)
3172 type(volgrid6d), intent(inout) :: this
3173 integer, intent(in) :: cgrid
3175 INTEGER :: i, j, k, iv, stallo
3176 REAL, ALLOCATABLE :: tmp_arr(:,:)
3177 REAL, POINTER :: voldatiuv(:,:)
3180 IF (cgrid == 0) RETURN
3181 IF (cgrid /= 1 .AND. cgrid /= 2) THEN
3182 CALL l4f_category_log(this%category,l4f_fatal, "C grid type "// &
3183 trim(to_char(cgrid))// " not known")
3189 ALLOCATE(tmp_arr(this%griddim%dim%nx, this%griddim%dim%ny),stat=stallo)
3191 call l4f_log(l4f_fatal, "allocating memory")
3192 call raise_fatal_error()
3196 IF (.NOT. ASSOCIATED(this%voldati)) THEN
3197 ALLOCATE(voldatiuv(this%griddim%dim%nx, this%griddim%dim%ny), stat=stallo)
3198 IF (stallo /= 0) THEN
3199 CALL l4f_log(l4f_fatal, "allocating memory")
3200 CALL raise_fatal_error()
3204 IF (cgrid == 1) THEN
3205 DO iv = 1, SIZE(this%var)
3206 DO k = 1, SIZE(this%timerange)
3207 DO j = 1, SIZE(this%time)
3208 DO i = 1, SIZE(this%level)
3209 tmp_arr(:,:) = rmiss
3210 CALL volgrid_get_vol_2d(this, i, j, k, iv, voldatiuv)
3213 WHERE(voldatiuv(1,:) /= rmiss .AND. voldatiuv(2,:) /= rmiss)
3214 tmp_arr(1,:) = voldatiuv(1,:) - (voldatiuv(2,:) - voldatiuv(1,:)) / 2.
3218 WHERE(voldatiuv(1:this%griddim%dim%nx-1,:) /= rmiss .AND. &
3219 voldatiuv(2:this%griddim%dim%nx,:) /= rmiss)
3220 tmp_arr(2:this%griddim%dim%nx,:) = &
3221 (voldatiuv(1:this%griddim%dim%nx-1,:) + &
3222 voldatiuv(2:this%griddim%dim%nx,:)) / 2.
3225 voldatiuv(:,:) = tmp_arr
3226 CALL volgrid_set_vol_2d(this, i, j, k, iv, voldatiuv)
3232 ELSE IF (cgrid == 2) THEN
3233 DO iv = 1, SIZE(this%var)
3234 DO k = 1, SIZE(this%timerange)
3235 DO j = 1, SIZE(this%time)
3236 DO i = 1, SIZE(this%level)
3237 tmp_arr(:,:) = rmiss
3238 CALL volgrid_get_vol_2d(this, i, j, k, iv, voldatiuv)
3241 WHERE(voldatiuv(:,1) /= rmiss .AND. voldatiuv(:,2) /= rmiss)
3242 tmp_arr(:,1) = voldatiuv(:,1) - (voldatiuv(:,2) - voldatiuv(:,1)) / 2.
3246 WHERE(voldatiuv(:,1:this%griddim%dim%ny-1) /= rmiss .AND. &
3247 voldatiuv(:,2:this%griddim%dim%ny) /= rmiss)
3248 tmp_arr(:,2:this%griddim%dim%ny) = &
3249 (voldatiuv(:,1:this%griddim%dim%ny-1) + &
3250 voldatiuv(:,2:this%griddim%dim%ny)) / 2.
3253 voldatiuv(:,:) = tmp_arr
3254 CALL volgrid_set_vol_2d(this, i, j, k, iv, voldatiuv)
3261 IF (.NOT. ASSOCIATED(this%voldati)) THEN
3262 DEALLOCATE(voldatiuv)
3264 DEALLOCATE (tmp_arr)
3266 end subroutine vg6d_c2a_mat
|