Skip to content

Instantly share code, notes, and snippets.

View Kirubaharan's full-sized avatar

Kirubaharan J Kirubaharan

  • ATREE, Bangalore
  • Bangalore
View GitHub Profile
@Kirubaharan
Kirubaharan / createcsvt
Created July 12, 2013 12:46
This script scans the directory for csv files and creates respective csvt file from the default csvt(create as per the requirement) The csvt file is neccessary for making QGIS understand the dataformat; It is useful for hydrologists who do longterm rainfall analysis for basin
###############################################################################
# Python Script for Creating csvt file for QGIS
#written by Kirubaharan J mail:[email protected]
#Credits: Hemanth.hm,Stefano and few others from Stackflow
#This script scans the directory for csv files and creates respective csvt file
#from the default csvt(create as per the requirement)
# The csvt file is neccessary for making QGIS understand the dataformat
#useful for hydrologists who do longterm rainfall analysis for basin
###############################################################################
@Kirubaharan
Kirubaharan / csvtoshp
Last active December 19, 2015 18:19
This scripts converts the raingauge data in csv file to shapefile points
###############################################################################
# This scripts converts the raingauge data in csv file to shapefile points
#Written by Kirubaharan J mail:[email protected]
#Credits: sgrieve from gisstackexchange.com
#
###############################################################################
import shapefile as shp
import csv
import os, fnmatch
from os.path import basename
@Kirubaharan
Kirubaharan / spider
Last active December 20, 2015 13:19
This code is used to crawl the web page and download the pdf and store it in datewise format
###############################################################################
# This Script is used for downloading the daily storage flow data from TN PWD
# Website and stores them in file name representing date.
# Credit: Alexander Afanasiev (alecxe),
#http://www.linkedin.com/in/alexanderafanasiev
#alecxe written this code and made sure it worked the right way
#Just for the sake I am Kirubaharan ([email protected])who learnt
#how to do this from alecxe
#2-8-2013
###############################################################################
@Kirubaharan
Kirubaharan / 0_reuse_code.js
Created May 20, 2014 06:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Kirubaharan
Kirubaharan / stage_volume.r
Last active August 29, 2015 14:02
calculating volume of the check dam for different height
getwd()
setwd('E:/r/r_dir/stream_profile/')
#testing the auc function
raw<-read.csv(file='634_stream_profile.csv',sep=",")
library(ggplot2)
ggplot(data=raw,aes(x=raw$X,y=raw$y.0/100)) + geom_line() +geom_abline(mapping=aes(slope=0,intercept=.66))
library(flux)
area_0<-auc(x=raw$X,y=raw$y/100.0,thresh=.7)
area_0
raw_2<-read.csv('634_stream_profile_2.csv', sep=',')
@Kirubaharan
Kirubaharan / area_func.py
Created June 27, 2014 06:45
Script to calculate the check dam stage vs volume curve.
__author__ = 'kirubaharan'
##area of curve
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from spread import spread
@Kirubaharan
Kirubaharan / profile_creator.py
Created July 2, 2014 11:10
The python script creates 3d profileplot, assuming a uniform stream shape with differnt slope values
__author__ = 'kiruba'
# import statements
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib import rc
import itertools
from mpl_toolkits.mplot3d import axes3d, Axes3D
from matplotlib import cm
@Kirubaharan
Kirubaharan / area_function.py
Created July 2, 2014 11:25
A python function to create stage-volume relationship curve
__author__ = 'kiruba'
##area of curve
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from spread import spread
# copy the code from http://code.activestate.com/recipes/577878-generate-equally-spaced-floats/ #
import itertools
@Kirubaharan
Kirubaharan / phenology.py
Created November 16, 2014 08:10
phenology
import matplotlib.pyplot as plt
import numpy as np
from phenology import *
data2011 = np.loadtxt('/Users/User/data2011.txt')
# Define variables
doy = data2011[:,0]
temp = data2011[:,1]
tbase = 10.
''' remove annoying website names from a music file
and also if it starts with a number remove it as it
causes problems while searching a particular file
Author: Kshitiz Joshi
e-mail: [email protected]