{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Using ACT for Satellite data\n\nSimple example for working with satellite data.\nIt is recommended that users explore other\nsatellite specific libraries suchas SatPy.\n\nAuthor: Adam Theisen\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\nfrom arm_test_data import DATASETS\n\nimport act\n\n# Read in VISST Data\nfiles = DATASETS.fetch('enavisstgridm11minnisX1.c1.20230307.000000.cdf')\nds = act.io.read_arm_netcdf(files)\n\n# Plot up the VISST cloud percentage using XSectionDisplay\ndisplay = act.plotting.XSectionDisplay(ds, figsize=(10, 8))\ndisplay.plot_xsection_map(\n 'cloud_percentage', x='longitude', y='latitude', isel_kwargs={'time': 0, 'cld_type': 0}\n)\nplt.show()\n\n# Download ARM TSI Data\nfiles = DATASETS.fetch('enatsiskycoverC1.b1.20230307.082100.cdf')\nds_tsi = act.io.read_arm_netcdf(files)\nds_tsi = ds_tsi.where(ds_tsi.percent_opaque > 0)\nds_tsi = ds_tsi.resample(time='30min').mean()\n\n# Set coordinates to extra data for ENA\nena_lat = 39.091600\nena_lon = 28.025700\n\nlat = ds['lat'].values\nlon = ds['lon'].values\n\n# Find the nearest pixel for the satellite data and extract it\nlat_ind = np.argmin(np.abs(lat - ena_lat))\nlon_ind = np.argmin(np.abs(lon - ena_lon))\n\nds_new = ds.isel(lat=lat_ind, lon=lon_ind, cld_type=0)\n\n# Plot the comparison using TimeSeriesDisplay\ndisplay = act.plotting.TimeSeriesDisplay({'Satellite': ds_new, 'ARM': ds_tsi}, figsize=(15, 8))\ndisplay.plot('cloud_percentage', dsname='Satellite', label='VISST Cloud Percentage')\ndisplay.plot('percent_opaque', dsname='ARM', label='ARM TSI Percent Opaque')\ndisplay.day_night_background(dsname='ARM')\nplt.legend()\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 }