Skip to content

Instantly share code, notes, and snippets.

View aronnem's full-sized avatar

Aronne Merrelli aronnem

View GitHub Profile
@aronnem
aronnem / gist:583ee5892b410f1c3b625ba4f294c2e7
Created November 25, 2023 18:12
Error when accessing certain types of NASA data with HTTPSFileSystem
import datetime as dt
import earthaccess, h5py
earthaccess.login()
# first DOI succeeds: netCDF4 file, CLIMCAPS Level-2 retrievals
# second DOI fails: hdf5 file, OCO-2 Level-1B radiance
# h5py.File() fails in AbstractBufferedFile.seek, TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
dois = ["10.5067/LESQUBLWS18H",
@aronnem
aronnem / simplest_example.py
Created November 21, 2018 23:00
An example loop calling Scipy's LinearNDInterpolator
import os, psutil
from scipy.interpolate import LinearNDInterpolator
max_N = 199000
tenth_max_N = int(max_N/10)
process = psutil.Process(os.getpid())
interp_pt = [[0.1, 0.1]]
@aronnem
aronnem / cy_func_test.pyx
Created February 8, 2012 17:01
Trying out methods for changing calculations inside a cython loop
# copying http://docs.cython.org/src/tutorial/cdef_classes.html
cdef class Function:
cpdef double evaluate(self, double x) except *:
return 0
cdef class func0(Function):
cpdef double evaluate(self, double x) except *:
return basefunc0(x)
cdef class func1(Function):
cpdef double evaluate(self, double x) except *:
return basefunc1(x)
@aronnem
aronnem / matrix_array_wrap_test.py
Created December 22, 2011 18:40
Some example code showing unexpected behavior of __array_wrap__ in a subclass of np.matrix
import numpy as np
class ArrSubClass(np.ndarray):
def __new__(cls, input_var):
obj = np.ndarray(input_var).view(cls)
return obj
def __array_wrap__(self, obj):
raise AssertionError
class MatSubClass(np.matrix):