.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "source/auto_examples/retrievals/plot_cbh_sobel.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_source_auto_examples_retrievals_plot_cbh_sobel.py: Cloud Base Height Retrievals ---------------------------- This example shows how to calculate the cloud base heights using the sobel edge detection method. This can be used for vertical radar and lidar data. Author: Adam Theisen .. GENERATED FROM PYTHON SOURCE LINES 12-42 .. image-sg:: /source/auto_examples/retrievals/images/sphx_glr_plot_cbh_sobel_001.png :alt: SGP Ceilometer with Lidar-Calculated CBH Overplotted, SGP Ceilometer with CBH Overplotted :srcset: /source/auto_examples/retrievals/images/sphx_glr_plot_cbh_sobel_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Average difference between ceilomter and sobel heights 84.37419 | .. code-block:: Python from arm_test_data import DATASETS from matplotlib import pyplot as plt import act import numpy as np # Read Ceilometer data for an example filename_ceil = DATASETS.fetch('sgpceilC1.b1.20190101.000000.nc') ds = act.io.arm.read_arm_netcdf(filename_ceil) ds = act.retrievals.cbh.generic_sobel_cbh( ds, variable='backscatter', height_dim='range', var_thresh=1000.0, fill_na=0.0 ) # Plot the cloud base height data display = act.plotting.TimeSeriesDisplay(ds, subplot_shape=(1, 2), figsize=(16, 6)) display.plot('backscatter', subplot_index=(0, 0)) title = 'SGP Ceilometer with Lidar-Calculated CBH Overplotted' display.plot('first_cbh', subplot_index=(0, 0), color='k', set_title=title) display.plot('backscatter', subplot_index=(0, 1)) title = 'SGP Ceilometer with CBH Overplotted' display.plot('cbh_sobel_backscatter', color='k', subplot_index=(0, 1), set_title=title) diff = ds['first_cbh'].values - ds['cbh_sobel_backscatter'].values print("Average difference between ceilomter and sobel heights ", np.nanmean(diff)) ds.close() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.551 seconds) .. _sphx_glr_download_source_auto_examples_retrievals_plot_cbh_sobel.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_cbh_sobel.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_cbh_sobel.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_cbh_sobel.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_