How to make a Piper Diagram in Python - Tutorial

A Piper Diagram is an effective graphic procedure to segregate relevant analytical data to understand the sources of the dissolved constituents in water. This procedure was born under the statement that most natural waters contain cations and anions in chemical equilibrium. It is assumed that the most abundant cations are calcium (Ca), magnesium (Mg) and sodium (Na). The most common anions are bicarbonate (HCO3), sulphate (SO4) and chloride (Cl).

The Piper diagram can be made by free and commercial desktop software, however in this tutorial we have generated the Python scripts and working procedure to create a Piper Diagram from values stored in a working spreadsheet.

Read More

Dynamic Flood Simulation of Combined Peak Flows with HEC-RAS - Tutorial

Flood events come from periods of high precipitiation and favourable soil moisture conditions. Based on the basin topography, land cover and precipitation distribution, flood events can be conceptualized as the cummulative sum of a series of peak flows from different affluent rivers.

Flood management involve the prediction of river water elevation and velocitiy from extreme precipitation events. This tutorial shows the procedure to build a unsteady (dynamic) flow simulation of two peak flows with different hydrograms. The channel network configuration for the area of study consists of one main river and a affluent river. Peak flow in the main river is 10 hours ahead of the peak flow in the affluent river.

Read More

How to create a boxplot to represent basin scale water constituents using Python - Tutorial

Python is an interpreted high-level programming language which allows performing several statistical procedures. This programming language is an excellent option to create box plots because of its simplicity and exceptional results. This tutorial explains how to download and use Python´s Jupyter Notebook to analyze water quality data in the form of boxplots.

Box plots show the distribution of a sample using the lower quartile (Q1), the median (m or Q2) and the upper quartile (Q3)--and the interquartile range (IQR = Q3-Q1), which covers the central 50% of the data. Quartiles are values that divide the data in quarters; the term refers to the value that falls in the line that divides each quarter. Therefore, Q1 is the highest value of the first 25% of the data, Q2 is the one of the 50% of the data and Q3, the one for the 75% of the data. Characterizing the data with quartiles is advantageous because they are insensitive to outliers and preserve information about the center and spread (Krzywinski & Altman 2014).

Read More

What is a Piper diagram for water chemistry analysis and how to create one?

In 1994, Arthur M. Piper, proposed an effective graphic procedure to segregate relevant analytical data to understand the sources of the dissolved constituents in water. This procedure was born under the statement that most natural waters contain cations and anions in chemical equilibrium. It is assumed that the most abundant cations are two “alkaline earths” calcium (Ca) and magnesium (Mg) and one “Alkali” sodium (Na). The most common anions are one “weak acid” bicarbonate (HCO3) and two “strong acids” sulphate (SO4) and chloride (Cl). Less common anion and cation-constituents are summed with the major three anions and cations as shown in the following table:

Read More

Dynamic Simulation of Hillslope Landslide with openFoam - Tutorial

This tutorial shows the whole procedure to simulate a landslide of a hillslope from a initial condition of failure. The tutorial was done with the interFoam solver from openFoam on a non- Newtonian flow. The fluid has a variable kinematic viscosity (nu) based on the Bird-Carreau model. Failure scenario last only 6 seconds and results were recorded every 0.1 seconds. Final geometry and the landslide development were analyzed with paraView with predefined views (paraView states).

Read More

Modeling and Analysis between 5 Newtonian Fluids in OpenFOAM - Tutorial

Computational fluid dynamics modeling with OpenFOAM could be challenging for water resources engineers since OpenFOAM models all types of fluids like water, air, heat and electromagnetism. On a normal hydrological software, it is implicit that the physical properties or the empiric formulation matches water on the liquid phase at temperatures around 20°C; however in a CDF program as OpenFOAM we have to define that the fluid we are working with is water and this increases the level of complexity on the model conceptualization and analysis.

But there is a interesting face of this complex fluid formulation in OpenFOAM: we can model any fluid, fluid type and turbulence condition; that means that we can model fluids like oil, alcohol, beer, or glycerine just with their property definition. In this tutorial we model and compare the behavior of 5 Newtonian fluids: beer, benzene, glycerine, olive oil and water. All fluids have been simulated on the same geometry and timeframe and all simulation output have been integrated in one paraView session for the comparative analysis of the fluid performance. Fluids were modeled with the interFOAM solver on turbulent conditions with the k-epsilon schema.

