@@ -45,6 +45,7 @@ h = RegularGridDataset('share/nrt_global_allsat_phy_l4_20190223_20190226.nc', 'l
4545
4646Plotting grid
4747``` python 
48+ from  matplotlib import  pyplot as  plt
4849fig =  plt.figure(figsize = (14 , 12 ))
4950ax =  fig.add_axes([.02 , .51 , .9 , .45 ])
5051ax.set_title(' ADT (m)' 
@@ -74,3 +75,59 @@ fig.savefig('share/png/filter.png')
7475
7576![ signal filtering] ( share/png/filter.png ) 
7677
78+ #### Compute spectrum and spectrum ratio on some area  #### 
79+ Load data
80+ ``` python 
81+ grid_name, lon_name, lat_name =  ' share/nrt_global_allsat_phy_l4_20190223_20190226.nc' ' longitude' ' latitude' 
82+ raw =  RegularGridDataset(grid_name, lon_name, lat_name)
83+ filtered =  RegularGridDataset(grid_name, lon_name, lat_name)
84+ filtered.bessel_low_filter(' adt' 150 , order = 3 )
85+ 
86+ areas =  dict (
87+     sud_pacific = dict (llcrnrlon = 188 , urcrnrlon = 280 , llcrnrlat = - 64 , urcrnrlat = - 7 ),
88+     atlantic_nord = dict (llcrnrlon = 290 , urcrnrlon = 340 , llcrnrlat = 19.5 , urcrnrlat = 43 ),
89+     indien_sud = dict (llcrnrlon = 35 , urcrnrlon = 110 , llcrnrlat = - 49 , urcrnrlat = - 26 ),
90+     )
91+ ``` 
92+ 
93+ Compute and display spectrum
94+ ``` python 
95+ fig =  plt.figure(figsize = (10 ,6 ))
96+ ax =  fig.add_subplot(111 )
97+ ax.set_title(' Spectrum' 
98+ ax.set_xlabel(' km' 
99+ for  name_area, area in  areas.items():
100+ 
101+     lon_spec, lat_spec =  raw.spectrum_lonlat(' adt' area = area)
102+     mappable =  ax.loglog(* lat_spec, label = ' lat %s  raw' %  name_area)[0 ]
103+     ax.loglog(* lon_spec, label = ' lon %s  raw' %  name_area, color = mappable.get_color(), linestyle = ' --' 
104+ 
105+     lon_spec, lat_spec =  filtered.spectrum_lonlat(' adt' area = area)
106+     mappable =  plt.loglog(* lat_spec, label = ' lat %s  high' %  name_area)[0 ]
107+     plt.loglog(* lon_spec, label = ' lon %s  high' %  name_area, color = mappable.get_color(), linestyle = ' --' 
108+ 
109+ ax.set_xscale(' log' 
110+ ax.legend()
111+ ax.grid()
112+ fig.savefig(' share/png/spectrum.png' 
113+ ``` 
114+ 
115+ ![ spectrum] ( share/png/spectrum.png ) 
116+ 
117+ Compute and display spectrum ratio
118+ ``` python 
119+ fig =  plt.figure(figsize = (10 ,6 ))
120+ ax =  fig.add_subplot(111 )
121+ ax.set_title(' Spectrum ratio' 
122+ ax.set_xlabel(' km' 
123+ for  name_area, area in  areas.items():
124+     lon_spec, lat_spec =  filtered.spectrum_lonlat(' adt' area = area, ref = raw)
125+     mappable =  ax.plot(* lat_spec, label = ' lat %s  high' %  name_area)[0 ]
126+     ax.plot(* lon_spec, label = ' lon %s  high' %  name_area, color = mappable.get_color(), linestyle = ' --' 
127+ 
128+ ax.set_xscale(' log' 
129+ ax.legend()
130+ ax.grid()
131+ fig.savefig(' share/png/spectrum_ratio.png' 
132+ ``` 
133+ ![ spectrum] ( share/png/spectrum_ratio.png ) 
0 commit comments