|
6 | 6 |
|
7 | 7 | [**Link to documentation**](https://uihilab.github.io/HydroLang/) |
8 | 8 |
|
9 | | -* [Introduction](https://github.com/uihilab/HydroLang#Introduction) |
10 | | -* [How to Use](https://github.com/uihilab/HydroLang#How-to-Use) |
11 | | -* [Expansions and Test Cases](https://github.com/uihilab/HydroLang#Expansions-and-Test-Cases) |
12 | | -* [Community](https://github.com/uihilab/HydroLang#Community) |
13 | | -* [Feedback](https://github.com/uihilab/HydroLang#Feedback) |
14 | | -* [Scalability and To Do's](https://github.com/uihilab/HydroLang#Scalability-and-To-Dos) |
15 | | -* [License](https://github.com/uihilab/HydroLang#License) |
16 | | -* [Acknowledgements](https://github.com/uihilab/HydroLang#Acknowledgements) |
| 9 | +* [Introduction](#introduction) |
| 10 | +* [Modules](#modules) |
| 11 | + * [Data](#data) |
| 12 | + * [Analyze](#analyze) |
| 13 | + * [Visualization](#visualization) |
| 14 | + * [Maps](#maps) |
| 15 | +* [How to Use](#how-to-use) |
| 16 | +* [Examples](#examples) |
| 17 | +* [Community](#community) |
| 18 | +* [Feedback](#feedback) |
| 19 | +* [License](#license) |
| 20 | +* [Acknowledgements](#acknowledgements) |
17 | 21 | * [References](#references) |
18 | 22 |
|
19 | 23 | ## Introduction |
20 | | -This project introduces HydroLang, a web-based framework for environmental and hydrological analyses. It contains 4 different modules, each with a specific purpose that can be used either in combination with other modules or separately. The modules are: |
21 | | -* **Data**: used for data retrieval, manipulation, download and upload. |
22 | | -* **Analyze**: contains three different components, each aiming towards a similar purpose: |
23 | | - - *hydro*: functions for precipitation analysis and rainfall-runoff lumped models. |
24 | | - - *stats*: functions for statistical characterization of data. |
25 | | - - *NN*: functions for the creation of feed forward neural network models using [TensorFlow.js](https://www.tensorflow.org/js). |
26 | | -* **Visualization**: used for rendering different types of charts and tables on screen using [Google Charts](https://developers.google.com/chart). |
27 | | -* **Maps**: used for rendering of maps with option of adding/removing/downloading layers of different formats (geoJSON, KML) using two options on map engines [Google Maps](https://developers.google.com/maps/documentation) and [Leaflet](https://leafletjs.com/). |
| 24 | +HydroLang is an open-source, web-based framework designed for comprehensive environmental and hydrological analysis. Built with modularity and extensibility in mind, it empowers researchers and developers to perform complex data retrieval, analysis, modeling, and visualization directly within the browser. |
28 | 25 |
|
29 | | -The current modular structure serves as a starting point for basic hydrologic and environmental analyses, with further development bringing along new functions and modules that work using the same ontological design. |
| 26 | +By leveraging modern web technologies including **GDAL via WebAssembly for raster processing** and **TensorFlow.js for client-side machine learning**, HydroLang enables high-performance computing without the need for backend infrastructure. |
| 27 | + |
| 28 | +## Modules |
| 29 | + |
| 30 | +HydroLang consists of four core modules, each designed to handle specific aspects of the hydrological workflow. These modules can be used independently or chained together for seamless end-to-end analysis. |
| 31 | + |
| 32 | +### Data |
| 33 | +The **Data** module facilitates the retrieval, manipulation, and management of hydrological and environmental data. It supports connection to various public APIs and data sources, harmonizing diverse data formats into a unified structure for analysis. |
| 34 | + |
| 35 | +### Analyze |
| 36 | +The **Analyze** module is the computational core of HydroLang, subdivided into three specialized components: |
| 37 | +* **Hydro & Stats**: Provides essential hydrological functions (e.g., rainfall-runoff lumped models) and robust statistical characterization tools for time-series data. |
| 38 | +* **Geoprocessor**: A powerful client-side raster analysis engine powered by **GDAL (WASM)**. It enables advanced geospatial operations such as slope and aspect calculation, hillshading, reclassification, and terrain analysis directly in the browser. |
| 39 | +* **NN (Neural Networks)**: A comprehensive machine learning component built on **TensorFlow.js**. It runs in a dedicated Web Worker to ensure UI responsiveness and supports various architectures including: |
| 40 | + * **Dense (Feed Forward)**: For general regression and classification. |
| 41 | + * **LSTM (Long Short-Term Memory)**: Optimized for time-series forecasting. |
| 42 | + * **CNN (Convolutional Neural Networks)**: For spatial pattern recognition. |
| 43 | + |
| 44 | +### Visualization |
| 45 | +The **Visualization** module enables the creation of interactive and publication-quality charts and tables. Built on top of **Google Charts**, it offers a wide range of visualization types (Line, Scatter, Bar, Histogram, etc.) and includes utilities for generating comprehensive HTML reports (`generateReport`) to summarize analytical results. |
| 46 | + |
| 47 | +### Maps |
| 48 | +The **Maps** module handles geospatial visualization, supporting both **Leaflet** and **Google Maps** engines. It provides tools for: |
| 49 | +* Rendering vector data (GeoJSON, KML). |
| 50 | +* Visualizing raster data (GeoTIFF) using the `addGeoRasterLayer` function. |
| 51 | +* Interactive drawing and spatial querying with the built-in `draw` capabilities. |
30 | 52 |
|
31 | 53 | ## How to Use |
32 | | -Please download the library and run `index.html`. If a new html file should be created, the library must be onloaded onto the file as a script |
| 54 | +To use HydroLang, simply include the `hydro.js` module in your HTML file. No installation or build process is required. |
33 | 55 |
|
34 | 56 | ```html |
35 | | -<script |
36 | | - type = "module" |
37 | | - src= "./hydrolang/hydro.js" |
38 | | -></script> |
| 57 | +<script type="module" src="./hydrolang/hydro.js"></script> |
39 | 58 | ``` |
40 | 59 |
|
41 | | -Once the library is loaded, a new intance of HydroLang is added to the body of the file as: |
| 60 | +Initialize the library: |
| 61 | + |
42 | 62 | ```javascript |
43 | | -var hydro1 = new Hydrolang(); |
| 63 | +import Hydrolang from './hydrolang/hydro.js'; |
| 64 | +const hydro = new Hydrolang(); |
44 | 65 | ``` |
45 | 66 |
|
46 | | -Each of the modules is accessed through chainage using the `hydro` class instance. Functions on the third level chainage have been declared as static methods and thus, will not appear as quick access on the browser. Parameter destructuring has been added to most driving function within the framework to create an easier way to declare workflows. The destructuring is driven mainly in the following scope: |
| 67 | +HydroLang uses a consistent "params-args-data" pattern for most of its functions, utilizing object destructuring for clarity and flexibility: |
47 | 68 |
|
48 | 69 | ```javascript |
49 | | -hydro[module][function]({params:{}, args:{}, data: []}) |
| 70 | +hydro[module][component][function]({ |
| 71 | + params: { /* Configuration parameters (e.g., model type, chart options) */ }, |
| 72 | + args: { /* Execution arguments (e.g., specific flags, keys) */ }, |
| 73 | + data: [ /* Input data (arrays, typed arrays, or data objects) */ ] |
| 74 | +}) |
50 | 75 | ``` |
51 | | -`params:{}` represents an object with initial drivers for a specific function, `args:{}` is an object with additional parameters required for the function, and `data` is any data representation, usually an `n-D` array, for the function to run. For instance, in the data retrieval function: |
| 76 | + |
| 77 | +### Quick Examples |
| 78 | + |
| 79 | +**1. Data Retrieval** |
52 | 80 | ```javascript |
53 | | -hydro.data.retrieve({params:{source: someSource, dataType: someType}, args:{specificArg: someArg}}) |
54 | | -``` |
55 | | -The function definition found in the documentation states which parameters are required. |
56 | | - |
57 | | -Summary examples for each module: |
58 | | -* Function call for data module |
59 | | -```javascript |
60 | | -var example: hydro1.data.function({params: {}, args:{}, data: []}) |
61 | | -``` |
62 | | -* Function call for any component on the analyze module |
63 | | -```javascript |
64 | | -var example: hydro1.analyze.component.function({params: {}, args:{}, data: []}) |
| 81 | +hydro.data.retrieve({ |
| 82 | + params: { source: 'USGS', dataType: 'streamflow' }, |
| 83 | + args: { site: '05454500', period: 'P7D' } |
| 84 | +}) |
| 85 | +.then(data => console.log(data)); |
65 | 86 | ``` |
66 | | -* Function call for visualization module |
67 | | -```javascript |
68 | | -var example: hydro1.visualize.function({params: {}, args:{}, data: []}) |
69 | | -``` |
70 | | -* Function call for maps module |
71 | | -```javascript |
72 | | -var example: hydro1.map.function({params: {}, args:{}, data: []}) |
| 87 | + |
| 88 | +**2. Neural Network Prediction** |
| 89 | +```javascript |
| 90 | +// Create and train an LSTM model |
| 91 | +const model = await hydro.analyze.nn.createModel({ |
| 92 | + params: { type: 'lstm', units: 50, shape: [7, 1] } // 7-day lookback |
| 93 | +}); |
| 94 | + |
| 95 | +await model.train({ |
| 96 | + params: { epochs: 50 }, |
| 97 | + data: { inputs: xTrain, outputs: yTrain } |
| 98 | +}); |
73 | 99 | ``` |
74 | 100 |
|
75 | | -## Expansions and Test Cases |
| 101 | +**3. Geoprocessing** |
| 102 | +```javascript |
| 103 | +// Calculate slope from a DEM |
| 104 | +const slopeData = await hydro.analyze.geoprocessor.execute({ |
| 105 | + params: { action: 'slope' }, |
| 106 | + data: [{ buffer: demArrayBuffer }] |
| 107 | +}); |
| 108 | +``` |
76 | 109 |
|
77 | | -### Core library usage |
78 | | -The usage of the library through its core structure can be found within the following files or within each module folder: |
79 | | -* `test-analysis.html` |
80 | | -* `test-data.html` |
81 | | -* `test-maps.html` |
82 | | -* `test-visualization.html` |
| 110 | +## Examples |
| 111 | +The `examples/` directory contains a comprehensive set of demos illustrating real-world use cases. These are categorized to help you get started quickly: |
83 | 112 |
|
84 | | -### Expansions |
85 | | -The current expansions of the framework are the following: |
86 | | -* [BMI specification](https://github.com/uihilab/HydroLang/tree/master/hydrolang/bmi-implementation): CSDMS basic modeling interface through steering files. |
87 | | -* [HL-ML](https://github.com/uihilab/HydroLang-ML): HTML driven web components for hydrology and environmental sciences. |
| 113 | +* **Data Sources**: |
| 114 | + * `usgs_streamflow.html`: Fetching and visualizing real-time streamflow data. |
| 115 | + * `3dep_dem_retrieval.html`: Retrieving elevation data for terrain analysis. |
| 116 | +* **Geoprocessing**: |
| 117 | + * `terrain_analysis.html`: Performing client-side terrain analysis (Slope, Aspect, Hillshade). |
| 118 | + * `watershed_delineation.html`: Delineating watersheds and stream networks. |
| 119 | +* **Machine Learning**: |
| 120 | + * `lstm_streamflow_forecast.html`: Forecasting streamflow using Deep Learning (LSTM). |
| 121 | +* **Statistical Analysis**: |
| 122 | + * `correlation_analysis.html`: analyzing relationships between hydrological variables. |
88 | 123 |
|
89 | 124 | ## Community |
90 | | -It is possible for the library to expand by becoming a community-based framework with collaborations from research institutes or knowledgeable individuals thanks to the flexibility of employing a modular architecture, open-source libraries, and not requiring installation. Interested parties can adapt and expand HydroLang to fit their unique use cases, development environments, project requirements, and data resources. Everyone is encouraged to contribute to the growth of HydroLang by: |
91 | | -* filing an issue to request certain features, functionality, and data, |
92 | | -* implementing the desired capability on a fork, and submitting a pull request. |
93 | | -Please visit the [contributing](https://github.com/uihilab/HydroLang/blob/master/docs/CONTRIBUTING.md) guidelines for more details. |
| 125 | +HydroLang is a community-driven project. We welcome contributions from researchers, developers, and hydrologists. You can contribute by: |
| 126 | +* Filing issues for bugs or feature requests. |
| 127 | +* Submitting Pull Requests with new modules, data sources, or improvements. |
| 128 | +* Sharing your models and case studies on the [HydroLang-Models repository](https://github.com/uihilab/HydroLang-Models). |
94 | 129 |
|
95 | | -Furthermore, for community building, we encourage users of HydroLang to share their models, codes, and case studies on [HydroLang-Models repository](https://github.com/uihilab/HydroLang-Models). |
| 130 | +Please refer to the [Contributing Guidelines](https://github.com/uihilab/HydroLang/blob/master/docs/CONTRIBUTING.md) for more details. |
96 | 131 |
|
97 | 132 | ## Feedback |
98 | | -Please feel free to send feedback to us on any issues found by filing an [issue](https://github.com/uihilab/HydroLang/blob/master/.github/ISSUE_TEMPLATE/feature_request.md). |
99 | | - |
100 | | -## Scalability and To-Do's |
101 | | -The framework is not limited to the functions and modules implemented, but rather provides a boilerplate for new features to be added. Nonetheless, the following should be considered: |
102 | | - |
103 | | -* The hydro component contains only lumped models. |
104 | | -* The map module is fully available only on Leaflet engine. |
| 133 | +We value your feedback. Please report any issues or suggestions via our [GitHub Issues](https://github.com/uihilab/HydroLang/issues) page. |
105 | 134 |
|
106 | 135 | ## License |
107 | 136 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/uihilab/HydroLang/blob/master/LICENSE) file for details. |
108 | 137 |
|
109 | 138 | ## Acknowledgements |
110 | | -This project is developed by the University of Iowa Hydroinformatics Lab (UIHI Lab): |
| 139 | +Developed by the **University of Iowa Hydroinformatics Lab (UIHI Lab)**: |
| 140 | +https://hydroinformatics.uiowa.edu/ |
111 | 141 |
|
112 | | -https://hydroinformatics.uiowa.edu/. |
113 | | - |
114 | | -And with the support of the Cosortium of Universities for the Advancement of Hydrological Science [CUAHSI](https://www.cuahsi.org/) through the [Hydroinformatics Innovation Fellowship](https://www.cuahsi.org/grant-opportunities/hydroinformatics-innovation-fellowship). |
| 142 | +Supported by the **Consortium of Universities for the Advancement of Hydrological Science (CUAHSI)** through the Hydroinformatics Innovation Fellowship. |
115 | 143 |
|
116 | 144 | ## References |
117 | | - |
118 | | -* Erazo Ramirez, C., Sermet, Y., Molkenthin, F., & Demir, I. (2022). HydroLang: An open-source web-based programming framework for hydrological sciences. Environmental Modelling & Software, 157, 105525. [doi:10.1016/j.envsoft.2022.105525](https://www.sciencedirect.com/science/article/pii/S1364815222002250) |
| 145 | +* Erazo Ramirez, C., Sermet, Y., Molkenthin, F., & Demir, I. (2022). HydroLang: An open-source web-based programming framework for hydrological sciences. *Environmental Modelling & Software*, 157, 105525. [doi:10.1016/j.envsoft.2022.105525](https://www.sciencedirect.com/science/article/pii/S1364815222002250) |
0 commit comments