-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclip.py
More file actions
executable file
·25 lines (19 loc) · 788 Bytes
/
Copy pathclip.py
File metadata and controls
executable file
·25 lines (19 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3
import click
import numpy as np
import numpy.ma as ma
import rasterio
import projections.raster_utils as ru
@click.command()
@click.argument('infile', type=click.Path(dir_okay=False))
@click.argument('outfile', type=click.Path(dir_okay=False))
@click.option('--min', 'a_min', type=float, default=None,
help='Min value to clip to (default: unbounded)')
@click.option('--max', 'a_max', type=float, default=None,
help='Max value to clip to (default: unbounded)')
@click.option('--mask', is_flag=True, default=False,
help='Mask (insted of clip) pixels outside the bounds')
def clip(infile, outfile, a_min=None, a_max=None, mask=False):
ru.clip(infile, outfile, a_min, a_max, mask)
if __name__ == '__main__':
clip()