-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
did I/ should I invert the HLS mask #502
Comments
The "1" value in the mask means "this pixel has clouds": Line 221 in 15d1577
I'm pretty sure that's by design, though I can't remember the specifics. Edit: hey github permalinks to code render pretty good |
Hey thanks Tom. I see that and it makes sense in a way, but I'm just wondering for the purposes of using |
So, the reason for it being |
Thanks Ian, so I might be doing something double bass-ackwards as my grandad used to say. But, when I invoked On top of that, when I tweaked the cloud mask product in the driver such that the 0s and 1s are reversed, then run gips_mask using that mask, I get a good result in that I see land instead of clouds. |
Yeah. To apply a gips I thought there used to be a diff --git a/gips/scripts/mask.py b/gips/scripts/mask.py
index 27a94b0..027a3cc 100644
--- a/gips/scripts/mask.py
+++ b/gips/scripts/mask.py
@@ -39,6 +39,7 @@ def main():
group = parser.add_argument_group('masking options')
group.add_argument('--filemask', help='Mask all files with this static mask', default=None)
group.add_argument('--pmask', help='Mask files with this corresponding product', nargs='*', default=[])
+ group.add_argument('--invert', help='Invert the masks from corresponding products', nargs='*', default=[])
h = 'Write mask to original image instead of creating new image'
group.add_argument('--original', help=h, default=False, action='store_true')
h = 'Overwrite existing files when creating new'
@@ -76,7 +77,11 @@ def main():
img.AddMask(mask_file[0])
meta = basename(args.filemask) + ' '
for mask in available_masks:
- img.AddMask(inv[date].open(mask)[0])
+ mask_img = inv[date].open(mask)[0]
+ if mask in args.invert:
+ mask_img = mask_img.BXOR(1)
+ meta += 'inverted-'
+ img.AddMask(mask_img)
meta = meta + basename(inv[date][mask]) + ' '
if meta != '':
if args.original: |
If you want to submit a PR implementing that @bhbraswell, let me know if you'd like some help figuring out how to write a system test for it. |
I am wondering if the hls mask is inverted from the others (e.g. landsat). Such that when I apply the mask, I get something like the attached that leaves the clouds, and eliminates the good stuff. Alternatively is there a switch I can use to flip the mask so that the 1s are the good stuff?
Or possibly I breathed too many fumes on my morning commute. I think it's likely I'm missing something.
Any input on this appreciated. Thanks as always -- Rob
The text was updated successfully, but these errors were encountered: