Indian Forum for Water Adroit

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Karthikeyan L

Pages: 1 [2] 3 4 5
Work carried out by Ms. Buvaneshwari has been published in Science of the Total Environment.

Title: Groundwater resource vulnerability and spatial variability of nitrate contamination: Insights from high density tubewell monitoring in a hard rock aquifer

Description: Agriculture has been increasingly relying on groundwater irrigation for the last decades, leading to severe groundwater depletion and/or nitrate contamination. Understanding the links between nitrate concentration and groundwater resource is a prerequisite for assessing the sustainability of irrigated systems. The Berambadi catchment (ORE-BVET/Kabini Critical Zone Observatory) in Southern India is a typical example of intensive irrigated agriculture and then an ideal site to study the relative influences of land use, management practices and aquifer properties on NO3 spatial distribution in groundwater. The monitoring of > 200 tube wells revealed nitrate concentrations from 1 to 360 mg/L. Three configurations of groundwater level and elevation gradient were identified: i) NO3 hot spots associated to deep groundwater levels (30–60 m) and low groundwater elevation gradient suggest small groundwater reserve with absence of lateral flow, then degradation of groundwater quality due to recycling through pumping and return flow; ii) high groundwater elevation gradient, moderate NO3 concentrations suggest that significant lateral flow prevented NO3 enrichment; iii) low NO3 concentrations, low groundwater elevation gradient and shallow groundwater indicate a large reserve. We propose that mapping groundwater level and gradient could be used to delineate zones vulnerable to agriculture intensification in catchments where groundwater from low-yielding aquifers is the only source of irrigation. Then, wells located in low groundwater elevation gradient zones are likely to be suitable for assessing the impacts of local agricultural systems, while wells located in zones with high elevation gradient would reflect the average groundwater quality of the catchment, and hence should be used for regional mapping of groundwater quality. Irrigation with NO3 concentrated groundwater induces a “hidden” input of nitrogen to the crop which can reach 200 kgN/ha/yr in hotspot areas, enhancing groundwater contamination. Such fluxes, once taken into account in fertilizer management, would allow optimizing fertilizer consumption and mitigate high nitrate concentrations in groundwater.

Buvaneshwari, S., Riotte, J., Sekhar, M., Kumar, M. M., Sharma, A. K., Duprey, J. L., ... & Durand, P. (2017). Groundwater resource vulnerability and spatial variability of nitrate contamination: Insights from high density tubewell monitoring in a hard rock aquifer. Science of The Total Environment, 579, 838-847.

Buvaneshwari can be reached at

Programming / Re: Python Resources for Hydrologists
« on: January 07, 2017, 04:24:13 AM »
How did I miss them :P Congratulations Sat!  :)

Programming / Re: R vs Python
« on: December 29, 2016, 03:31:06 PM »
I think MATLAB can be competent enough for GIS functionality, its just that the toolbox is not well explored. MATLAB has a dedicated MAPPING toolbox. I had a task of plotting spatial maps to present my results and I was not satisfied with the colormaps of R and Python (may be I was not patient enough to edit the preset colormaps to my requirements), this lead me to MATLAB. I presented my findings from toolbox in a MATLAB primer seminar series held at IISc. The following code plots a spatial map of mean daily rainfall (mm) over India. I plotted the same data in R and Python and felt MATLAB produced satisfactory outcome.

Code: [Select]
% Geo-Spatial Plotting in MATLAB using MAPPING Toolbox %

% Unzip data.rar and change directory to unzipped folder; Load requisite data for plot
load data_spatial_mapping.mat;                 
% Read shapefile of India
S = shaperead('India.shp','usegeocoords',true);
% Define map projection
axesm('MapProjection', 'eqdcylin')
% Set map axis limits and labels
setm(gca,'GLineStyle','--', 'GColor',[0.83 0.82 0.78], 'Grid','on','Frame','on')
setm(gca, 'MapLatLimit',[8 37.2],'MapLonLimit',[68 97.5],...
    'MlabelLocation', 5,'MLabelParallel','north', 'MeridianLabel','on',...
% Plot shapefile of India
geoshow(S.Lat,S.Lon,'LineWidth', 2,'Color',[0 0 0])
% Overlay with data
% geoshow(lat_mesh,lon_mesh,data_mesh,'DisplayType','surface');
colormap hsv;
xlabel('Mean Daily Rainfall (mm)','FontSize',14)      % Add title to the map

I can say that 'setm' is the heart of this code which sets the requisite parameters of the map.
Functions list in Mapping Toolbox can be found from here:

I would suggest interested people to edit this code and see the changes happening in the map.

I am still interested in learning in detail the 'ggplot2' and other important packages of R that support GIS functionality. Although they are huge, I wish there is some tutorial that covers all the aspects of these packages.

MATLAB has a function called 'MEX function - Matlab EXecutable function' which is used to compile your source codes written in C or C++ or Fortran and invoke them from MATLAB. It is a facility through which you can create a C/C++/Fortran wrapper code (called the MEX function in this context) which in turn is used to pass data from MATLAB to source codes which does the computations and pass the outputs back to MATLAB.

MATLAB----> Prepare your data in MATLAB ----> Pass data to MEX function ----> MEX function passes data to C/C++/Fortran codes which does computation and produces output ----> Read output in MATLAB

Effectively, once you compile the MEX function, it just acts as any other MATLAB function, although it's written in C/C++/Fortran language.

The biggest advantage of this procedure is that the computations are extremely fast because of precise memory allocations that you carry out in your C/C++/Fortran codes.

So, you can write core operations of your bulky MATLAB codes in these machine languages and call them using MEX function.

You can find further information in
MATLAB Documentation: 1) 2)

Some tutorial:

