Loading...

Follow Hatari Labs Blog on Feedspot

Continue with Google
Continue with Facebook
or

Valid

Spatial data created / processed by commercial or open source software follows standards by institutions like the Open Geospatial Consortium; this standards allow the interoperability of the vector or raster data among different software however standards apply to the position but not the style. Styles from ArcGIS were not easy to convert to formats compatible with QGIS, specially if you don’t have the commercial software.

Governmental offices release spatial data as land use, land cover, infraestructures, and sometimes release styles in ArcGIS formats posing a great obstacle for the QGIS users. This tutorial shows the complete procedure to convert ArcGIS Style to QGIS as *.xml format with a case study of land cover from Costa Rica. The tutorial is developed in Windows, if you are a Linux and Mac users its necessary to install Mdbtools on your own operating system.

Credits: The tutorial is a video version of the procedure developed by open.gis.lab on this link: https://opengislab.com/blog/2019/3/16/converting-esri-styles-to-qgis-styles-using-slyr

Tutorial
How to convert from ArcGIS Style to QGIS 3 - Part 1/2 - YouTube
How to convert from ArcGIS Style to QGIS 3 - Part 2/2 - YouTube

Urls

These are the urls required for the tutorial:

Slyr url: https://github.com/nyalldawson/slyr

Mdbtools url: https://github.com/lsgunth/mdbtools-win

Input files

You can download the input files for this tutorial here.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Nature is geospatial, and every physical process related to the groundwater flow and transport regime is spatially located or spatially distributed. Groundwater models are based on a grid structure and models are discretized on cells located on arrangements of rows and columns; is that level of disconnexion of the spatial position of a piece of porous media and the corresponding cell row and column that creates some challenges for the sustainable management of groundwater resources.

We have to create or re-create the duality in between the geospatial and the model grid, that would be similar to duality of a vector GIS object and its metadata on its essence but more difficult to manage. Beginner users won’t face such difficulties when working with a pre and post processing software as Model Muse, however for researchers and professionals related to intermediate topics on groundwater modeling as sensibility analysis of discretization, machine learning for calibration, and coupling groundwater models with ecosystem modeling it would be much more efficient to work seamlessly with geospatial referenced groundwater models.

Affortunately Flopy, the Python library to build and simulate MODFLOW models, has tools to georeference the model grid even with rotation options. The workflow is kind of explicit, meaning that the modeler need a medium knowledge of Python and Flopy tools. This tutorial shows the whole procedure to create a fully geospatial groundwater with MODFLOW and Flopy.

Issues about a “fully geospatial model”

Even though that we have done some tutorial represent MODFLOW results on QGIS, the examples provided weren’t fully geospatial. In order to create numerical model with a “fully geospatial” tag we have to create the model extension from shapefiles, the model discretization from shapefiles, import the surface elevation from rasters, and export the model output to GIS platforms as QGIS. We need a complete coupling of the spatial nature of the groundwater flow regime into our model.

Tutorial
How to create a fully Geospatial Groundwater Model with MODFLOW and Flopy - Tutorial - YouTube

Python code

This is the Python code used in this tutorial:

Import the required libraries
import os
import numpy as np
import matplotlib.pyplot as plt
import flopy
import shapefile as sf #in case you dont have it, form anaconda prompt: pip install pyshp
from flopy.utils.gridgen import Gridgen
from flopy.utils.reference import SpatialReference
import pandas as pd
from scipy.interpolate import griddata
flopy is installed in E:\Software\Anaconda37\lib\site-packages\flopy
Creation of model object and application of MODFLOW NWT
modelname='Model1'
model_ws= '../Model'
mf = flopy.modflow.Modflow(modelname, exe_name="../Exe/MODFLOW-NWT_64.exe", version="mfnwt",model_ws=model_ws)

#Definition of MODFLOW NWT Solver
nwt = flopy.modflow.ModflowNwt(mf ,maxiterout=200,linmeth=2,headtol=0.01)
Refinement areas and spatial / temporal discretization
# Open the shapefiles from the model limit and the refiment area around the wells
modelLimitShp = sf.Reader('../Shp/ModelLimit1.shp')
modelWelShp = sf.Reader('../Shp/ModelWell2.shp')
#We create a preview figure of the model limits and refinement area 

