[cdftools] 160/228: JMM : add option in cdfnan

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jun 12 08:21:43 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 7c072a748feda5c028a99407fbb44d6a155346cc
Author: molines <molines at 1055176f-818a-41d9-83e1-73fbe5b947c5>
Date:   Tue Jul 3 13:29:11 2012 +0000

    JMM : add option in cdfnan
    
    
    git-svn-id: http://servforge.legi.grenoble-inp.fr/svn/CDFTOOLS/trunk@608 1055176f-818a-41d9-83e1-73fbe5b947c5
---
 Macrolib/macro.ifort |  1 +
 Makefile             | 12 ++++++------
 cdfnan.f90           | 15 +++++++++++----
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/Macrolib/macro.ifort b/Macrolib/macro.ifort
index 281cd5e..2ce9422 100644
--- a/Macrolib/macro.ifort
+++ b/Macrolib/macro.ifort
@@ -14,3 +14,4 @@ FFLAGS= -O  $(NCDF) -assume byterecl -convert big_endian -CB -fpe0 -g -traceback
 LMPI=-lmpich
 
 INSTALL=$(HOME)/bin
+INSTALL_MAN=$(HOME)/man
diff --git a/Makefile b/Makefile
index 8133273..a2a8df1 100644
--- a/Makefile
+++ b/Makefile
@@ -42,12 +42,12 @@ all: $(EXEC)
 help:
 	@echo "#-------------------------------------------------"
 	@echo "# List of make targets:"
-	@echo "#  all      : build cdftools binary"
-	@echo "#  man      : build manual"
-	@echo "#  clean    : remove building object (.o, .mod...)"
-	@echo "#  cleanexe : remove binary executable"
-	@echo "#  install  : install binary in INSTALL folder"
-	@echo "#  install  : install manual in INSTALL_MAN folder"
+	@echo "#  all          : build cdftools binary"
+	@echo "#  man          : build manual"
+	@echo "#  clean        : remove building object (.o, .mod...)"
+	@echo "#  cleanexe     : remove binary executable"
+	@echo "#  install      : install binary in INSTALL folder"
+	@echo "#  install_man  : install manual in INSTALL_MAN folder"
 	@echo "#-------------------------------------------------"
 
 ## Statistical programs
diff --git a/cdfnan.f90 b/cdfnan.f90
index e9be2ee..435cb43 100644
--- a/cdfnan.f90
+++ b/cdfnan.f90
@@ -29,6 +29,7 @@ PROGRAM cdfnan
   INTEGER(KIND=4), DIMENSION(:),    ALLOCATABLE :: id_var                 ! arrays of var id
 
   REAL(KIND=4)                                  :: zspval, replace        ! spval, replace value
+  REAL(KIND=4)                                  :: rabsmax                ! spval, replace value
   REAL(KIND=4), DIMENSION(:,:),     ALLOCATABLE :: tab                    ! Arrays for data
 
   CHARACTER(LEN=256)                            :: cldum                  ! dummy string for getarg
@@ -44,7 +45,7 @@ PROGRAM cdfnan
 
   narg= iargc()
   IF ( narg == 0 ) THEN
-     PRINT *,' usage : cdfnan list_of_model_output_files [-value replace] '
+     PRINT *,' usage : cdfnan list_of_model_output_files [-value replace] [-absmax rabsmax ] '
      PRINT *,'      '
      PRINT *,'     PURPOSE :'
      PRINT *,'       Detect NaN values in the input files, and change them to '
@@ -65,6 +66,7 @@ PROGRAM cdfnan
      STOP
   ENDIF
 
+  rabsmax=huge(0.0)
   ijarg=1
   DO WHILE ( ijarg <= narg )
      CALL getarg(ijarg, cldum) ;   ijarg = ijarg + 1
@@ -72,6 +74,9 @@ PROGRAM cdfnan
      CASE ('-value' )
         CALL getarg( ijarg, cldum) ; ijarg = ijarg+1 ; 
         READ(cldum,*) replace ; l_replace=.true.
+     CASE ('-absmax' )
+        CALL getarg( ijarg, cldum) ; ijarg = ijarg+1 ; 
+        READ(cldum,*) rabsmax 
      CASE DEFAULT
         cf_inout=TRIM(cldum)
      END SELECT
@@ -108,12 +113,14 @@ PROGRAM cdfnan
   ijarg = 1
   DO WHILE (ijarg <=  narg ) 
      CALL getarg (ijarg, cf_inout) ; ijarg = ijarg + 1 
-     IF ( chkfile (cf_inout) )  STOP ! missing file
 
      SELECT CASE ( cf_inout)
      CASE ('-value' )
         ! replace already read, just skip
         ijarg = ijarg + 1
+     CASE ('-absmax' )
+        !  already read, just skip
+        ijarg = ijarg + 1
      CASE DEFAULT  ! reading files
         PRINT *, 'Change NaN on file ', cf_inout
         ncid = ncopen(cf_inout)
@@ -142,8 +149,8 @@ PROGRAM cdfnan
                     ! we replace it by the following test that gives the same results
                     ! reference : http://www.unixguide.net/ibm/faq/faq3.03.shtml
                     WHERE( tab(:,:) /=  tab(:,:) ) tab(:,:) = zspval
-                    WHERE( tab(:,:) < -huge(0.0) ) tab(:,:) = zspval
-                    WHERE( tab(:,:) >  huge(0.0) ) tab(:,:) = zspval
+                    WHERE( tab(:,:) < -rabsmax ) tab(:,:) = zspval
+                    WHERE( tab(:,:) >  rabsmax ) tab(:,:) = zspval
                     ierr = putvar(ncid, id_var(jvar), tab, jk, npiglo, npjglo, ktime=jt)
                  ENDDO
               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