Skip to content

Instantly share code, notes, and snippets.

@jpswinski
Created June 8, 2022 13:08
Show Gist options
  • Save jpswinski/fbe09c2528afddcd0ec82e47e10882e6 to your computer and use it in GitHub Desktop.
Save jpswinski/fbe09c2528afddcd0ec82e47e10882e6 to your computer and use it in GitHub Desktop.
Plot photons against SlideRule elevations with the x-axis being distance in order to verify distance alignment.
# Imports
from sliderule import icesat2
import matplotlib.pyplot as plt
import numpy as np
import logging
# Settings
url = "icesat2sliderule.org"
asset = "nsidc-s3"
verbose = True
# Initialize Client
icesat2.init(url, verbose=verbose)
# ATL03 Subsetting Parameters
poly = [{'lon': -20.372964324492575, 'lat': 78.47400837990965},
{'lon': -20.263346363064308, 'lat': 78.46393546381341},
{'lon': -20.210487946975864, 'lat': 78.48683542224246},
{'lon': -20.320279015854357, 'lat': 78.49692891286226},
{'lon': -20.372964324492575, 'lat': 78.47400837990965}]
rgt = 870
params_03 = {'poly':poly,
'cnf':0,
'rgt': rgt,
'cycle':4,
'yapc':{"knn":0, "win_h":3, "win_x":15},
'pass_invalid':True}
# Run SlideRule ATL03 Subsetter
D3 = icesat2.atl03sp(params_03, asset=asset)
# ATL06 Parameters
L = 20
res = L/4
params_06 = {'poly':poly,
'cnf':0,
'len':L,
'res':res,
'ats':L/2,
'cnt':10,
'rgt':rgt,
'cycle':4,
'maxi': 10,
'yapc':{"score":190, "knn":0, "win_h":3, "win_x":15},
'pass_invalid':False}
# Run SlideRule ATL06-SR
D6 = icesat2.atl06p(params_06, asset=asset)
# Interactive Matlibplots (for juypter lab)
# %matplotlib widget
# Plot Elevations overtop Photons (points)
plt.figure()
D3s = D3[D3["spot"] == 4]
plt.scatter(D3s['segment_dist']+D3s['distance'], D3s['height'], 2, c=D3s['yapc_score'], vmin=100, vmax=255); plt.colorbar()
D6s = D6[D6["spot"] == 4]
plt.plot(D6s['distance'], D6s['h_mean'], 'k', linewidth=2)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment