ras-commander 0.35.0__py3-none-any.whl → 0.36.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/RasCmdr.py +360 -332
- ras_commander/RasExamples.py +113 -80
- ras_commander/RasGeo.py +38 -28
- ras_commander/RasGpt.py +142 -0
- ras_commander/RasHdf.py +170 -253
- ras_commander/RasPlan.py +115 -166
- ras_commander/RasPrj.py +212 -141
- ras_commander/RasUnsteady.py +37 -22
- ras_commander/RasUtils.py +98 -82
- ras_commander/__init__.py +11 -13
- ras_commander/logging_config.py +80 -0
- {ras_commander-0.35.0.dist-info → ras_commander-0.36.0.dist-info}/METADATA +15 -11
- ras_commander-0.36.0.dist-info/RECORD +17 -0
- ras_commander-0.35.0.dist-info/RECORD +0 -15
- {ras_commander-0.35.0.dist-info → ras_commander-0.36.0.dist-info}/LICENSE +0 -0
- {ras_commander-0.35.0.dist-info → ras_commander-0.36.0.dist-info}/WHEEL +0 -0
- {ras_commander-0.35.0.dist-info → ras_commander-0.36.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
# logging_config.py
|
2
|
+
|
3
|
+
import logging
|
4
|
+
import logging.handlers
|
5
|
+
from pathlib import Path
|
6
|
+
import functools
|
7
|
+
|
8
|
+
# Define log levels
|
9
|
+
DEBUG = logging.DEBUG
|
10
|
+
INFO = logging.INFO
|
11
|
+
WARNING = logging.WARNING
|
12
|
+
ERROR = logging.ERROR
|
13
|
+
CRITICAL = logging.CRITICAL
|
14
|
+
|
15
|
+
|
16
|
+
_logging_setup_done = False
|
17
|
+
|
18
|
+
def setup_logging(log_file=None, log_level=logging.INFO):
|
19
|
+
"""Set up logging configuration for the ras-commander library."""
|
20
|
+
global _logging_setup_done
|
21
|
+
if _logging_setup_done:
|
22
|
+
return
|
23
|
+
|
24
|
+
# Define log format
|
25
|
+
log_format = logging.Formatter(
|
26
|
+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
27
|
+
)
|
28
|
+
|
29
|
+
# Configure console handler
|
30
|
+
console_handler = logging.StreamHandler()
|
31
|
+
console_handler.setFormatter(log_format)
|
32
|
+
|
33
|
+
# Set up root logger
|
34
|
+
root_logger = logging.getLogger()
|
35
|
+
root_logger.setLevel(log_level)
|
36
|
+
root_logger.addHandler(console_handler)
|
37
|
+
|
38
|
+
# Configure file handler if log_file is provided
|
39
|
+
if log_file:
|
40
|
+
log_dir = Path('logs')
|
41
|
+
log_dir.mkdir(exist_ok=True)
|
42
|
+
log_file_path = log_dir / log_file
|
43
|
+
|
44
|
+
file_handler = logging.handlers.RotatingFileHandler(
|
45
|
+
log_file_path, maxBytes=10*1024*1024, backupCount=5
|
46
|
+
)
|
47
|
+
file_handler.setFormatter(log_format)
|
48
|
+
root_logger.addHandler(file_handler)
|
49
|
+
|
50
|
+
_logging_setup_done = True
|
51
|
+
|
52
|
+
def get_logger(name):
|
53
|
+
"""Get a logger for a specific module."""
|
54
|
+
return logging.getLogger(name)
|
55
|
+
|
56
|
+
def log_call(logger=None):
|
57
|
+
"""Decorator to log function calls."""
|
58
|
+
def get_logger():
|
59
|
+
# Check if logger is None or doesn't have a debug method
|
60
|
+
if logger is None or not hasattr(logger, 'debug'):
|
61
|
+
return logging.getLogger(__name__)
|
62
|
+
return logger
|
63
|
+
|
64
|
+
def decorator(func):
|
65
|
+
@functools.wraps(func)
|
66
|
+
def wrapper(*args, **kwargs):
|
67
|
+
log = get_logger()
|
68
|
+
log.debug(f"Calling {func.__name__}")
|
69
|
+
result = func(*args, **kwargs)
|
70
|
+
log.debug(f"Finished {func.__name__}")
|
71
|
+
return result
|
72
|
+
return wrapper
|
73
|
+
|
74
|
+
# Check if we're being called as @log_call or @log_call()
|
75
|
+
if callable(logger):
|
76
|
+
return decorator(logger)
|
77
|
+
return decorator
|
78
|
+
|
79
|
+
# Set up logging when this module is imported
|
80
|
+
setup_logging()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ras-commander
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.36.0
|
4
4
|
Summary: A Python library for automating HEC-RAS operations
|
5
5
|
Home-page: https://github.com/billk-FM/ras-commander
|
6
6
|
Author: William M. Katzenmeyer
|
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.9
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: pandas>=
|
16
|
-
Requires-Dist: numpy>=
|
15
|
+
Requires-Dist: pandas>=2.0
|
16
|
+
Requires-Dist: numpy>=2.0
|
17
17
|
Requires-Dist: h5py>=3.1.0
|
18
18
|
Requires-Dist: requests>=2.25.0
|
19
19
|
Requires-Dist: scipy>=1.5.0
|
@@ -33,14 +33,21 @@ Requires-Dist: twine>=3.3.0; extra == "dev"
|
|
33
33
|
RAS Commander is a Python library for automating HEC-RAS operations, providing a set of tools to interact with HEC-RAS project files, execute simulations, and manage project data. This library is an evolution of the RASCommander 1.0 Python Notebook Application previously released under the [HEC-Commander tools repository](https://github.com/billk-FM/HEC-Commander).
|
34
34
|
|
35
35
|
## Contributors:
|
36
|
-
William Katzenmeyer, P.E., C.F.M.
|
36
|
+
William Katzenmeyer, P.E., C.F.M.
|
37
37
|
|
38
|
-
Sean Micek, P.E., C.F.M.
|
38
|
+
Sean Micek, P.E., C.F.M.
|
39
39
|
|
40
|
-
Aaron Nichols, P.E., C.F.M.
|
40
|
+
Aaron Nichols, P.E., C.F.M.
|
41
41
|
|
42
42
|
(Additional Contributors Here)
|
43
43
|
|
44
|
+
## Don't Ask Me, Ask ChatGPT!
|
45
|
+
|
46
|
+
Before you read any further, you can [chat directly with ChatGPT on this topic.](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant) Ask it anything, and it will use its tools to answer your questions and help you learn. You can even upload your own plan, unsteady and HDF files to inspect and help determine how to automate your workflows or visualize your results.
|
47
|
+
|
48
|
+
There are also [AI Assistant Knowledge Bases](https://github.com/billk-FM/ras-commander/tree/main/ai_tools/assistant_knowledge_bases) with various versions available to directly use with large context LLM models such as Anthropic's Claude, Google Gemini and OpenAI's GPT4o and o1 models.
|
49
|
+
|
50
|
+
FUTURE: TEMPLATES are available to use with AI Assistant Notebooks to build your own automation tools. When used with large context models, these templates allow you to ask GPT to build a workflow from scratch to automate your projects.
|
44
51
|
|
45
52
|
## Background
|
46
53
|
The ras-commander library emerged from the initial test-bed of AI-driven coding represented by the HEC-Commander tools Python notebooks. These notebooks served as a proof of concept, demonstrating the value proposition of automating HEC-RAS operations. The transition from notebooks to a structured library aims to provide a more robust, maintainable, and extensible solution for water resources engineers.
|
@@ -300,11 +307,8 @@ Additionally, we would like to acknowledge the following notable contributions a
|
|
300
307
|
|
301
308
|
2. Attribution: The [`pyHMT2D`](https://github.com/psu-efd/pyHMT2D/) project by Xiaofeng Liu, which provided insights into HDF file handling methods for HEC-RAS outputs. Many of the functions in the [Ras_2D_Data.py](https://github.com/psu-efd/pyHMT2D/blob/main/pyHMT2D/Hydraulic_Models_Data/RAS_2D/RAS_2D_Data.py) file were adapted with AI for use in RAS Commander.
|
302
309
|
|
303
|
-
Xiaofeng Liu, Ph.D., P.E
|
304
|
-
|
305
|
-
Department of Civil and Environmental Engineering
|
306
|
-
Institute of Computational and Data Sciences
|
307
|
-
Penn State University
|
310
|
+
Xiaofeng Liu, Ph.D., P.E., Associate Professor, Department of Civil and Environmental Engineering
|
311
|
+
Institute of Computational and Data Sciences, Penn State University
|
308
312
|
|
309
313
|
These acknowledgments recognize the contributions and inspirations that have helped shape RAS Commander, ensuring proper attribution for the ideas and code that have influenced its development.
|
310
314
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ras_commander/RasCmdr.py,sha256=_opzPdFuja2wXmFu2iayP6igJqGeILAavPC1XsCC6ks,25010
|
2
|
+
ras_commander/RasExamples.py,sha256=g2HIbppxIVeCKriy9Th1RDtrCPzFkdoP-BWEzHPsedY,25112
|
3
|
+
ras_commander/RasGeo.py,sha256=cqKpN-1r_uXw24acqA8ubGGw2-Od51p-I_X0kGSkWBE,5395
|
4
|
+
ras_commander/RasGpt.py,sha256=-524sU_PBPxCmjDKJbDXg6Q3k1-Uhk2tYj6HeW8QFJ8,4201
|
5
|
+
ras_commander/RasHdf.py,sha256=_aJ2PAqFPAnTWN2btmASjWT8dHAFZveAorAu6QXLwgA,77162
|
6
|
+
ras_commander/RasPlan.py,sha256=p9IVQ5vKzv01jcrY0-Lbx8N7YwkPf4WKovBNx_FgXpE,48835
|
7
|
+
ras_commander/RasPrj.py,sha256=qDJJiWnAaf-Uzc31DVI5aTKjOulIEoVeH05-kjb4tZQ,34444
|
8
|
+
ras_commander/RasUnsteady.py,sha256=37GKaYNJZ39y-khhy01LbHwZnf7HT0V2XKQ-UUaJHlY,4639
|
9
|
+
ras_commander/RasUtils.py,sha256=P9SopqMd6awZyj0U2xNxc-pl1-HEktmyY1lz3LiduPs,25079
|
10
|
+
ras_commander/__init__.py,sha256=h4xld8gpvjTTpOOJcPKXwsRMUVGtg8tRqf64AHwZB3k,1051
|
11
|
+
ras_commander/_version.py,sha256=BReLomJ164W3bJhfQJi0gbNKc3DXCzwusmCheUzClB8,478
|
12
|
+
ras_commander/logging_config.py,sha256=5bYd_5KMlf81bXsiu2mABBlw0USMhcu5uRv8DIYJSFE,2317
|
13
|
+
ras_commander-0.36.0.dist-info/LICENSE,sha256=_pbd6qHnlsz1iQ-ozDW_49r86BZT6CRwO2iBtw0iN6M,457
|
14
|
+
ras_commander-0.36.0.dist-info/METADATA,sha256=izerc1IGczuZ6ESEZV2fU5HtEXJA7w5jBMY_u9qFEAE,16187
|
15
|
+
ras_commander-0.36.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
16
|
+
ras_commander-0.36.0.dist-info/top_level.txt,sha256=i76S7eKLFC8doKcXDl3aiOr9RwT06G8adI6YuKbQDaA,14
|
17
|
+
ras_commander-0.36.0.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
ras_commander/RasCmdr.py,sha256=fX_rh_IcBuJYEbGXfUc7Fge6cdJAAGKN_V5sGZgIJT4,24447
|
2
|
-
ras_commander/RasExamples.py,sha256=VgjBcB56u5gzzzYzz0YXj5rKWk3u7oRoja97_3ArJHc,24127
|
3
|
-
ras_commander/RasGeo.py,sha256=6DO5utVBjkIhqJ_WYQSeU4i74Bv_pZO3pmWdVf-jj3U,5137
|
4
|
-
ras_commander/RasHdf.py,sha256=z5PZDZ44jS6dYNc1AdDyVqt2YqaMGulR72yBLQYoIeI,83927
|
5
|
-
ras_commander/RasPlan.py,sha256=Aa3qhPA8EvEEfSSibeQq2UYawU5kMRCJOgonjBwn8uU,53718
|
6
|
-
ras_commander/RasPrj.py,sha256=246bvWbjRCEt-4L1sMovCyNmPWQ6t2uGHkecs9Nro4E,30594
|
7
|
-
ras_commander/RasUnsteady.py,sha256=jgV3gqGFsIMV0c9eFaXjVM5pqAb82Du_7ObiIPnemJs,4077
|
8
|
-
ras_commander/RasUtils.py,sha256=ESsjQNjPsojZ8SINnMbMZDDWeyBqF6owaPV8brtS3S8,24435
|
9
|
-
ras_commander/__init__.py,sha256=7H3JDR5VmTo6P0fJFJe9mTozMWp-owrrHjy7lADVA6Q,1167
|
10
|
-
ras_commander/_version.py,sha256=BReLomJ164W3bJhfQJi0gbNKc3DXCzwusmCheUzClB8,478
|
11
|
-
ras_commander-0.35.0.dist-info/LICENSE,sha256=_pbd6qHnlsz1iQ-ozDW_49r86BZT6CRwO2iBtw0iN6M,457
|
12
|
-
ras_commander-0.35.0.dist-info/METADATA,sha256=k4I3IpZXFOHaMK0Y9CUPuaZ8IlGjBLF5ot4dElRytOQ,15325
|
13
|
-
ras_commander-0.35.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
14
|
-
ras_commander-0.35.0.dist-info/top_level.txt,sha256=i76S7eKLFC8doKcXDl3aiOr9RwT06G8adI6YuKbQDaA,14
|
15
|
-
ras_commander-0.35.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|