wolfhece 2.1.112__py3-none-any.whl → 2.1.114__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 +1 -1
- wolfhece/PyVertexvectors.py +57 -4
- wolfhece/acceptability/acceptability_gui.py +244 -244
- wolfhece/apps/version.py +1 -1
- wolfhece/irm_qdf.py +34 -7
- wolfhece/mar/commontools.py +203 -196
- wolfhece/wolf_array.py +53 -14
- {wolfhece-2.1.112.dist-info → wolfhece-2.1.114.dist-info}/METADATA +1 -2
- {wolfhece-2.1.112.dist-info → wolfhece-2.1.114.dist-info}/RECORD +12 -12
- {wolfhece-2.1.112.dist-info → wolfhece-2.1.114.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.112.dist-info → wolfhece-2.1.114.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.112.dist-info → wolfhece-2.1.114.dist-info}/top_level.txt +0 -0
wolfhece/apps/version.py
CHANGED
wolfhece/irm_qdf.py
CHANGED
@@ -271,8 +271,16 @@ class Qdf_IRM():
|
|
271
271
|
|
272
272
|
self.store = store_path
|
273
273
|
|
274
|
+
|
275
|
+
# This one will hold Qdf data of one locality. If it is None it means no
|
276
|
+
# data has been loaded.
|
277
|
+
self.qdf = None
|
278
|
+
|
274
279
|
if force_import:
|
275
|
-
|
280
|
+
# Import all QDF's from IRM
|
281
|
+
Qdf_IRM.importfromwebsite(store_path, ins=ins)
|
282
|
+
self._code = None
|
283
|
+
self._name = None
|
276
284
|
|
277
285
|
if code !=0:
|
278
286
|
if self.ins_read_excel(code=str(code)):
|
@@ -289,6 +297,11 @@ class Qdf_IRM():
|
|
289
297
|
else:
|
290
298
|
logging.debug(f"Name {name} not found in the store")
|
291
299
|
|
300
|
+
def has_data_for_locality(self) -> bool:
|
301
|
+
""" Has this instance been initialized with data from a locality ?
|
302
|
+
"""
|
303
|
+
return self.qdf is not None
|
304
|
+
|
292
305
|
@property
|
293
306
|
def name(self):
|
294
307
|
return self._name
|
@@ -326,8 +339,8 @@ class Qdf_IRM():
|
|
326
339
|
|
327
340
|
|
328
341
|
@classmethod
|
329
|
-
def importfromwebsite(cls, store_path= 'irm', verbose:bool= False, waitingtime:float= .01, ins:Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018):
|
330
|
-
""" Import Excel files for all municipalities from the IRM website
|
342
|
+
def importfromwebsite(cls, store_path= 'irm', verbose:bool= False, waitingtime:float= .01, ins:Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018, ins_code: int = None):
|
343
|
+
""" Import Excel files for one or all municipalities from the IRM website
|
331
344
|
|
332
345
|
:param store_path: Where to store the downloaded data. Directory will be created if it doesn't exists.
|
333
346
|
:param verbose: If `True`, will print some progress information.
|
@@ -339,29 +352,43 @@ class Qdf_IRM():
|
|
339
352
|
of each station (will make sure we don't overwhelm IRM's website).
|
340
353
|
|
341
354
|
:param ins: The year of the INS codes to use.
|
355
|
+
:param code: Restricts the data download to a specific NIS code. `None` means full download.
|
342
356
|
"""
|
343
357
|
import requests
|
344
358
|
|
345
359
|
myloc = Localities(ins)
|
346
360
|
|
347
|
-
if not
|
348
|
-
|
361
|
+
if ins_code is not None:
|
362
|
+
codes_to_load = [ins_code]
|
363
|
+
else:
|
364
|
+
if not path.exists(store_path):
|
365
|
+
mkdir(store_path)
|
366
|
+
codes_to_load = myloc.inscode2name
|
349
367
|
|
350
|
-
for key,myins in enumerate(
|
368
|
+
for key,myins in enumerate(codes_to_load):
|
351
369
|
#chaîne URL du fichier Excel
|
352
370
|
url="https://www.meteo.be//resources//climatology//climateCity//xls//IDF_table_INS"+str(myins)+".xlsx"
|
353
371
|
#Obtention du fichiers depuis le site web de l'IRM
|
354
372
|
response=requests.get(url)
|
355
373
|
|
356
374
|
if str(response.content).find("Page not found")==-1 :
|
375
|
+
|
376
|
+
# Make sure we create the store path only if we have
|
377
|
+
# something to put inside.
|
378
|
+
if ins_code is not None and not path.exists(store_path):
|
379
|
+
mkdir(store_path)
|
380
|
+
|
357
381
|
file=open(path.join(store_path,str(myins)+".xlsx"), 'wb')
|
358
382
|
file.write(response.content)
|
359
383
|
file.close()
|
360
384
|
if verbose:
|
361
385
|
if callable(verbose):
|
362
|
-
verbose(key/len(
|
386
|
+
verbose(key/len(codes_to_load))
|
363
387
|
else:
|
364
388
|
print(myins)
|
389
|
+
else:
|
390
|
+
#logging.error(response.content)
|
391
|
+
logging.error(f"Failed to load IRM data: {url} --> {response}")
|
365
392
|
|
366
393
|
sleep(waitingtime)
|
367
394
|
|