#Numpy array of model limit and refinement area (well area)
limitArray = np.array(modelLimitShp.shapeRecords()[0].shape.points)
wellArray = np.array([point.shape.points[0] for point in modelWelShp.shapeRecords()]) # looks complicated but it is just a list comprehension converted to numpy array
WBB = modelWelShp.bbox                                                                # WBB comes from Well Bounding Box

fig = plt.figure()
plt.plot(limitArray[:,0],limitArray[:,1])
plt.plot([WBB[0],WBB[0],WBB[2],WBB[2],WBB[0]],[WBB[1],WBB[3],WBB[3],WBB[1],WBB[1]])
plt.scatter(wellArray[:,0],wellArray[:,1])
plt.show()
#Since we have geospatial and georeferenced data, we can add a satellite image in the background with the Mplleaflet package

import mplleaflet

crs = {'init' :'epsg:32718'}
mplleaflet.display(fig,crs=crs)

E:\Software\Anaconda37\lib\site-packages\IPython\core\display.py:689: UserWarning: Consider using IPython.display.IFrame instead
  warnings.warn("Consider using IPython.display.IFrame instead")
# Coordinates of the global and local discretization
GloRefBox = modelLimitShp.bbox 
LocRefBox = modelWelShp.bbox 

print(GloRefBox)
print(LocRefBox)

[353300.0, 8547900.0, 356400.0, 8549600.0]
[354369.8840337161, 8548609.34745342, 354904.6274241918, 8549128.04875159]

#Calculating Global Model (Glo) and Local Refinement (Loc) dimensions
GloLx = GloRefBox[2] - GloRefBox[0] #x_max - x_min
GloLy = GloRefBox[3] - GloRefBox[1]
print('Global Refinement Dimension. Easting Dimension: %8.1f, Northing Dimension: %8.1f' % (GloLx,GloLy))

LocLx = LocRefBox[2] - LocRefBox[0] #x_max - x_min
LocLy = LocRefBox[3] - LocRefBox[1]
print('Local Refinement Dimension. Easting Dimension: %8.1f, Northing Dimension: %8.1f' % (LocLx,LocLy))

Global Refinement Dimension. Easting Dimension:   3100.0, Northing Dimension:   1700.0
Local Refinement Dimension. Easting Dimension:    534.7, Northing Dimension:    518.7

#Defining Global and Local Refinements, for purpose of simplicity cell x and y dimension will be the same
celGlo = 100
celRef = 50

def arrayGeneratorCol(gloRef, locRef, gloSize, locSize):

    cellArray = np.array([])

    while cellArray.sum() + gloRef[0] < locRef[0] - celGlo:
        cellArray = np.append(cellArray,[gloSize])
    while cellArray.sum() + gloRef[0] > locRef[0] - celGlo and cellArray.sum() + gloRef[0] < locRef[2] + celGlo:
        cellArray = np.append(cellArray,[locSize])
    while cellArray.sum() + gloRef[0] > locRef[2] + celGlo and cellArray.sum() + gloRef[0] < gloRef[2]:
        cellArray = np.append(cellArray,[gloSize])

    return cellArray

def arrayGeneratorRow(gloRef, locRef, gloSize, locSize):

    cellArray = np.array([])
    accumCoordinate =  gloRef[3] - cellArray.sum()

    while gloRef[3] - cellArray.sum() > locRef[3] + celGlo:
        cellArray = np.append(cellArray,[gloSize])
    while gloRef[3] - cellArray.sum() < locRef[3] + celGlo and gloRef[3] - cellArray.sum() > locRef[1] - celGlo:
        cellArray = np.append(cellArray,[locSize])
    while gloRef[3] - cellArray.sum() < locRef[1] - celGlo and gloRef[3] - cellArray.sum() > gloRef[1]:
        cellArray = np.append(cellArray,[gloSize])

    return cellArray

#Remember that DELR is space between rows, so it is the column dimension array
delRArray = arrayGeneratorCol(GloRefBox, LocRefBox, celGlo, celRef)
delRArray

array([100., 100., 100., 100., 100., 100., 100., 100., 100., 100.,  50.,
        50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,
        50.,  50.,  50., 100., 100., 100., 100., 100., 100., 100., 100.,
       100., 100., 100., 100., 100., 100.])

