|
◆ 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 3194 del file volgrid6d_class.F90.
3195 step_lat=(ymax-ymin)/dble(this%griddim%dim%ny-1)
3196 ymin=ymin-step_lat/2.d0
3197 ymax=ymax-step_lat/2.d0
3198 call set_val(this%griddim, ymin=ymin, ymax=ymax)
3200 CALL griddim_setsteps(this%griddim)
3204 call l4f_category_log(this%category,l4f_fatal, "C grid type not known")
3205 call raise_fatal_error ()
3212 call griddim_unproj(this%griddim)
3215 end subroutine vg6d_c2a_grid
3218 subroutine vg6d_c2a_mat(this,cgrid)
3220 type(volgrid6d), intent(inout) :: this
3221 integer, intent(in) :: cgrid
3223 INTEGER :: i, j, k, iv, stallo
3224 REAL, ALLOCATABLE :: tmp_arr(:,:)
3225 REAL, POINTER :: voldatiuv(:,:)
3228 IF (cgrid == 0) RETURN
3229 IF (cgrid /= 1 .AND. cgrid /= 2) THEN
3230 CALL l4f_category_log(this%category,l4f_fatal, "C grid type "// &
3231 trim(to_char(cgrid))// " not known")
3237 ALLOCATE(tmp_arr(this%griddim%dim%nx, this%griddim%dim%ny),stat=stallo)
3239 call l4f_log(l4f_fatal, "allocating memory")
3240 call raise_fatal_error()
3244 IF (.NOT. ASSOCIATED(this%voldati)) THEN
3245 ALLOCATE(voldatiuv(this%griddim%dim%nx, this%griddim%dim%ny), stat=stallo)
3246 IF (stallo /= 0) THEN
3247 CALL l4f_log(l4f_fatal, "allocating memory")
3248 CALL raise_fatal_error()
3252 IF (cgrid == 1) THEN
3253 DO iv = 1, SIZE(this%var)
3254 DO k = 1, SIZE(this%timerange)
3255 DO j = 1, SIZE(this%time)
3256 DO i = 1, SIZE(this%level)
3257 tmp_arr(:,:) = rmiss
3258 CALL volgrid_get_vol_2d(this, i, j, k, iv, voldatiuv)
3261 WHERE(voldatiuv(1,:) /= rmiss .AND. voldatiuv(2,:) /= rmiss)
3262 tmp_arr(1,:) = voldatiuv(1,:) - (voldatiuv(2,:) - voldatiuv(1,:)) / 2.
3266 WHERE(voldatiuv(1:this%griddim%dim%nx-1,:) /= rmiss .AND. &
3267 voldatiuv(2:this%griddim%dim%nx,:) /= rmiss)
3268 tmp_arr(2:this%griddim%dim%nx,:) = &
3269 (voldatiuv(1:this%griddim%dim%nx-1,:) + &
3270 voldatiuv(2:this%griddim%dim%nx,:)) / 2.
3273 voldatiuv(:,:) = tmp_arr
3274 CALL volgrid_set_vol_2d(this, i, j, k, iv, voldatiuv)
3280 ELSE IF (cgrid == 2) THEN
3281 DO iv = 1, SIZE(this%var)
3282 DO k = 1, SIZE(this%timerange)
3283 DO j = 1, SIZE(this%time)
3284 DO i = 1, SIZE(this%level)
3285 tmp_arr(:,:) = rmiss
3286 CALL volgrid_get_vol_2d(this, i, j, k, iv, voldatiuv)
3289 WHERE(voldatiuv(:,1) /= rmiss .AND. voldatiuv(:,2) /= rmiss)
3290 tmp_arr(:,1) = voldatiuv(:,1) - (voldatiuv(:,2) - voldatiuv(:,1)) / 2.
3294 WHERE(voldatiuv(:,1:this%griddim%dim%ny-1) /= rmiss .AND. &
3295 voldatiuv(:,2:this%griddim%dim%ny) /= rmiss)
3296 tmp_arr(:,2:this%griddim%dim%ny) = &
3297 (voldatiuv(:,1:this%griddim%dim%ny-1) + &
3298 voldatiuv(:,2:this%griddim%dim%ny)) / 2.
3301 voldatiuv(:,:) = tmp_arr
3302 CALL volgrid_set_vol_2d(this, i, j, k, iv, voldatiuv)
3309 IF (.NOT. ASSOCIATED(this%voldati)) THEN
3310 DEALLOCATE(voldatiuv)
3312 DEALLOCATE (tmp_arr)
3314 end subroutine vg6d_c2a_mat
|