I would like to illustrate an example of this function where the task is to add two matrices. So, I write the following MEX function in C language (code's name is addmat.c) to carry out the task.

Code: [Select]
/********* addmat.c ************/
#include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
    /* Declarations */
    double *A, *B, *C; /* A, B, C are pointers */
    int m,n,i,j;
    /************** INPUT AND OUTPUT INITIALIZATIONS *********************************/
    /* Initialization - 'mxGetPr' is used to pass data; 'mxGetM' & 'mxGetN' are used to estimate the size of matrix */
    A = mxGetPr(prhs[0]); /* Passes first input matrix using prhs[0] which is a pointer to input */
    B = mxGetPr(prhs[1]); /* Passes first second matrix using prhs[1] which is a pointer to input */
    m = mxGetM(prhs[0]);
    n = mxGetN(prhs[0]);
   /* Similar to prhs, 'plhs' are array of pointers which pass expected output to MATLAB */
   /* In the step below pointer to output matrix is being created, which is of consistent dimensions with that of A and B */
    plhs[0] = mxCreateDoubleMatrix(m, n, mxREAL);

    C = mxGetPr(plhs[0]); /* This line indicates initialization of plhs[0] pointer to that of C, this step ensures that what ever modifications we do to C will be reflected in output, i.e., we ultimately get C as the output */


    /************** CODE TO ADD TWO MATRICES *********************************/
    for (i=0;i<m;i++)
        for (j=0;j<n;j++)

Once you write this C code, its MEX function can be created by running line >> mex addmat.c in MATLAB and you get following outcome.
Code: [Select]
>> mex addmat.c
Building with 'gcc'.
MEX completed successfully.

Once MEX file is successfully compiled you can observe a file addmat.mexa64 created in your working directory. That's it! Now you can use your mex code in MATLAB the following way to add two matrices.
Code: [Select]
>> a=[1 2;3 4];b=[7 -2;6 -10];
>> a

a =

     1     2
     3     4

>> b

b =

     7    -2
     6   -10

>> c=addmat(a,b)

c =

     8     0
     9    -6

One can write much complicated C/C++/Fortran codes and invoke them from MATLAB.

Writing MEX function is the most efficient way of tackling with cumbersome algorithms. Such a facility exists in R ( and Python ( too and the concept is something very similar to that of MATLAB.

Announcements / Working with Time and Frequency in MATLAB
« on: September 12, 2016, 06:52:31 PM »
Indian Institute of Science
Date & Time : 20th September 2016, 02:00 PM
Venue : IV Floor, SERC Auditorium
Speaker: Loren Shure

In this technical session, Loren Shure, MathWorks Technical Ambassador will present tools and techniques for accessing,  visualizing, analyzing, and measuring signals and other time-series data. Using real-world examples from a variety of application domains, she will demonstrate how you can use MATLAB, along with the Signal Processing Toolbox, to extract meaningful information from signals and other time-series data much more quickly and easily than with conventional tools and techniques.


•Import data from various sources

•Analyze signals in the time and frequency domain

•Remove noise by designing/applying filters

•Build scripts that automatically repeat the analysis

•Generate reports and build apps

Register at:

Admission is free but seats are limited.

Models / VIC Model - Version 5.0.0
« on: September 07, 2016, 09:43:56 PM »
Released on September 2, 2016.

This is a major update from VIC 4. The VIC 5.0.0 release aims to have nearly identical physics as VIC 4.2 while providing a clean, refactored code base supporting multiple drivers. There are a number of new features, bug fixes, and backward incompatible changes. See the VIC Github page for more details on the changes included in this release.

Programming / MATLAB - Plotting/Graphics
« on: August 23, 2016, 08:13:45 PM »
Dear all,

I have taken a session of MATLAB Graphics primer for the first year ME students in IISc. In this process, I have prepared some scripts which will familiarize one with wide range of plotting options available in MATLAB. The link below contains rar file having scripts, sample datasets and a pdf of presentation that I have made.

There is a script in the folder by name 'spatial mapping.m' which I feel is the most useful script for researchers working on geo-spatial domains. It is based on mapping toolbox. I have even provided sample data to run the script and see the output. I want to stress the fact that MATLAB has done wonderful job in generating spatial maps. Please feel free to use the codes in your research.


Announcements / IEEE Workshop on Programming with Python
« on: August 10, 2016, 08:05:17 PM »
IEEE-IISc student branch is organizing a workshop on programming with
python language. Please avail this opportunity and have an edifying
experience with learning python.

When: 19th and 20th August 2016
Where: Golden Jubilee Hall,ECE dept,IISc
Timings: 9am-6pm

Lunch/Beverages/Snacks are offered.

The details of the workshop are as follows:

Day 1: Python Basics - Part 1

Day 1: Natural Language Processing - Part 1

Day 2: Python Basics - Part 2

Day 2: Natural Language Processing - Part 2

Day 2: Recommender Systems

The costs associated with the workshops are as follows:

1000 - For IISc student who is an IEEE member

1500 - For IISc student who is not an IEEE member

2000 - For IEEE member(who is not a student)

2500 - For non-IEEE member(who is not a student)

Please visit the link below to find the session flow of the workshop

Please visit the link below to register for the workshop

Note: Please register by august 15th.

Programming / Mapping in MATLAB
« on: July 11, 2016, 11:41:05 PM »
MATLAB has an extensively developed mapping toolbox for preparing geospatial images. Users can perform operations such as altering the projection system, reading the KML and shapefiles etc.

User manual and reference guide for MATLAB R2016a can be obtained from the links below:

Also, link below provides a good description of the toolbox with the aid of examples:

Post your question/information / Re: KS test to fit pdf
« on: June 22, 2016, 11:53:51 AM »
The test statistic of KS test is: Maximum absolute distance between two CDFs.

Suppose you want to check if a particular dataset (say X) is following a certain distribution (say exponential distribution, Now, intuition suggests that the CDF obtained empirically from data ( aligns closely with CDF obtained by fitting X with exponential distribution. Now for the second part, you need exponential distribution CDF equation which will be of form F(x|lambda), where lambda is the parameter of distribution. Here you need sort of a representative of X to be substituted in aforesaid CDF equation. That will be the parameter 'lambda'. So, you substitute lambda and provide x values to get corresponding CDF values.

Since you are comparing 13 distributions, you first need empirical CDF and 13 CDFs obtained by above procedure. Then you compare each of the 13 CDFs with empirical CDF using KS test.

In case of matlab, kstest is the command used for this purpose ( If you go through the help file, there is an example where you can directly provide two CDFs in syntax and get test result.

I am providing the example from help file below:

Specify the Hypothesized Distribution Using a Two-Column Matrix
Load the sample data. Create a vector containing the first column of the students' exam grades data.
Code: [Select]
load examgrades;
x = grades(:,1);
Specify the hypothesized distribution as a two-column matrix. Column 1 contains the data vector x. Column 2 contains cdf values evaluated at each value in x for a hypothesized Student's t distribution with a location parameter of 75, a scale parameter of 10, and one degree of freedom.
Code: [Select]
test_cdf = [x,cdf('tlocationscale',x,75,10,1)];Test if the data are from the hypothesized distribution.
Code: [Select]
h = kstest(x,'CDF',test_cdf)
h =
The returned value of h = 1 indicates that kstest rejects the null hypothesis at the default 5% significance level.

Models / Re: Anybody working with VIC model
« on: June 16, 2016, 02:46:27 PM »
I would like to add some more information to this post. From personal communication with Sat I could learn the manner in which flow direction map should be prepared and I would like to summarize the findings here.

Once the flow direction map is prepared, though a tedious job in case of huge basins, one has to visualize how the flow is taking place from one cell to other. Say I have following 3 by 3 cells encompassing my basin.
1 1 0
1 1 0
0 0 1
where, 1 indicates locations where basin is situated and cell(3,3) is the outlet (indicating all the water in basin should drain to this cell). Let us assume we got following flow direction map.
5 7 0
5 1 0
0 0 1
where, the numbers indicate the directions provided in

If you observe cell(2,1) the flow direction, which is 5, is showing that the water is flowing outwards (south direction). And cell(2,2) has north direction. It can be observed that these numbers will form an eternal loop of water flow without it ever reaching cell(3,3). This could lead to an error while executing routing model, more specifically, "Searching for catchment" issue.
I would expect the cell(2,1)'s direction to be 3 (towards east) and cell(2,2)'s direction to be 4 (south-east towards cell (3,3)) which gives the following flow direction file.
5 7 0
3 4 0
0 0 1

Now if we visualize the flow of water from cell to cell, we can observe that water from all the cells finally reaches cell(3,3). Thank you Sat for helping me understand this very sensible concept.

Data / Water Resources Information System (WRIS)
« on: June 16, 2016, 12:09:34 AM »
I guess most of you might be knowing, but this website WRIS maintained by the central government of India has comprehensive information about DEM, watersheds, river network, LULC, Dams, Reservoirs, monitoring stations etc. for all the major river basins of India.

Upon registration, one can even download data of say streamflow observations of some of the stations from the following link.

Also, some real time rainfall information can be obtained from AWS network maintained by IMD. Visit following link.

Although, the WRIS website is not very user-friendly it gives huge amount of information at free of cost.

Data / Re: ABout the "Quantile map bias correction"
« on: May 03, 2016, 11:11:16 AM »
If you are using distribution based mapping, I think the issue is occurring in doQmapDIST.R code. You can either view that code in R or check this github link

I feel upon reading the code (and testing with example dataset), we can understand what exactly is the problem.

« on: April 27, 2016, 03:18:21 PM »

About the Summer School
The summer school aims to draw the attention of outstanding students towards exciting research areas in Climate Studies. The course content will include lectures and tutorials on climate science and policy by faculty members from IITB and other renowned institutes.

Eligibility criteria
Pre-final and final year of BE/BTech,  ME/MTech,  MPlanning and MSc students can apply for the summer school.

•  Climate Science

•  Observations and Modeling

•  Impact Assessment and Vulnerability

•  Mitigation and Adaptation

•  Climate Policy

Registration Fee
Rs. 1000 for Shortlisted Candidates.

Important Dates
Fully filled application form & a letter of recommendation should reach us by 5 pm, 10 May, 2016.

* Note: Selected applicants will be given the reimbursement of to and fro 3AC rail fare, local hospitality and accommodation to facilitate their participation.


Ms. Archismita Banerjee and Ms. Rameshwari Ramdas Ahire
IDP in Climate Studies
Phone: +91 22-2576-5141/42

School Coordinators

Prof.  Arpita Mondal, Associate Faculty in Interdisciplinary Program in Climate Studies and Assistant Professor, Department of Civil Engineering, IIT Bombay.


Phone: +91 22 2576 9305

Prof. Harish Phuleria, Associate Faculty in Interdisciplinary Program in Climate Studies and Assistant Professor, Centre for Environmental Science & Engineering, IIT Bombay.


Phone: +91 22 2576 5851

Prof. Ritesh Gautam, Associate Faculty in Interdisciplinary Program in Climate Studies and Assistant Professor, Center of Studies in Resources Engineering, IIT Bombay.


Phone: +91 22 2576 7663

More Details -

Pages: 1 [2] 3 4 5