#And DELC is the space between columns, so its the row dimension array
delCArray = arrayGeneratorRow(GloRefBox, LocRefBox, celGlo, celRef)
delCArray

array([100., 100., 100., 100.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,
        50.,  50.,  50.,  50.,  50.,  50.,  50., 100., 100., 100., 100.,
       100., 100.])

#Calculating number or rows and cols since they are dependant from the discretization
nrows = delCArray.shape[0]
ncols = delRArray.shape[0]
print('Number of rows: %d and number of cols: %d' % (nrows,ncols))

Number of rows: 24 and number of cols: 39

#Define some parametros and values for the spatial and temporal discretization (DIS package)

#Number of layers and layer elevations
nlays = 3
mtop = 0
botm = [-10,-20,-30]

#Number of stress periods and time steps
#In this case we will simulate the effect on the aquifer of 2000 days divided in 10 stress periods of 200 days,
#each stress period is divided in 4 time steps
#there is a steady state stress period at the beginning of the simulation
nper = 11
perlen = np.ones(nper)
perlen[0] = 1
perlen[1:] = 200 * 86400

#Definition of time steps
nstp = np.ones(11) 
nstp[0] = 1
nstp[1:] = 4

#Definition of stress period type, transient or steady state
periodType = np.zeros(11, dtype=bool)
periodType[0] = True

print('This is the lenght of stress periods: ', perlen)
print('This is the number of time steps: ', nstp)
print('This is the stress period type: ', periodType)

This is the lenght of stress periods:  [1.000e+00 1.728e+07 1.728e+07 1.728e+07 1.728e+07 1.728e+07 1.728e+07
 1.728e+07 1.728e+07 1.728e+07 1.728e+07]
This is the number of time steps:  [1. 4. 4. 4. 4. 4. 4. 4. 4. 4. 4.]
This is the stress period type:  [ True False False False False False False False False False False]

# Apply the spatial and temporal discretization parameters to the DIS package
dis = flopy.modflow.ModflowDis(mf, nlay=nlays,
                               nrow=delCArray.shape[0],ncol=delRArray.shape[0],
                               delr=delRArray,delc=delCArray,
                               top=mtop,botm=botm,
                               itmuni=1.,nper=nper,perlen=perlen,nstp=nstp,steady=periodType)

#Assign spatial reference

mf.dis.sr = SpatialReference(delr=delRArray,delc=delCArray, xul=GloRefBox[0], yul= GloRefBox[3],epsg=32718)
mf.dis.sr.epsg

32718

mf.modelgrid.set_coord_info(xoff=GloRefBox[0], yoff=GloRefBox[3]-delCArray.sum(), angrot=0,epsg=32717)

fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(1, 1, 1, aspect='equal')
modelmap = flopy.plot.PlotMapView(model=mf)
linecollection = modelmap.plot_grid(linewidth=0.5, color='royalblue')
#Representation of model geometry with all the boundary conditions
fig = plt.figure(figsize=(8,8))

modelmap = flopy.plot.PlotMapView(model=mf)
linecollection = modelmap.plot_grid(linewidth=0.5, color='cyan')
shpRiver = flopy.plot.plot_shapefile('../Shp/ModelRiver2', facecolor='none') #RIV boundary condition
shpGHB = flopy.plot.plot_shapefile('../Shp/ModelGHB1', facecolor='none')     #GHB boundary condition

plt.plot(limitArray[:,0],limitArray[:,1])
plt.scatter(wellArray[:,0],wellArray[:,1])

crs = {'init' :'epsg:32718'}
mplleaflet.display(fig,crs=crs)
Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

From a conversation with a specialist in soil subsidence we came to the conclusion about which was the most critical hydrogeological data needed for a numerical model. There is a proposed list of required data on this link, but when we plan a hydrogeological study which is critical?

It is possible that this approach would be seen as “not scientific” or informal, and a rigid hydrogeologist could object that results from studies with scarce data or low quality of data are useless, but the reality is that data about the groundwater flow regime and the hydrogeological environment is always scarce. And there are even more complications on the data gathering because these data depend on a number of institutions and shareholders that could not be willing to share it because there is a mainstream idea that "information is power" while in fact "knowledge is power", information is just numbers with a potential use.

Spatial and temporal data can be even in paper format with the risk of an existence of a newer / data version not available because is “under reviewing”.

On this blog we have always look forward the sustainable management of water resources and especially groundwater. The concept of sustainability is not only based on good evaluations from the underground flow regime and aquifer storage, but also on progressive regulations, critical decision making, population awareness campaigns, capacity building, web frameworks, civil society participation and other factors. Hydrogeological studies need to be made with their corresponding numerical models, but those studies need to be updated progressively with the upcoming data and stakeholder participation. The quality of an evaluation depends partially on the quality of the consultant / professional, but also depend on data quality; some institutions tend to “solve” conflicts with the realization of a hydrogeological evaluation with the participation of well known professionals, but this study is impractical if the data was limited and if the study is not updated every 3 or 5 years. The sole realization of only one hydrogeological evaluation is kind of nonsense, it's like trying to combat cancer and plan the whole chemotherapy with only the first diagnosis.

About hydrogeological studies
  • Hydrogeological studies are needed,

  • Hydrogeological studies depend on numerical modeling,

  • Hydrogeological studies are limited at the beginning,

  • Hydrogeological studies can and need to be updated,

  • Hydrogeological studies are time, capacities and resources expensive,

  • Hydrogeological studies must be public and online available,

  • Hydrogeological studies need to be understood by the population,

  • Regulation and management plans have to be done from the hydrogeological studies,

  • Regulation and management plans need to be updated

Obtainable or accessible data

Even though the data is scarce, there are options to get the data with a certain degree of acceptance on a regional scale:

  • Digital Elevation Model (DEM): Can be obtained from Aster Dems or Alos Palsar images

  • Recharge: Can be inferred as a percentage from precipitation

  • Water network: Is calculated from the DEM with tools of SAGA GIS / QGIS

  • Geology: Alluvial aquifers and outcrops can be extracted from a satellite image

  • Potential evapotranspiration:  Calculated from the FAO Penman-Monteith equation

  • Wetlands: Can be delineated from an NDVI image on the dry season

Key data for a numerical model

Although the previous data could be obtained from a remote sensing or online repositories, the following data is almost unreproducible and has to be taken on the field

  • Well / Piezometer location

  • Well / Piezometer installation details

  • Piezometric water levels

  • Pumping rates

  • Baseflows (if applicable)

  • If a groundwater quality evaluation is performed, chemistry data have to be added to the list.

Conclusion

We hope we have given a practical and pragmatic overview of the key data needed for a hydrogeological evaluation as a tool of sustainable water management. There is a lot we can do for the preservation of our groundwater resources, however critical steps are only being made when the aquifers reach a critical situation; this failure can be avoided.


Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Following the term “applied hydrogeology for non hydrogeologist” we found that little has been made to bring practical and scientific-based concepts to professionals from other areas (and for the common people as well). Hydrogeology itself seems to be an area with a variety of “flavours” where the knowledge of groundwater resources has “trends” based on authors, disciplines or tools, however, there is a common characteristic in the study of groundwater resources worldwide: hydrogeological evaluations are expensive, take a lot of time and deal with a high degree of uncertainty.

Hydrogeologist need to support the industry in a modular manner where hydrogeological concepts and evaluations has to be understood by all the related stakeholders in order to conduct an industrial activity with a clear sense of pumping / water level performance and changes in water quality with time.

Popular hydrogeology and decision making

Even though the decisions about the groundwater use can affect the feasibility of an industrial plant, the common background and understanding of how an aquifer works remain very poor among the project and planning personal. That scenario would bring an interesting question: If few people know exactly how an aquifer will perform on the future, how a team plans the water supply of an industrial activity?

Key aspects

