Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Aug 16, 2024
1 parent c1692f6 commit 1df79a5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clima/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
28 changes: 28 additions & 0 deletions clima/cython/futils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1df79a5

Please sign in to comment.