Index: palm/trunk/SOURCE/calc_spectra.f90
===================================================================
--- palm/trunk/SOURCE/calc_spectra.f90	(revision 1319)
+++ palm/trunk/SOURCE/calc_spectra.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,29 +46,4 @@
 ! 1003 2012-09-14 14:35:53Z raasch
 ! adjustment of array tend for cases with unequal subdomain sizes removed
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng for allocation
-! of tend
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine
-!
-! 225 2009-01-26 14:44:20Z raasch
-! Bugfix: array d is reallocated in case that multigrid is used
-!
-! 192 2008-08-27 16:51:49Z letzel
-! bugfix in calc_spectra_x: exponent = 1.0 / ( ny + 1.0 )
-! allow 100 spectra levels instead of 10 for consistency with
-! define_netcdf_header
-! user-defined spectra, arguments removed from transpose routines
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.9  2006/04/11 14:56:00  raasch
-! pl_spectra renamed data_output_sp
 !
 ! Revision 1.1  2001/01/05 15:08:07  raasch
@@ -81,15 +61,31 @@
 
 #if defined( __spectra )
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE fft_xy
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, tend
+
+    USE control_parameters,                                                    &
+        ONLY:  average_count_sp, bc_lr_cyc, bc_ns_cyc, message_string, psolver
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_init
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, nzt_x, nzt_yd
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
+
+    USE spectrum,                                                              &
+        ONLY:  data_output_sp, spectra_direction
+
 
     IMPLICIT NONE
 
-    INTEGER ::  m, pr
+    INTEGER(iwp) ::  m  !:
+    INTEGER(iwp) ::  pr !:
 
 
@@ -163,5 +159,5 @@
           CALL calc_spectra_y( d, pr, m )
 #else
-          message_string = 'sorry, calculation of spectra in non parallel' // &
+          message_string = 'sorry, calculation of spectra in non parallel' //  &
                            'mode& is still not realized'
           CALL message( 'calc_spectra', 'PA0161', 1, 2, 0, 6, 0 )
@@ -189,13 +185,28 @@
  SUBROUTINE preprocess_spectra( m, pr )
 
-    USE arrays_3d
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, pt, q, u, v, w
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  data_output_sp
+
+    USE statistics,                                                            &
+        ONLY:  sums
+
 
     IMPLICIT NONE
 
-    INTEGER :: i, j, k, m, pr
+    INTEGER(iwp) :: i  !:
+    INTEGER(iwp) :: j  !:
+    INTEGER(iwp) :: k  !:
+    INTEGER(iwp) :: m  !:
+    INTEGER(iwp) :: pr !:
 
     SELECT CASE ( TRIM( data_output_sp(m) ) )
@@ -247,25 +258,52 @@
  SUBROUTINE calc_spectra_x( ddd, pr, m )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE fft_xy
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  
+
+    USE control_parameters,                                                    &
+        ONLY:  fft_method
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_x_1d
+
+    USE grid_variables,                                                        &
+        ONLY:  dx
+
+    USE indices,                                                               &
+        ONLY:  nx, ny, nyn_x, nys_x, nzb_x, nzt_x
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, n_sp_x
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_x
+
     USE transpose_indices
 
+
     IMPLICIT NONE
 
-    INTEGER                    ::  i, ishape(1), j, k, m, n, pr
-
-    REAL                       ::  fac, exponent
-    REAL, DIMENSION(0:nx)      ::  work
-    REAL, DIMENSION(0:nx/2)    ::  sums_spectra_l
-    REAL, DIMENSION(0:nx/2,100)::  sums_spectra
-
-    REAL, DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::  ddd
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  ishape(1) !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  k         !:
+    INTEGER(iwp) ::  m         !:
+    INTEGER(iwp) ::  n         !:
+    INTEGER(iwp) ::  pr        !:
+
+    REAL(wp) ::  fac      !:
+    REAL(wp) ::  exponent !:
+    
+    REAL(wp), DIMENSION(0:nx) ::  work !:
+    
+    REAL(wp), DIMENSION(0:nx/2) ::  sums_spectra_l !:
+    
+    REAL(wp), DIMENSION(0:nx/2,100) ::  sums_spectra !:
+    
+    REAL(wp), DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::  ddd !:
 
 !
@@ -320,5 +358,5 @@
 #if defined( __parallel )   
        CALL MPI_BARRIER( comm2d, ierr )  ! Necessary?
-       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), nx/2+1, &
+       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), nx/2+1,          &
                         MPI_REAL, MPI_PROD, 0, comm2d, ierr )
 #else
@@ -357,25 +395,52 @@
  SUBROUTINE calc_spectra_y( ddd, pr, m )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE fft_xy
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  
+
+    USE control_parameters,                                                    &
+        ONLY:  fft_method
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_y_1d
+
+    USE grid_variables,                                                        &
+        ONLY:  dy
+
+    USE indices,                                                               &
+        ONLY:  nx, ny, nxl_yd, nxr_yd, nzb_yd, nzt_yd
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, n_sp_y
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_y
+
     USE transpose_indices
 
+
     IMPLICIT NONE
 
-    INTEGER :: i, j, jshape(1), k, m, n, pr
-
-    REAL                       ::  fac, exponent
-    REAL, DIMENSION(0:ny)      ::  work
-    REAL, DIMENSION(0:ny/2)    ::  sums_spectra_l
-    REAL, DIMENSION(0:ny/2,100)::  sums_spectra
-
-    REAL, DIMENSION(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) :: ddd
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  jshape(1) !:
+    INTEGER(iwp) ::  k         !:
+    INTEGER(iwp) ::  m         !:
+    INTEGER(iwp) ::  n         !:
+    INTEGER(iwp) ::  pr        !:
+
+    REAL(wp) ::  fac      !:
+    REAL(wp) ::  exponent !:
+    
+    REAL(wp), DIMENSION(0:ny) ::  work !:
+    
+    REAL(wp), DIMENSION(0:ny/2) ::  sums_spectra_l !:
+    
+    REAL(wp), DIMENSION(0:ny/2,100) ::  sums_spectra !:
+    
+    REAL(wp), DIMENSION(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) :: ddd !:
 
 
@@ -431,5 +496,5 @@
 #if defined( __parallel )   
        CALL MPI_BARRIER( comm2d, ierr )  ! Necessary?
-       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), ny/2+1, &
+       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), ny/2+1,          &
                         MPI_REAL, MPI_PROD, 0, comm2d, ierr )
 #else
