@@ -12,23 +12,29 @@ def id_parser():
12
12
parser = EddyParser ('Eddy Identification' )
13
13
parser .add_argument ('filename' )
14
14
parser .add_argument ('filename_out' )
15
- parser .add_argument ('-p' , '--period' , nargs = 2 , type = int ,
16
- help = 'Start day and end day, if it s negative value we will add to day min and add to day max, if 0 it s not use' )
17
- parser .add_argument ('-l' , '--length' , nargs = 2 , type = int ,
18
- help = 'Minimal and maximal quantity of observation for one track, ones bounds could be negative, it will be not use' )
19
- parser .add_argument ('-f' , '--full_path' , action = 'store_true' ,
20
- help = 'Extract path, if one obs or more are selected' )
21
- parser .add_argument ('-d' , '--remove_incomplete' , action = 'store_true' ,
22
- help = 'Extract path only if all obs are selected' )
23
- parser .add_argument ('--reject_virtual' , action = 'store_true' ,
24
- help = "If there are only virtual observation in selection, we don't select track" )
25
- parser .add_argument ('-a' , '--area' , nargs = 4 , type = float ,
26
- metavar = ('llcrnrlon' , 'llcrnrlat' , 'urcrnrlon' , 'urcrnrlat' ),
27
- help = 'Coordinates of bounding to extract'
28
- )
29
- parser .add_argument ('--remove_var' , nargs = '+' , type = str , help = 'remove all listed variable' )
30
- parser .add_argument ('--include_var' , nargs = '+' , type = str , help = 'use only listed variable, remove_var will be ignored' )
31
- parser .add_argument ('-i' , '--ids' , nargs = '+' , type = int , help = 'List of tracks which will be extract' )
15
+
16
+ group = parser .add_argument_group ('Extraction options' )
17
+ group .add_argument ('-p' , '--period' , nargs = 2 , type = int ,
18
+ help = 'Start day and end day, if it s negative value we will add to day min and add to day max, if 0 it s not use' )
19
+ group .add_argument ('-l' , '--length' , nargs = 2 , type = int ,
20
+ help = 'Minimal and maximal quantity of observation for one track, ones bounds could be negative, it will be not use' )
21
+ group .add_argument ('-f' , '--full_path' , action = 'store_true' ,
22
+ help = 'Extract path, if one obs or more are selected' )
23
+ group .add_argument ('-d' , '--remove_incomplete' , action = 'store_true' ,
24
+ help = 'Extract path only if all obs are selected' )
25
+ group .add_argument ('--reject_virtual' , action = 'store_true' ,
26
+ help = "If there are only virtual observation in selection, we don't select track" )
27
+ group .add_argument ('-a' , '--area' , nargs = 4 , type = float ,
28
+ metavar = ('llcrnrlon' , 'llcrnrlat' , 'urcrnrlon' , 'urcrnrlat' ),
29
+ help = 'Coordinates of bounding to extract'
30
+ )
31
+ group .add_argument ('--remove_var' , nargs = '+' , type = str , help = 'remove all listed variable' )
32
+ group .add_argument ('--include_var' , nargs = '+' , type = str , help = 'use only listed variable, remove_var will be ignored' )
33
+ group .add_argument ('-i' , '--ids' , nargs = '+' , type = int , help = 'List of tracks which will be extract' )
34
+
35
+ group = parser .add_argument_group ('Extraction options' )
36
+ group .add_argument ('--sort_time' , action = 'store_true' , help = 'sort all observation with time' )
37
+
32
38
parser .add_argument ('-n' , '--no_raw_mode' , action = 'store_true' ,
33
39
help = 'Uncompress all data, could be create a memory error for huge file, but is safer for extern file of py eddy tracker' )
34
40
return parser
@@ -38,7 +44,7 @@ if __name__ == '__main__':
38
44
args = id_parser ().parse_args ()
39
45
40
46
# Original dataset
41
- dataset = TrackEddiesObservations .load_from_netcdf (
47
+ dataset = TrackEddiesObservations .load_file (
42
48
args .filename ,
43
49
raw_data = False if args .no_raw_mode else True ,
44
50
remove_vars = args .remove_var ,
@@ -70,6 +76,11 @@ if __name__ == '__main__':
70
76
remove_incomplete = args .remove_incomplete ,
71
77
reject_virtual = args .reject_virtual )
72
78
79
+ if args .sort_time :
80
+ logging .debug ('start sorting ...' )
81
+ dataset .obs .sort (order = ['time' , 'lon' , 'lat' ])
82
+ logging .debug ('end sorting' )
83
+
73
84
# if no data, no output will be written
74
85
if len (dataset ) == 0 :
75
86
logging .warning ("No data are selected, out file couldn't be create" )
0 commit comments