annotate psymap_simple.py @ 0:eb1f3666ce17 draft

planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
author climate
date Thu, 25 Apr 2019 18:10:40 -0400
parents
children 322e000d8c48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
1 #!/usr/bin/env python3
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
2 #
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
3 #
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
4 # usage: psymap_simple.py [-h] [--proj PROJ]
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
5 # [--cmap CMAP]
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
6 # [--output OUTPUT]
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
7 # [-v]
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
8 # input varname
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
9 #
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
10 # positional arguments:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
11 # input input filename with geographical coordinates (netCDF
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
12 # format)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
13 # varname Specify which variable to plot (case sensitive)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
14 #
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
15 # optional arguments:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
16 # -h, --help show this help message and exit
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
17 # --proj PROJ Specify the projection on which we draw
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
18 # --cmap CMAP Specify which colormap to use for plotting
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
19 # --output OUTPUT output filename to store resulting image (png format)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
20 # -v, --verbose switch on verbose mode
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
21 #
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
22
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
23 import argparse
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
24 import warnings
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
25 from pathlib import Path
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
26
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
27 import matplotlib as mpl
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
28 mpl.use('Agg')
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
29 from matplotlib import pyplot # noqa: I202,E402
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
30
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
31 import psyplot.project as psy # noqa: I202,E402
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
32
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
33
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
34 class PsyPlot ():
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
35 def __init__(self, input, proj, varname, cmap, output,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
36 verbose=False
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
37 ):
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
38 self.input = input
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
39 self.proj = proj
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
40 self.varname = varname
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
41 self.cmap = cmap
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
42 if output is None:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
43 self.output = Path(input).stem + '.png'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
44 else:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
45 self.output = output
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
46 self.verbose = verbose
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
47 if verbose:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
48 print("input: ", self.input)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
49 print("proj: ", self.proj)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
50 print("varname: ", self.varname)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
51 print("cmap: ", self.cmap)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
52 print("output: ", self.output)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
53
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
54 def plot(self):
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
55 if self.cmap is None and self.proj is None:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
56 print("op1")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
57 psy.plot.mapplot(self.input, name=self.varname,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
58 clabel='{desc}')
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
59 elif self.proj is None or self.proj == '':
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
60 print("op2")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
61 psy.plot.mapplot(self.input, name=self.varname,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
62 cmap=self.cmap, clabel='{desc}')
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
63 elif self.cmap is None or self.cmap == '':
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
64 print("op3")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
65 psy.plot.mapplot(self.input, name=self.varname,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
66 projection=self.proj,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
67 clabel='{desc}')
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
68 else:
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
69 print("op4")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
70 psy.plot.mapplot(self.input, name=self.varname,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
71 cmap=self.cmap,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
72 projection=self.proj,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
73 clabel='{desc}')
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
74
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
75 pyplot.savefig(self.output)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
76
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
77
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
78 def psymap_plot(input, proj, varname, cmap, output, verbose):
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
79 """Generate plot from input filename"""
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
80
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
81 p = PsyPlot(input, proj, varname, cmap, output, verbose)
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
82 p.plot()
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
83
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
84
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
85 if __name__ == '__main__':
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
86 warnings.filterwarnings("ignore")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
87 parser = argparse.ArgumentParser()
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
88 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
89 'input',
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
90 help='input filename with geographical coordinates (netCDF format)'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
91 )
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
92
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
93 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
94 '--proj',
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
95 help='Specify the projection on which we draw'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
96 )
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
97 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
98 'varname',
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
99 help='Specify which variable to plot (case sensitive)'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
100 )
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
101 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
102 '--cmap',
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
103 help='Specify which colormap to use for plotting'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
104 )
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
105 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
106 '--output',
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
107 help='output filename to store resulting image (png format)'
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
108 )
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
109 parser.add_argument(
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
110 "-v", "--verbose",
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
111 help="switch on verbose mode",
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
112 action="store_true")
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
113 args = parser.parse_args()
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
114
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
115 psymap_plot(args.input, args.proj, args.varname, args.cmap,
eb1f3666ce17 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/psy-maps commit c1362af034361b6fb869411f1ea928388f230d72
climate
parents:
diff changeset
116 args.output, args.verbose)