[cdftools] 69/228: JMM add cdfinfo as a minimalist tool for retrieving basic informations on files

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jun 12 08:21:30 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 a19794bc84a4755c73f08d88d7d1f49a9ebc0561
Author: molines <molines at 1055176f-818a-41d9-83e1-73fbe5b947c5>
Date:   Tue Sep 21 18:22:40 2010 +0000

    JMM add cdfinfo as a minimalist tool for retrieving basic informations on files
    
    
    git-svn-id: http://servforge.legi.grenoble-inp.fr/svn/CDFTOOLS/trunk@345 1055176f-818a-41d9-83e1-73fbe5b947c5
---
 cdfinfo.f90 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/cdfinfo.f90 b/cdfinfo.f90
new file mode 100644
index 0000000..ea7816c
--- /dev/null
+++ b/cdfinfo.f90
@@ -0,0 +1,89 @@
+PROGRAM cdfinfo
+  !!-----------------------------------------------------------------------
+  !!                 ***  PROGRAM cdfinfo  ***
+  !!
+  !!  **  Purpose: Give very basic informations for Netcdf File
+  !!  
+  !!  **  Method: 
+  !!
+  !! history :
+  !!     Original code :   J.M. Molines (Sep. 2010) 
+  !!-----------------------------------------------------------------------
+  !!  $Rev$
+  !!  $Date$
+  !!  $Id$
+  !!--------------------------------------------------------------
+  !!
+  USE cdfio 
+
+  IMPLICIT NONE
+  INTEGER   :: jk,jt,jvar, jv , jtt,jkk                     !: dummy loop index
+  INTEGER   :: ierr                                         !: working integer
+  INTEGER   :: narg, iargc                                  !: 
+  INTEGER   :: npiglo,npjglo, npk ,nt                       !: size of the domain
+  INTEGER   :: nvars                                        !: Number of variables in a file
+  INTEGER   :: ntframe                                      !: Cumul of time frame
+  INTEGER , DIMENSION(:), ALLOCATABLE :: id_var , &         !: arrays of var id's
+       &                             ipk    , &             !: arrays of vertical level for each var
+       &                             id_varout
+
+  CHARACTER(LEN=256) :: cfile                                !: file name
+  CHARACTER(LEN=256) ::  cdep
+  CHARACTER(LEN=256) ,DIMENSION(:), ALLOCATABLE:: cvarname   !: array of var name
+  TYPE (variable), DIMENSION(:), ALLOCATABLE :: typvar
+  
+  INTEGER    :: istatus
+
+
+  !!  Read command line
+  narg= iargc()
+  IF ( narg == 0 ) THEN
+     PRINT *,' Usage : cdfinfo ''model cdf file'' '
+     STOP
+  ENDIF
+  !!
+  !! Initialisation from 1st file (all file are assume to have the same geometry)
+  CALL getarg (1, cfile)
+
+  npiglo= getdim (cfile,'x')
+  npjglo= getdim (cfile,'y')
+  npk   = getdim (cfile,'depth',cdtrue=cdep, kstatus=istatus)
+
+  IF (istatus /= 0 ) THEN
+     npk   = getdim (cfile,'z',cdtrue=cdep,kstatus=istatus)
+     IF (istatus /= 0 ) THEN
+       npk   = getdim (cfile,'sigma',cdtrue=cdep,kstatus=istatus)
+        IF ( istatus /= 0 ) THEN 
+          npk = getdim (cfile,'nav_lev',cdtrue=cdep,kstatus=istatus)
+            IF ( istatus /= 0 ) THEN 
+              npk = getdim (cfile,'levels',cdtrue=cdep,kstatus=istatus)
+              IF ( istatus /= 0 ) THEN 
+                PRINT *,' assume file with no depth'
+                npk=0
+              ENDIF
+            ENDIF
+        ENDIF
+     ENDIF
+  ENDIF
+  
+
+  PRINT *, 'npiglo =', npiglo
+  PRINT *, 'npjglo =', npjglo
+  PRINT *, 'npk    =', npk
+
+  PRINT *,' Depth dimension name is ', TRIM(cdep)
+
+  nvars = getnvar(cfile)
+  PRINT *,' nvars =', nvars
+
+  ALLOCATE (cvarname(nvars)  )
+  ALLOCATE (typvar(nvars)  )
+
+  ! get list of variable names and collect attributes in typvar (optional)
+  cvarname(:)=getvarname(cfile,nvars,typvar)
+
+  DO jvar = 1, nvars
+   PRINT *, 'variable# ',jvar,' is : ',TRIM(cvarname(jvar))
+  END DO
+
+END PROGRAM cdfinfo

-- 
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