Read More

Floating Object Stability Modeling with OpenFOAM - Tutorial

This tutorial is about a floating object stability simulation from a water surface oscillation (wave). The model was done with the interFoam solver that is a solver for two incompressible fluids, on isotermic conditions using a volume of control (VOF) phase-fraction interface approach. Turbulence was conceptualized on the model with the kEpsilon turbulence model. Simulation was done for 4 seconds with outputs every 0.05 seconds and runs in almost 5 minutes on OpenFOAM for Windows, better computation times are expected when run on Linux with paralleling computing.

Read More

Modeling Effluent Disposal Mixing Zone into the Ocean with OpenFOAM - Tutorial

A right assessment of the effluent mixing zone would require a baseline of sea currents, discharge flows, seawater and effluent density, bathymetry, waves, infraestructure geometry and a tool that can analyse the interaction of the mentioned factors. OpenFOAM is a numerical model for Computational Fluid Dynamics (CFD) modeling capable of modeling fluids with complex geometries, conditions and requirements; with OpenFOAM one can model compressible/uncompressible, single phase / multiphase, flows that mix, non-newtonian flows, etc. OpenFOAM comes with build-in tools for model construction and visualization, and there is Salome Platform for advanced mesh generation.

This tutorial show the entire procedure for the simulation of a effluent of 40 l/s into the ocean that has a current of 0.05 m/s. The model is on transient conditions, model simulation were done under uniform discharge rates, the development of the mixing zone was analyzed with paraView tools and a water chemistry component was introduced into the simulation with some Python scripts. 

Read More

OpenFOAM Model Local Mesh Refinement with Salome and Python3 - Tutorial

Discretization is the “art” of transforming a continuous media as nature into discrete parts; for numerical models the spatial and temporal discretization have become a key issue in assuring model efficiency, output precision and the overall quality of the modeling work. Flow models are constructed to represent an specific requirement on the surface water/ groundwater flow regime (local scale), however, the model has to represent first the overall flow regimen (global scale). On the general model areas, an efficient spatial discretization criteria rules to keep the mesh elements as big as possible, meanwhile, in the areas of interest the model should be discretized into the smallest parts.

Read More

Object / fluid interaction modelling with OpenFOAM - Submarine Case - Tutorial

This tutorial will apply OpenFOAM to simulate the flow effect on submerged object using the simpleFoam solver and the k-epsilon turbulence schema. The tutorial develops the case of a submarine model against a flow current; the velocity and pressure applied on the submarine will be analyzed on the model results and flow paths will be plotted to see the main patterns around the submarine. Model output visualization is performed on Paraview that allows the representation of velocity and pressure vectors over the submarine.

Read More

Energy Dissipator Modelling in Open Channels with OpenFOAM - Tutorial

This tutorial will demonstrate the modelling configuration to simulate a power dissipator in an open channel. The dissipator design is proposed on the Stormwater Drainage Manual from the Drainage Services Department of Hong Kong and  OpenFOAM will be used for the simulation with the interFoam solver since two immiscible and isothermal fluids are involved (water and air). The main variable of interest on the dissipator simulation is flow velocity to assess the efficiency of the dissipator.

Read More

Download Climate Change Data (2006-2096) on Daily Scale from NASA NCCS Server with Python - Tutorial

There are many Global Circulation Models (GCMs) with historic and future data of Precipitation, Maximum Temperature and Minimum Temperature for different emission scenarios. Data is available on daily timescale from particular servers, in this tutorial we will show the main characteristics of the NASA NCCS THREDDS Data Server that provide the NASA Earth Exchange Global Daily Downscaled Projections (NEX-GDDP) dataset that has two of the four greenhouse gas emissions scenarios. Data from this dataset is available from 1950 to 2100 separated on historic and future with a spatial resolution of 0.25 degrees (~25km x 25 km). The tutorial show the main parts of the web server and scripts in Python to locate the closest model cell and to recursively download group of records.

Read More

How to download Climate Change data from the World Bank Data API with Python

