Skip to content
Snippets Groups Projects
Commit 2ff4b873 authored by RODIER Quentin's avatar RODIER Quentin
Browse files

Quentin 14/08/2024: update to MNHPy 0.3.3, bugfix for Reunion interpol

parent 4aab1d39
No related branches found
No related tags found
No related merge requests found
...@@ -97,13 +97,12 @@ Dvar['f1']['THT-LSTHM'] = copy.deepcopy(Dvar['f1']['THT']) ...@@ -97,13 +97,12 @@ Dvar['f1']['THT-LSTHM'] = copy.deepcopy(Dvar['f1']['THT'])
Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f2']['LSTHM'] Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f2']['LSTHM']
Dvar['f1']['VT-LSVM'] = copy.deepcopy(Dvar['f1']['VM']) Dvar['f1']['VT-LSVM'] = copy.deepcopy(Dvar['f1']['VM'])
Dvar['f1']['VT-LSVM'] = Dvar['f1']['VM'] - Dvar['f2']['LSVM'] Dvar['f1']['VT-LSVM'] = Dvar['f1']['VM'] - Dvar['f2']['LSVM']
Lplot = [ Dvar['f1']['THT'][:,:,i_slice], Dvar['f1']['THT-LSTHM'][:,:,i_slice],Dvar['f1']['VT-LSVM'][:,:,i_slice],Dvar['f1']['WT'][:,:,i_slice]] Lplot = [ Dvar['f1']['THT'][:,:,i_slice], Dvar['f1']['THT-LSTHM'][:,:,i_slice],Dvar['f1']['VT-LSVM'][:,:,i_slice],Dvar['f1']['WT'][:,:,i_slice]]
Ltitle = ['Potential Temperature', 'Anomalie de théta (THT-LSTHM)', 'Anomalie de V (VT-LSVM)', 'WT vertical velocity'] Ltitle = ['Potential Temperature', 'Anomalie de théta (THT-LSTHM)', 'Anomalie de V (VT-LSVM)', 'WT vertical velocity']
LaxeZ = [Dvar['f1']['altitude'][:,:,i_slice], Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude_w'][:,:,i_slice]] LaxeZ = [Dvar['f1']['altitude'][:,:,i_slice], Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude_w'][:,:,i_slice]]
LaxeX = [Dvar['f1']['ny_3D'][:,:,i_slice]]*len(Lplot) LaxeX = [Dvar['f1']['ny_3D'][:,:,i_slice]]*len(Lplot)
Lcbarlabel = ['K', 'K','m/s', 'm/s'] Lcbarlabel = ['K', 'K','m/s', 'm/s']
Lxlab = ['longitude']*len(Lplot) Lxlab = ['latitude']*len(Lplot)
Lylab = ['altitude (m)']*len(Lplot) Lylab = ['altitude (m)']*len(Lplot)
Lylim = [(0,16000)]*len(Lplot) Lylim = [(0,16000)]*len(Lplot)
Lminval = [300, -1.9, -10.5, -6.75] Lminval = [300, -1.9, -10.5, -6.75]
...@@ -123,7 +122,7 @@ Lplot2 = [ Dvar['f1']['WM'][:,:,i_slice]] ...@@ -123,7 +122,7 @@ Lplot2 = [ Dvar['f1']['WM'][:,:,i_slice]]
Ltitle = ['Wind'] Ltitle = ['Wind']
Llegendval = [15] Llegendval = [15]
Llegendlabel = ['m/s']*len(Lplot) Llegendlabel = ['m/s']*len(Lplot)
Lxlab = ['longitude']*len(Lplot) Lxlab = ['latitude']*len(Lplot)
Lylab = ['altitude (m)']*len(Lplot) Lylab = ['altitude (m)']*len(Lplot)
Larrowstep = [1]*len(Lplot) Larrowstep = [1]*len(Lplot)
Lwidth = [0.002]*len(Lplot) Lwidth = [0.002]*len(Lplot)
......
...@@ -74,7 +74,7 @@ class PanelPlot(): ...@@ -74,7 +74,7 @@ class PanelPlot():
self.iplt += 1 self.iplt += 1
return self.iplt return self.iplt
def draw_Backmap(self, drawCoastLines, ax, projo): def draw_Backmap(self, drawCoastLines, ax, projo, gridLines=True):
""" """
Handle drawing of the background plot (coastlines, departements, grid lines and labels) Handle drawing of the background plot (coastlines, departements, grid lines and labels)
""" """
...@@ -87,8 +87,8 @@ class PanelPlot(): ...@@ -87,8 +87,8 @@ class PanelPlot():
from cartopy.mpl.ticker import (LatitudeLocator, LongitudeLocator,LongitudeFormatter, LatitudeFormatter) from cartopy.mpl.ticker import (LatitudeLocator, LongitudeLocator,LongitudeFormatter, LatitudeFormatter)
gl.top_labels = False gl.top_labels = False
gl.right_labels = False gl.right_labels = False
gl.xlines = True gl.xlines = gridLines
gl.ylines = True gl.ylines = gridLines
gl.xlocator = LongitudeLocator() gl.xlocator = LongitudeLocator()
gl.ylocator = LatitudeLocator() gl.ylocator = LatitudeLocator()
gl.xformatter = LongitudeFormatter() gl.xformatter = LongitudeFormatter()
...@@ -544,7 +544,7 @@ class PanelPlot(): ...@@ -544,7 +544,7 @@ class PanelPlot():
def psectionH(self, lon=[], lat=[], Lvar=[], Lcarte=[], Llevel=[], Lxlab=[], Lylab=[], Ltitle=[], Lminval=[], Lmaxval=[], def psectionH(self, lon=[], lat=[], Lvar=[], Lcarte=[], Llevel=[], Lxlab=[], Lylab=[], Ltitle=[], Lminval=[], Lmaxval=[],
Lstep=[], Lstepticks=[], Lcolormap=[], LcolorLine=[], Lcbarlabel=[], Lproj=[], Lfacconv=[], coastLines=True, ax=[], Lstep=[], Lstepticks=[], Lcolormap=[], LcolorLine=[], Lcbarlabel=[], Lproj=[], Lfacconv=[], coastLines=True, ax=[],
Lid_overlap=[], colorbar=True, Ltime=[], LaddWhite_cm=[], LwhiteTop=[], Lpltype=[], Lcbformatlabel=[], Llinewidth=[], Lid_overlap=[], colorbar=True, Ltime=[], LaddWhite_cm=[], LwhiteTop=[], Lpltype=[], Lcbformatlabel=[], Llinewidth=[],
Lextendcolorbar=[], PrintMinMaxText=True): Lextendcolorbar=[], PrintMinMaxText=True,gridLines=True):
""" """
Horizontal cross section plot Horizontal cross section plot
Parameters : Parameters :
...@@ -577,6 +577,7 @@ class PanelPlot(): ...@@ -577,6 +577,7 @@ class PanelPlot():
- Lcbformatlabel: List of boolean to reduce the format to exponential 1.1E+02 format colorbar label - Lcbformatlabel: List of boolean to reduce the format to exponential 1.1E+02 format colorbar label
- Lextendcolorbar : List of boolean to extend the colorbar in both directions - Lextendcolorbar : List of boolean to extend the colorbar in both directions
- PrintMinMaxText: Boolean, True to add a min/max values of the plotted variables on top of the graph - PrintMinMaxText: Boolean, True to add a min/max values of the plotted variables on top of the graph
- gridLines : Boolean, True to add the horizontal and vertical grid lines in cartopy
""" """
self.ax = ax self.ax = ax
...@@ -707,7 +708,7 @@ class PanelPlot(): ...@@ -707,7 +708,7 @@ class PanelPlot():
# Coastlines / Grid lines and labels # Coastlines / Grid lines and labels
if Lproj: if Lproj:
self.draw_Backmap(coastLines, self.ax[iax], Lproj[i]) self.draw_Backmap(coastLines, self.ax[iax], Lproj[i], gridLines)
# X/Y Axis # X/Y Axis
self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i])
......
...@@ -193,10 +193,10 @@ def comp_altitude2DVar(oneVar3D, orography, ztop, level, n_y, n_x): ...@@ -193,10 +193,10 @@ def comp_altitude2DVar(oneVar3D, orography, ztop, level, n_y, n_x):
level : array 1D level : array 1D
1D level variable (level or level_w) 1D level variable (level or level_w)
n_x : array 1D n_x : array 1D (or 2D if LCARTESIAN=F)
1D directionnal grid variable along i (ni_u, or ni_v) 1D directionnal grid variable along i (ni_u, or ni_v)
n_y : array 1D n_y : array 1D (or 2D if LCARTESIAN=F)
1D directionnal grid variable along j (nj_u, or nj_v) 1D directionnal grid variable along j (nj_u, or nj_v)
Returns Returns
...@@ -214,10 +214,14 @@ def comp_altitude2DVar(oneVar3D, orography, ztop, level, n_y, n_x): ...@@ -214,10 +214,14 @@ def comp_altitude2DVar(oneVar3D, orography, ztop, level, n_y, n_x):
n_y3D = copy.deepcopy(oneVar3D) n_y3D = copy.deepcopy(oneVar3D)
altitude = copy.deepcopy(oneVar3D) altitude = copy.deepcopy(oneVar3D)
for k in range(len(level)): for k in range(len(level)):
for j in range(oneVar3D.shape[2]): if n_x.ndim == 2:
n_y3D[k,:,j] = n_y n_y3D[k,:,:] = n_y
for i in range(oneVar3D.shape[1]): n_x3D[k,:,:] = n_x
n_x3D[k,i,:] = n_x else:
for j in range(oneVar3D.shape[2]):
n_y3D[k,:,j] = n_y
for i in range(oneVar3D.shape[1]):
n_x3D[k,i,:] = n_x
for i in range(oneVar3D.shape[2]): for i in range(oneVar3D.shape[2]):
for j in range(oneVar3D.shape[1]): for j in range(oneVar3D.shape[1]):
if ztop == 0: if ztop == 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment