ras-commander 0.72.0__py3-none-any.whl → 0.74.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.
- ras_commander/Decorators.py +68 -17
- ras_commander/HdfInfiltration.py +910 -76
- ras_commander/HdfPlan.py +8 -4
- ras_commander/HdfResultsMesh.py +245 -0
- ras_commander/RasGeo.py +537 -523
- ras_commander/RasPlan.py +46 -12
- ras_commander/__init__.py +3 -2
- {ras_commander-0.72.0.dist-info → ras_commander-0.74.0.dist-info}/METADATA +21 -2
- {ras_commander-0.72.0.dist-info → ras_commander-0.74.0.dist-info}/RECORD +12 -12
- {ras_commander-0.72.0.dist-info → ras_commander-0.74.0.dist-info}/WHEEL +0 -0
- {ras_commander-0.72.0.dist-info → ras_commander-0.74.0.dist-info}/licenses/LICENSE +0 -0
- {ras_commander-0.72.0.dist-info → ras_commander-0.74.0.dist-info}/top_level.txt +0 -0
ras_commander/Decorators.py
CHANGED
@@ -110,13 +110,17 @@ def standardize_input(file_type: str = 'plan_hdf'):
|
|
110
110
|
except Exception as e:
|
111
111
|
raise ValueError(f"RAS object is not initialized: {str(e)}")
|
112
112
|
|
113
|
+
# Extract the number part and strip leading zeros
|
113
114
|
number_str = hdf_input if hdf_input.isdigit() else hdf_input[1:]
|
114
|
-
|
115
|
+
stripped_number = number_str.lstrip('0')
|
116
|
+
if stripped_number == '': # Handle case where input was '0' or '00'
|
117
|
+
stripped_number = '0'
|
118
|
+
number_int = int(stripped_number)
|
115
119
|
|
116
120
|
if file_type == 'plan_hdf':
|
117
121
|
try:
|
118
|
-
# Convert plan_number column to integers for comparison
|
119
|
-
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].astype(int) == number_int]
|
122
|
+
# Convert plan_number column to integers for comparison after stripping zeros
|
123
|
+
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].str.lstrip('0').astype(int) == number_int]
|
120
124
|
if not plan_info.empty:
|
121
125
|
# Make sure HDF_Results_Path is a string and not None
|
122
126
|
hdf_path_str = plan_info.iloc[0]['HDF_Results_Path']
|
@@ -128,12 +132,35 @@ def standardize_input(file_type: str = 'plan_hdf'):
|
|
128
132
|
|
129
133
|
elif file_type == 'geom_hdf':
|
130
134
|
try:
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
# First try to get the geometry number from the plan
|
136
|
+
from ras_commander import RasPlan
|
137
|
+
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].astype(int) == number_int]
|
138
|
+
if not plan_info.empty:
|
139
|
+
# Extract the geometry number from the plan
|
140
|
+
geom_number = plan_info.iloc[0]['geometry_number']
|
141
|
+
if pd.notna(geom_number) and geom_number is not None:
|
142
|
+
# Handle different types of geom_number (string or int)
|
143
|
+
try:
|
144
|
+
# Get the geometry path using RasPlan
|
145
|
+
geom_path = RasPlan.get_geom_path(str(geom_number), ras_obj)
|
146
|
+
|
147
|
+
if geom_path is not None:
|
148
|
+
# Create the HDF path by adding .hdf to the geometry path
|
149
|
+
hdf_path = Path(str(geom_path) + ".hdf")
|
150
|
+
if hdf_path.exists():
|
151
|
+
logger.info(f"Found geometry HDF file for plan {number_int}: {hdf_path}")
|
152
|
+
else:
|
153
|
+
# Try to find it in the geom_df if direct path doesn't exist
|
154
|
+
geom_info = ras_obj.geom_df[ras_obj.geom_df['full_path'] == str(geom_path)]
|
155
|
+
if not geom_info.empty and 'hdf_path' in geom_info.columns:
|
156
|
+
hdf_path_str = geom_info.iloc[0]['hdf_path']
|
157
|
+
if pd.notna(hdf_path_str):
|
158
|
+
hdf_path = Path(str(hdf_path_str))
|
159
|
+
logger.info(f"Found geometry HDF file from geom_df for plan {number_int}: {hdf_path}")
|
160
|
+
except (TypeError, ValueError) as e:
|
161
|
+
logger.warning(f"Error processing geometry number {geom_number}: {str(e)}")
|
162
|
+
else:
|
163
|
+
logger.warning(f"No valid geometry number found for plan {number_int}")
|
137
164
|
except Exception as e:
|
138
165
|
logger.warning(f"Error retrieving geometry HDF path: {str(e)}")
|
139
166
|
else:
|
@@ -153,8 +180,8 @@ def standardize_input(file_type: str = 'plan_hdf'):
|
|
153
180
|
|
154
181
|
if file_type == 'plan_hdf':
|
155
182
|
try:
|
156
|
-
# Convert plan_number column to integers for comparison
|
157
|
-
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].astype(int) == number_int]
|
183
|
+
# Convert plan_number column to integers for comparison after stripping zeros
|
184
|
+
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].str.lstrip('0').astype(int) == number_int]
|
158
185
|
if not plan_info.empty:
|
159
186
|
# Make sure HDF_Results_Path is a string and not None
|
160
187
|
hdf_path_str = plan_info.iloc[0]['HDF_Results_Path']
|
@@ -162,14 +189,38 @@ def standardize_input(file_type: str = 'plan_hdf'):
|
|
162
189
|
hdf_path = Path(str(hdf_path_str))
|
163
190
|
except Exception as e:
|
164
191
|
logger.warning(f"Error retrieving plan HDF path: {str(e)}")
|
192
|
+
|
165
193
|
elif file_type == 'geom_hdf':
|
166
194
|
try:
|
167
|
-
#
|
168
|
-
|
169
|
-
if not
|
170
|
-
|
171
|
-
|
172
|
-
|
195
|
+
# First try finding plan info to get geometry number
|
196
|
+
plan_info = ras_obj.plan_df[ras_obj.plan_df['plan_number'].astype(int) == number_int]
|
197
|
+
if not plan_info.empty:
|
198
|
+
# Extract the geometry number from the plan
|
199
|
+
geom_number = plan_info.iloc[0]['geometry_number']
|
200
|
+
if pd.notna(geom_number) and geom_number is not None:
|
201
|
+
# Handle different types of geom_number (string or int)
|
202
|
+
try:
|
203
|
+
# Get the geometry path using RasPlan
|
204
|
+
from ras_commander import RasPlan
|
205
|
+
geom_path = RasPlan.get_geom_path(str(geom_number), ras_obj)
|
206
|
+
|
207
|
+
if geom_path is not None:
|
208
|
+
# Create the HDF path by adding .hdf to the geometry path
|
209
|
+
hdf_path = Path(str(geom_path) + ".hdf")
|
210
|
+
if hdf_path.exists():
|
211
|
+
logger.info(f"Found geometry HDF file for plan {number_int}: {hdf_path}")
|
212
|
+
else:
|
213
|
+
# Try to find it in the geom_df if direct path doesn't exist
|
214
|
+
geom_info = ras_obj.geom_df[ras_obj.geom_df['full_path'] == str(geom_path)]
|
215
|
+
if not geom_info.empty and 'hdf_path' in geom_info.columns:
|
216
|
+
hdf_path_str = geom_info.iloc[0]['hdf_path']
|
217
|
+
if pd.notna(hdf_path_str):
|
218
|
+
hdf_path = Path(str(hdf_path_str))
|
219
|
+
logger.info(f"Found geometry HDF file from geom_df for plan {number_int}: {hdf_path}")
|
220
|
+
except (TypeError, ValueError) as e:
|
221
|
+
logger.warning(f"Error processing geometry number {geom_number}: {str(e)}")
|
222
|
+
else:
|
223
|
+
logger.warning(f"No valid geometry number found for plan {number_int}")
|
173
224
|
except Exception as e:
|
174
225
|
logger.warning(f"Error retrieving geometry HDF path: {str(e)}")
|
175
226
|
else:
|