Commit 8d813c3b authored by GROUAZEL's avatar GROUAZEL

change the generation spectra png script

parent 2579ee10
......@@ -3,7 +3,7 @@ from netCDF4 import Dataset
import netCDF4 as nc
import os
import traceback
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
......@@ -430,6 +430,8 @@ def add_wind_to_plot(myspectrum,ax_plot,cut_off):
ax_plot.annotate(r'$U10_{TO}$ = %3.2f'%(wspd)+ ' m/s\ndir=%3.1f$^o$'%(myspectrum.wind.dir),
xy=(np.arctan2(U,V),0.9*2*np.pi/cut_off),color='red',zorder=1000000)
except:
logging.error('cant add the direction on the plot as annotation')
logging.error('%s',traceback.format_exc())
ax_plot.annotate(r'$U10_{TO}$ = %3.2f'%(wspd)+ ' m/s',
xy=(np.arctan2(U,V),0.9*2*np.pi/cut_off),color='red',zorder=1000000)
logging.debug('quiver added')
......@@ -469,7 +471,7 @@ def add_spectrum_to_plot(fig,myspectrum,vmin,vmax,colormap,cb_label,nrow,ncolumn
if isinstance(part_u.mask,np.ndarray):
logging.debug('part_u.mask==False -> %s',part_u.mask==False)
# part_u = part_u[part_u.mask==False]
part_u = np.array(part_u[(part_u<200)&(part_u>=0)], dtype=float)
part_u = np.array(part_u[(part_u<200)&(part_u>0)], dtype=float)
logging.debug('part_u: %s',part_u)
if isinstance(part_u,np.float):# or isinstance(part_u,np.float):
part_u = np.array([part_u])
......@@ -479,6 +481,7 @@ def add_spectrum_to_plot(fig,myspectrum,vmin,vmax,colormap,cb_label,nrow,ncolumn
for cpt in part_u:
ppart=myspectrum.spec_data.part*0
ppart[myspectrum.spec_data.part==cpt]=cpt
logging.debug('partition cpt = %s -> color = %s',cpt,ccc[np.int(cpt)])
if canPlotContour:
plt.contour(*init_sp(myspectrum.spec_data.k,myspectrum.spec_data.phi,ppart),levels=[0],colors=ccc[np.int(cpt)])
#adding the colorbar
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment