Skip to content

Commit

Permalink
add -M MSK-var option in cdfmltmask to allow a specific variable in t…
Browse files Browse the repository at this point in the history
…he mask file

 * when -M option is used, the -p [ type ] is overrid.
  • Loading branch information
molines committed Nov 10, 2016
1 parent 2d81d8b commit 84c9509
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cdfmltmask.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ PROGRAM cdfmltmask
IF ( narg == 0 ) THEN
PRINT *,' usage : cdfmltmask -f IN-file -m MSK-file -v IN-var1,var2,... '
PRINT *,' -p T| U | V | F | W | P [-s _Fillvalue] [-nc4] [-o OUT-file]'
PRINT *,' [ -M MSK-var ]'
PRINT *,' '
PRINT *,' PURPOSE :'
PRINT *,' Multiply IN-var(s) of IN-file by the mask corresponding to the'
Expand All @@ -71,6 +72,8 @@ PROGRAM cdfmltmask
PRINT *,' -s _FillValue : specify values for masked areas [0 by default ]'
PRINT *,' -nc4 : output file will be chunked and deflated'
PRINT *,' -o OUT-file : name of output file, instead of <IN-file>_masked'
PRINT *,' -M MSK-var : use MSK-var in the MSK-file, instead of the one defined'
PRINT *,' by default according to the -p option. Overrid -p option.'
PRINT *,' '
PRINT *,' REQUIRED FILES :'
PRINT *,' none, all are given as arguments.'
Expand All @@ -85,13 +88,16 @@ PROGRAM cdfmltmask

zspv0 = 0.
ijarg = 1
cv_msk ='none'
DO WHILE (ijarg <= narg)
CALL getarg (ijarg, cldum ) ; ijarg = ijarg + 1
SELECT CASE ( cldum)
CASE ( '-f' )
CALL getarg(ijarg, cf_in ) ; ijarg = ijarg + 1
CASE ( '-m' )
CALL getarg(ijarg, cf_msk) ; ijarg = ijarg + 1
CASE ( '-M' )
CALL getarg(ijarg, cv_msk) ; ijarg = ijarg + 1
CASE ( '-v' )
CALL getarg(ijarg, cldum) ; ijarg = ijarg + 1
CALL ParseVars ( cldum )
Expand Down Expand Up @@ -178,6 +184,7 @@ PROGRAM cdfmltmask
ALLOCATE( zv (npiglo,npjglo) )
ALLOCATE(zvmask(npiglo,npjglo) )

IF ( cv_msk == 'none' ) THEN ! means cv_msk was not defined by -M option
SELECT CASE (TRIM(cvartype))
CASE ( 'T' )
cv_msk='tmask'
Expand All @@ -195,6 +202,7 @@ PROGRAM cdfmltmask
PRINT *, 'this type of variable is not known :', TRIM(cvartype)
STOP
END SELECT
ENDIF

IF ( npkmask <= 1 ) THEN
zmask(:,:) = getvar(cf_msk, cv_msk, 1, npiglo, npjglo)
Expand Down

0 comments on commit 84c9509

Please sign in to comment.