Commit ea32241e authored by GROUAZEL's avatar GROUAZEL

correction wind direction on WW3 spectra arctan2 (V,U) instead of (U,V)

parent 8d813c3b
......@@ -164,7 +164,7 @@ class SpectrumReaderSat(AbstractSpectrumReader):
my_data['k'] = ncf.variables['oswK'][:]
my_data['phi'] = ncf.variables['oswPhi'][:]
print('mode1',mode,my_data['phi'],type(my_data['phi']))
# print('mode1',mode,my_data['phi'],type(my_data['phi']))
if isinstance(my_data['phi'],np.ma.core.MaskedArray) or True:
my_data['phi'] = np.ma.array(my_data['phi'])
my_data['phi'].mask = np.zeros(my_data['phi'].shape)
......
......@@ -67,7 +67,18 @@ class SpectrumReaderWw3(AbstractSpectrumReader):
wind['U'] = wind['U'][0]
wind['V'] = ncf.variables['wind_speed_model_v'][:]
wind['V'] = wind['V'][0]
wdir = (np.arctan2(wind['U'],wind['V']) * 180 / np.pi) % 360
speed = np.sqrt(wind['U']**2+wind['V']**2)
# if True:#patch agrouaze Sept 2019
# wind['U'] = -wind['U']
# wind['V'] = -wind['V']
if True:#patch agrouaze Sept 2019: (90-val+180)%360 correction sans explication qui vient de tests sur http://grougrou1.ifremer.fr:8888/notebooks/workspace_leste/cfosat_perso/verif_windir_computation.ipynb#
# wdir = (90-np.arctan2(wind['U'],wind['V']) * 180 / np.pi + 180.) % 360
wdir = (np.arctan2(wind['V'],wind['U']) * 180 / np.pi + 180.) % 360 #trop bien jai trouvé que en inversant V et U comme dans la doc numpy on retombe bien sur la bonne direction
wind['V'] = speed*np.cos(np.radians(wdir))
wind['U'] = speed*np.sin(np.radians(wdir))
# print('plop')
else:
wdir = (np.arctan2(wind['U'],wind['V']) * 180 / np.pi) % 360
wind['dir'] = wdir
return wind
@staticmethod
......
......@@ -86,11 +86,11 @@ class SpectrumReader(AbstractSpectrumReader):
elif 'ww3' in name:
return 'ww3'
elif 's1a' in name or 's1b' in name:
print 'ambiguous situation will return the full spectrum mode:satfull'
print('ambiguous situation will return the full spectrum mode:satfull')
return 'satfull'
@staticmethod
def selectmodebydata(data):
print data.title
print(data.title)
#-----------------------------------------------
# End of Generic Reader
#-----------------------------------------------
......
......@@ -385,10 +385,10 @@ def add_basic_elements_to_plot(ax_plot,title,fs_title,circleradius,freq):
#Function that add a wind Vector to ax_plot
def add_wind_to_plot(myspectrum,ax_plot,cut_off):
print('myspectrum',myspectrum)
print('add_wind_to_plot')
# print('myspectrum',myspectrum)
# print('add_wind_to_plot')
scriptpath = os.path.realpath(__file__)
print("Script path is : " + scriptpath)
# print("Script path is : " + scriptpath)
U = None
V = None
#Test to ignore empty array
......
import matplotlib
matplotlib.use('Agg')
import plot_spec_V2
import Spectrum
# from SpectrumReader import SpectrumReaderSat
......
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