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 / mailmerge.py
Created November 5, 2015 11:15
This simple python Mail Merge script accepts .xlsx, .xls, and .csv files as the list input. The list input is assumed to have a header row with nickname in the first column and email in the second column. This header row will be skipped during processing. Below the header row the appropriate nickname/email combinations should be listed. The emai…
import getpass
import csv
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import xlrd
import xlwt
import re
from time import sleep
@Kirubaharan
Kirubaharan / modis_monthly.R
Created April 30, 2015 11:57
monthly modis download
library(MODIS)
product <- "MOD13A3"
#h25v07
#1999-2011
dates <- as.POSIXct(as.Date(c("01/01/1999", "31/12/2011"), format="%d/%m/%Y"))
dates2 <- transDate(dates[1], dates[2])
h = "25"
v = "07"
MODISoptions(localArcPath = "/media//kiruba//New Volume//MODIS//veg_ind_monthly//download", outDirPath = "/media//kiruba/New Volume/MODIS/veg_ind_monthly")
runGdal(product = product, begin = dates2$beginDOY, end = dates2$endDOY, tileH = h, tileV = v)
#!/usr/bin/env python
"""
A script to grab timeseries from MODIS data using GDAL and python
Author: J Gomez-Dans/NCEO & UCL
"""
__author__: J Gómez-Dans
import numpy as np
import matplotlib.pyplot as plt
from osgeo import gdal
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
import pynotify
from time import sleep
''' 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]
@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.
@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 / 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_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 / 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=',')