Skip to content

Instantly share code, notes, and snippets.

@mikshila
mikshila / SM_data.py
Created July 29, 2016 18:40
Code for managing soil moisture data
from numpy import *
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
matplotlib.style.use('ggplot')
#read in the .dat file
DataIn = np.genfromtxt('CZC\czc13may.dat', delimiter=',', skip_header=1, )
@mikshila
mikshila / PRISM_extract.R
Created November 21, 2018 16:39
R script for manipulating PRISM data - from .bil, reproject, clip, and export as .asc
library(sp)
library(raster)
library(rgdal)
reference <- raster("D:\\ClipGridv1\\ca_270m_v8.asc")
projection(reference) <- "+proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
teale <- CRS("+proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs")
#resample DEM at 4km
reference4k <- raster("D:\\Metgrid\\PRISM_daily\\reference4k.tif")