gimu 0.2.0__py3-none-any.whl → 0.3.0__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.
gimu/gmf/data.py CHANGED
@@ -11,6 +11,29 @@ import json
11
11
  import os
12
12
  from collections import OrderedDict
13
13
 
14
+
15
+ class WellData(dict):
16
+ def __init__(self, *args, **kwargs):
17
+ super().__init__(*args, **kwargs)
18
+
19
+ def downhole_temperature(self, date_str):
20
+ """ get direct access to data without fluff """
21
+ try:
22
+ raw_data = self['Downhole_Temperature'][date_str]['Data']
23
+ except KeyError as e:
24
+ print(f"Data '{date_str}' does not exist in {self['Well_Name']}")
25
+ print(f"-> available data set are: {list(self['Downhole_Temperature'].keys())}")
26
+ raise e
27
+ elevs, temps = [], []
28
+ for elev_str, temp in raw_data.items():
29
+ elev = float(elev_str)
30
+ elevs.append(elev)
31
+ temps.append(temp)
32
+
33
+ # TODO takes care of units in GMF
34
+ return elevs, temps
35
+
36
+
14
37
  class DataJSON:
15
38
  def __init__(self, max_cache_size=10):
16
39
  self._data_folders = []
@@ -44,7 +67,7 @@ class DataJSON:
44
67
  file_path = os.path.join(folder, f"{well_name}_data.json")
45
68
  if os.path.exists(file_path):
46
69
  with open(file_path, 'r') as f:
47
- data = json.load(f)
70
+ data = WellData(json.load(f))
48
71
 
49
72
  if len(self._cache) >= self._max_cache_size:
50
73
  self._cache.popitem(last=False)
@@ -52,7 +75,10 @@ class DataJSON:
52
75
  self._cache[well_name] = data
53
76
  return data
54
77
 
55
- raise KeyError(f"Well '{well_name}' not found in any of the data folders.")
78
+ msg = '\n',join([
79
+ f"Well '{well_name}' not found in any of the data folders:",
80
+ ] + [f" {f}" for f in self._data_folders])
81
+ raise KeyError(msg)
56
82
 
57
83
  def __contains__(self, well_name):
58
84
  if well_name in self._cache:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gimu
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A toolkit and python library for modelling at Geothermal Institute, University of Auckland.
5
5
  Project-URL: Documentation, https://github.com/cyeh015/gimu/blob/main/README.md
6
6
  Project-URL: Issues, https://github.com/cyeh015/gimu/issues
@@ -8,9 +8,9 @@ gimu/t2listingh5.py,sha256=sepCah3lV6etWr-aJ_Tc9d3Rubio7DitEn0SQP2oJ2E,16628
8
8
  gimu/waiwera_copy.py,sha256=G84UQWbVq--cfkETCs_jpcquTL-x5SftAFNNNs3GfJs,1286
9
9
  gimu/waiwera_listing.py,sha256=c7moQY8DQEH_MqLUuhrinnkEHnDMKWx4srChffXoK6I,27787
10
10
  gimu/gmf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- gimu/gmf/data.py,sha256=aSpm_GZchVV_TCoBw9ymi5btT--53K2ibXCpmV-591I,2711
12
- gimu-0.2.0.dist-info/METADATA,sha256=A_BuKk58QciB8cBVdmX1bdYn1Oss2rFYDvztTX6rCOc,2320
13
- gimu-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- gimu-0.2.0.dist-info/entry_points.txt,sha256=FbtLXv_XXn6Wh2DXRsqJpTp85lxEvJiE36TTUTa0e1o,129
15
- gimu-0.2.0.dist-info/licenses/LICENSE.txt,sha256=E2nlaUhQtke9PAEhVEbZfNCPa-qJYGSeuR6Q3f6XgOM,1121
16
- gimu-0.2.0.dist-info/RECORD,,
11
+ gimu/gmf/data.py,sha256=qzvouw-l88nDtNGMmTGKMGrtizcck1lHTbgcU5uv7UQ,3587
12
+ gimu-0.3.0.dist-info/METADATA,sha256=Fx3AVaIO98Pt56YAJv_tQuHL2uidMPVsVjviiSl6XP0,2320
13
+ gimu-0.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ gimu-0.3.0.dist-info/entry_points.txt,sha256=FbtLXv_XXn6Wh2DXRsqJpTp85lxEvJiE36TTUTa0e1o,129
15
+ gimu-0.3.0.dist-info/licenses/LICENSE.txt,sha256=E2nlaUhQtke9PAEhVEbZfNCPa-qJYGSeuR6Q3f6XgOM,1121
16
+ gimu-0.3.0.dist-info/RECORD,,
File without changes