wolfhece 2.2.36__py3-none-any.whl → 2.2.38__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.
@@ -424,7 +424,7 @@ class hydrometry():
424
424
  self.get_groups()
425
425
  self.save_struct()
426
426
  except Exception as e:
427
- print('Error in hydrometry init :', e)
427
+ logging.error('Error in hydrometry init :', e)
428
428
  self.realstations = None
429
429
  pass
430
430
 
@@ -1041,7 +1041,7 @@ class hydrometry():
1041
1041
  if timezone=='Europe/Brussels' or timezone=='local':
1042
1042
  timezone=''
1043
1043
 
1044
- nb = (todate - fromdate).days*24 * (3600/interval)
1044
+ nb = int((todate - fromdate).days*24 * (3600/interval))
1045
1045
  cursec = interval
1046
1046
  # id = ''
1047
1047
  if ts_id == '':
@@ -1105,8 +1105,8 @@ class hydrometry():
1105
1105
  curend = curfrom+timedelta(seconds=200000 * cursec)
1106
1106
  locts=[]
1107
1107
  while curfrom<todate:
1108
- print(curfrom, curend)
1109
- tmpts = self.timeseries(stationname, stationcode, dir, curfrom, curend, ts_name, ts_id, timezone=timezone)
1108
+ logging.info('Getting data from {0} to {1}'.format(curfrom, curend))
1109
+ tmpts = self.timeseries(stationname, stationcode, dir = dir, fromdate= curfrom, todate= curend, ts_name= ts_name, ts_id= ts_id, timezone=timezone)
1110
1110
  if len(tmpts)>0:
1111
1111
  locts.append(tmpts)
1112
1112
 
@@ -1115,22 +1115,31 @@ class hydrometry():
1115
1115
  if curend>todate:
1116
1116
  curend=todate
1117
1117
 
1118
+ if len(locts)==0:
1119
+ logging.warning('No data found for timeseries {0} for station {1} ({2}) between {3} and {4}'.format(ts_name, stationname, stationcode, fromdate, todate))
1120
+ return pd.DataFrame()
1121
+
1118
1122
  return pd.concat(locts)
1119
1123
  else:
1120
- json_data = requests.get(self._get_commandstr(kiwis_command.getTimeseriesValues)
1121
- +"&"+urllib.parse.urlencode({
1122
- "ts_id":str(ts_id),
1123
- "from":fromdate.strftime("%Y-%m-%dT%H:%M:%S"),
1124
- "to":todate.strftime("%Y-%m-%dT%H:%M:%S"),
1125
- # "format":"json",
1126
- "timezone":timezone})
1127
- ,verify=True,
1128
- headers=self._header,
1129
- timeout=TIMEOUT).json()
1124
+ try:
1125
+ json_data = requests.get(self._get_commandstr(kiwis_command.getTimeseriesValues)
1126
+ +"&"+urllib.parse.urlencode({
1127
+ "ts_id":str(ts_id),
1128
+ "from":fromdate.strftime("%Y-%m-%dT%H:%M:%S"),
1129
+ "to":todate.strftime("%Y-%m-%dT%H:%M:%S"),
1130
+ # "format":"json",
1131
+ "timezone":timezone})
1132
+ ,verify=True,
1133
+ headers=self._header,
1134
+ timeout=TIMEOUT).json()
1130
1135
 
1131
- df = pd.DataFrame(json_data[0]['data'], columns = json_data[0]['columns'].split(','))
1132
- df.set_index('Timestamp', inplace = True)
1133
- df.index = pd.to_datetime(df.index,format="%Y-%m-%dT%H:%M:%S.%f%z")
1136
+ df = pd.DataFrame(json_data[0]['data'], columns = json_data[0]['columns'].split(','))
1137
+ df.set_index('Timestamp', inplace = True)
1138
+ df.index = pd.to_datetime(df.index,format="%Y-%m-%dT%H:%M:%S.%f%z")
1139
+
1140
+ except Exception as e:
1141
+ logging.error('Error in timeseries :', e)
1142
+ return pd.DataFrame()
1134
1143
 
1135
1144
  return df.squeeze()
1136
1145
 
@@ -1210,8 +1219,8 @@ class hydrometry():
1210
1219
  curend = curfrom+timedelta(seconds=200000 * cursec)
1211
1220
  locts=[]