This article brings some key aspects to take into account on the decision making process for the planning and project phase of an industry based on groundwater supply.

  1. Aquifer sustainability: Let's say that an aquifer is a dynamic reservoir and you plan to extract from this reservoir, but how much water can you pump?. Will you extract water or mine water? The answer to this question requires to look on the inflows to the groundwater flow regime, that is usually recharge from precipitation but it can be recharge by irrigation, the interaction with a lake or river, among others. The amount of water that you can pump cannot be greater that the amount that enters the system otherwise you will be mining the aquifer and pumping wells will show a decreasing trend of water levels and potentially they well will dry.

  2. Porous media: An aquifer is a dynamic reservoir, but the dynamic is a particularly slow. Travel paths on the groundwater flow regime can take weeks, months, years of decades. The porous media regulates the maximum amount of water that an industry can pump, if the hydraulic conductivity of the porous media is high (case of gravel or coarse sand) the amount of available water for pumping will be higher than in the case of silt or clay.

  3. Extraction method: Sometimes an industry cannot pump all the required water not because the aquifer is unable to supply the demand, but because the design of the extraction method is wrong. In order to increase pumping flow, wells need to be as deep as possible, screened on most of the wet depth and with the well installed at well bottom.

  4. Aquifer water quality: Salinization or contamination can pose threats to industrial water demand. Usually freshwater is located on the upper parts of the aquifer, whereas more saline water is located on the bottom part of the aquifer. Pumping bring fresh water on the beginning but the dissolved solids concentration (TDS) can increase with time when pumping interacts with the lower horizons of the aquifer.

  5. Social licence: Industrial use of the aquifers will bring impacts on the neighboring users, usually these impacts are a decrease in water level. The assessment of this decrease have to be done prior to the operation to conduct social programs, run workshops and create strategies on the social networks.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Stiff Diagrams are a common and powerful tool for the representation of surface water / groundwater main ions. Anion and cation concentrations are represented on equivalent weight (meq/l), and usually cations are represented at the left side and anions at the right side. Traditionally, this diagram is useful for the comparison of the main water chemical components by examination of a series of diagrams, however it was not easy to compare the diagrams with the position of the observacion point.

To enhance the chemical analysis on regional scale this tutorial has coupled the Stiff Diagrams with their position on a QGIS project. The diagramas are generated from a spreadsheet with Python on a Jupyter Notebook and stored a vector file (.svg), then the images files are referenced on a style file (.sld) and uploaded to QGIS3.

Tutorial
How to do a georeferenced Stiff Diagram with Python 3 and QGIS 3 - Tutorial - YouTube


Code

This is the main code for the diagram representation and file export:

Import the required libraries

Fot this tutorial we have developed two packages, one that stores some text for the style file (*.sld) and another that generates the Stiff format. There are required packages for the tutorial as pandas, re, and os.

%matplotlib inline
import pandas as pd
import numpy as np
import re, os

from funciones import *
from variables import *
Define the equivalent concentrations and open the chemistry data

The code converts component concentration to equivalent HCO3 weights and creates a columns with the calculated values for each sample.

#ion dictionary
iones = {
'HCO3': 61, 'CO3' : 30, 'Cl' : 35, 'SO4': 48,
'Na' : 23, 'Ca' : 20, 'Mg' : 12, 'K'  : 39
}

#chemistry dataframe
datosQuimica = pd.read_excel('../InputData/DatosDiagramaStiff.xlsx')

#replace incompatible characters
datosQuimica['Estacion'] = datosQuimica['Estacion'].str.replace("/","_")
datosQuimica['Estacion'] = datosQuimica['Estacion'].str.replace("–","-")
datosQuimica['Estacion'] = datosQuimica['Estacion'].str.replace(" |%/s","")
datosQuimica = datosQuimica.set_index(['Estacion'])

#equivalen weight colum
for ion in iones.keys():
    datosQuimica[str(ion)+'_meq'] = datosQuimica[ion]/iones[ion]
Generation of images files

This tutorial generates the Stiff diagram as Png and SVG files. In order to import the Stiff diagram in QGIS we need the image vector file SVG.

for index, row in datosQuimica.iterrows():
    Na_K, Ca, Mg = row['Na_meq']+row['K_meq'], row['Ca_meq'], row['Mg_meq'] 
    Cl, SO4, HCO3_CO3 = row['Cl_meq'], row['SO4_meq'], row['HCO3_meq']+row['CO3_meq']
    #apply some factor for the axis
    maxConNorm = max([Na_K, Ca, Mg, Cl, SO4, HCO3_CO3])*2
    #set of points of the Stiff diagram
    a = np.array([[0.5 + Cl/maxConNorm,1],[0.5 + SO4/maxConNorm,.5],[0.5 + HCO3_CO3/maxConNorm,0]
                  ,[0.5 - Mg/maxConNorm,0],[0.5 - Ca/maxConNorm,.5],[0.5 - Na_K/maxConNorm,1]])

    figura = diagramaStiff(a, maxConNorm, index)
    figura.savefig('../Svg/Stiff-'+str(index)+'.svg')
    figura.savefig('../Png/Stiff-'+str(index)+'.png')
Representation of the generated Stiff diagrams

A sample representation of the generated diagrams

import matplotlib.pyplot as plt
stiffObject = plt.imread('../Png/Stiff-CHA-01.png')
fig, ax = plt.subplots(figsize=(10,6))
ax.axis('off')
ax.imshow(stiffObject)
plt.show()
Generation of spatial file and style file

The observation points with their coordinates are exported in one file and the Stiff diagrams are linked on a style file.

#observation point spatial file
datosQuimicaGeo = datosQuimica.loc[:,'Este':'Norte']
datosQuimicaGeo.to_csv('../Txt/datosQuimicaGeo.csv')

#path to the Svg folder
imagePath = os.path.join(os.path.dirname(os.getcwd()),'Svg')
imagePath = imagePath.replace('\\','/')
imagePath

'C:/Users/GIDAWK1/Documents/GeoreferencedStiffDiagramwithPythonandQGIS/Svg'

#style file generation
archivoestilos = open('../Txt/estilosQuimicaGeo.sld','w')
archivoestilos.write(encabezado)

for index, row in datosQuimica.iterrows():
    item = re.sub('%%path%%',imagePath,item)
    estiloitem = re.sub('%%index%%',index,item)
    archivoestilos.write(estiloitem)
archivoestilos.write(final)

archivoestilos.close()

Input files

Input files for this tutorial can be downloaded from this link.


Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

On the MODFLOW groundwater model construction process in Model Muse there are tools to import hydrogeological parameters as hydraulic conductivity and boundary conditions from shapefiles assigning the parameter values from the spatial object metadata. This type of workflow is useful for idealized aquifers or simple hydrogeological assessments; however on groundwater models at regional scale the calibration process requires the quick and repetitive change of the hydrogeological parameters and boundary conditions to evaluate the hydraulic response against observed data.

For model calibration the use of Global Variables (Data/Edit Global Variables...) of Model Muse makes relatively easy, ordered and with better change control the calibration process. This tutorial gives the procedure to implement Global Variables for the hydraulic conductivities of 15 hydrogeological units distributed on a model of 560 square kilometers.

Tutorial

Input data

The input files for this tutorial can be downloaded on this link.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Groundwater modeling on the regional scale or with huge baseline can be tedious to do manually in a Graphical User Interface as Model Muse. There are more advanced options to insert a great amount of wells with long and diverse pumping schedules with Flopy or by altering the *.gpt file with some programming effort; however these are kind of intermediate level solutions that would be time expensive for a beginner groundwater modeler.

This tutorial shows the procedure to insert multiple wells with different pumping rates in MODFLOW with Model Muse by the use of some special features. The procedure can insert wells at different depths however it cannot set the well name and in case of wells with multiple pumping records a group of superposed wells will be inserted, one for each pumping rate record.

Aerial view and cross section of inserted wells at different depths

All the processing files used for the tutorial can be found at the end of this post.

Tutorial
Implementation of Multiple Wells with MODFLOW and Model Muse - Tutorial - YouTube

Input files

You can download the input files for this tutorial here.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Quick tutorial about how to get geospatial weather data in QGIS using the QWeather plugin. This plugin connects QGIS with the Yahoo Weather API and retrives all information from a location or a lat/long coordinate. Weather data is available for the current day and data is represent as a geojson file.

The tutorial shows the common procedure to retrieve data for capitals and explore the location and metadata information available of precipitation, wind (speed, direction), temperature and humidity. It is possible to setup a defined location list using a .csv file; for the tutorial, main cities in Saxony, Germany were selected.

Tutorial
How to Get Geospatial Weather Information with QGIS and QWeather - Tutorial - YouTube

Input data

You can download the input files for the tutorial here.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Groundwater modeling with MODFLOW and other codes are defined as inverse modeling where the aquifer parameters can be calculated from the comparison of model results with observed data. This comparison process is time consuming, employs acceptance criteria and trend analysis of the boundary condition influence.

