Commit dcfe16e9 authored by Eva Börgens's avatar Eva Börgens
Browse files

update docstrings to numpy format

parent ea7beaae
......@@ -44,13 +44,15 @@ def get_grid_area(lon : np.ndarray, lat : np.ndarray) -> np.ndarray:
"""
Function getting the area weights of a coordinate list
Args:
Parameters
----------
lon : np.ndarray
array of longitudes
lat : np.ndarray
array of latitudes
Returns:
Returns
-------
np.ndarray
area per grid point
"""
......@@ -67,7 +69,8 @@ def get_area(lon_ll: float, lat_ll: float, lon_ur: float,lat_ur: float) -> fl
"""
returns area of rectangular on sphere, defined by corner points lower left ll and upper right ur
Args:
Parameters
----------
lon_ll: float
lon of lower left corner
lat_ll: float
......@@ -77,7 +80,8 @@ def get_area(lon_ll: float, lat_ll: float, lon_ur: float,lat_ur: float) -> fl
lat_ur: float
lat of upper right corner
Returns:
Returns
-------
float
area of grid point
"""
......@@ -96,7 +100,8 @@ def cov_function_lat(lat1: float, lat2: float,
Function to compute covariance function between two points according to
publication Boergens et al. 2020
Args:
Parameters
----------
lat1, lat2: float
Latitude of the two points
d: float
......@@ -117,7 +122,8 @@ def cov_function_lat(lat1: float, lat2: float,
amplitude parameter
k2,k4, k6, k8: float
Legende polynome Args for c0
Returns:
Returns
-------
float
Covariance
"""
......@@ -147,11 +153,13 @@ def legendre_polynome(n: int, lat: float) -> float:
"""
Computes Legendre Polynome of degree n at given latitude lat
Args:
Parameters
----------
n: int
lat: float
Returns:
Returns
-------
float
"""
sin_lat = np.sin(lat)
......@@ -163,7 +171,8 @@ def sum_legendre(n_max: int, leg_weights: np.ndarray, lat:float) -> float:
"""
Computes weighted sum of Legendre Polynomes
Args:
Parameters
----------
n_max: int
maximum degree of Legendre Polynomes
leg_weights: np.ndarray
......@@ -171,7 +180,8 @@ def sum_legendre(n_max: int, leg_weights: np.ndarray, lat:float) -> float:
lat: float
latitude where the Legendre Polynomes are summed
Returns:
Returns
-------
float
"""
if n_max!=len(leg_weights)-1:
......@@ -190,7 +200,8 @@ def yaglom(dist: float,
"""
Function to compute the adapted Yaglom function
Args:
Parameters
----------
dist: float
spherical distance
theta: float
......@@ -204,7 +215,8 @@ def yaglom(dist: float,
ny: int
Order of Bessel function
Returns:
Returns
-------
float
"""
......@@ -217,7 +229,8 @@ def distance(lon_0: float, lat_0: float, lon_1: float, lat_1: float):
"""
convert geograpic coordinates to spherical distances
Args:
Parameters
----------
lon_0: float
[degree]
lat_0: float
......@@ -227,7 +240,8 @@ def distance(lon_0: float, lat_0: float, lon_1: float, lat_1: float):
lat_1: float
[degree]
Returns:
Returns
-------
float
"""
......@@ -254,7 +268,8 @@ def azimut_angle(lon_0: float, lat_0: float, lon_1: float, lat_1: float):
"""
get azimut angle between geograpic coordinates
Args:
Parameters
----------
lon_0: float
[degree]
lat_0: float
......@@ -264,7 +279,8 @@ def azimut_angle(lon_0: float, lat_0: float, lon_1: float, lat_1: float):
lat_1: float
[degree]
Returns:
Returns
-------
float
"""
......@@ -293,7 +309,8 @@ def compute_covariance(region_coords: np.ndarray,
"""
Function to compute the covariances for a region
Args:
Parameters
----------
region_coords: np.ndarray
coordinates of region, size [n,2]
gridstd: np.ndarray
......@@ -303,7 +320,8 @@ def compute_covariance(region_coords: np.ndarray,
flag_matrix: bool
flag, return covariance matrix of region
Returns:
Returns
-------
Dict[str, np.ndarray]
"""
......@@ -376,7 +394,8 @@ def get_timeseries(grid, lon_grid, lat_grid, region_coords):
"""
Returns mean tws time series of region
Args:
Parameters
----------
grid: np.ndarray
tws grid, size [t,n,m]
lon_grid: np.ndarray
......@@ -386,7 +405,8 @@ def get_timeseries(grid, lon_grid, lat_grid, region_coords):
region_coords: np.ndarray
coordinates of region of interest, size [l,2]
Returns:
Returns
-------
np.ndarray
size [t]
"""
......@@ -426,17 +446,20 @@ def get_timeseries(grid, lon_grid, lat_grid, region_coords):
</code></dt>
<dd>
<div class="desc"><p>get azimut angle between geograpic coordinates</p>
<p>Args:
lon_0: float
[degree]
lat_0: float
[degree]
lon_1: float
[degree]
lat_1: float
[degree]</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>lon_0</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lat_0</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lon_1</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lat_1</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>float</p></div>
<pre><code>float
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -445,7 +468,8 @@ lat_1: float
&#34;&#34;&#34;
get azimut angle between geograpic coordinates
Args:
Parameters
----------
lon_0: float
[degree]
lat_0: float
......@@ -455,7 +479,8 @@ lat_1: float
lat_1: float
[degree]
Returns:
Returns
-------
float
&#34;&#34;&#34;
......@@ -484,17 +509,20 @@ lat_1: float
</code></dt>
<dd>
<div class="desc"><p>Function to compute the covariances for a region</p>
<p>Args:
region_coords: np.ndarray
coordinates of region, size [n,2]
gridstd: np.ndarray
standard deviation for each grid point, size[n]
flag_uncertainty: bool
flag, return uncertainty of mean tws of region
flag_matrix: bool
flag, return covariance matrix of region</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>region_coords</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>coordinates of region, size [n,2]</dd>
<dt><strong><code>gridstd</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>standard deviation for each grid point, size[n]</dd>
<dt><strong><code>flag_uncertainty</code></strong> :&ensp;<code>bool</code></dt>
<dd>flag, return uncertainty of mean tws of region</dd>
<dt><strong><code>flag_matrix</code></strong> :&ensp;<code>bool</code></dt>
<dd>flag, return covariance matrix of region</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>Dict[str, np.ndarray]</p></div>
<pre><code>Dict[str, np.ndarray]
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -505,7 +533,8 @@ flag, return covariance matrix of region</p>
&#34;&#34;&#34;
Function to compute the covariances for a region
Args:
Parameters
----------
region_coords: np.ndarray
coordinates of region, size [n,2]
gridstd: np.ndarray
......@@ -515,7 +544,8 @@ flag, return covariance matrix of region</p>
flag_matrix: bool
flag, return covariance matrix of region
Returns:
Returns
-------
Dict[str, np.ndarray]
&#34;&#34;&#34;
......@@ -590,38 +620,32 @@ flag, return covariance matrix of region</p>
<dd>
<div class="desc"><p>Function to compute covariance function between two points according to
publication Boergens et al. 2020</p>
<h2 id="args">Args</h2>
<dl>
<dt>lat1, lat2: float</dt>
<dt>Latitude of the two points</dt>
<dt><strong><code>d</code></strong></dt>
<dd>float
distance between points</dd>
<dt><strong><code>theta</code></strong></dt>
<dd>float
azimuth angle between points</dd>
<dt><strong><code>ny</code></strong></dt>
<dd>float
order of Bessle function</dd>
<dt><strong><code>a0</code></strong></dt>
<dd>float
anisotropy parameter</dd>
<dt>ka0_2, ka0_4, ka0_6, ka0_8: float</dt>
<dt>Legende polynome Args for a0</dt>
<dt><strong><code>a1</code></strong></dt>
<dd>float
isotropy shape parameter</dd>
<dt>ka1_2, ka1_4, ka1_6, ka1_8: float</dt>
<dt>Legende polynome Args for a1</dt>
<dt><strong><code>c0</code></strong></dt>
<dd>float
amplitude parameter</dd>
</dl>
<p>k2,k4, k6, k8: float
Legende polynome Args for c0</p>
<h2 id="parameters">Parameters</h2>
<pre><code>lat1, lat2: float
Latitude of the two points
d: float
distance between points
theta: float
azimuth angle between points
ny: float
order of Bessle function
a0: float
anisotropy parameter
ka0_2, ka0_4, ka0_6, ka0_8: float
Legende polynome Args for a0
a1: float
isotropy shape parameter
ka1_2, ka1_4, ka1_6, ka1_8: float
Legende polynome Args for a1
c0: float
amplitude parameter
k2,k4, k6, k8: float
Legende polynome Args for c0
</code></pre>
<h2 id="returns">Returns</h2>
<p>float
Covariance</p></div>
<pre><code>float
Covariance
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -637,7 +661,8 @@ Covariance</p></div>
Function to compute covariance function between two points according to
publication Boergens et al. 2020
Args:
Parameters
----------
lat1, lat2: float
Latitude of the two points
d: float
......@@ -658,7 +683,8 @@ Covariance</p></div>
amplitude parameter
k2,k4, k6, k8: float
Legende polynome Args for c0
Returns:
Returns
-------
float
Covariance
&#34;&#34;&#34;
......@@ -690,17 +716,20 @@ Covariance</p></div>
</code></dt>
<dd>
<div class="desc"><p>convert geograpic coordinates to spherical distances</p>
<p>Args:
lon_0: float
[degree]
lat_0: float
[degree]
lon_1: float
[degree]
lat_1: float
[degree]</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>lon_0</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lat_0</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lon_1</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
<dt><strong><code>lat_1</code></strong> :&ensp;<code>float</code></dt>
<dd>[degree]</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>float</p></div>
<pre><code>float
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -709,7 +738,8 @@ lat_1: float
&#34;&#34;&#34;
convert geograpic coordinates to spherical distances
Args:
Parameters
----------
lon_0: float
[degree]
lat_0: float
......@@ -719,7 +749,8 @@ lat_1: float
lat_1: float
[degree]
Returns:
Returns
-------
float
&#34;&#34;&#34;
......@@ -748,24 +779,20 @@ lat_1: float
</code></dt>
<dd>
<div class="desc"><p>returns area of rectangular on sphere, defined by corner points lower left ll and upper right ur</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>lon_ll</code></strong></dt>
<dd>float
lon of lower left corner</dd>
<dt><strong><code>lat_ll</code></strong></dt>
<dd>float
lat of lower left corner</dd>
<dt><strong><code>lon_ur</code></strong></dt>
<dd>float
lon of upper right corner</dd>
<dt><strong><code>lat_ur</code></strong></dt>
<dd>float
lat of upper right corner</dd>
</dl>
<h2 id="parameters">Parameters</h2>
<pre><code>lon_ll: float
lon of lower left corner
lat_ll: float
lat of lower left corner
lon_ur: float
lon of upper right corner
lat_ur: float
lat of upper right corner
</code></pre>
<h2 id="returns">Returns</h2>
<p>float
area of grid point</p></div>
<pre><code>float
area of grid point
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -774,7 +801,8 @@ area of grid point</p></div>
&#34;&#34;&#34;
returns area of rectangular on sphere, defined by corner points lower left ll and upper right ur
Args:
Parameters
----------
lon_ll: float
lon of lower left corner
lat_ll: float
......@@ -784,7 +812,8 @@ area of grid point</p></div>
lat_ur: float
lat of upper right corner
Returns:
Returns
-------
float
area of grid point
&#34;&#34;&#34;
......@@ -797,14 +826,16 @@ area of grid point</p></div>
</code></dt>
<dd>
<div class="desc"><p>Function getting the area weights of a coordinate list</p>
<h2 id="args">Args</h2>
<p>lon : np.ndarray
array of longitudes
<h2 id="parameters">Parameters</h2>
<pre><code>lon : np.ndarray
array of longitudes
lat : np.ndarray
array of latitudes</p>
array of latitudes
</code></pre>
<h2 id="returns">Returns</h2>
<p>np.ndarray
area per grid point</p></div>
<pre><code>np.ndarray
area per grid point
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -813,13 +844,15 @@ area per grid point</p></div>
&#34;&#34;&#34;
Function getting the area weights of a coordinate list
Args:
Parameters
----------
lon : np.ndarray
array of longitudes
lat : np.ndarray
array of latitudes
Returns:
Returns
-------
np.ndarray
area per grid point
&#34;&#34;&#34;
......@@ -838,18 +871,21 @@ area per grid point</p></div>
</code></dt>
<dd>
<div class="desc"><p>Returns mean tws time series of region</p>
<p>Args:
grid: np.ndarray
tws grid, size [t,n,m]
lon_grid: np.ndarray
longitude of grid, size [m]
lat_grid: np.ndarray
latitude of grid, size [n]
region_coords: np.ndarray
coordinates of region of interest, size [l,2]</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>grid</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>tws grid, size [t,n,m]</dd>
<dt><strong><code>lon_grid</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>longitude of grid, size [m]</dd>
<dt><strong><code>lat_grid</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>latitude of grid, size [n]</dd>
<dt><strong><code>region_coords</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>coordinates of region of interest, size [l,2]</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>np.ndarray
size [t]</p></div>
<pre><code>np.ndarray
size [t]
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -858,7 +894,8 @@ size [t]</p></div>
&#34;&#34;&#34;
Returns mean tws time series of region
Args:
Parameters
----------
grid: np.ndarray
tws grid, size [t,n,m]
lon_grid: np.ndarray
......@@ -868,7 +905,8 @@ size [t]</p></div>
region_coords: np.ndarray
coordinates of region of interest, size [l,2]
Returns:
Returns
-------
np.ndarray
size [t]
&#34;&#34;&#34;
......@@ -902,11 +940,16 @@ size [t]</p></div>
<dd>
<div class="desc"><p>Computes
Legendre Polynome of degree n at given latitude lat</p>
<p>Args:
n: int
lat: float</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>n</code></strong> :&ensp;<code>int</code></dt>
<dd>&nbsp;</dd>
<dt><strong><code>lat</code></strong> :&ensp;<code>float</code></dt>
<dd>&nbsp;</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>float</p></div>
<pre><code>float
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -915,11 +958,13 @@ lat: float</p>
&#34;&#34;&#34;
Computes Legendre Polynome of degree n at given latitude lat
Args:
Parameters
----------
n: int
lat: float
Returns:
Returns
-------
float
&#34;&#34;&#34;
sin_lat = np.sin(lat)
......@@ -933,15 +978,18 @@ lat: float</p>
</code></dt>
<dd>
<div class="desc"><p>Computes weighted sum of Legendre Polynomes</p>
<p>Args:
n_max: int
maximum degree of Legendre Polynomes
leg_weights: np.ndarray
arrays of the weights for the sum
lat: float
latitude where the Legendre Polynomes are summed</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>n_max</code></strong> :&ensp;<code>int</code></dt>
<dd>maximum degree of Legendre Polynomes</dd>
<dt><strong><code>leg_weights</code></strong> :&ensp;<code>np.ndarray</code></dt>
<dd>arrays of the weights for the sum</dd>
<dt><strong><code>lat</code></strong> :&ensp;<code>float</code></dt>
<dd>latitude where the Legendre Polynomes are summed</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>float</p></div>
<pre><code>float
</code></pre></div>
<details class="source">
<summary>
<span>Expand source code</span>
......@@ -950,7 +998,8 @@ latitude where the Legendre Polynomes are summed</p>
&#34;&#34;&#34;
Computes weighted sum of Legendre Polynomes
Args:
Parameters
----------
n_max: int
maximum degree of Legendre Polynomes
leg_weights: np.ndarray
......@@ -958,7 +1007,8 @@ latitude where the Legendre Polynomes are summed</p>
lat: float
latitude where the Legendre Polynomes are summed
Returns:
Returns
-------
float
&#34;&#34;&#34;
if n_max!=len(leg_weights)-1:
......@@ -974,21 +1024,24 @@ latitude where the Legendre Polynomes are summed</p>
</code></dt>
<dd>
<div class="desc"><p>Function to compute the adapted Yaglom function</p>
<p>Args:
dist: float
spherical distance
theta: float
azimut angel
a_0: float
anisotropic width parameter