From 1df79a5138813a2a8cd04c67734dc0e182295613 Mon Sep 17 00:00:00 2001 From: Nick Wogan Date: Thu, 15 Aug 2024 17:12:22 -0700 Subject: [PATCH] docs --- clima/__init__.py | 2 +- clima/cython/futils.pyx | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/clima/__init__.py b/clima/__init__.py index 03c6378..cca05b3 100644 --- a/clima/__init__.py +++ b/clima/__init__.py @@ -2,5 +2,5 @@ os.environ['OMP_NUM_THREADS'] = '1' from ._clima import AdiabatClimate, ClimaException -from ._clima import rebin # rebin routine from futils +from ._clima import rebin, rebin_with_errors, grid_at_resolution, make_bins # rebin routine from futils from ._clima import __version__ \ No newline at end of file diff --git a/clima/cython/futils.pyx b/clima/cython/futils.pyx index fd146e1..a4075d5 100644 --- a/clima/cython/futils.pyx +++ b/clima/cython/futils.pyx @@ -109,6 +109,22 @@ cpdef rebin_with_errors(ndarray[double, ndim=1] old_bins, ndarray[double, ndim=1 return new_vals, new_errs cpdef grid_at_resolution(double wv_min, double wv_max, double R): + """Computes a grid of bins at a given resolution `R` + + Parameters + ---------- + wv_min : double + Minimum bin extent + wv_max : double + Maximum bin extent + R : double + Bin resolution (dlam = lam/R) + + Returns + ------- + wavl : ndarray[double,ndim=1] + Ouput grid + """ cdef int wavl_len cdef void *wavl_ptr @@ -129,6 +145,18 @@ cpdef grid_at_resolution(double wv_min, double wv_max, double R): return wavl cpdef make_bins(ndarray[double, ndim=1] wv): + """Given a series of wavelength points, find the corresponding bin edges + + Parameters + ---------- + wv : ndarray[double,ndim=1] + Wavelength points. + + Returns + ------- + wavl : ndarray[double,ndim=1] + Bin edges + """ cdef int wv_len = wv.shape[0] cdef int wavl_len = wv_len + 1