There are tools for the comparison of observed and simulated heads in Model Muse and custom charts can be done with few lines in Python. This tutorial cover the whole procedure to create a simulated / observed plot in Python from the results of a MODFLOW model run on Model Muse. The study case is over a regional model with more than 100 piezometers. The tutorial creates a graph with a colorbar and exports it as a JPG file.

Tutorial
MODFLOW Observed / Simulated Head Comparison Plot with Model Muse and Python - YouTube

Python code

This is the code in Python for the tutorial:

# Import the required libraries
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Setup the model folder and model name
modPath = '../Model/'
modName = 'Modelo1'
# Import observation results as a Pandas dataframe
hobOut = pd.read_csv(modPath + modName + '.hob_out',delimiter='\s+')
hobOut.head()
SIMULATED EQUIVALENT OBSERVED VALUE OBSERVATION NAME
0 3741.871338 3758.0 SD_04_1
1 3744.384277 3763.0 SD_04_2
2 3748.123779 3767.0 SD_04_3
3 3765.178711 3776.0 SD_04_4
4 3761.951904 3784.0 SD_05_5
# Column names are renamed. There is one more column on the dataframe from the difference in between observed - simulated
hobOut.rename(columns={'SIMULATED EQUIVALENT':'Simulated Head',
                      'OBSERVED VALUE':'Observed Head',
                      'OBSERVATION NAME':'Piezometer'},inplace=True)
hobOut.set_index('Piezometer', inplace=True)
hobOut['Residual'] = hobOut['Simulated Head'] - hobOut['Observed Head']
hobOut.head()
Simulated Head Observed Head Residual
Piezometer
SD_04_1 3741.871338 3758.0 -16.128662
SD_04_2 3744.384277 3763.0 -18.615723
SD_04_3 3748.123779 3767.0 -18.876221
SD_04_4 3765.178711 3776.0 -10.821289
SD_05_5 3761.951904 3784.0 -22.048096
#Piezometers that went dry are filtered from the plot, because there is no mean to compare a simulated dry piezometer with
#a observed head
hobOutFil = hobOut[hobOut['Simulated Head']>-10000]
hobOutFil.head()
Simulated Head Observed Head Residual
Piezometer
SD_04_1 3741.871338 3758.0 -16.128662
SD_04_2 3744.384277 3763.0 -18.615723
SD_04_3 3748.123779 3767.0 -18.876221
SD_04_4 3765.178711 3776.0 -10.821289
SD_05_5 3761.951904 3784.0 -22.048096
#Create a basic scatter plot with Matplotlib
#A identity line was created based on the minumum and maximum observed value
#Points markers are colored by the residual and a residual colorbar is added to the figure
fig = plt.figure(figsize=(10,8))
x = np.linspace(hobOutFil['Observed Head'].min(), hobOutFil['Observed Head'].max(), 100)
plt.plot(x, x, linestyle='dashed')
plt.scatter(hobOutFil['Observed Head'],hobOutFil['Simulated Head'], marker='o', c=hobOutFil['Residual'])

cbar = plt.colorbar()
cbar.set_label('Residual (m)', fontsize=14)

plt.grid()
plt.xlabel('Observed Head (m)', fontsize=14)
plt.ylabel('Simulated Head (m)', fontsize=14)
fig.tight_layout()
fig.savefig('../Figures/ObservedSimulatedHeadComparisonPlot.png')

Input files

You can download the input files for this tutorial on this link.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Pumping well productivity depends of the aquifer porous media, aquifer thickness and extension, physical processes of water cycle relevant to groundwater flow regime, well design and operation considerations. Determination of maximum pumping rate from a well is the key for well construction process because the maximum rate is relevant to pump sizing, licensing, purchase of conduction materials and dimension of water storage facilities. On a project feasibility perpective, the maximum rate estimation is important to meet the project demand on its different stages.

This tutorial shows the complete procedure to determine the maximum pumping rate from a well on a quaternary aquifer on steady state flow conditions with MODFLOW and Model Muse. The tutorial covers all the steps of spatial and temporal discretization, boundary condition setup and hydraulic parameter definition, with an emphasis on the conceptualization of a maximum pumping scenario with operational conditions on the well.


Tutorial
Maximum Pumping Well Rate Estimation with Modflow and ModelMuse - Tutorial - YouTube

Input Files

You can download the input files for this tutorial on this link.


Read Full Article

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview