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
Data / Free GIS Data
« on: March 11, 2019, 11:38:41 PM »
The following contains information on variable wise as well as country wise free GIS datasets. A very good summary!
The following users thanked this post: Subir Paul, Pankaj Dey

Recently, I have published a couple of papers related to satellite microwave soil moisture research in the Advances in Water Resources Journal.

The process of retrieving soil moisture from satellite microwave sensors depends on the type of sensor i.e., active and passive microwave sensors. Over the past four decades, the microwave community has progressed in terms of improving the sensor design and retrieval algorithm so as to achieve accurate global scale soil moisture observations.

The first paper titled "Four decades of microwave satellite soil moisture observations: Part 1. A review of retrieval algorithms" gives a comprehensive overview of the developments that took place in the retrieval algorithms over the past four decades. The paper discusses the algorithmic developments of both active as well as passive sensors. We have also, for the first time, summarized the literature in the form of figures, one each for active and passive microwave soil moisture research (PFA). This review also discusses the latest developments in components of the algorithms, and also discusses the challenges that need attention in future. I can say that this paper serves as a starting point for someone who wants to venture into the field of microwave soil moisture research.

The second paper titled "Four decades of microwave satellite soil moisture observations: Part 2. Product validation and inter-satellite comparisons" is focused on assessing the accuracy of soil moisture products, which were developed over the past forty years. We have considered eight passive (SMMR, SSM/I, TMI, AMSR-E, WindSAT, AMSR2, SMOS, and SMAP), two active (ERS-Scatterometer, and MetOp-ASCAT), and one active-passive combined (ESA-CCI combined product) soil moisture products for the analysis. The Contiguous United States (CONUS) is considered as a case study. The validation is carried out using the data pertaining to 1058 stations over the CONUS, along with model soil moisture simulations obtained from the VIC land surface model. We analyzed these products in terms of daily coverage (a figure in this context is atteched with this post), temporal performance, and spatial performance. We also carried out inter-satellite comparisons to study the roles of sensor design and algorithms on the retrieval accuracy. The Part 1 serves as a prelude to this paper. Through these papers, one can get an idea about how well the satellites along with algorithms have progressed over the four decades and significantly improved the accuracy of soil moisture retrievals.

Part 1 can be downloaded for free from here: (until November 4, 2017)
Part 2 can be downloaded for free from here: (until November 17, 2017)

Here are the permanent links:
Part 1:
Part 2:

You can write an email to me at for full-text requests or any other query related to papers.
The following users thanked this post: Diwan

The work carried out by Ila Chawla along with Prof. P.P. Mujumdar titled "Partitioning Uncertainty in Streamflow Projections under Nonstationary Model Conditions" was recently published in the Advances in Water Resources Journal.

In this work, the authors, in a novel attempt, have addressed the possibility of nonstationary hydrological model (here they have used the VIC land surface model coupled with a routing model). They found that the hydrological model parameters, which are influenced by climate variables, vary over time, and thus may not be assumed to be stationary. Further, the work also involves attribution the total uncertainty in the streamflow projections to multiple effects such as, model parameters, GCM simulations, emission scenarios, land use scenarios, the assumption of hydrological model stationarity, along with internal variability of the model. The Upper Ganga Basin (UGB) is considered as a case study for this analysis.

Further details on the work can be found here:

Authors are glad to share their article with interested readers.

Correspondence to:
The following users thanked this post: Diwan, Hemant Kumar

Programming / Re: Exporting High Resolution figures from 'R'
« on: July 06, 2017, 12:21:18 AM »
We can create high resolution plots in two ways: 1) using the default functions; 2) using the 'cairo' package. Say you want to create a tiff file. Both methods have the following syntax,

Code: [Select]
tiff (filename='filename.tiff',  width=5, height=4,units="in",pointsize=12,res=72)
$$your plot command$$ ()
In case of cairo, load the library first, instead of tiff we use:
Code: [Select]
cairo(filename='filename.tiff', type="tiff", width=5, height=4,units="in",pointsize=12,res=72)Cairo is used because it produces much smoother plots.

Say you want to increase the resolution to 300 dpi from existing 72 dpi. Apart from changing 'res' in the function input, you should also increase the pointsize. The default pointsize correspond to 1/72 of inch. The pointsize should be increased according to this formula: 12×(new resolution)/72. In case of 300 dpi, it will be 12×300/72=50.

In case your output seems to be clumsy, increase width and height parameters.
The following users thanked this post: shailza

Models / Re: I need help to run Skehekin sample with VIC 5.0
« on: June 24, 2017, 05:34:05 PM »
You will have to compile the model first. You can find detailed explanations regarding setting up the VIC model in the following links:
The following users thanked this post: giaMSU

Post your question/information / Re: Indexed image in Matlab
« on: May 10, 2017, 10:23:00 AM »
An indexed image is useful to represent the image which has limited number of colors in it so as to reduce the space consumption (of the image). As the name suggests, an indexed image is a matrix of indexes with each number pointing to the color in the colormap matrix.

Say you have an image with only three colors red, green and blue and no other color, its indexed image X (assuming it to be a 4x4 matrix image) could look something like this:
Code: [Select]
X=[3,2,2,1;1,3,1,2;1,2,1,2];And the corresponding colormap matrix will be:
Code: [Select]
map=[1,0,0;0,1,0;0,0,1];Here map will be 3x3 matrix with rows indicating number of colors (which is three in this example) and columns indicating R,G,B (the numbers will be varying between [0,1]).
For example, 3 in X simply points to 3rd row in map matrix and takes its corresponding color (which is blue).

Once you obtain index and colormap from an image, you can use them to get an RGB image by using ind2rgb
 ( command. This command simply maps indexes to the colormap matrix and creates a 3D matrix where the third dimension contains the RGB colors. You can run following lines in matlab for better understanding:

Code: [Select]
[X,map] = imread('corn.tif');
RGB = ind2rgb(X,map);
The following users thanked this post: Pooja Pandey

If you are dealing with huge datasets that are saved in .mat format, loading them to workspace eats lot of RAM. So, matlab has an option to read part of such files without loading them to memory. Have a look at this link:

Interesting information / A lecture by Prof. Fawwaz Ulaby
« on: January 28, 2017, 11:40:36 PM »
In this lecture Prof. Fawwaz T Ulaby, a pioneer in Radar Remote Sensing talks in a fascinating way about how Radar technology was developed in 1970s. You can see the first half of the video.
The following users thanked this post: Amit Kumar Sharma, Agilan

Programming / Colormaps in MATLAB
« on: January 28, 2017, 11:36:51 PM »
Toolbox below provides users to view images in MATLAB with wider range of colorbars.
The following users thanked this post: Sonali

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.
The following users thanked this post: Subir Paul, Diwan

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.
The following users thanked this post: Sonali, Subir Paul, B N Priyanka, Pankaj Dey, Diwan

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.
The following users thanked this post: Sat Kumar Tomer, Sonali, Subir Paul, prayas

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.
The following users thanked this post: Sat Kumar Tomer, Harsh

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.


Pages: [1] 2