annotate xarray_info.py @ 4:b393815e4cb7 draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
author ecology
date Sun, 31 Jul 2022 21:20:41 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
1 # xarray tool for:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
2 # - getting metadata information
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
3 # - select data and save results in csv file for further post-processing
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
4
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
5 import argparse
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
6 import csv
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
7 import os
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
8 import warnings
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
9
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
10 import xarray as xr
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
11
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
12
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
13 class XarrayInfo ():
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
14 def __init__(self, infile, outfile_info="", outfile_summary="",
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
15 verbose=False, coords_info=None):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
16 self.infile = infile
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
17 self.outfile_info = outfile_info
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
18 self.outfile_summary = outfile_summary
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
19 self.coords_info = coords_info
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
20 self.verbose = verbose
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
21 # initialization
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
22 self.dset = None
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
23 self.gset = None
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
24 if self.verbose:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
25 print("infile: ", self.infile)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
26 print("outfile_info: ", self.outfile_info)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
27 print("outfile_summary: ", self.outfile_summary)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
28 print("coords_info: ", self.coords_info)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
29
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
30 def info(self):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
31 f = open(self.outfile_info, 'w')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
32 ds = xr.open_dataset(self.infile)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
33 ds.info(f)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
34 f.close()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
35
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
36 def summary(self):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
37 f = open(self.outfile_summary, 'w')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
38 ds = xr.open_dataset(self.infile)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
39 writer = csv.writer(f, delimiter='\t')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
40 header = ['VariableName', 'NumberOfDimensions']
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
41 for idx, val in enumerate(ds.dims.items()):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
42 header.append('Dim' + str(idx) + 'Name')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
43 header.append('Dim' + str(idx) + 'Size')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
44 writer.writerow(header)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
45 for name, da in ds.data_vars.items():
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
46 line = [name]
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
47 line.append(len(ds[name].shape))
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
48 for d, s in zip(da.shape, da.sizes):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
49 line.append(s)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
50 line.append(d)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
51 writer.writerow(line)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
52 for name, da in ds.coords.items():
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
53 line = [name]
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
54 line.append(len(ds[name].shape))
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
55 for d, s in zip(da.shape, da.sizes):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
56 line.append(s)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
57 line.append(d)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
58 writer.writerow(line)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
59 f.close()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
60
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
61 def get_coords_info(self):
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
62 ds = xr.open_dataset(self.infile)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
63 for c in ds.coords:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
64 filename = os.path.join(self.coords_info,
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
65 c.strip() +
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
66 '.tabular')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
67 pd = ds.coords[c].to_pandas()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
68 pd.index = range(len(pd))
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
69 pd.to_csv(filename, header=False, sep='\t')
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
70
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
71
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
72 if __name__ == '__main__':
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
73 warnings.filterwarnings("ignore")
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
74 parser = argparse.ArgumentParser()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
75
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
76 parser.add_argument(
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
77 'infile',
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
78 help='netCDF input filename'
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
79 )
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
80 parser.add_argument(
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
81 '--info',
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
82 help='Output filename where metadata information is stored'
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
83 )
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
84 parser.add_argument(
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
85 '--summary',
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
86 help='Output filename where data summary information is stored'
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
87 )
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
88 parser.add_argument(
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
89 '--coords_info',
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
90 help='output-folder where for each coordinate, coordinate values '
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
91 ' are being printed in the corresponding outputfile'
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
92 )
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
93 parser.add_argument(
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
94 "-v", "--verbose",
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
95 help="switch on verbose mode",
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
96 action="store_true"
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
97 )
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
98 args = parser.parse_args()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
99
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
100 p = XarrayInfo(args.infile, args.info, args.summary,
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
101 args.verbose, args.coords_info)
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
102 if args.info:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
103 p.info()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
104 elif args.coords_info:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
105 p.get_coords_info()
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
106 if args.summary:
b393815e4cb7 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit fd8ad4d97db7b1fd3876ff63e14280474e06fdf7
ecology
parents:
diff changeset
107 p.summary()