@@ -11,7 +11,7 @@ logger = logging.getLogger("pet")
11
11
12
12
13
13
def id_parser ():
14
- parser = EddyParser ('Eddy Identification ' )
14
+ parser = EddyParser ('Eddy Subsetter ' )
15
15
parser .add_argument ('filename' )
16
16
parser .add_argument ('filename_out' )
17
17
@@ -30,11 +30,17 @@ def id_parser():
30
30
metavar = ('llcrnrlon' , 'llcrnrlat' , 'urcrnrlon' , 'urcrnrlat' ),
31
31
help = 'Coordinates of bounding to extract'
32
32
)
33
+ group .add_argument ('--direction' , choices = ['E' , 'W' , 'S' , 'N' ],
34
+ help = 'Select only track which have an end point which go in this direction' )
35
+ group .add_argument ('--minimal_degrees_displacement_in_direction' , type = float ,
36
+ help = 'Minimal displacement in direction specified in --directio options' )
37
+ group .add_argument ('--select_first_observation_in_box' , type = float ,
38
+ help = 'Select only the first obs in each box for each tracks, value specified must be resolution' )
33
39
group .add_argument ('--remove_var' , nargs = '+' , type = str , help = 'remove all listed variable' )
34
40
group .add_argument ('--include_var' , nargs = '+' , type = str , help = 'use only listed variable, remove_var will be ignored' )
35
41
group .add_argument ('-i' , '--ids' , nargs = '+' , type = int , help = 'List of tracks which will be extract' )
36
42
37
- group = parser .add_argument_group ('Extraction options' )
43
+ group = parser .add_argument_group ('General options' )
38
44
group .add_argument ('--sort_time' , action = 'store_true' , help = 'sort all observation with time' )
39
45
40
46
parser .add_argument ('-n' , '--no_raw_mode' , action = 'store_true' ,
@@ -78,6 +84,18 @@ if __name__ == '__main__':
78
84
remove_incomplete = args .remove_incomplete ,
79
85
reject_virtual = args .reject_virtual )
80
86
87
+ # Select only track which go in the direction specified
88
+ if args .direction :
89
+ if args .minimal_degrees_displacement_in_direction :
90
+ dataset = dataset .extract_in_direction (
91
+ args .direction ,
92
+ value = args .minimal_degrees_displacement_in_direction )
93
+ else :
94
+ dataset = dataset .extract_in_direction (args .direction )
95
+
96
+ if args .select_first_observation_in_box :
97
+ dataset = dataset .extract_first_obs_in_box (res = args .select_first_observation_in_box )
98
+
81
99
if args .sort_time :
82
100
logger .debug ('start sorting ...' )
83
101
dataset .obs .sort (order = ['time' , 'lon' , 'lat' ])
0 commit comments