geoloop 1.0.1__py3-none-any.whl → 1.0.2__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.
geoloop/configuration.py CHANGED
@@ -19,6 +19,8 @@ class LithologyConfig(BaseModel):
19
19
  Path to the JSON configuration file that created this object.
20
20
  out_dir_lithology : str or Path
21
21
  Directory where lithology outputs will be written.
22
+ lithology_properties_path: str or Path
23
+ Path to the Excel table with lithology properties.
22
24
  borehole_lithology_path : str or Path
23
25
  Path to the Excel or CSV file containing lithology data.
24
26
  borehole_lithology_sheetname : str
@@ -48,6 +50,7 @@ class LithologyConfig(BaseModel):
48
50
  config_file_path: str | Path
49
51
  out_dir_lithology: str | Path
50
52
  input_dir_lithology: str | Path
53
+ lithology_properties_path: str |Path | None = None
51
54
  borehole_lithology_path: str | Path
52
55
  borehole_lithology_sheetname: str
53
56
  out_table: str
@@ -89,6 +92,23 @@ class LithologyConfig(BaseModel):
89
92
  if not isinstance(self.out_dir_lithology, Path):
90
93
  self.out_dir_lithology = base_dir_lithology / Path(self.out_dir_lithology)
91
94
 
95
+ # Lithology properties table
96
+ # Resolve user-supplied path
97
+ if self.lithology_properties_path is not None:
98
+ if not isinstance(self.lithology_properties_path, Path):
99
+ self.lithology_properties_path = Path(self.lithology_properties_path)
100
+
101
+ if not self.lithology_properties_path.is_absolute():
102
+ self.lithology_properties_path = (
103
+ base_dir_lithology / self.lithology_properties_path
104
+ ).resolve()
105
+
106
+ if not self.lithology_properties_path.exists():
107
+ raise FileNotFoundError(
108
+ f"Lithology properties file not found: "
109
+ f"{self.lithology_properties_path}"
110
+ )
111
+
92
112
  return self
93
113
 
94
114
 
geoloop/constants.py CHANGED
@@ -1,20 +1,3 @@
1
- from pathlib import Path
2
-
3
- repo_path = Path(__file__).parent.parent.parent
4
-
5
- # Test directories
6
- test_dir = repo_path / "test"
7
- tests_input_path = test_dir / "input"
8
- test_output_path = test_dir / "output"
9
-
10
- # Resources directory
11
- resources_path = repo_path / "resources"
12
-
13
- # Lithology resources directory
14
- lithology_properties_xlsx = (
15
- resources_path / "lithology_properties" / "lithology_properties.xlsx"
16
- )
17
-
18
1
  # Dictionary of units for various parameters in the model.
