wolfhece 2.1.119__py3-none-any.whl → 2.1.121__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +732 -153
- wolfhece/PyVertexvectors.py +299 -0
- wolfhece/acceptability/acceptability.py +17 -13
- wolfhece/acceptability/acceptability_gui.py +517 -526
- wolfhece/acceptability/func.py +46 -58
- wolfhece/apps/check_install.py +39 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/lazviewer/_add_path.py +17 -17
- wolfhece/lazviewer/laz_viewer.py +72 -13
- wolfhece/lazviewer/libs/qt_plugins/platforms/qwindows.dll +0 -0
- wolfhece/lazviewer/viewer/qt.conf +2 -0
- wolfhece/lazviewer/viewer/viewer.py +16 -6
- wolfhece/matplotlib_fig.py +83 -1
- wolfhece/wolfresults_2D.py +487 -21
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/METADATA +1 -1
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/RECORD +19 -17
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/top_level.txt +0 -0
wolfhece/PyVertexvectors.py
CHANGED
@@ -46,6 +46,7 @@ from .PyVertex import wolfvertex,getIfromRGB,getRGBfromI, cloud_vertices
|
|
46
46
|
from .PyParams import Wolf_Param, Type_Param, new_json
|
47
47
|
from .wolf_texture import Text_Image_Texture,Text_Infos
|
48
48
|
from .drawing_obj import Element_To_Draw
|
49
|
+
from .matplotlib_fig import Matplotlib_Figure as MplFig
|
49
50
|
|
50
51
|
class Triangulation(Element_To_Draw):
|
51
52
|
def __init__(self, fn='', pts=[], tri=[], idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
|
@@ -2626,6 +2627,83 @@ class vector:
|
|
2626
2627
|
|
2627
2628
|
return fig,ax
|
2628
2629
|
|
2630
|
+
def plot_linked_wx(self, fig:MplFig, linked_arrays:dict):
|
2631
|
+
"""
|
2632
|
+
Graphique Matplolib de valeurs dans les matrices liées.
|
2633
|
+
|
2634
|
+
Version pour wxPython
|
2635
|
+
"""
|
2636
|
+
|
2637
|
+
colors=['red','blue','green']
|
2638
|
+
|
2639
|
+
exit=True
|
2640
|
+
for curlabel, curarray in linked_arrays.items():
|
2641
|
+
if curarray.plotted:
|
2642
|
+
exit=False
|
2643
|
+
|
2644
|
+
if exit:
|
2645
|
+
return
|
2646
|
+
|
2647
|
+
k=0
|
2648
|
+
|
2649
|
+
myls = self.asshapely_ls()
|
2650
|
+
length = myls.length
|
2651
|
+
tol=length/10.
|
2652
|
+
fig.cur_ax.set_xlim(0-tol,length+tol)
|
2653
|
+
|
2654
|
+
zmin=99999.
|
2655
|
+
zmax=-99999.
|
2656
|
+
nullvalue = -99999
|
2657
|
+
|
2658
|
+
for curlabel, curarray in linked_arrays.items():
|
2659
|
+
if curarray.plotted:
|
2660
|
+
|
2661
|
+
ds = curarray.get_dxdy_min()
|
2662
|
+
|
2663
|
+
nb = int(np.ceil(length/ds*2))
|
2664
|
+
|
2665
|
+
alls = np.linspace(0,int(length),nb)
|
2666
|
+
|
2667
|
+
pts = [myls.interpolate(curs) for curs in alls]
|
2668
|
+
|
2669
|
+
allz = np.asarray([curarray.get_value(curpt.x,curpt.y, nullvalue= nullvalue) for curpt in pts])
|
2670
|
+
|
2671
|
+
zmaxloc=np.max(allz[allz!=nullvalue])
|
2672
|
+
zminloc=np.min(allz[allz!=nullvalue])
|
2673
|
+
|
2674
|
+
zmax=max(zmax,zmaxloc)
|
2675
|
+
zmin=min(zmin,zminloc)
|
2676
|
+
|
2677
|
+
if np.max(allz)>nullvalue:
|
2678
|
+
# select parts
|
2679
|
+
if nullvalue in allz:
|
2680
|
+
# find all parts separated by nullvalue
|
2681
|
+
nulls = np.argwhere(allz==nullvalue)
|
2682
|
+
nulls = np.insert(nulls,0,-1)
|
2683
|
+
nulls = np.append(nulls,len(allz))
|
2684
|
+
|
2685
|
+
addlabel = True
|
2686
|
+
for i in range(len(nulls)-1):
|
2687
|
+
if nulls[i+1]-nulls[i]>1:
|
2688
|
+
fig.plot(alls[nulls[i]+1:nulls[i+1]],allz[nulls[i]+1:nulls[i+1]],
|
2689
|
+
color=colors[np.mod(k,3)],
|
2690
|
+
lw=2.0,
|
2691
|
+
label=curlabel if addlabel else None)
|
2692
|
+
addlabel = False
|
2693
|
+
|
2694
|
+
else:
|
2695
|
+
fig.plot(alls,allz,
|
2696
|
+
color=colors[np.mod(k,3)],
|
2697
|
+
lw=2.0,
|
2698
|
+
label=curlabel)
|
2699
|
+
k+=1
|
2700
|
+
|
2701
|
+
fig.cur_ax.set_ylim(zmin,zmax)
|
2702
|
+
fig.cur_ax.legend()
|
2703
|
+
fig.cur_ax.grid()
|
2704
|
+
|
2705
|
+
return fig
|
2706
|
+
|
2629
2707
|
def plot_mpl(self,show=False,forceaspect=True,fig:Figure=None,ax:Axes=None,labels:dict={}):
|
2630
2708
|
"""
|
2631
2709
|
Graphique Matplolib du vecteur
|
@@ -4814,6 +4892,227 @@ class zone:
|
|
4814
4892
|
ax.set_yticks(np.arange(zmodmin,zmax,.25))
|
4815
4893
|
fig.canvas.draw()
|
4816
4894
|
|
4895
|
+
def plot_linked_polygons_wx(self, fig:MplFig,
|
4896
|
+
linked_arrays:dict, linked_vec:dict[str,"Zones"]=None,
|
4897
|
+
linestyle:str='-', onlymedian:bool=False,
|
4898
|
+
withtopography:bool = True, ds:float = None):
|
4899
|
+
"""
|
4900
|
+
Création d'un graphique sur base des polygones
|
4901
|
+
|
4902
|
+
Chaque polygone se positionnera sur base de la valeur Z de ses vertices
|
4903
|
+
- façon conventionnelle de définir une longueur
|
4904
|
+
- ceci est normalement fait lors de l'appel à 'create_polygon_from_parallel'
|
4905
|
+
- si les polygones sont créés manuellement, il faut donc prendre soin de fournir l'information adhoc ou alors utiliser l'rgument 'ds'
|
4906
|
+
|
4907
|
+
ATTENTION : Les coordonnées Z ne sont sauvegardées sur disque que si le fichier est 3D, autrement dit au format '.vecz'
|
4908
|
+
|
4909
|
+
:param fig: Figure
|
4910
|
+
:param ax: Axes
|
4911
|
+
:param linked_arrays: dictionnaire contenant les matrices à lier -- les clés sont les labels
|
4912
|
+
:param linked_vec: dictionnaire contenant les instances Zones à lier -- Besoin d'une zone et d'un vecteur 'trace/trace' pour convertir les positions en coordonnées curvilignes
|
4913
|
+
:param linestyle: style de ligne
|
4914
|
+
:param onlymedian: affiche uniquement la médiane
|
4915
|
+
:param withtopography: affiche la topographie
|
4916
|
+
:param ds: pas spatial le long de l'axe
|
4917
|
+
|
4918
|
+
"""
|
4919
|
+
|
4920
|
+
colors=['red','blue','green','darkviolet','fuchsia','lime']
|
4921
|
+
|
4922
|
+
#Vérifie qu'au moins une matrice liée est fournie, sinon rien à faire
|
4923
|
+
exit=True
|
4924
|
+
for curlabel, curarray in linked_arrays.items():
|
4925
|
+
if curarray.plotted:
|
4926
|
+
exit=False
|
4927
|
+
if exit:
|
4928
|
+
return
|
4929
|
+
|
4930
|
+
k=0
|
4931
|
+
|
4932
|
+
zmin=99999.
|
4933
|
+
zmax=-99999.
|
4934
|
+
|
4935
|
+
if ds is None:
|
4936
|
+
# Récupération des positions
|
4937
|
+
srefs=np.asarray([curpol.myvertices[0].z for curpol in self.myvectors])
|
4938
|
+
else:
|
4939
|
+
# Création des positions sur base de 'ds'
|
4940
|
+
srefs=np.arange(0., float(self.nbvectors) * ds, ds)
|
4941
|
+
|
4942
|
+
for idx, (curlabel, curarray) in enumerate(linked_arrays.items()):
|
4943
|
+
if curarray.plotted:
|
4944
|
+
|
4945
|
+
logging.info(_('Plotting linked polygons for {}'.format(curlabel)))
|
4946
|
+
logging.info(_('Number of polygons : {}'.format(self.nbvectors)))
|
4947
|
+
logging.info(_('Extracting values inside polygons...'))
|
4948
|
+
|
4949
|
+
vals= [curarray.get_values_insidepoly(curpol) for curpol in self.myvectors]
|
4950
|
+
|
4951
|
+
logging.info(_('Computing stats...'))
|
4952
|
+
|
4953
|
+
values = np.asarray([cur[0] for cur in vals],dtype=object)
|
4954
|
+
valel = np.asarray([cur[1] for cur in vals],dtype=object)
|
4955
|
+
|
4956
|
+
zmaxloc=np.asarray([np.max(curval) if len(curval) >0 else -99999. for curval in values])
|
4957
|
+
zminloc=np.asarray([np.min(curval) if len(curval) >0 else -99999. for curval in values])
|
4958
|
+
|
4959
|
+
zmax=max(zmax,np.max(zmaxloc[np.where(zmaxloc>-99999.)]))
|
4960
|
+
zmin=min(zmin,np.min(zminloc[np.where(zminloc>-99999.)]))
|
4961
|
+
|
4962
|
+
if zmax>-99999:
|
4963
|
+
|
4964
|
+
zloc = np.asarray([np.median(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
|
4965
|
+
|
4966
|
+
fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
4967
|
+
color=colors[np.mod(k,3)],
|
4968
|
+
lw=2.0,
|
4969
|
+
linestyle=linestyle,
|
4970
|
+
label=curlabel+'_median')
|
4971
|
+
|
4972
|
+
zloc = np.asarray([np.min(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
|
4973
|
+
|
4974
|
+
if not onlymedian:
|
4975
|
+
|
4976
|
+
fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
4977
|
+
color=colors[np.mod(k,3)],alpha=.3,
|
4978
|
+
lw=2.0,
|
4979
|
+
linestyle=linestyle,
|
4980
|
+
label=curlabel+'_min')
|
4981
|
+
|
4982
|
+
zloc = np.asarray([np.max(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
|
4983
|
+
|
4984
|
+
fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
4985
|
+
color=colors[np.mod(k,3)],alpha=.3,
|
4986
|
+
lw=2.0,
|
4987
|
+
linestyle=linestyle,
|
4988
|
+
label=curlabel+'_max')
|
4989
|
+
|
4990
|
+
if withtopography and idx==0:
|
4991
|
+
if valel[0] is not None:
|
4992
|
+
zmaxloc=np.asarray([np.max(curval) if len(curval) >0 else -99999. for curval in valel])
|
4993
|
+
zminloc=np.asarray([np.min(curval) if len(curval) >0 else -99999. for curval in valel])
|
4994
|
+
|
4995
|
+
zmax=max(zmax,np.max(zmaxloc[np.where(zmaxloc>-99999.)]))
|
4996
|
+
zmin=min(zmin,np.min(zminloc[np.where(zminloc>-99999.)]))
|
4997
|
+
|
4998
|
+
if zmax>-99999:
|
4999
|
+
|
5000
|
+
zloc = np.asarray([np.median(curpoly) if len(curpoly) >0 else -99999. for curpoly in valel])
|
5001
|
+
|
5002
|
+
fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
5003
|
+
color='black',
|
5004
|
+
lw=2.0,
|
5005
|
+
linestyle=linestyle,
|
5006
|
+
label=curlabel+'_top_median')
|
5007
|
+
|
5008
|
+
# if not onlymedian:
|
5009
|
+
# zloc = np.asarray([np.min(curpoly) for curpoly in valel])
|
5010
|
+
|
5011
|
+
# ax.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
5012
|
+
# color='black',alpha=.3,
|
5013
|
+
# lw=2.0,
|
5014
|
+
# linestyle=linestyle,
|
5015
|
+
# label=curlabel+'_top_min')
|
5016
|
+
|
5017
|
+
# zloc = np.asarray([np.max(curpoly) for curpoly in valel])
|
5018
|
+
|
5019
|
+
# ax.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
|
5020
|
+
# color='black',alpha=.3,
|
5021
|
+
# lw=2.0,
|
5022
|
+
# linestyle=linestyle,
|
5023
|
+
# label=curlabel+'_top_max')
|
5024
|
+
|
5025
|
+
k+=1
|
5026
|
+
|
5027
|
+
for curlabel, curzones in linked_vec.items():
|
5028
|
+
curzones:Zones
|
5029
|
+
names = [curzone.myname for curzone in curzones.myzones]
|
5030
|
+
trace = None
|
5031
|
+
tracels = None
|
5032
|
+
|
5033
|
+
logging.info(_('Plotting linked zones for {}'.format(curlabel)))
|
5034
|
+
|
5035
|
+
curzone: zone
|
5036
|
+
if 'trace' in names:
|
5037
|
+
curzone = curzones.get_zone('trace')
|
5038
|
+
trace = curzone.get_vector('trace')
|
5039
|
+
|
5040
|
+
if trace is None:
|
5041
|
+
if curzone is not None:
|
5042
|
+
if curzone.nbvectors>0:
|
5043
|
+
trace = curzone.myvectors[0]
|
5044
|
+
|
5045
|
+
if trace is not None:
|
5046
|
+
tracels = trace.asshapely_ls()
|
5047
|
+
else:
|
5048
|
+
logging.warning(_('No trace found in the vectors {}'.format(curlabel)))
|
5049
|
+
break
|
5050
|
+
|
5051
|
+
if ('marks' in names) or ('repères' in names):
|
5052
|
+
if ('marks' in names):
|
5053
|
+
curzone = curzones.myzones[names.index('marks')]
|
5054
|
+
else:
|
5055
|
+
curzone = curzones.myzones[names.index('repères')]
|
5056
|
+
|
5057
|
+
logging.info(_('Plotting marks for {}'.format(curlabel)))
|
5058
|
+
logging.info(_('Number of marks : {}'.format(curzone.nbvectors)))
|
5059
|
+
|
5060
|
+
for curvect in curzone.myvectors:
|
5061
|
+
curls = curvect.asshapely_ls()
|
5062
|
+
|
5063
|
+
if curls.intersects(tracels):
|
5064
|
+
inter = curls.intersection(tracels)
|
5065
|
+
curs = float(tracels.project(inter))
|
5066
|
+
|
5067
|
+
fig.plot([curs, curs], [zmin, zmax], linestyle='--', label=curvect.myname)
|
5068
|
+
fig.text(curs, zmax, curvect.myname, fontsize=8, ha='center', va='bottom')
|
5069
|
+
|
5070
|
+
if ('banks' in names) or ('berges' in names):
|
5071
|
+
|
5072
|
+
if ('banks' in names):
|
5073
|
+
curzone = curzones.myzones[names.index('banks')]
|
5074
|
+
else:
|
5075
|
+
curzone = curzones.myzones[names.index('berges')]
|
5076
|
+
|
5077
|
+
logging.info(_('Plotting banks for {}'.format(curlabel)))
|
5078
|
+
logging.info(_('Number of banks : {}'.format(curzone.nbvectors)))
|
5079
|
+
|
5080
|
+
for curvect in curzone.myvectors:
|
5081
|
+
curvect: vector
|
5082
|
+
|
5083
|
+
curproj = curvect.projectontrace(trace)
|
5084
|
+
sz = curproj.asnparray()
|
5085
|
+
fig.plot(sz[:,0], sz[:,1], label=curvect.myname)
|
5086
|
+
|
5087
|
+
if ('bridges' in names) or ('ponts' in names):
|
5088
|
+
if ('bridges' in names):
|
5089
|
+
curzone = curzones.myzones[names.index('bridges')]
|
5090
|
+
else:
|
5091
|
+
curzone = curzones.myzones[names.index('ponts')]
|
5092
|
+
|
5093
|
+
logging.info(_('Plotting bridges for {}'.format(curlabel)))
|
5094
|
+
|
5095
|
+
for curvect in curzone.myvectors:
|
5096
|
+
curvect: vector
|
5097
|
+
curls = curvect.asshapely_ls()
|
5098
|
+
|
5099
|
+
if curls.intersects(tracels):
|
5100
|
+
|
5101
|
+
logging.info(_('Bridge {} intersects the trace'.format(curvect.myname)))
|
5102
|
+
|
5103
|
+
inter = curls.intersection(tracels)
|
5104
|
+
curs = float(tracels.project(inter))
|
5105
|
+
locz = np.asarray([vert.z for vert in curvect.myvertices])
|
5106
|
+
zmin = np.amin(locz)
|
5107
|
+
zmax = np.amax(locz)
|
5108
|
+
|
5109
|
+
fig.plot(curs, zmin, label=curvect.myname + ' min', marker='x')
|
5110
|
+
fig.plot(curs, zmax, label=curvect.myname + ' max', marker='x')
|
5111
|
+
|
5112
|
+
fig.cur_ax.set_ylim(zmin,zmax)
|
5113
|
+
zmodmin= np.floor_divide(zmin*100,25)*25/100
|
5114
|
+
fig.cur_ax.set_yticks(np.arange(zmodmin,zmax,.25))
|
5115
|
+
|
4817
5116
|
def reset_listogl(self):
|
4818
5117
|
"""
|
4819
5118
|
Reset OpenGL lists.
|
@@ -566,26 +566,30 @@ def Acceptability(main_dir:str = 'Vesdre',
|
|
566
566
|
|
567
567
|
comb += part_accept[curT] * float(pond["Ponderation"][curT])
|
568
568
|
|
569
|
-
y_pixels, x_pixels = comb.shape
|
569
|
+
y_pixels, x_pixels = comb.shape
|
570
570
|
|
571
|
-
# Set up output GeoTIFF
|
572
571
|
driver = gdal.GetDriverByName('GTiff')
|
573
|
-
|
574
|
-
dataset = driver.Create(
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
572
|
+
|
573
|
+
dataset = driver.Create(
|
574
|
+
str(saveA),
|
575
|
+
x_pixels, y_pixels,
|
576
|
+
1,
|
577
|
+
gdal.GDT_Float32,
|
578
|
+
options=["COMPRESS=LZW"]
|
579
|
+
)
|
579
580
|
|
580
581
|
assert comb.dtype == np.float32, "The dtype of the combined acceptability matrix is not np.float32"
|
581
582
|
|
582
|
-
dataset.GetRasterBand(1).WriteArray(comb)
|
583
583
|
dataset.SetGeoTransform(geotrans)
|
584
584
|
dataset.SetProjection(proj)
|
585
|
-
dataset.
|
586
|
-
|
587
|
-
|
588
|
-
|
585
|
+
band = dataset.GetRasterBand(1)
|
586
|
+
band.WriteArray(comb)
|
587
|
+
band.FlushCache()
|
588
|
+
dataset.SetGeoTransform(geotrans)
|
589
|
+
dataset.SetProjection(proj)
|
590
|
+
dataset = None
|
591
|
+
|
592
|
+
done.append(steps_acceptability.COMPUTE_MEAN_ACCEPT)
|
589
593
|
|
590
594
|
if 6 in steps or steps_acceptability.RESAMPLING in steps:
|
591
595
|
if os.path.exists(manager.OUT_ACCEPT):
|