wolfhece 2.2.42__py3-none-any.whl → 2.2.43__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/apps/version.py +1 -1
- wolfhece/pywalous.py +146 -2
- {wolfhece-2.2.42.dist-info → wolfhece-2.2.43.dist-info}/METADATA +1 -1
- {wolfhece-2.2.42.dist-info → wolfhece-2.2.43.dist-info}/RECORD +7 -7
- {wolfhece-2.2.42.dist-info → wolfhece-2.2.43.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.42.dist-info → wolfhece-2.2.43.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.42.dist-info → wolfhece-2.2.43.dist-info}/top_level.txt +0 -0
wolfhece/apps/version.py
CHANGED
wolfhece/pywalous.py
CHANGED
@@ -22,6 +22,8 @@ import wx.grid
|
|
22
22
|
|
23
23
|
from .PyTranslate import _
|
24
24
|
from .PyPalette import wolfpalette
|
25
|
+
from .wolf_array import WolfArray, header_wolf
|
26
|
+
|
25
27
|
|
26
28
|
"""
|
27
29
|
Hydrology classification for Land Use in Wallonia:
|
@@ -339,8 +341,8 @@ class Walous_data():
|
|
339
341
|
|
340
342
|
"""
|
341
343
|
|
342
|
-
self._dir = dir_data # directory of the data
|
343
|
-
self._fn = fn # filename without extension
|
344
|
+
self._dir = str(dir_data) # directory of the data
|
345
|
+
self._fn = str(fn) # filename without extension
|
344
346
|
self._extension = extension # extension of the file
|
345
347
|
self._gdf = None # geopandas dataframe
|
346
348
|
|
@@ -402,6 +404,8 @@ class Walous_data():
|
|
402
404
|
|
403
405
|
chdir(detsdir)
|
404
406
|
|
407
|
+
fnout = str((Path(fnout)).with_suffix(self._extension))
|
408
|
+
|
405
409
|
self._gdf.to_file(basename(fnout))
|
406
410
|
|
407
411
|
chdir(curdir)
|
@@ -753,3 +757,143 @@ class Walous_OCS_Legend(wx.Dialog):
|
|
753
757
|
|
754
758
|
def close(self):
|
755
759
|
self.Destroy()
|
760
|
+
|
761
|
+
|
762
|
+
def get_array_WALOUS_OCS(fname:Path, spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]]) -> Union[WolfArray, None]:
|
763
|
+
""" Get WALOUS OCS as WolfArray
|
764
|
+
|
765
|
+
:param fname: path to the WALOUS OCS file
|
766
|
+
:param spatial_res: desired spatial resolution (in m)
|
767
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
768
|
+
:return: WolfArray or None if error
|
769
|
+
"""
|
770
|
+
|
771
|
+
if not fname.exists():
|
772
|
+
logging.error(_('WALOUS OCS file not found: {}').format(fname))
|
773
|
+
return None
|
774
|
+
|
775
|
+
# Convert bounds to [[xmin, xmax], [ymin, ymax]] if needed
|
776
|
+
if len(bounds)==4:
|
777
|
+
bounds = [[bounds[0], bounds[2]], [bounds[1], bounds[3]]]
|
778
|
+
|
779
|
+
# Convert bvounds to list to be able to modify it
|
780
|
+
bounds = [list(bounds[0]), list(bounds[1])]
|
781
|
+
|
782
|
+
bounds_copy = [list(bounds[0]), list(bounds[1])]
|
783
|
+
|
784
|
+
header_OCS = header_wolf.read_header(fname)
|
785
|
+
if header_OCS.dx != spatial_res:
|
786
|
+
# Adapt bounds to ensure that the rebin will be correct.
|
787
|
+
# If spatial_res is a multiple of header_OCS.dx, no need to change bounds.
|
788
|
+
# If not, change the bounds to ensure that the crop will include data in all footprints.
|
789
|
+
|
790
|
+
if (bounds[0][0] - header_OCS.origx) % header_OCS.dx != 0:
|
791
|
+
bounds[0][0] = header_OCS.origx + ((bounds[0][0] - header_OCS.origx) // header_OCS.dx) * header_OCS.dx
|
792
|
+
if (bounds[0][1] - bounds[0][0]) % header_OCS.dx != 0:
|
793
|
+
bounds[0][1] = bounds[0][0] + ((bounds[0][1] - bounds[0][0]) // header_OCS.dx + 1) * header_OCS.dx
|
794
|
+
if (bounds[1][0] - header_OCS.origy) % header_OCS.dy != 0:
|
795
|
+
bounds[1][0] = header_OCS.origy + ((bounds[1][0] - header_OCS.origy) // header_OCS.dy) * header_OCS.dy
|
796
|
+
if (bounds[1][1] - bounds[1][0]) % header_OCS.dy != 0:
|
797
|
+
bounds[1][1] = bounds[1][0] + ((bounds[1][1] - bounds[1][0]) // header_OCS.dy + 1) * header_OCS.dy
|
798
|
+
|
799
|
+
locwalous = WolfArray(fname=fname, crop = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]])
|
800
|
+
|
801
|
+
if locwalous.dx != spatial_res:
|
802
|
+
locwalous.rebin(spatial_res / locwalous.dx, operation='min')
|
803
|
+
logging.info(_('Rebin to {} m because original data are {} m').format(spatial_res, locwalous.dx))
|
804
|
+
locwalous = WolfArray(mold=locwalous, crop = bounds_copy)
|
805
|
+
|
806
|
+
return locwalous
|
807
|
+
|
808
|
+
def get_array_WALOUS_OCS_2023_10m(spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]]) -> Union[WolfArray, None]:
|
809
|
+
""" Get WALOUS OCS 2023 as WolfArray
|
810
|
+
|
811
|
+
:param spatial_res: desired spatial resolution (in m)
|
812
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
813
|
+
:return: WolfArray or None if error
|
814
|
+
"""
|
815
|
+
|
816
|
+
from wolfhece.pydownloader import toys_dataset
|
817
|
+
|
818
|
+
fname = toys_dataset(dir='Walous_OCS', file='WALOUS_2023_lbt72_10m.tif')
|
819
|
+
|
820
|
+
return get_array_WALOUS_OCS(fname, spatial_res, bounds)
|
821
|
+
|
822
|
+
def get_array_WALOUS_OCS_2023_4m(spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]]) -> Union[WolfArray, None]:
|
823
|
+
""" Get WALOUS OCS 2023 as WolfArray
|
824
|
+
|
825
|
+
:param spatial_res: desired spatial resolution (in m)
|
826
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
827
|
+
:return: WolfArray or None if error
|
828
|
+
"""
|
829
|
+
|
830
|
+
from wolfhece.pydownloader import toys_dataset
|
831
|
+
|
832
|
+
fname = toys_dataset(dir='Walous_OCS', file='WALOUS_2023_lbt72_4m.tif')
|
833
|
+
|
834
|
+
return get_array_WALOUS_OCS(fname, spatial_res, bounds)
|
835
|
+
|
836
|
+
def get_array_WALOUS_OCS_2020_10m(spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]]) -> Union[WolfArray, None]:
|
837
|
+
""" Get WALOUS OCS 2020 as WolfArray
|
838
|
+
|
839
|
+
:param spatial_res: desired spatial resolution (in m)
|
840
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
841
|
+
:return: WolfArray or None if error
|
842
|
+
"""
|
843
|
+
|
844
|
+
from wolfhece.pydownloader import toys_dataset
|
845
|
+
|
846
|
+
fname = toys_dataset(dir='Walous_OCS', file='WALOUS_2020_lbt72_10m.tif')
|
847
|
+
|
848
|
+
return get_array_WALOUS_OCS(fname, spatial_res, bounds)
|
849
|
+
|
850
|
+
def get_array_WALOUS_OCS_2020_4m(spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]]) -> Union[WolfArray, None]:
|
851
|
+
""" Get WALOUS OCS 2020 as WolfArray
|
852
|
+
|
853
|
+
:param spatial_res: desired spatial resolution (in m)
|
854
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
855
|
+
:return: WolfArray or None if error
|
856
|
+
"""
|
857
|
+
|
858
|
+
from wolfhece.pydownloader import toys_dataset
|
859
|
+
|
860
|
+
fname = toys_dataset(dir='Walous_OCS', file='WALOUS_2020_lbt72_4m.tif')
|
861
|
+
|
862
|
+
return get_array_WALOUS_OCS(fname, spatial_res, bounds)
|
863
|
+
|
864
|
+
def get_array_WALOUS_UTS(fname:Path, fnout:Path, spatial_res:float, bounds:Union[list[float, float, float, float],list[list[float, float], list[float, float]]], which:Literal['UTS_MAJ_NIV1', 'UTS_MAJ_NIV2'] = 'UTS_MAJ_NIV1') -> Union[WolfArray, None]:
|
865
|
+
""" Get WALOUS UTS as WolfArray
|
866
|
+
|
867
|
+
:param fname: path to the WALOUS UTS file
|
868
|
+
:param spatial_res: desired spatial resolution (in m)
|
869
|
+
:param bounds: [xmin, ymin, xmax, ymax] or [[xmin, xmax], [ymin, ymax]]
|
870
|
+
:param which: which level to use ('UTS_MAJ_NIV1' or 'UTS_MAJ_NIV2')
|
871
|
+
:return: WolfArray or None if error
|
872
|
+
"""
|
873
|
+
|
874
|
+
fname = Path(fname)
|
875
|
+
fnout = Path(fnout)
|
876
|
+
|
877
|
+
if not fname.exists():
|
878
|
+
logging.error(_('WALOUS UTS file not found: {}').format(fname))
|
879
|
+
return None
|
880
|
+
|
881
|
+
# Convert bounds to [[xmin, xmax], [ymin, ymax]] if needed
|
882
|
+
if len(bounds)==4:
|
883
|
+
bounds = [[bounds[0], bounds[2]], [bounds[1], bounds[3]]]
|
884
|
+
|
885
|
+
# Convert bvounds to list to be able to modify it
|
886
|
+
bounds = [list(bounds[0]), list(bounds[1])]
|
887
|
+
|
888
|
+
bounds_copy = [list(bounds[0]), list(bounds[1])]
|
889
|
+
|
890
|
+
locwalous = Walous_data(fname.parent, fname.name, extension=fname.suffix, bounds=bounds)
|
891
|
+
ret = locwalous.rasterize(bounds=bounds, layer= which, fn_out=fnout.with_suffix('.tif'), pixel_size=spatial_res)
|
892
|
+
|
893
|
+
ret = Path(ret)
|
894
|
+
|
895
|
+
if ret.exists():
|
896
|
+
locwalous_array = WolfArray(fname=ret)
|
897
|
+
return locwalous_array
|
898
|
+
else:
|
899
|
+
return None
|
@@ -61,7 +61,7 @@ wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
|
|
61
61
|
wolfhece/pypolygons_scen.py,sha256=NWaNeK0RSUeOkgukeogK9FLmQiDjGZ9yhqs9208fojM,46237
|
62
62
|
wolfhece/pyshields.py,sha256=KMtUO5kD0lisKnJD1NsDz-qaY5DpFcmS4O3WkXtUSmo,27898
|
63
63
|
wolfhece/pyviews.py,sha256=zuZjWUptRDm1MTE1PN4Xj_qSITnojgDMG0LlFIBH3SE,13739
|
64
|
-
wolfhece/pywalous.py,sha256=
|
64
|
+
wolfhece/pywalous.py,sha256=qF_hzmVFBjM3JP6RV4tbKEVTBsiOGcBJ_O82uoX2Rxg,38595
|
65
65
|
wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
66
66
|
wolfhece/textpillow.py,sha256=7hgfsLYAaE_rNKD-g8xsON8sdWvoV8vbqnGGxIayShE,14137
|
67
67
|
wolfhece/tools2d_dll.py,sha256=TfvvmyZUqEZIH0uHwUCJf0bdmCks_AiidDt23Unsp5w,13550
|
@@ -95,7 +95,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
95
95
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
96
96
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
97
97
|
wolfhece/apps/splashscreen.py,sha256=EdGDN9NhudIiP7c3gVqj7dp4MWFB8ySizM_tpMnsgpE,3091
|
98
|
-
wolfhece/apps/version.py,sha256=
|
98
|
+
wolfhece/apps/version.py,sha256=kWgIrbzo3PaJpeEetSvb9-zhutuO1cGL5wg1gqsJFDM,388
|
99
99
|
wolfhece/apps/wolf.py,sha256=mRnjYsUu4KIsRuamdQWAINFMuwN4eJgMo9erG-hkZ70,729
|
100
100
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
101
101
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -320,8 +320,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=u4C7CXe_bUyGKx7c_Bi0x9
|
|
320
320
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
321
321
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
322
322
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
323
|
-
wolfhece-2.2.
|
324
|
-
wolfhece-2.2.
|
325
|
-
wolfhece-2.2.
|
326
|
-
wolfhece-2.2.
|
327
|
-
wolfhece-2.2.
|
323
|
+
wolfhece-2.2.43.dist-info/METADATA,sha256=6-h2-a9g7o3Tg99jRn5s_izELlJ5gWaMZSPzG6SlW0A,2785
|
324
|
+
wolfhece-2.2.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
325
|
+
wolfhece-2.2.43.dist-info/entry_points.txt,sha256=Jr187pyvA3EeJiQLjZK9yo6mJX7IAn6ygZU9T8qF_gQ,658
|
326
|
+
wolfhece-2.2.43.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
327
|
+
wolfhece-2.2.43.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|