19
2
  units_dict = {
20
3
  "Q_b": "W",
@@ -1,12 +1,12 @@
1
1
  import math
2
2
  from pathlib import Path
3
+ from importlib.resources import files
3
4
 
4
5
  import numpy as np
5
6
  import pandas as pd
6
7
  import xarray as xr
7
8
 
8
9
  from geoloop.configuration import LithologyConfig
9
- from geoloop.constants import lithology_properties_xlsx
10
10
  from geoloop.geoloopcore.strat_interpolator import TgInterpolator
11
11
 
12
12
 
@@ -257,6 +257,7 @@ class ProcessLithologyToThermalConductivity:
257
257
 
258
258
  def __init__(
259
259
  self,
260
+ lithology_properties_df: pd.DataFrame,
260
261
  borehole_df: pd.DataFrame,
261
262
  Tg: float,
262
263
  Tgrad: float,
@@ -270,8 +271,7 @@ class ProcessLithologyToThermalConductivity:
270
271
  out_table: str,
271
272
  read_from_table: bool,
272
273
  ) -> None:
273
- # Read lithology properties reference table (Excel)
274
- self.lithology_props_df = pd.read_excel(lithology_properties_xlsx)
274
+ self.lithology_props_df = lithology_properties_df
275
275
 
276
276
  self.borehole_df = borehole_df
277
277
  self.lithology_props_dict = self.create_lithology_props_dict()
@@ -385,12 +385,22 @@ class ProcessLithologyToThermalConductivity:
385
385
  Initialized instance.
386
386
  """
387
387
 
388
- borehole_path = config.borehole_lithology_path
388
+ # Read borehole lithology table (Excel)
389
389
  borehole_df = pd.read_excel(
390
- borehole_path, sheet_name=config.borehole_lithology_sheetname
390
+ config.borehole_lithology_path, sheet_name=config.borehole_lithology_sheetname
391
391
  )
392
+ # Read lithology properties reference table (Excel)
393
+ if config.lithology_properties_path is not None:
394
+ lithology_properties_df = pd.read_excel(
395
+ config.lithology_properties_path
396
+ )
397
+ else:
398
+ lithology_properties_df = pd.read_excel(
399
+ files("geoloop.lithology.resources").joinpath("lithology_properties.xlsx")
400
+ )
392
401
 
393
402
  return cls(
403
+ lithology_properties_df=lithology_properties_df,
394
404
  borehole_df=borehole_df,
395
405
  Tg=config.Tg,
396
406
  Tgrad=config.Tgrad,
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geoloop
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: This is a Python package for simulation of (deep) vertical Borehole Heat Exchanger (BHE) systems
5
5
  Author-email: Zanne Korevaar <zanne.korevaar@tno.nl>, Jan-Diederik van Wees <jan_diederik.vanwees@tno.nl>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  geoloop/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- geoloop/configuration.py,sha256=hYpskvpol_82Ai5RsGTcH7zBWLX8SYSSFSF0NBs21ig,33131
3
- geoloop/constants.py,sha256=F2fsh3e35Fp8AqNguPba6W96jaIAfsWazk1d6uzKi6I,2698
2
+ geoloop/configuration.py,sha256=dhiqW326YYxZLT9-hdiKG5_UqVUIhCETnNOyjxl-xb4,34052
3
+ geoloop/constants.py,sha256=v_U88LpjxQCBq-7wv8XCprNqa4XTpsNFW7XLKFC2cuw,2276
4
4
  geoloop/axisym/AxisymetricEL.py,sha256=uGERxWzt9PIixzyYqK_v2kBuOEye6ZhqqXVBBEbrRig,28218
5
5
  geoloop/axisym/__init__.py,sha256=s3Suw3X0GzuQKGvR1ia6RCYGa43Az8g4gtRgedkf2b0,84
6
6
  geoloop/bin/Flowdatamain.py,sha256=vwVn7y9jPH-6RU2_eH2tWLvcsbFFHDxi8APoQ5ug1J0,2566
@@ -28,7 +28,8 @@ geoloop/geoloopcore/soilproperties.py,sha256=vpH5Iq7Uuf1AX2wEqWEAv9J8w9nQqh-CfEA
28
28
  geoloop/geoloopcore/strat_interpolator.py,sha256=BB-xMA5Py3QOOoAdZMZBnxsuGpEug9xCfvuE7ZL6Ysk,6071
29
29
  geoloop/lithology/__init__.py,sha256=Nwcc5G-DCpBQjTIn2VK0Rvm2HDs3cc8gjXUAjRg7DmU,158
30
30
  geoloop/lithology/plot_lithology.py,sha256=SyOYH6hEAhMz8f4qk9XlofEVG7cEpOtBxOwgh6uEeQ0,9477
31
- geoloop/lithology/process_lithology.py,sha256=LjNKJ77PKnrZlvBZ27Lt7kiFdjj8X5CVe39Obb9dPgM,26327
31
+ geoloop/lithology/process_lithology.py,sha256=F4Z7gTJRzU_P46EFUW7tsdBGfY1wI13vxvvUH3ntAHo,26765
32
+ geoloop/lithology/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
33
  geoloop/loadflowdata/__init__.py,sha256=5LO-5fjkWkw50gOuLwDIY2oZHojguTdKJrOtuHHVFPo,138
33
34
  geoloop/loadflowdata/flow_data.py,sha256=FM9QZ-oK0zSrMTfTTOjjifP4G5F5sAiWHhnSpRVGaaw,5395
34
35
  geoloop/loadflowdata/loadprofile.py,sha256=a0sMkNfqs-YDMwuLreX1Oy3L_yF4aciziHBthsnEvMM,9746
@@ -38,9 +39,9 @@ geoloop/plotting/load_data.py,sha256=7-HGOLV4e-_D8PShTljMSbehRrX10vok6aTjenrfOYM
38
39
  geoloop/utils/RunManager.py,sha256=_teQvHJ5ET5STjTv1YZbYUD4I9lC6xPpACL5zer7nas,5861
39
40
  geoloop/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
41
  geoloop/utils/helpers.py,sha256=Xrowd6t1nUUsU642y2bD3haKtNs0Zi8cCR8PtIFqAug,32139
41
- geoloop-1.0.1.dist-info/licenses/LICENSE.md,sha256=0MhY1_Mi2BnmfY4sG2hMfaIQBsGbCR-_jPNOQ2wjnaI,582
42
- geoloop-1.0.1.dist-info/METADATA,sha256=ANOyDCdRzvdS5doWu2VF-4fa8R2S3--Y8toow1Jy0kA,4302
43
- geoloop-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
- geoloop-1.0.1.dist-info/entry_points.txt,sha256=MK2kD_B90zZfZN-kUVrfQyJZqorcgg1WYLe7CSgvfHc,56
45
- geoloop-1.0.1.dist-info/top_level.txt,sha256=V20v-HNxFxZn9Tguuo4KZFG3c9Kn4D4w06tL1tlRbwE,8
46
- geoloop-1.0.1.dist-info/RECORD,,
42
+ geoloop-1.0.2.dist-info/licenses/LICENSE.md,sha256=0MhY1_Mi2BnmfY4sG2hMfaIQBsGbCR-_jPNOQ2wjnaI,582
43
+ geoloop-1.0.2.dist-info/METADATA,sha256=iniZ8EQ_-5rm7qvJ6Zqlg7eA2DqIPOfvw1I_WhECR5w,4302
44
+ geoloop-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
+ geoloop-1.0.2.dist-info/entry_points.txt,sha256=MK2kD_B90zZfZN-kUVrfQyJZqorcgg1WYLe7CSgvfHc,56
46
+ geoloop-1.0.2.dist-info/top_level.txt,sha256=V20v-HNxFxZn9Tguuo4KZFG3c9Kn4D4w06tL1tlRbwE,8
47
+ geoloop-1.0.2.dist-info/RECORD,,