Skip to content

Commit

Permalink
fix images in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinMortier committed Sep 22, 2024
1 parent da281ac commit 4e6eb85
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 99 deletions.
6 changes: 1 addition & 5 deletions aprofiles/detection/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ def detect_clouds(profiles, time_avg=1., zmin=0., thr_noise=5., thr_clouds=4., m
profiles.plot(show_clouds=True, vmin=1e-2, vmax=1e1, log=True)
```
.. figure:: ../../examples/images/clouds.png
:scale: 50 %
:alt: clouds detection
Clouds detection.
![Clouds detection](../../assets/images/clouds.png)
"""

def _detect_clouds_from_rcs(data, zmin, thr_noise, thr_clouds, min_snr):
Expand Down
6 changes: 1 addition & 5 deletions aprofiles/detection/foc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ def detect_foc(profiles, method="cloud_base", var="attenuated_backscatter_0", z_
profiles.plot(show_foc=True, zmax=6000., vmin=1e-2, vmax=1e1, log=True)
```
.. figure:: ../../examples/images/foc.png
:scale: 50 %
:alt: foc detection
Fog or condensation (foc) detection.
![Fog or condensation (foc) detection](../../assets/images/foc.png)
"""

if method == "cloud_base":
Expand Down
6 changes: 1 addition & 5 deletions aprofiles/detection/pbl.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ def detect_pbl(
profiles.plot(show_pbl=True, zmax=6000., vmin=1e-2, vmax=1e1, log=True)
```
.. figure:: ../../examples/images/pbl.png
:scale: 50 %
:alt: clouds detection
Planetary Boundary Layer Height detection.
![Planetary Boundary Layer Height detection](../../assets/images/pbl.png)
"""

from scipy.ndimage.filters import uniform_filter1d
Expand Down
2 changes: 1 addition & 1 deletion aprofiles/plot/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def plot(
# attenuated backscatter image
profiles.plot(vmin=1e-2, vmax=1e1, log=True)
```
![Image of attenuated backscatter profiles](assets/images/attenuated_backscatter.png){: style="width: 50%;" }
![Image of attenuated backscatter profiles](../../assets/images/attenuated_backscatter.png)
"""

# calculates max value from data
Expand Down
9 changes: 3 additions & 6 deletions aprofiles/plot/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def plot(
show_fig=True,
save_fig=None
):
"""Plot single profile of selected variable from :class:`aprofiles.profiles.ProfilesData` object.
"""
Plot single profile of selected variable from (aprofiles.profiles.ProfilesData): object.
Args:
da (xarray.DataArray): DataArray.
Expand Down Expand Up @@ -164,11 +165,7 @@ def plot(
profiles.plot(datetime=datetime, vmin=-1, vmax=10, zmax=12000, show_clouds=True, show_pbl=True)
```
.. figure:: ../../docs/assets/images/Profile-Oslo-20210909T212005.png
:scale: 80 %
:alt: profile
Single profile of attenuated backscatter.
![Single profile of attenuated backscatter](../../assets/images/Profile-Oslo-20210909T212005.png){: style="width: 60%;" }
"""

if datetime is None:
Expand Down
9 changes: 3 additions & 6 deletions aprofiles/plot/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@


def plot(da, var="aod", show_fig=True, save_fig=None, **kwargs):
"""Plot time series of selected variable from :class:`aprofiles.profiles.ProfilesData` object.
"""
Plot time series of selected variable from (aprofiles.profiles.ProfilesData): object.
Args:
da (xarray.DataArray): DataArray
Expand All @@ -31,11 +32,7 @@ def plot(da, var="aod", show_fig=True, save_fig=None, **kwargs):
profiles.plot(var="pbl" ymin=0., ymax=3000., min_snr=2.)
```
.. figure:: ../../docs/assets/images/time_series.png
:scale: 50 %
:alt: time series
Time series of Planetary Boundary Layer height.
![Time series of Planetary Boundary Layer height](../../assets/images/time_series.png)
"""

def __init__(self):
Expand Down
45 changes: 7 additions & 38 deletions aprofiles/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ def snr(self, var="attenuated_backscatter_0", step=4, verbose=False):
profiles.plot(var='snr',vmin=0, vmax=3, cmap='Greys_r')
```
.. figure:: ../../docs/assets/images/snr.png
:scale: 50 %
:alt: snr
Signal to Noise Ratio.
![Signal to Noise Ratio](../../assets/images/snr.png)
"""

def _1D_snr(array, step):
Expand Down Expand Up @@ -174,17 +170,8 @@ def gaussian_filter(
0.50
```
.. figure:: ../../docs/assets/images/attenuated_backscatter.png
:scale: 50 %
:alt: before filtering
Before gaussian filtering.
.. figure:: ../../docs/assets/images/gaussian_filter.png
:scale: 50 %
:alt: after gaussian filtering
After gaussian filtering (sigma=0.5).
![Before gaussian filtering](../../assets/images/attenuated_backscatter.png)
![After gaussian filtering (sigma=0.5)](../../assets/images/gaussian_filter.png)
"""
import copy

Expand Down Expand Up @@ -271,17 +258,8 @@ def extrapolate_below(
150
```
.. figure:: ../../docs/assets/images/lowest.png
:scale: 50 %
:alt: before extrapolation
Before extrapolation.
.. figure:: ../../docs/assets/images/lowest_extrap.png
:scale: 50 %
:alt: after desaturation
After extrapolation.
![Before extrapolation](../../assets/images/lowest.png)
![After extrapolation](../../assets/images/lowest_extrap.png)
"""

# get index of z
Expand Down Expand Up @@ -381,17 +359,8 @@ def desaturate_below(self, var="attenuated_backscatter_0", z=4000.0, inplace=Fal
True
```
.. figure:: ../../docs/assets/images/saturated.png
:scale: 50 %
:alt: before desaturation
Before desaturation.
.. figure:: ../../docs/assets/images/desaturated.png
:scale: 50 %
:alt: after desaturation
After desaturation.
![Before desaturation](../../assets/images/saturated.png)
![After desaturation](../../assets/images/desaturated.png)
"""

imax = self._get_index_from_altitude_AGL(z)
Expand Down
12 changes: 2 additions & 10 deletions aprofiles/retrieval/extinction.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,7 @@ def inversion(
profiles.plot(var='extinction', zmax=6000, vmin=0, vmax=5e-2)
```
.. figure:: ../../docs/assets/images/backward.png
:scale: 50 %
:alt: clouds detection
Extinction profiles retrieved with the backward method.
![Extinction profiles retrieved with the backward method](../../assets/images/backward.png)
Forward inversion
```python
Expand All @@ -214,11 +210,7 @@ def inversion(
profiles.plot(var='extinction', zmax=6000, vmin=0, vmax=5e-2)
```
.. figure:: ../../docs/assets/images/forward.png
:scale: 50 %
:alt: clouds detection
Extinction profiles retrieved with the forward method.
![Extinction profiles retrieved with the forward method](../../assets/images/forward.png)
"""

# we work on profiles averaged in time to reduce the noise
Expand Down
7 changes: 1 addition & 6 deletions aprofiles/retrieval/mass_conc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ def concentration_profiles(profiles, method):
profiles.plot(var='mass_concentration:urban', zmax=6000, vmin=0, vmax=100)
```
.. figure:: ../../docs/assets/images/mass_conc-urban.png
:scale: 50 %
:alt: mass concentration
Mass concentration profiles in the case of urban particles.
![Mass concentration profiles in the case of urban particles](../../assets/images/mass_conc-urban.png)
"""

# read aer_properties.json files
Expand Down
6 changes: 1 addition & 5 deletions aprofiles/simulation/ext2back.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ class ExtinctionToAttenuatedBackscatter:
sim_profiles.plot('extinction_model')
```
.. figure:: ../../docs/assets/images/simulation_step-model.png
:scale: 80 %
:alt: simlation step model
Simulation of aerosol extinction using a step model.
![Simulation of aerosol extinction using a step model](../../assets/images/simulation_step-model.png)
"""
# get the right reading class
def __init__(self, model, wavelength, lidar_ratio, noise):
Expand Down
7 changes: 1 addition & 6 deletions aprofiles/size_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@ def plot(self, show_fig=True):
sd.plot()
```
.. figure:: ../../docs/assets/images/urban_sd.png
:scale: 80 %
:alt: urban size distribution
Size distributions for urban particles.
![Size distributions for urban particles](../../assets/images/urban_sd.png)
"""
fig, ax = plt.subplots(1, 1, figsize=(6, 6))

Expand Down
9 changes: 8 additions & 1 deletion docs/assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ a.download {
a.download::before {
content: "⇩ "; /* Adding a download icon before the text */
}


.md-header-nav__icon .vprofiles {
background-image: url('../assets/images/vprofiles-bold.ico');
background-size: cover;
width: 24px;
height: 24px;
display: inline-block;
}
17 changes: 12 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ theme:
features:
- navigation.instant
- navigation.tracking
- navigation.sections
#- navigation.expand # Automatically expands sections
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
Expand All @@ -38,8 +40,13 @@ theme:

# To set logos for different color schemes, use:
extra:
logo_default: assets/images/A-Profiles-white.png
logo_slate: assets/images/A-Profiles.png
social:
- icon: fontawesome/solid/globe
link: https://vprofiles.met.no
name: V-Profiles
# Optional: Support for dark/light mode with custom logos
logo_light: assets/images/A-Profiles-white.png # Logo for light mode
logo_dark: assets/images/A-Profiles.png # Logo for dark mode

# Repository information (replaces the 'icon_links' feature in Sphinx)
repo_name: "AugustinMortier/A-Profiles"
Expand Down Expand Up @@ -93,7 +100,7 @@ extra_css:
extra_javascript:
- assets/js/custom.js

extra_files:
- aprofiles/cli/aprocess.py
- aprofiles/cli/utils/workflow.py
#extra_files:
# - aprofiles/cli/aprocess.py
# - aprofiles/cli/utils/workflow.py

0 comments on commit 4e6eb85

Please sign in to comment.