{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Cloud Base Height Retrievals\n\nThis example shows how to calculate the cloud base heights\nusing the sobel edge detection method. This can be used\nfor vertical radar and lidar data.\n\nAuthor: Adam Theisen\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nfrom arm_test_data import DATASETS\nfrom matplotlib import pyplot as plt\n\nimport act\n\n# Read Ceilometer data for an example\nfilename_ceil = DATASETS.fetch('sgpceilC1.b1.20190101.000000.nc')\nds = act.io.arm.read_arm_netcdf(filename_ceil)\n\nds = act.retrievals.cbh.generic_sobel_cbh(\n ds, variable='backscatter', height_dim='range', var_thresh=1000.0, fill_na=0.0\n)\n\n# Plot the cloud base height data\ndisplay = act.plotting.TimeSeriesDisplay(ds, subplot_shape=(1, 2), figsize=(16, 6))\ndisplay.plot('backscatter', subplot_index=(0, 0))\ntitle = 'SGP Ceilometer with Lidar-Calculated CBH Overplotted'\ndisplay.plot('first_cbh', subplot_index=(0, 0), color='k', set_title=title)\n\ndisplay.plot('backscatter', subplot_index=(0, 1))\ntitle = 'SGP Ceilometer with CBH Overplotted'\ndisplay.plot('cbh_sobel_backscatter', color='k', subplot_index=(0, 1), set_title=title)\n\ndiff = ds['first_cbh'].values - ds['cbh_sobel_backscatter'].values\n\nprint(\"Average difference between ceilomter and sobel heights \", np.nanmean(diff))\n\nds.close()\nplt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }