[cdftools] 74/228: JMM modify cdfstdevts.f90 in order to compute Standard deviation instead of variance

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jun 12 08:21:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch master
in repository cdftools.

commit 56fe72ec373d8af7874613227940d7aff908f833
Author: molines <molines at 1055176f-818a-41d9-83e1-73fbe5b947c5>
Date:   Tue Nov 9 18:09:03 2010 +0000

    JMM modify cdfstdevts.f90 in order to compute Standard deviation instead of variance
    
    
    git-svn-id: http://servforge.legi.grenoble-inp.fr/svn/CDFTOOLS/trunk@350 1055176f-818a-41d9-83e1-73fbe5b947c5
---
 cdfstdevts.f90 | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/cdfstdevts.f90 b/cdfstdevts.f90
index c6df4bf..afb3eee 100644
--- a/cdfstdevts.f90
+++ b/cdfstdevts.f90
@@ -4,7 +4,7 @@ PROGRAM cdfstdevts
   !!
   !!  **  Purpose : Compute standard deviation of TS fields
   !!  
-  !!  **  Method  : Try to avoid 3 d arrays 
+  !!  **  Method  : Start from T2 files computed with cdfmoy_sal2_temp2
   !!
   !! history :
   !!     Original : J.M. Molines (nov 2004) for ORCA025
@@ -23,10 +23,10 @@ PROGRAM cdfstdevts
   INTEGER   :: narg, iargc                                  !: 
   INTEGER   :: npiglo,npjglo, npk                                !: size of the domain
   INTEGER, DIMENSION(2) ::  ipk, id_varout
-  REAL(KIND=8) , DIMENSION (:,:), ALLOCATABLE :: u, u2,  rms
+  REAL(KIND=8) , DIMENSION (:,:), ALLOCATABLE :: u, u2,  stdev
   REAL(KIND=4) ,DIMENSION(1)                  :: timean
 
-  CHARACTER(LEN=256) :: cfile ,cfile2 ,cfileout='rmsts.nc'            !: file name
+  CHARACTER(LEN=256) :: cfile ,cfile2 ,cfileout='stdevts.nc'            !: file name
   CHARACTER(LEN=256), DIMENSION(2) :: cvar, cvar2
 
   TYPE(variable), DIMENSION(2)    :: typvar          !: structure for attributes
@@ -38,7 +38,7 @@ PROGRAM cdfstdevts
   narg= iargc()
   IF ( narg /= 2 ) THEN
      PRINT *,' Usage : cdfstdevts ''gridX gridX2'' '
-     PRINT *,'   Output on rmsts.nc variable votemper_rms vosaline_rms'
+     PRINT *,'   Output on stdevts.nc variable votemper_stdev vosaline_stdev'
      STOP
   ENDIF
   !!
@@ -54,24 +54,24 @@ PROGRAM cdfstdevts
   cvar(2)='vosaline'  ; cvar2(2)='vosaline_sqd'
 
   ipk(1) = npk
-  typvar(1)%name= 'votemper_rms'
+  typvar(1)%name= 'votemper_stdev'
   typvar(1)%units='DegC'
   typvar(1)%missing_value=0.
   typvar(1)%valid_min= 0.
   typvar(1)%valid_max= 20.
-  typvar(1)%long_name='RMS_temperature'
-  typvar(1)%short_name='votemper_rms'
+  typvar(1)%long_name='stdev_temperature'
+  typvar(1)%short_name='votemper_stdev'
   typvar(1)%online_operation='N/A'
   typvar(1)%axis='TZYX'
 
   ipk(2) = npk
-  typvar(2)%name= 'vosaline_rms'
+  typvar(2)%name= 'vosaline_stdev'
   typvar(2)%units='PSU'
   typvar(2)%missing_value=0.
   typvar(2)%valid_min= 0.
   typvar(2)%valid_max= 10.
-  typvar(2)%long_name='RMS_salinity'
-  typvar(2)%short_name='vosaline_rms'
+  typvar(2)%long_name='STDEV_salinity'
+  typvar(2)%short_name='vosaline_stdev'
   typvar(2)%online_operation='N/A'
   typvar(2)%axis='TZYX'
 
@@ -82,7 +82,7 @@ PROGRAM cdfstdevts
   PRINT *, 'npk   =', npk
 
   ALLOCATE( u(npiglo,npjglo), u2(npiglo,npjglo) )
-  ALLOCATE( rms(npiglo,npjglo) )
+  ALLOCATE( stdev(npiglo,npjglo) )
 
   ncout =create(cfileout, cfile,npiglo,npjglo,npk)
 
@@ -94,13 +94,13 @@ PROGRAM cdfstdevts
      u(:,:) = getvar(cfile,cvar(jvar),jk, npiglo, npjglo)
      u2(:,:) = getvar(cfile2,cvar2(jvar),jk, npiglo, npjglo)
 
-     rms(:,:) = 0.
+     stdev(:,:) = 0.
      DO ji=2, npiglo
         DO jj=2,npjglo
-           rms(ji,jj)  =  ((u2(ji,jj)-u(ji,jj)*u(ji,jj)))
+           stdev(ji,jj)  =  ((u2(ji,jj)-u(ji,jj)*u(ji,jj)))
         END DO
      END DO
-     ierr=putvar(ncout,id_varout(jvar), real(rms), jk, npiglo, npjglo)
+     ierr=putvar(ncout,id_varout(jvar), sqrt(real(stdev)), jk, npiglo, npjglo)
   END DO
   timean=getvar1d(cfile,'time_counter',1)
   END DO

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cdftools.git



More information about the debian-science-commits mailing list