1212
1221
  while curfrom<todate:
1213
- print(curfrom, curend)
1214
- locts.append(self.timeseries(stationname,stationcode,dir,curfrom,curend,ts_name,ts_id))
1222
+ logging.info('Getting data from {0} to {1}'.format(curfrom, curend))
1223
+ locts.append(self.timeseries(stationname,stationcode, dir = dir, fromdate= curfrom, todate= curend, ts_name= ts_name, ts_id= ts_id))
1215
1224
  curfrom = curend
1216
1225
  curend = curfrom+timedelta(seconds=200000 * cursec)
1217
1226
  if curend>todate:
@@ -274,6 +274,10 @@ class hydrometry_gui(wx.Frame):
274
274
  """
275
275
  to_exclude = ['alarm', 'batterie']
276
276
 
277
+ if len(self.listbox2.GetSelections())==0:
278
+ logging.error(_('No station selected'))
279
+ return
280
+
277
281
  #treat only the first one if multiple selections
278
282
  stationname, stationcode = self._getname_code_fromindex(self.listbox2.GetSelections()[0])
279
283
 
@@ -584,11 +588,12 @@ class hydrometry_gui(wx.Frame):
584
588
  if stationname is None:
585
589
  return
586
590
 
587
- for curdata, curname in zip(data,tsname):
591
+ for curdata, curname in zip(data, tsname):
588
592
  if curdata is not None:
589
593
  if len(curdata)>1:
590
594
  curdata.to_csv('{}-{}.csv'.format(stationcode,curname), date_format="%Y%m%d%H%M%S%z", sep=";")
591
- if datumsizebv[0]!='':
595
+
596
+ if datumsizebv[0]!='' and 'hauteur' in curname.lower():
592
597
  curdata:pd.Series
593
598
  zdata = curdata.copy()
594
599
  zdata += float(datumsizebv[0])
wolfhece/picc.py CHANGED
@@ -19,6 +19,7 @@ from .PyTranslate import _
19
19
  from .PyVertexvectors import Zones, zone, vector, wolfvertex
20
20
  from .PyVertex import cloud_vertices, getRGBfromI, getIfromRGB
21
21
  from .drawing_obj import Element_To_Draw
22
+ from .wolf_array import WolfArray
22
23
 
23
24
  class Picc_data(Element_To_Draw):
24
25
  """
@@ -38,7 +39,7 @@ class Picc_data(Element_To_Draw):
38
39
 
39
40
  self.data_dir = data_dir
40
41
  self._filename_vector = 'Wallonie.gdb' #'PICC_Vesdre.shp'
41
- self._filename_points = 'PICC_Vesdre_points.shp'
42
+ self._filename_points = 'ADRESS_POINT.shp' #'PICC_Vesdre_points.shp'
42
43
  self.zones = None
43
44
  self.cloud = None
44
45
  self._colors = {'Habitation': [255, 0, 0], 'Annexe': [0, 255, 0], 'Culture, sport ou loisir': [0, 0, 255], 'Autre': [10, 10, 10]}
@@ -59,9 +60,11 @@ class Picc_data(Element_To_Draw):
59
60
  if data_dir is None:
60
61
  data_dir = self.data_dir
61
62
 
63
+ data_dir = Path(data_dir)
64
+
62
65
  datafile = data_dir / self._filename_vector
63
66
 
64
- if datafile.exists():
67
+ if datafile.exists() and datafile.is_file():
65
68
  self.zones = Zones(data_dir / self._filename_vector, bbox = bbox, mapviewer=self.mapviewer, colors= self._colors)
66
69
  else:
67
70
  logging.info(_('File not found : {}').format(datafile))
@@ -118,6 +121,24 @@ class Picc_data(Element_To_Draw):
118
121
  else:
119
122
  logging.error(_('Point file not found : {}').format(pointfile))
120
123
 
