Skip to content

Commit 84c9509

Browse files
committed
add -M MSK-var option in cdfmltmask to allow a specific variable in the mask file
* when -M option is used, the -p [ type ] is overrid.
1 parent 2d81d8b commit 84c9509

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cdfmltmask.f90

+8
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ PROGRAM cdfmltmask
5656
IF ( narg == 0 ) THEN
5757
PRINT *,' usage : cdfmltmask -f IN-file -m MSK-file -v IN-var1,var2,... '
5858
PRINT *,' -p T| U | V | F | W | P [-s _Fillvalue] [-nc4] [-o OUT-file]'
59+
PRINT *,' [ -M MSK-var ]'
5960
PRINT *,' '
6061
PRINT *,' PURPOSE :'
6162
PRINT *,' Multiply IN-var(s) of IN-file by the mask corresponding to the'
@@ -71,6 +72,8 @@ PROGRAM cdfmltmask
7172
PRINT *,' -s _FillValue : specify values for masked areas [0 by default ]'
7273
PRINT *,' -nc4 : output file will be chunked and deflated'
7374
PRINT *,' -o OUT-file : name of output file, instead of <IN-file>_masked'
75+
PRINT *,' -M MSK-var : use MSK-var in the MSK-file, instead of the one defined'
76+
PRINT *,' by default according to the -p option. Overrid -p option.'
7477
PRINT *,' '
7578
PRINT *,' REQUIRED FILES :'
7679
PRINT *,' none, all are given as arguments.'
@@ -85,13 +88,16 @@ PROGRAM cdfmltmask
8588

8689
zspv0 = 0.
8790
ijarg = 1
91+
cv_msk ='none'
8892
DO WHILE (ijarg <= narg)
8993
CALL getarg (ijarg, cldum ) ; ijarg = ijarg + 1
9094
SELECT CASE ( cldum)
9195
CASE ( '-f' )
9296
CALL getarg(ijarg, cf_in ) ; ijarg = ijarg + 1
9397
CASE ( '-m' )
9498
CALL getarg(ijarg, cf_msk) ; ijarg = ijarg + 1
99+
CASE ( '-M' )
100+
CALL getarg(ijarg, cv_msk) ; ijarg = ijarg + 1
95101
CASE ( '-v' )
96102
CALL getarg(ijarg, cldum) ; ijarg = ijarg + 1
97103
CALL ParseVars ( cldum )
@@ -178,6 +184,7 @@ PROGRAM cdfmltmask
178184
ALLOCATE( zv (npiglo,npjglo) )
179185
ALLOCATE(zvmask(npiglo,npjglo) )
180186

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

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

0 commit comments

Comments
 (0)