-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spatiotemporal visualization of active subglacial lake surfaces over ICESat-2 cycles #180
Conversation
It's easier to look at raster grid surfaces than point clouds, and visualize them in 3D too! Using the good ol' `blockmedian` and `surface` modules from PyGMT to interpolate ICESat-2 points onto a grid. This is done on a (3 month) cycle by cycle basis, and the resulting NetCDF files are stacked into a single NetCDF data cube using xarray. Will need to work on using a proper datetime64 time axis instead of just cycle number, and perhaps allow for kwargs into the `surface` instead of the current hardcoded parameters.
Newer gmt with xarray shading support, and a newer intake-xarray too!
Refactor to move the NetCDF files into the folder correctly, overwriting the filepath(s) if the file is already present. Also added a 'projection' parameter so that the projection information is stored in the NetCDF grid and viewable directly in QGIS without needing to set a projection first. Using the proj4 string of Antarctic Polar Stereographic EPSG:3031 from https://spatialreference.org/ref/epsg/3031/proj4/. Note to self, the grid_mapping coordinate should actually be an attribute, either handle that using xarray.open_rasterio, use rioxarray, or wait until the pangeo/xarray community standardizes on what to do with this.
Better handle elevation outliers that had resulted in sharp peaks and troughs in the output NetCDF grid. Doing so by telling `pygmt.surface` to limit the output solution to a lower and upper bound, determined as ±3 median absolute deviations from the median of the entire dataframe table. Originally I was clipping the grid in a post-processing step, but decided it's much better to impose the limits in the surface algorithm itself! The elevation statistics of the test case in Greenland also looks more sensible now than before.
Main changes are an elev_filter setting in `deepicedrain.vizplots.plot_crossovers`, and the addition of annotated track numbers in the crossover_area map plot using GMT's quoted line functionality. Lots of other little bits too, including a refresh of the subglacial_lake ID (key) and name (value) pairs, a quick improvement to the inefficient brute-force crossover for-loop, and organizing figures inside 'figures/{lakename}' instead of just the 'figures' directory. Still a big chunk of local code yet to be committed, need to refactor and streamline the processing to be able to loop through many subglacial lakes in a more hands off manner!
Congratulations 🎉. DeepCode analyzed your code in 1.793 seconds and we found no issues. Enjoy a moment of no bugs ☀️. 👉 View analysis in DeepCode’s Dashboard | Configure the bot |
Visualizing ice surface changes in 3D, because it's more intuitive to the eye! There's a bit of an art to 3D perspective plots, and PyGMT's `grdview` does a fine job at it, though there's many lines of code involved! The figure consists of two plots. On the left is a shaded ice surface elevation grid overlaid with the subglacial lake outline in yellow. On the right is an elevation difference/anomaly grid view (relative to ICESat-2 Cycle 3). Still need to wait for `subplot` and `plot3d` to be wrapped in PyGMT to simplify the code and make things look more polished. Animated GIF is made using imagemagick's `convert` in bash as it was higher quality (and less lines of code) than Pillow. Also have a code cell showing an alternative HvPlot-based 2D map of the same time-series grid, complete with an interactive slider to cycle through each ICESat-2 cycle.
d2a932c
to
38237d1
Compare
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.04%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
Going from point clouds to data cubes! Going to make some cool 3D perspective views of changing ice surface over time.
Note: below is actually Lower Subglacial Lake Conway (the little one), not Subglacial Lake Conway.
TODO:
spatiotemporal_cube
function (ec1eac1, 665995a)In a separate PR, automate the spatiotemporal analysis across several lakes in a more scripted for-loop manner.