Grdmask is not working as expected in masking exact grid region

I’m using grdmask (in pygmt) for a Gridded data (text file) to mask the exact grid coverage which is irregular in shape. Code is given below

!gmt grdmask abc.txt -Rxx/XX/yy/YY -I0.1m/0.1m -NNaN/0/1 -S30k -Gmask.grd

where xx, XX, yy, YY are min, max longitudes and latitudes respectively of my pygmt figure region

One thing to mention is the text file grid data has two sized grids (0.2 and 0.4 degrees) for selective regions.

But the output I’m getting is a rectangular mask.