@@ -57,6 +57,37 @@ def merge_eddies():
5757 obs .write_file (filename = args .out )
5858
5959
60+ def get_frequency_grid ():
61+ parser = EddyParser ("Compute eddy frequency" )
62+ parser .add_argument ("observations" , help = "Input observations to compute frequency" )
63+ parser .add_argument ("out" , help = "Grid output file" )
64+ parser .add_argument (
65+ "--intern" ,
66+ help = "Use speed contour instead of effective contour" ,
67+ action = "store_true" ,
68+ )
69+ parser .add_argument (
70+ "--xrange" , nargs = "+" , type = float , help = "Horizontal range : START,STOP,STEP"
71+ )
72+ parser .add_argument (
73+ "--yrange" , nargs = "+" , type = float , help = "Vertical range : START,STOP,STEP"
74+ )
75+ args = parser .parse_args ()
76+
77+ if (args .xrange is None or len (args .xrange ) not in (3 ,)) or (
78+ args .yrange is None or len (args .yrange ) not in (3 ,)
79+ ):
80+ raise Exception ("Use START/STOP/STEP for --xrange and --yrange" )
81+
82+ var_to_load = ["longitude" ]
83+ var_to_load .extend (EddiesObservations .intern (args .intern , public_label = True ))
84+ e = EddiesObservations .load_file (args .observations , include_vars = var_to_load )
85+
86+ bins = args .xrange , args .yrange
87+ g = e .grid_count (bins , intern = args .intern )
88+ g .write (args .out )
89+
90+
6091def display_infos ():
6192 parser = EddyParser ("Display General inforamtion" )
6293 parser .add_argument ("observations" , nargs = '+' , help = "Input observations to compute frequency" )
0 commit comments