World Bank has a Climate Change Knowledge Portal with information, data and reports about climate change around the world. The portal has an Climate Data API as REST framework that can provide Precipitation and Temperature data on historic and modeled dataset from 15 global circulation models (CGMs) and 2 emissions scenarios at country and basin spatial scale. There is a Python package called wbpy that makes really easy the access to the Climate Data API by few lines of code. There are options to download data on monthly, annual and decade timescale as Python dictionary data type. This tutorial show the main parts of the API, the involved codes and a example of usage for historic and future data.

Read More

Online Representation of Piper, Schoeller and Stiff Diagrams with Hatarichem -Tutorial

We present our own webapp for the representation of the Piper Diagram, Stiff Diagram and Scholler Diagram and export it as a figure file or a PDF file. The webapp was developed in NodeJS and Python and it is entirely free for everyone. The main objective behind this webapp was to develop a user friendly and minimum requirement tool to create these water quality / hidrogeochemical diagrams. This tutorial show the complete procedure to update the working file and then generate the diagrams.

Read More

Fill Missing Precipitation Data with Artificial Intelligence (Python Keras) - Tutorial

Evaluation of hydrological processes as evapotranspiration, runoff, routing and infiltration require data as precipitation, flow, temperature and radiation on a daily basis. Required data for the hydrological modeling need to be accurate and must be completed over the period of study. Many times historical data from hydrological stations are incomplete and present many gaps that can be filled by the use of Artificial Intelligence tools as the Keras library in Python.

This tutorial show the procedure to run a complete script for the filling of missing precipitation in one station by the use of data from 2 nearby stations. The Python script is done on a Jupyter Notebook.

Read More

Sedimentation Tank Design with OpenFOAM - Tutorial

Drinking and residual water treatment, water intake into hydroelectric power stations or water treatment for industrial processes require the removal of suspended particles by sedimentation tanks. These hydraulic structures have a slow speed water inlet and a geometry that allows the decantation or precipitation of sediments along the settler path.

OpenFOAM is a open source software for Computational Fluid Dynamics (CFD) modeling with a series of solvers for different flow conditions. In this case we have used the driftFluxFoam solver to represent sediment precipitation in a sedimentator in a transient simulation of 6400 seconds. The tutorial contains 2 videos with the model description and its simulation.

Read More

Crop Yield Assessment from Photos with Python and Scikit-Learn

Evaluation of crop yield can be tedious because sampling methods requires the actual counting of fruits for a whole tree or canopy area. If we want to optimize this time demanding task we can use new and open source machine learning algorithms available. We have selected Scikit-Learn for this tutorial, a machine learning library in Python for it ease to use, the available documentation and the sort of available tools. 

The tutorial covers the whole procedure of image representation, point of interest selection, template matching, cluster analysis and fruit counting. Python scripting was done in Jupyter Notebook, it is interactive and allows the user to add more points of interest or remove inaccurate points.

Read More

How to convert GTIFF to STL for Topography Representation in OpenFOAM Models

For OpenFOAM modelers the representation of topography can be painful due to the unstabilities and complexities of the Bezier Surfaces in Salome Platform. It is more stable to create the mesh by importing a full textured surface on a format file compatible with Salome. This tutorial show the process to create a STL file from a GeoTiff(.tif) file by scripts in Python. We have used the OSGeo4W Shell that comes with the normal QGIS instalation because it comes with the gdal library already installed.

Read More

How To Create Line From Points in QGIS with PyQGIS and Pandas - Tutorial

Python scripting allows us to enhance the data management and spatial analysis in QGIS. Most times, spatial data comes from a variety of data providers in a sort of formats and data types that we have to be adapted to the GIS standard. Big data and continuos monitoring create large datasets that have to indexed, sorted and manipulated in a effective way.

QGIS has a Python console and the capability to install external Python packages that run on QGIS session. This time we have installed Pandas in QGIS to handle the data from a sensing device made on a Raspberry Pi 3 and then we have defined the path as a succession of points with PyQGIS scripting.

Read More

Spatio-Temporal Hurricane Tracking in the Gulf of Mexico with QGIS and PyQGIS - Tutorial

This tutorial show a mixed procedure with native QGIS tools and PyQGIS commands for the data representation, styling and plotting with spatio-temporal criteria with the TimeManager plugin. Data for this tutorial was downloaded from the National Hurricane Center's Tropical Cyclone Reports that contains information as six-hourly positions and intensities. You can access the whole hurricane database o

Read More