lib.malib module¶
Functions involving masked arrays
Some functions are general array operations, others involve geospatial information
-
class
pygeotools.lib.malib.DEMStack(fn_list=[], stack_fn=None, outdir=None, res=None, extent=None, srs=None, trend=True, robust=False, med=False, stats=True, save=True, sort=True, datestack=True, mask_geom=None, min_dt_ptp=<Mock id='140637716128528'>, n_thresh=2, n_cpu=None)[source]¶
-
pygeotools.lib.malib.calcperc(b, perc=(0.1, 99.9))[source]¶ Calculate values at specified percentiles
-
pygeotools.lib.malib.calcperc_sym(b, perc=(0.1, 99.9))[source]¶ Get symmetrical percentile values Useful for determining clim centered on 0 for difference maps
-
pygeotools.lib.malib.fast_median(a)[source]¶ Fast median operation for masked array using 50th-percentile
-
pygeotools.lib.malib.get_2dhist(x, y, xlim=None, ylim=None, xint=None, yint=None, nbins=(128, 128))[source]¶
-
pygeotools.lib.malib.get_stack_subset(s_orig, idx, out_stack_fn=None, copy=True, save=False)[source]¶ Create a new stack object as a subset of an exising stack object
-
pygeotools.lib.malib.get_stats(a, full=False)[source]¶ Compute and print statistics for input array
Needs to be cleaned up, return a stats object
-
pygeotools.lib.malib.get_stats_dict(a_in, full=True)[source]¶ Compute and print statistics for input array
-
pygeotools.lib.malib.ma_linreg(ma_stack, dt_list, n_thresh=2, model='linear', dt_stack_ptp=None, min_dt_ptp=None, smooth=False, rsq=False, conf_test=False, parallel=True, n_cpu=None, remove_outliers=False)[source]¶ Compute per-pixel linear regression for stack object
-
pygeotools.lib.malib.mad(a, axis=None, c=1.4826, return_med=False)[source]¶ Compute normalized median absolute difference
Can also return median array, as this can be expensive, and often we want both med and nmad
Note: 1.4826 = 1/0.6745
-
pygeotools.lib.malib.nanfill(a, f_a, *args, **kwargs)[source]¶ Fill masked areas with np.nan
Wrapper for functions that can’t handle ma (e.g. scipy.ndimage)
This will force filters to ignore nan, but causes adjacent pixels to be set to nan as well: http://projects.scipy.org/scipy/ticket/1155
-
pygeotools.lib.malib.norm_shape(shape)[source]¶ Normalize numpy array shapes so they’re always expressed as a tuple, even for one-dimensional shapes.
- Parameters
- shape - an int, or a tuple of ints
- Returns
- a shape tuple
-
pygeotools.lib.malib.randomfill(a)[source]¶ Fill masked areas with random noise
This is needed for any fft-based operations
-
pygeotools.lib.malib.stack_clip(s_orig, extent, out_stack_fn=None, copy=True, save=False)[source]¶ Create a new stack object with limited extent from an exising stack object