Skip to content

Instantly share code, notes, and snippets.

View OneGneissGuy's full-sized avatar
🎯
Focusing

John Franco Saraceno OneGneissGuy

🎯
Focusing
View GitHub Profile
@OneGneissGuy
OneGneissGuy / SM_data.py
Last active August 1, 2016 15:40 — forked from mikshila/SM_data.py
Code for managing soil moisture data
# -*- coding: utf-8 -*-
"""
:DESCRIPTION:Code for managing soil moisture data
:REQUIRES:
:TODO:More error handling
:AUTHOR: John Franco Saraceno
:ORGANIZATION: U.S. Geological Survey, United States Department of Interior
:CONTACT: saraceno@usgs.gov
:VERSION: 1.0
Fri Jul 29 18:48:40 2016
@OneGneissGuy
OneGneissGuy / proc_lisst.m
Created August 9, 2016 18:12
Script to process LISST binary data files
%code to batch process and invert binary lisst data
f_directory = 'C:\Users\saraceno\Documents\MATLAB\LISST\recachelisstdata';
datafile_ext = '*.dat';
zscfile = 'office_zsc_1145_110712.asc';
fac_zscfile = 'factory_zsc_1145.asc';
ringareafile = 'Ringarea_1145.asc';
instrument_data = 'InstrumentData.txt';
VCC = 4972;
type = 3;
random_shape = 1;
@OneGneissGuy
OneGneissGuy / proc_lisst.py
Created August 10, 2016 05:01
Process a matlab .mat file generated by proc_lisst.m
# -*- coding: utf-8 -*-
"""
:DESCRIPTION:code to process LISST VC data
:REQUIRES:
:TODO:
:AUTHOR: John Franco Saraceno
:ORGANIZATION: U.S. Geological Survey, United States Department of Interior
@OneGneissGuy
OneGneissGuy / read_durafet.py
Last active August 10, 2016 22:43
Code to process durafet pH data
# -*- coding: utf-8 -*-
"""
:DESCRIPTION:
:REQUIRES:
:TODO:
:AUTHOR: John Franco Saraceno
:ORGANIZATION: U.S. Geological Survey, United States Department of Interior
@OneGneissGuy
OneGneissGuy / useful_pandas_snippets.py
Created September 6, 2016 05:57 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@OneGneissGuy
OneGneissGuy / pexpect_ssh.py
Last active March 15, 2017 18:16
driver for ssh automation using pexpect
#v1.0 - to supply password and login
#shamlessly stolen form the web
import sys
import pexpect
user = 'user'
password = 'password'
host = 'host1.us.com'
command = 'hostname ; echo $?'
def dossh(user, password, host, command):
@OneGneissGuy
OneGneissGuy / merge.py
Last active January 4, 2018 20:52
script to merge water quality and discharge data from two USGS gages for the X2CM project
# -*- coding: utf-8 -*-
"""
script to merge water quality and discharge data from two USGS gages for
the X2CM project
@author: saraceno
Created on Wed Jun 14 14:51:19 2017
"""
import pandas as pd
@OneGneissGuy
OneGneissGuy / buoyspectraplotter.py
Created August 14, 2017 17:28 — forked from mpiannucci/buoyspectraplotter.py
Parse Raw NDBC Directional Wave Spectra
import urllib.request as request
import json
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
import numpy as np
class BuoySpectraPlotter:
def __init__(self, buoy_station):
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <PubSubClient.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define wifi_ssid "YOUR_WIFI_SSID"
#define wifi_password "YOUR_WIFI_PASSWORD"
#define mqtt_server "YOUR_MQTT_SERVER_HOST"
# -*- coding: utf-8 -*-
"""
Webscraping local air quality index forecast from https://sparetheair.com/
@author: saraceno
@email: jfsaraceno@gmail.com
@github: onegneissguy
code adapted from https://medium.com/python-pandemonium/6-things-to-develop-an-efficient-web-scraper-in-python-1dffa688793c
"""