# analysis of high aerosol loading during dust event (April 3, 2024)
# read High Spectra Resolution Lidar (HSRL) data using ACT

### code courtesy of Damao Zhang ###

#%matplotlib widget
import ipywidgets as widgets

import matplotlib.pyplot as plt
import ipywidgets as widgets
import numpy as np
import pandas as pd
import os
from datetime import datetime

import act
import xarray as xr

Dust layer observations

### April 3rd, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-3'
enddate = '2023-04-3'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230403.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/4e6dcb33b6e008d4e85cc8db05305a8aa85540e9c0d9262e88d9a3f645ee20cc.png
### April 4rd, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-4'
enddate = '2023-04-4'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230404.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/d8d1431453a0ad7b2fc6714a64f7c141d76248b3606a26f450519a4bd10d6e6d.png
### April 5rd, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-5'
enddate = '2023-04-5'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230405.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/b225f95d2fa17f23fd352b5a171a7f5e25e5948eaa2d202d8d1d0743cd5982e1.png
### April 6rd, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-6'
enddate = '2023-04-6'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230406.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/f9c7793424d12dfc38b869dd47d4d207ec4a420edb37e65682adaca046e8b784.png
### April 7th, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-7'
enddate = '2023-04-7'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230407.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/3a37a4a4831e0b54b410a1de6eb79ad9467799dcefc7785f89d1334920a8e545.png
### April 8th, 2022 ###
# Set your username and token here!
username = 'username'
token = 'token'

# Set the datastream and start/enddates

datastream = 'guchsrlM1.a1'
startdate = '2023-04-8'
enddate = '2023-04-8'

# Use ACT to easily download the data.  Watch for the data citation!  Show some support
# for ARM's instrument experts and cite their data if you use it in a publication
result = act.discovery.download_arm_data(username, token, datastream, startdate, enddate)
result.sort()

ds = act.io.read_arm_netcdf(result)
ds.clean.cleanup()

# compute log of backscatter 
ds['beta_a_backscatter_log'] = np.log10(ds['beta_a_backscatter'])
ds['beta_a_backscatter_log'].attrs['units'] = f"log10({ds['beta_a_backscatter'].attrs['units']})"
ds = ds.where(ds.range <= 10000, drop=True)

mask = ds['particulate_backscatter_signal_to_noise']>=3

#beta_a_backscatter - column backscatter 
variables = ['beta_a_backscatter_log', 'linear_depol', 'color_ratio']

# watch out cloudy pixels
display = act.plotting.TimeSeriesDisplay(ds.where(mask),
                                         subplot_shape=(3,), figsize=(12,16))
display.plot(variables[0], subplot_index=(0,))
display.set_yrng([0, 6000], subplot_index=(0,))

# linear_depol indicates irregular aerosol 
display.plot(variables[1], subplot_index=(1,), vmin = 0, vmax = 0.3)
display.set_yrng([0, 6000], subplot_index=(0,))

# color_ratio an indicator of aerosol particle size. Large aerosol particles have larger color_ratios
display.plot(variables[2], subplot_index=(2,), vmin = 0, vmax = 1)
display.set_yrng([0, 6000], subplot_index=(0,))

plt.show()
[DOWNLOADING] guchsrlM1.a1.20230408.000000.nc

If you use these data to prepare a publication, please cite:

Holz, R., Garcia, J., Schuman, E., Bambha, R., Ermold, B., Eloranta, E., &
Garcia, J. High Spectral Resolution Lidar (HSRL). Atmospheric Radiation
Measurement (ARM) User Facility. https://doi.org/10.5439/1462207
/opt/conda/lib/python3.11/site-packages/dask/core.py:127: RuntimeWarning: invalid value encountered in log10
  return func(*(_execute_task(a, cache) for a in args))
../_images/c23ad40c0fb86c65a8c3e3320f911bacde354eea4025294dacd7afee5f8a89fd.png