Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Marsh pmarshwx

View GitHub Profile
@pmarshwx
pmarshwx / README
Created Sep 12, 2019
pyproj testing
View README
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 Mar 11, 2019
Shapefile Projection Converter
View README.md

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 Aug 24, 2016
Script to Parse GEMPAK GDLIST Output
View parser.py
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
View climo-traces.ipynb
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 Dec 21, 2015
2012 Synoptic Severe Weather Lab
View 1950_2011_onetor.csv
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 Jun 24, 2013
Overzealous Basemap Clipping Issue/Bug
View M1CP.txt
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 Apr 22, 2013
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.
View ipynb_contour_issue.ipynb
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 Mar 7, 2013
Create cross sections in Python
View xsections.ipynb
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 Dec 13, 2015
An IPython Notebook designed to compute the population impacted by a given by a model forecast.
View population-impacts.ipynb
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 Nov 11, 2018
Epanechnikov kernel for use in Kernel Density Estimation. Note, for large arrays, performance may be slow. Originally designed for sparse grids.
View epanechnikov.pyx
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)