Skip to content

Instantly share code, notes, and snippets.

install.packages("ncdf4")
install.packages("purrr")
library(ncdf4)
library(purrr)
setwd("/Users/marketa/Library/Mobile Documents/com~apple~CloudDocs/School/Thesis")
#reading the NetCDF file and getting specific variables
f <- nc_open("20180527_1441_historic_SPI_6_month.nc")
time <- ncdf4::ncvar_get(f, varid = "time")
in_table = 'C:\Users\mpodebradska2\Documents\ArcGIS\Thesis_New\Table.dbf'
field_names = ['Plan_Name', 'Plan_Nam_1', 'Plan_Nam_2', 'Plan_Nam_3']
all_values = []
with arcpy.da.SearchCursor(in_table,field_names) as cursor:
for row in cursor:
all_values.extend(list(row))
unique_values = set(all_values)
print unique_values
setwd("C:/Users/mpodebradska2/Desktop")
all_content <- readLines("data.csv")
skip_second <- all_content[-2]
my_data <- read.csv(textConnection(skip_second), header = TRUE, stringsAsFactors = FALSE)
my_data$TF <- my_data$X.1>=my_data$State..WWDT.
library(car)
library(MASS)
library(ggplot2)
library(viridisLite)
setwd("/Users/marketa/Library/Mobile Documents/com~apple~CloudDocs/School/Thesis/SPI")
SPI6m <- read.csv("SPI6m.csv", header = TRUE)
names(SPI6m) <- c("2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013","2014", "2015", "2016")
Productivity <- read.csv("prod_anomaly.csv", header = TRUE)
names(Productivity) <- c("2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013","2014", "2015", "2016")
library(car)
library(MASS)
library(ggplot2)
library(viridisLite)
setwd("C:/Users/mpodebradska2/Desktop/School/Thesis/Indices_analysis/VegDRI")
VegDRI <- read.csv("VegDRI.csv", header = TRUE)
names(VegDRI) <- c( "2009", "2010", "2011", "2012", "2013","2014", "2015", "2016")
Productivity <- read.csv("prod_anomaly.csv", header = TRUE)
Productivity <- Productivity[-480,-c(1,2,3,4,5,6,7,8,9)]
import sys, os, glob, winsound
import arcpy
from arcpy.sa import *
from arcpy import env
arcpy.CheckOutExtension('spatial')
arcpy.env.overwriteOutput = True
## List of rasters to project/sample to that of raster list 2
dataPath1 = r"I:\Data\USDM\GRACE_Grid"
dataPath2 = r"I:\Data\NLDAS\Reclassify\Levels\ewp"
library(car)
library(MASS)
library(ggplot2)
library(viridisLite)
setwd("/Users/marketa/Library/Mobile Documents/com~apple~CloudDocs/School/Thesis/ESI")
ESI <- read.csv("ESI.csv", header = TRUE)
names(ESI) <- c("2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013","2014", "2015", "2016")
Productivity <- read.csv("prod_anomaly.csv", header = TRUE)
Productivity <- Productivity[,-1]
library(car)
library(MASS)
library(ggplot2)
library(viridisLite)
setwd("/Users/marketa/Library/Mobile Documents/com~apple~CloudDocs/School/Thesis/EDDI")
EDDI <- read.csv("EDDI_3mn_all.csv", header = TRUE)
EDDI <- EDDI[,-1]
EDDI <- EDDI*-1
names(EDDI) <- c("2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013","2014", "2015", "2016")
#variables
price = 24.95
discount = 1 - 0.4
number_copies = 60
first_copy = 2
next_copies = 0.80
#functions
def discounted(price, discount):
'''Calculated discounted price'''
# -*- coding: utf-8 -*-
"""
Read the comments in this file. The comments contain problem statements.
Do your best to write code that satisfies what is being requested in the
problem statements.
This homework will be handed in at the start of the next class by depositing
the file in the class folder in the Y drive. Place the homework in your
personal folder. Name the file {first name}_{last name}_homework1.py.
For example: philip_blankenau_homework1.py