Balance between excell and C++ is NB
- Python -- a bit more flexible than MATLAB for instance
- Matlab
- R
import numpy as np | |
from pylab import num2date | |
from itertools import ifilter | |
from time import struct_time | |
from __future__ import print_function | |
class TimeTupleArray(np.ndarray): | |
def __new__(cls, input_array, info=None): |
def dataset_encoding(xds): | |
cols = ['source', 'original_shape', 'dtype', 'zlib', 'complevel', 'chunksizes'] | |
info = pd.DataFrame(columns=cols, index=xds.data_vars) | |
for row in info.index: | |
var_encoding = xds[row].encoding | |
for col in info.keys(): | |
info.ix[row, col] = var_encoding.pop(col, '') | |
return info |
\b(\w+)\s+\1\b % repeated words | |
^[A-Za-z].*[A-Za-Z0-9] % lines that do not end with a full stop |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This script is written to calculate total alkalinity according to Lee et al. (2006). | |
Please see function help for more details. | |
Please acknowledge use. | |
""" | |
__author__ = "Luke Gregor" |
#!/usr/bin/env python | |
""" | |
A short script that is used to fill gaps in a time series (gap_filler_with_noise). | |
The method uses gaussian processes (aka Kriging) to get the trend (calls gaussian_smoother). | |
I recommend that you play around with the theta0 value to find the correct scale for the trend. | |
Noise is added to the estimated trend by assessing the noise around the trend. | |
Diagnostic plots can be created with this script. |
import numpy as np | |
### Implementation of our EMD() function | |
def emd(data, stop_limit=0.001, spline_order=3): | |
""" | |
EMD as explained by Scott Cole (https://srcole.github.io/2016/01/18/emd/), | |
but has been modified by Luke Gregor (https://github.com/luke-gregor) to | |
automatically stop when there are no more IMFs in the dataset. | |
Additionally, the residual from the stopping point and the original dataset | |
is counted as the final IMF. |
def input_limits(return_bool=True, return_info=True, **kwargs): | |
""" | |
This is a function wrapper for functions that have defined input limits. | |
The user can define the valid limits of any of the inputs. | |
Parameters | |
---------- | |
return_bool: array-bool | |
returns a boolean array of the original function where valid or not | |
return_info: array-str |