This repository was archived by the owner on Aug 11, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplot-goes.py
More file actions
executable file
·45 lines (32 loc) · 1.25 KB
/
Copy pathplot-goes.py
File metadata and controls
executable file
·45 lines (32 loc) · 1.25 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
"""
Hi-res data
./plot-goes.py -d 8 ~/data/goes/goes13.2017.233.080017.BAND_02.nc
preview .jpg data
./plot-goes.py ~/data/goes13/goes13-IR-2017-07-13-15.jpg
"""
from pathlib import Path
from matplotlib.pyplot import show # draw, pause,
from argparse import ArgumentParser
import goesplot as gq
from goesplot.plots import plotgoes
def main():
p = ArgumentParser()
p.add_argument("datadir", help="directory of GOES image data to read")
p.add_argument("pat", help="file glob pattern preview:*.jpg hires:*.nc", nargs="?", default=["*.jpg", "*.nc"])
p.add_argument("-d", "--downsample", help="downsample factor", type=int, default=8)
p.add_argument("-wld", help=".wld path")
p.add_argument("-v", "--verbose", action="store_true")
p = p.parse_args()
datadir = Path(p.datadir).expanduser()
flist = [datadir] if datadir.is_file() else [sorted(datadir.glob(pat)) for pat in p.pat]
if len(flist) == 0:
raise FileNotFoundError(f"No {p.pat} files found in {datadir}")
if len(flist) > 1:
print(f"{len(flist)} files found in {datadir}")
for fn in flist:
img = gq.load(fn, p.downsample, p.wld)
plotgoes(img, p.verbose)
show()
if __name__ == "__main__":
main()