124
+ if self.mapviewer is not None:
125
+ dlg = wx.FileDialog(None, _('Select a point file'), wildcard="Shapefile (*.shp)|*.shp|Gpkg (*.gpkg)|*.gpkg", style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
126
+ if dlg.ShowModal() == wx.ID_CANCEL:
127
+ dlg.Destroy()
128
+ return
129
+
130
+ pathname = dlg.GetPath()
131
+ dlg.Destroy()
132
+
133
+ try:
134
+ self._filename_points = Path(pathname)
135
+
136
+ self.cloud = cloud_vertices(pathname, bbox = bbox, mapviewer=self.mapviewer)
137
+ self.cloud.myprop.width = 3
138
+ self.cloud.myprop.color = getIfromRGB([0, 0, 255])
139
+ except:
140
+ logging.error(_('File not found : {}').format(pathname))
141
+
121
142
 
122
143
  def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
123
144
  """ Plot data in OpenGL context
@@ -132,10 +153,11 @@ class Picc_data(Element_To_Draw):
132
153
  """
133
154
 
134
155
  if self.zones is not None:
135
- self.zones.plot(sx=sx, sy=sy, xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax, size=size)
156
+ self.zones.plot(sx=sx, sy=sy, xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax, size=size)
136
157
  if self.cloud is not None:
137
158
  self.cloud.plot(sx=sx, sy=sy, xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax, size=size)
138
159
 
160
+
139
161
  def check_plot(self):
140
162
  """ Generic function responding to check operation from mapviewer """
141
163
 
@@ -153,7 +175,7 @@ class Picc_data(Element_To_Draw):
153
175
 
154
176
  self.mapviewer.Refresh()
155
177
 
156
- def uncheck_plot(self, unload: bool = True):
178
+ def uncheck_plot(self, unload: bool = True, reset_filename: bool = False):
157
179
  """ Generic function responding to uncheck operation from mapviewer """
158
180
 
159
181
  super().uncheck_plot(unload = unload)
@@ -162,6 +184,11 @@ class Picc_data(Element_To_Draw):
162
184
  self.zones = None
163
185
  self.cloud = None
164
186
 
187
+ if reset_filename:
188
+ self._filename_vector = ''
189
+ self._filename_points = ''
190
+ self.data_dir = Path(r'./data/PICC')
191
+
165
192
  def show_properties(self):
166
193
  """ Showing properties of the object """
167
194
 
@@ -201,6 +228,13 @@ class Picc_data(Element_To_Draw):
201
228
  else:
202
229
  logging.warning(_('No mapviewer to activate zone !'))
203
230
 
231
+ def extrude_polygons(self, dest_array: WolfArray):
232
+ """ Extrude the active polygon along the z-axis """
233
+
234
+ if self.zones is not None:
235
+ for curzone in self.zones.myzones:
236
+ dest_array.interpolate_on_polygons(curzone, keep = 'above')
237
+
204
238
  class Cadaster_data(Picc_data):
205
239
  """ Read and show cadaster data """
206
240
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wolfhece
3
- Version: 2.2.36
3
+ Version: 2.2.38
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  Project-URL: Homepage, https://uee.uliege.be/hece
6
6
  Project-URL: Issues, https://uee.uliege.be/hece
@@ -8,7 +8,7 @@ wolfhece/Model1D.py,sha256=snEmu8Uj2YGcp1ybPnly-4A389XRnuOujGduqInNcgw,477001
8
8
  wolfhece/PandasGrid.py,sha256=YIleVkUkoP2MjtQBZ9Xgwk61zbgMj4Pmjj-clVTfPRs,2353
9
9
  wolfhece/PyConfig.py,sha256=13DDWjJdohYHwn1uRVHB0s8Jcwq_b9pwcwbAr8NlZyc,19667
10
10
  wolfhece/PyCrosssections.py,sha256=2m372NSriH41AcIk723y2i44mwUXodbIMIzqkuVMjUY,127365
11
- wolfhece/PyDraw.py,sha256=yE3Cdhnr74yLnZBRN6vBu0xk3KXfg8Z5SA1P3jzORpM,688239
11
+ wolfhece/PyDraw.py,sha256=F2zS8Mf8H44JDsV-ZaXaMIGx3lSFDUIyCeoLDQYRAiU,690532
12
12
  wolfhece/PyGui.py,sha256=mcLuHT_pGjW1ltJ-kjNFstVXyeBoZRCvM3vHWv5srB8,148594
13
13
  wolfhece/PyGuiHydrology.py,sha256=sKafpOopBg50L5llZCI_fZtbebVTDtxvoRI6-osUwhg,14745
14
14
  wolfhece/PyHydrographs.py,sha256=1P5XAURNqCvtSsMQXhOn1ihjTpr725sRsZdlCEhhk6M,3730
@@ -16,8 +16,8 @@ wolfhece/PyPalette.py,sha256=SiRngKml2EXsq1jwQvqh5pBZiV1yS0CY7QrRJGSZD1s,36281
16
16
  wolfhece/PyParams.py,sha256=BgTAwxxq831rYEq_KLcFBX_upjiSUpVtfoQnCxCNWUI,100443
17
17
  wolfhece/PyPictures.py,sha256=5X2HBkZG1gTaMKMu6UoU-cOY8SRkFyPScJ8bhdoNY7g,18930
18
18
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
19
- wolfhece/PyVertex.py,sha256=a56oY1NB45QnwARg96Tbnq-z-mhZKFkYOkFOO1lNtlk,51056
20
- wolfhece/PyVertexvectors.py,sha256=-ksHufJpbCQwMW73fjs3LE0kfvc3K_TfjbFOUaTEL70,370360
19
+ wolfhece/PyVertex.py,sha256=dg6pqYRBlveodKhpg9YQv3zBPq2TS986HhyTtlZIXGU,51274
20
+ wolfhece/PyVertexvectors.py,sha256=1-XhaaLa8dmwM0524vaUqyEIBzzd4313oRFnWYCXCUo,375606
21
21
  wolfhece/PyWMS.py,sha256=XcSlav5icct2UwV7K2r7vpxa5rKZWiHkp732lI94HFI,31534
22
22
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
23
23
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
@@ -46,7 +46,7 @@ wolfhece/lifewatch.py,sha256=Q_Wy6VGkrD-xxY0fv3PKpT8U8oXxNMgiLlrAE3bMheo,16340
46
46
  wolfhece/matplotlib_fig.py,sha256=vnFI6sghw9N9jKhR8X1Z4aWli_5fPNylZQtFuujFJDY,84075
47
47
  wolfhece/multiprojects.py,sha256=Sd6Bl6YP33jlR79A6rvSLu23vq8sqbFYL8lWuVPkEpE,21549
48
48
  wolfhece/os_check.py,sha256=SUHyUZ_tuRDvL995LFoJ6ncE91HcYpd9xN8Tfcg4RUA,316
49
- wolfhece/picc.py,sha256=0X_pzhSBoVxgtTfJ37pkOQO3Vbr9yurPaD1nVeurx8k,8531
49
+ wolfhece/picc.py,sha256=2haBqyY7tMphyifIPafPjC7ZnxZRcD585DDkgEFLATw,9988
50
50
  wolfhece/pidcontroller.py,sha256=PHYenOdzfyPK2pXAhyRolCxMSMRd2AFza0eVMafpPHk,5205
51
51
  wolfhece/pyGui1D.py,sha256=9g7OS3YiKsqy--6y0cBD7x2gaqTTYFXWkxImpgnTA20,121937
52
52
  wolfhece/pybridges.py,sha256=bFAqjL4ColeJtwvyCPGQ8VllWoq1RbVWXxFrdfrvqm8,65954
@@ -89,7 +89,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
89
89
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
90
90
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
91
91
  wolfhece/apps/splashscreen.py,sha256=EdGDN9NhudIiP7c3gVqj7dp4MWFB8ySizM_tpMnsgpE,3091
92
- wolfhece/apps/version.py,sha256=VBzF5NhnicGf2DpF1l5niAxswGFUsu6LAzTRFunDAvg,388
92
+ wolfhece/apps/version.py,sha256=zSOtAk-adGkIXfloe0DaNJen1MYZBxqVeiHCM9qL5Gc,388
93
93
  wolfhece/apps/wolf.py,sha256=mRnjYsUu4KIsRuamdQWAINFMuwN4eJgMo9erG-hkZ70,729
94
94
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
95
95
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -144,17 +144,19 @@ wolfhece/hydrology/PyWatershed.py,sha256=a26M6tVe4hrQ-a8FyAx7H9-RZcVCU5BBzFff4_Y
144
144
  wolfhece/hydrology/RetentionBasin.py,sha256=vFvpnomo5h8ZWq3Hq-YlxRnyqyQqHrojABMKzu3RP6E,83358
145
145
  wolfhece/hydrology/SubBasin.py,sha256=ORK1VmvBOfyDjfOTxFQ9bcHe78pAoVcRWwu5Vm-CDHo,181790
146
146
  wolfhece/hydrology/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- wolfhece/hydrology/constant.py,sha256=0o6l8zwLESlW6G9vYNFlUJV4YhcDq6_jnCN28DNchmU,1634
147
+ wolfhece/hydrology/climate_data.py,sha256=CYCs0ViP389-lbYKeOFSYjPdwvKlHWdMs0RePsl6c2w,13418
148
+ wolfhece/hydrology/constant.py,sha256=tP-AHRzXNKLtVI3VuqG8Q_tQ0-P5mrX_zFlznB6OeHo,2526
148
149
  wolfhece/hydrology/cst_exchanges.py,sha256=yT2cSIXjlfshPkSAdhyBxYwCPZ5L9s75BYM24tEO6_4,39699
149
150
  wolfhece/hydrology/data_treatment.py,sha256=vHNtEvXHJOdGHjaNjbTTvVoFQjVee-AdspJEesxVNuQ,34967
150
151
  wolfhece/hydrology/forcedexchanges.py,sha256=MrzMqKISX6G6t3XwkyFQa6tVFfTTC8ifm_nSvrOy5-8,2259
152
+ wolfhece/hydrology/hyetograms.py,sha256=E24e3zDIfzBk0C-djI61pL6D7G3BVGtpXNTP4UqjIXw,83393
151
153
  wolfhece/hydrology/plot_hydrology.py,sha256=M1cujLxA03SG8P7CkIPVIsrbfsbCwZPpLHQHN2xxm4w,35708
152
154
  wolfhece/hydrology/read.py,sha256=BaaIp1x44wPQz2LkWtzu7ZNKx3Gw_WDtAw-B4y_C2IU,9553
153
155
  wolfhece/hydrology/slope_manager.py,sha256=vlek0z8qcqB61eleiksyOe3QR1vpbtwfeowy6ms7_Fg,5580
154
156
  wolfhece/hydrology/wolfMap_treatment.py,sha256=eAxr24zJGwmDof1aZpcxewVvv_bWDvoO8t9Wwf99Mlo,10606
155
157
  wolfhece/hydrometry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
- wolfhece/hydrometry/kiwis.py,sha256=HDsTZenqG5La4t0Rv9iJeScH_j07w2k3J5fMlj74jI8,64491
157
- wolfhece/hydrometry/kiwis_gui.py,sha256=xubayI3ijq87l47pcVtP-D9mOGurOSu9rKz511oa7n0,24898
158
+ wolfhece/hydrometry/kiwis.py,sha256=UEShGBMHMqxMj58304GFt_SAoaACZi4PhJVEC8MpZ-E,65130
159
+ wolfhece/hydrometry/kiwis_gui.py,sha256=s4xCsqkKvI1YcIZ4X2A7hV11zyJFI8Q_4i82jOO6_ys,25060
158
160
  wolfhece/hydrometry/kiwis_wolfgui.py,sha256=GPa5YNp2V2ZlxYQjPiCXERgPuWB_zij4ec2yHpRvoFA,4027
159
161
  wolfhece/icons/folder_open.png,sha256=ykBlU2FtGcpjAu1YO4_eGlDg2svgs_IAs-4d5O2e3AM,2329
160
162
  wolfhece/icons/folder_plus.png,sha256=Z1Jcs87Z6pNcudxGDTNhC_hgolSSaXe6_fmQE_n-ero,1963
@@ -308,8 +310,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=u4C7CXe_bUyGKx7c_Bi0x9
308
310
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
309
311
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
310
312
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
311
- wolfhece-2.2.36.dist-info/METADATA,sha256=PcT7osVZ0AdB24tdvLvyBzA0_88Zmx2WyHyY3FhFs0c,2729
312
- wolfhece-2.2.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
313
- wolfhece-2.2.36.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
314
- wolfhece-2.2.36.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
315
- wolfhece-2.2.36.dist-info/RECORD,,
313
+ wolfhece-2.2.38.dist-info/METADATA,sha256=-p1k0cf0vU1Z873clKqpbu4YwhoQTcXLhqqLXtyNz9M,2729
314
+ wolfhece-2.2.38.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
315
+ wolfhece-2.2.38.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
316
+ wolfhece-2.2.38.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
317
+ wolfhece-2.2.38.dist-info/RECORD,,