Skip to content

Instantly share code, notes, and snippets.

View pmarshwx's full-sized avatar

Patrick Marsh pmarshwx

View GitHub Profile
@pmarshwx
pmarshwx / README
Created September 12, 2019 02:52
pyproj testing
Create python environment with pyproj 1.9.6 (and proj 5.2).
Create a different python environment with pyproj 2.2.0 (and proj 6.1.0)
Download (for now) the zipfile at http://pmarshwx.com/tmp/usa.zip which is a folder of a shapefile
Run the test.py script (below) with the unzipped file (which is a folder) from above in same directory as the python script in each environment
My results on a MBP (ballparks after running multiple times):
pyproj=1.9.6 (proj=5.2.0) vs pyproj=2.2.1 (proj=6.1.0)
read USbounds shpfile: 0.015 seconds vs 0.015 seconds
@pmarshwx
pmarshwx / README.md
Created March 11, 2019 02:27
Shapefile Projection Converter

Shapefile Projection Converter

A script that takes the path to a shapefile as a command line argument. This shapefile is then converted to a shapefile that has latitude and longitude as the projection.

Dependencies

- fiona
- shapely
  • pyproj
@pmarshwx
pmarshwx / parser.py
Created August 24, 2016 17:42
Script to Parse GEMPAK GDLIST Output
import numpy as np
def parse(lines, mask=-9999.):
'''
A simple routine to parse the output of GEMPAK's GDLIST output.
Parameters
----------
lines : string, sequence
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmarshwx
pmarshwx / 1950_2011_onetor.csv
Last active December 21, 2015 01:28
2012 Synoptic Severe Weather Lab
We can't make this file beautiful and searchable because it's too large.
om,yr,mo,dy,date,time,zone,state,stf,stn,f,inj,fat,dam,closs,slat,slon,elat,elon,len,wid,nstate,stno,sg
1,1950,1,3,1/3/50,11:00:00,3,MO,29,1,3,3,0,6,0,38.77,-90.22,38.83,-90.03,9.5,150,2,0,1
2,1950,1,3,1/3/50,11:55:00,3,IL,17,2,3,3,0,5,0,39.1,-89.3,39.12,-89.23,3.6,130,1,1,1
3,1950,1,3,1/3/50,16:00:00,3,OH,39,1,1,1,0,4,0,40.88,-84.58,0,0,0.1,10,1,1,1
4,1950,1,13,1/13/50,5:25:00,3,AR,5,1,3,1,1,3,0,34.4,-94.37,0,0,0.6,17,1,1,1
5,1950,1,25,1/25/50,19:30:00,3,MO,29,2,2,5,0,5,0,37.6,-90.68,37.63,-90.65,2.3,300,1,1,1
6,1950,1,25,1/25/50,21:00:00,3,IL,17,3,2,0,0,5,0,41.17,-87.33,0,0,0.1,100,1,1,1
7,1950,1,26,1/26/50,18:00:00,3,TX,48,1,2,2,0,0,0,26.88,-98.12,26.88,-98.05,4.7,133,1,1,1
8,1950,2,11,2/11/50,13:10:00,3,TX,48,2,2,0,0,4,0,29.42,-95.25,29.52,-95.13,9.9,400,1,1,1
9,1950,2,11,2/11/50,13:50:00,3,TX,48,3,3,12,1,4,0,29.67,-95.05,29.83,-95,12,1000,1,1,1
@pmarshwx
pmarshwx / M1CP.txt
Created June 24, 2013 13:59
Overzealous Basemap Clipping Issue/Bug
Grid file: /NAWIPS/nadata2/model/sfcOA/sfcoaruc_13062120
GRID IDENTIFIER:
TIME1 TIME2 LEVL1 LEVL2 VCORD PARM
130621/2000 0 NONE M1CP
AREA: DSET GRID SIZE: 151 113
COLUMNS: 1 151 ROWS: 1 113
Scale factor: 10** 0
@pmarshwx
pmarshwx / ipynb_contour_issue.ipynb
Created April 22, 2013 02:55
Illustrates issues with matplotlib contouring in IPython Notebook. Note, you can take the code in cell run and run it through the IPython console and it works just fine.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmarshwx
pmarshwx / xsections.ipynb
Created March 7, 2013 04:29
Create cross sections in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmarshwx
pmarshwx / population-impacts.ipynb
Last active December 13, 2015 18:58
An IPython Notebook designed to compute the population impacted by a given by a model forecast.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmarshwx
pmarshwx / epanechnikov.pyx
Last active November 11, 2018 10:45
Epanechnikov kernel for use in Kernel Density Estimation. Note, for large arrays, performance may be slow. Originally designed for sparse grids.
cimport cython
import numpy as np
cimport numpy as np
cdef extern from 'math.h':
float exp(float x)
float cos(float x)
float sin(float x)
float fabs(float x)