This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sample Code | |
#Gets netCDF data for lat/long points from Stevens Institute NYHOPS Data | |
library(ncdf4) | |
#Connect to netCDF | |
nyhops.nc <- nc_open("http://colossus.dl.stevens-tech.edu/thredds/dodsC/LISS/Hindcast/all_nb_mon_81.nc") | |
##To get 'simple', 3D variale (e.g., depth) | |
#Load depth, lat, and long |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> install.packages("RODBC") | |
Installing package into ‘/usr/local/lib/R/site-library’ | |
(as ‘lib’ is unspecified) | |
--- Please select a CRAN mirror for use in this session --- | |
trying URL 'https://cloud.r-project.org/src/contrib/RODBC_1.3-14.tar.gz' | |
Content type 'unknown' length 1163799 bytes (1.1 MB) | |
================================================== | |
downloaded 1.1 MB | |
* installing *source* package ‘RODBC’ ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Initiate Download of file, naming it as test.zip | |
download.file(url='https://data.cityofnewyork.us/api/geospatial/tqmj-j8zm?method=export&format=Original', destfile="test.zip") | |
#unzip the file using built in functionality | |
unzip('test.zip') | |
#Throws error when running on Windows: | |
#Warning message: | |
#In unzip("test.zip") : error 1 in extracting from zip file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/bash | |
pandoc ../CourseInfo/Syllabus.md -o syllabus_tmp.html; | |
cat html_head.html syllabus_tmp.html html_foot.html > ../Syllabus.html; | |
rm syllabus_tmp.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
et <- example_time <- Sys.time() | |
#This code will work on list of times, or can easily be set up to work on a column of a data frame | |
#The seconds are ignored and actually set to 0 (which was adequate for my needs) | |
for(i in et){ | |
if(as.POSIXlt(et)$min >= 10) | |
{ | |
if((as.POSIXlt(et)$min/5) %% 1 == 0) | |
{ | |
et <- et + 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#All of this tested in in Cygwin on Windows 7 x64 | |
#Requires GDAL, Cygwin (or other *nix terminal) with wget and unzip installed; also requires an installation of Python | |
#GDAL should be in system PATH | |
#To download files based on a hand-made text file called "URLZipList.txt" - list of all the .zip filenames needed (files from here: ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/NED/13/IMG/): | |
#Example file name: "ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/NED/1/IMG/n39w096.zip" | |
wget -i URLZipList.txt | |
#Unzip all files to respective folders | |
for z in *.zip; do |
NewerOlder