Changeset 3910


Ignore:
Timestamp:
Apr 17, 2019 11:46:56 AM (5 years ago)
Author:
suehring
Message:

Bugfix in rotation of UTM coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/virtual_measurement_mod.f90

    r3904 r3910  
    2525! -----------------
    2626! $Id$
     27! Bugfix in rotation of UTM coordinates
     28!
     29! 3904 2019-04-16 18:22:51Z gronemeier
    2730! Rotate coordinates of stations by given rotation_angle
    2831!
     
    465468    REAL(wp)     ::  fill_zag  !< _FillValue for height coordinate
    466469   
    467     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  e_utm !< easting UTM coordinate, temporary variable
    468     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  n_utm !< northing UTM coordinate, temporary variable,
    469     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  z_ag  !< height coordinate relative to origin_z, temporary variable
     470    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  e_utm     !< easting UTM coordinate, temporary variable
     471    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  n_utm     !< northing UTM coordinate, temporary variable
     472    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  e_utm_tmp !< EUTM coordinate before rotation
     473    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  n_utm_tmp !< NUTM coordinate before rotation
     474    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  z_ag      !< height coordinate relative to origin_z, temporary variable
    470475!
    471476!-- Obtain number of sites. Also, pass the 'open' string, in order to initially
     
    474479                                vmea_general%id_vm, input_file_vm,             &
    475480                                global_attribute, 'open', '' )
    476                                
    477481!
    478482!-- Allocate data structure which encompass all required information, such as
     
    589593          ENDIF
    590594       ENDDO
     595       
     596       
    591597!
    592598!--    Allocate array for the measured variables names for the respective site.
     
    658664          ALLOCATE( n_utm(1:vmea(l)%ntraj,1:dim_ntime) )
    659665          ALLOCATE( z_ag(1:vmea(l)%ntraj,1:dim_ntime)  )
     666         
     667          ALLOCATE( e_utm_tmp(1:vmea(l)%ntraj,1:dim_ntime) )
     668          ALLOCATE( n_utm_tmp(1:vmea(l)%ntraj,1:dim_ntime) )
    660669!
    661670!--       Read _FillValue attributes of the coordinate dimensions.
     
    704713!--          between UTM coordinates. Note, if the origin is not correct, the
    705714!--          virtual sites will be misplaced.
    706              e_utm(t,1:dim_ntime) = e_utm(t,1:dim_ntime) - init_model%origin_x
    707              n_utm(t,1:dim_ntime) = n_utm(t,1:dim_ntime) - init_model%origin_y
     715             e_utm_tmp(t,1:dim_ntime) = e_utm(t,1:dim_ntime) - init_model%origin_x
     716             n_utm_tmp(t,1:dim_ntime) = n_utm(t,1:dim_ntime) - init_model%origin_y
    708717             e_utm(t,1:dim_ntime) = COS( init_model%rotation_angle * pi / 180.0_wp ) &
    709                                     * e_utm(t,1:dim_ntime)                           &
     718                                    * e_utm_tmp(t,1:dim_ntime)                       &
    710719                                  - SIN( init_model%rotation_angle * pi / 180.0_wp ) &
    711                                     * n_utm(t,1:dim_ntime)
     720                                    * n_utm_tmp(t,1:dim_ntime)
    712721             n_utm(t,1:dim_ntime) = SIN( init_model%rotation_angle * pi / 180.0_wp ) &
    713                                     * e_utm(t,1:dim_ntime)                           &
     722                                    * e_utm_tmp(t,1:dim_ntime)                       &
    714723                                  + COS( init_model%rotation_angle * pi / 180.0_wp ) &
    715                                     * n_utm(t,1:dim_ntime)
     724                                    * n_utm_tmp(t,1:dim_ntime)
    716725!
    717726!--          Determine the individual time coordinate length for each station and
     
    791800          ALLOCATE( vmea(l)%j(1:vmea(l)%ns) )
    792801          ALLOCATE( vmea(l)%k(1:vmea(l)%ns) )
    793           ALLOCATE( vmea(l)%z_ag(1:vmea(l)%ns) )         
     802          ALLOCATE( vmea(l)%z_ag(1:vmea(l)%ns) )     
    794803!
    795804!--       Based on the flag array store the grid indices which correspond to
     
    889898!
    890899!--       Deallocate temporary coordinate arrays
    891           IF ( ALLOCATED( e_utm ) )  DEALLOCATE( e_utm )
    892           IF ( ALLOCATED( n_utm ) )  DEALLOCATE( n_utm )
    893           IF ( ALLOCATED( z_ag  ) )  DEALLOCATE( z_ag  )
    894           IF ( ALLOCATED( z_ag  ) )  DEALLOCATE( vmea(l)%dim_t )
     900          IF ( ALLOCATED( e_utm )     )  DEALLOCATE( e_utm )
     901          IF ( ALLOCATED( n_utm )     )  DEALLOCATE( n_utm )
     902          IF ( ALLOCATED( e_utm_tmp ) )  DEALLOCATE( e_utm_tmp )
     903          IF ( ALLOCATED( n_utm_tmp ) )  DEALLOCATE( n_utm_tmp )
     904          IF ( ALLOCATED( n_utm )     )  DEALLOCATE( n_utm )
     905          IF ( ALLOCATED( z_ag  )     )  DEALLOCATE( z_ag  )
     906          IF ( ALLOCATED( z_ag  )     )  DEALLOCATE( vmea(l)%dim_t )
    895907       ENDIF
    896908    ENDDO
Note: See TracChangeset for help on using the changeset viewer.