SlideRule is an on-demand science data processing service that runs in on Amazon Web Services and responds to REST API calls to process and return science results. SlideRule was designed to enable researchers and other data systems to have low-latency access to custom-generated, high-level, analysis-ready data products using processing parameters supplied at the time of the request.
The SlideRule ICESat-2 plug-in is a cloud-optimized version of the ATL06 algorithm that can process the lower-level ATL03 geolocated photon height data products hosted on AWS by the NSIDC DAAC.
Documentation for using SlideRule is available from the project website
SlideRule creates a simplified version of the ICESat-2 ATL06 land ice height product that can be adjusted to suit different needs. SlideRule let's you create customized ICESat-2 segment heights directly from the photon height data anywhere on the globe, on-demand and quickly.
Jupyter widgets are used to set parameters for the SlideRule API.
Regions of interest for submitting to SlideRule are drawn on a ipyleaflet map.
The results from SlideRule can be displayed on the interactive ipyleaflet map along with additional contextual layers.
from sliderule import icesat2, ipysliderule, io
import ipywidgets as widgets
import logging
import warnings
# autoreload
%load_ext autoreload
%autoreload 2
# turn off warnings for demo
warnings.filterwarnings('ignore')
# set the url for the sliderule service
# set the logging level
icesat2.init("slideruleearth.io", loglevel=logging.WARNING)
SlideRule follows a streamlined version of the ATL06 land ice height algorithm.
SlideRule also can use different sources for photon classification before calculating the average segment height.
This is useful for example, in cases where there may be a vegetated canopy affecting the spread of the photon returns.
# display widgets for setting SlideRule parameters
SRwidgets = ipysliderule.widgets()
widgets.VBox([
SRwidgets.asset,
SRwidgets.release,
SRwidgets.classification,
SRwidgets.surface_type,
SRwidgets.confidence,
SRwidgets.quality,
SRwidgets.land_class,
SRwidgets.yapc_knn,
SRwidgets.yapc_win_h,
SRwidgets.yapc_win_x,
SRwidgets.yapc_min_ph,
SRwidgets.yapc_weight,
SRwidgets.length,
SRwidgets.step,
SRwidgets.iteration,
SRwidgets.spread,
SRwidgets.count,
SRwidgets.window,
SRwidgets.sigma,
])
Interactive maps within the SlideRule python API are built upon ipyleaflet.
There are 3 projections available within SlideRule for mapping (Global, North and South). There are also contextual layers available for each projection.
Global (Web Mercator, EPSG:3857) | North (Alaska Polar Stereographic, EPSG:5936) | South (Antarctic Polar Stereographic, EPSG:3031) |
---|---|---|
In addition, most xyzservice providers can be added as contextual layers to the global Web Mercator maps
widgets.VBox([
SRwidgets.projection,
SRwidgets.layers,
SRwidgets.raster_functions
])
Here, we create polygons or bounding boxes for our regions of interest.
This map is also our viewer for inspecting our SlideRule ICESat-2 data returns.
# create ipyleaflet map in specified projection
m = ipysliderule.leaflet(SRwidgets.projection.value)
# install click handler callback
m.add_selected_callback(SRwidgets.atl06_click_handler)
m.map
m.add_layer(
layers=SRwidgets.layers.value,
rendering_rule=SRwidgets.rendering_rule
)
nsidc-s3
asset, the ICESat-2 ATL03 data are then accessed from the NSIDC AWS s3 bucket in us-west-2
%%time
# sliderule asset and data release
asset = SRwidgets.asset.value
release = SRwidgets.release.value
# build sliderule parameters using latest values from widget
parms = SRwidgets.build_atl06()
# create an empty geodataframe
gdf = icesat2.__emptyframe()
# for each region of interest
for poly in m.regions:
# add polygon from map to sliderule parameters
parms["poly"] = poly
# make the request to the SlideRule (ATL06-SR) endpoint
# and pass it the request parameters to request ATL06 Data
gdf = gdf.append(icesat2.atl06p(parms, asset, version=release))
Can inspect the columns, number of returns and returns at the top of the GeoDataFrame.
See the ICESat-2 documentation for descriptions of each column
print(f'Returned {gdf.shape[0]} records')
gdf.head()
For stability of the leaflet map, SlideRule will as a default limit the plot to have up to 10000 points from the GeoDataFrame
GeoDataFrames can be plotted in any available matplotlib colormap
widgets.VBox([
SRwidgets.variable,
SRwidgets.cmap,
SRwidgets.reverse,
])
%matplotlib inline
# ATL06-SR fields for hover tooltip
fields = m.default_atl06_fields()
m.GeoData(gdf, column_name=SRwidgets.variable.value, cmap=SRwidgets.colormap,
max_plot_points=10000, tooltip=True, colorbar=True, fields=fields)
The cycles plots should only be used in regions with repeat Reference Ground Track (RGT) pointing
widgets.VBox([
SRwidgets.plot_kind,
SRwidgets.rgt,
SRwidgets.ground_track,
SRwidgets.cycle,
])
%matplotlib widget
# default is to skip cycles with significant off-pointing
SRwidgets.plot(gdf, kind=SRwidgets.plot_kind.value, cycle_start=3,
legend=True, legend_frameon=False)
display(SRwidgets.filesaver)
# append sliderule api version to attributes
version = icesat2.get_version()
parms['version'] = version['icesat2']['version']
parms['commit'] = version['icesat2']['commit']
# save to file in format (HDF5 or netCDF)
io.to_file(gdf, SRwidgets.file,
format=SRwidgets.format,
driver='pytables',
parameters=parms,
regions=m.regions,
verbose=True)
display(SRwidgets.fileloader)
# read from file in format (HDF5 or netCDF)
gdf,parms,regions = io.from_file(SRwidgets.file,
format=SRwidgets.format,
driver='pytables',
return_parameters=True,
return_regions=True)
gdf.head()
SRwidgets.set_values(parms)
m.add_region(regions)