Skip to content

Commit 1b2d36b

Browse files
author
Spencer Jones
committed
docs for layers_apply
1 parent e1d0cef commit 1b2d36b

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

xlayers/core.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,46 @@ def _reshape_outputs(*args, shape = None):
3232
target_shape = shape
3333
return [np.reshape(a, target_shape) for a in args]
3434

35-
def layers_apply(data_in, dens_in, denslayers, fine_drf,fine_drc, fine_fact, lev_name, Tlev_name):
36-
#Then calculate the height of the depth cells in a new rebinned geometry, where there are ten smaller bins for each initial bin
35+
def layers_apply(data_in, theta_in, thetalayers, fine_drf,fine_drc, fine_fact=10, lev_name='lev', Tlev_name='Tlev'):
36+
"""Convert an xarray from depth coordinates to other coordinates
37+
Parameters
38+
----------
39+
data_in : array_like
40+
Variable that will be remapped.
41+
theta_in : array_like
42+
Variable that defines location of new coordinate system.
43+
For example, if you are remapping to temperature coordinates, this should be
44+
the temperature on the same grid points as the variable you wish to remap.
45+
thetalayers : array_like
46+
Vector of the values to use in the new coordinate system.
47+
For example, if you are remapping to temperature coordinates, this should be
48+
a vector of temperatures that defines the new coordinate system.
49+
fine_drf : array_like
50+
Depth of vertical cells in original coordinate system.
51+
fine_drc : array_like
52+
Distance between cell centers in original coordinate system.
53+
Must be one point longer than fine_drf. The first value should be the distance
54+
between the first cell center and the surface. The last value should be the
55+
distance between the last cell center and the bottom of the domain.
56+
fine_fact : integer
57+
Number ofr sub-bins chosen in the vertical. Recommended 10.
58+
lev_name : string
59+
The name of the vertical coordinate in data_in and theta_in
60+
Tlev_name : string
61+
The name of the vertical coordinate in the output array
62+
63+
Returns
64+
-------
65+
data_out : array
66+
data_out is an array of the thickness-weighted quantity in the new coordinate system.
67+
"""
3768
drf_finer, mapindex, mapfact, cellindex = finegrid.finegrid(np.squeeze(fine_drf),np.squeeze(fine_drc),[fine_drf.size,fine_fact])
38-
data_out=layers_xarray(data_in, dens_in, denslayers, mapfact, mapindex, cellindex, drf_finer, lev_name, Tlev_name)
69+
data_out=layers_xarray(data_in, theta_in, thetalayers, mapfact, mapindex, cellindex, drf_finer, lev_name, Tlev_name)
3970
return data_out
4071

4172

4273
def layers_xarray(data_in, theta_in, thetalayers, mapfact, mapindex, cellindex, drf_finer, lev_name, Tlev_name):
43-
"""Convert an xarray from depth coordinates to other coordinates
74+
"""Convert an xarray from depth coordinates to other coordinates (needs binning inputs)
4475
4576
Parameters
4677
----------

0 commit comments

Comments
 (0)