-
-
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
Calculate rolling time-series of ice volume displacement over subglacial lakes #216
Conversation
Math looks easy on paper until you try to implement it robustly, and this ice volume displacement calculation is one such example! We estimate ice volume displacement by multiplying lake area by the height anomaly, following Kim et al., 2016 and Siegfried et al., 2016. The height anomaly is a rolling mean elevation calculated with a window size of 91 days (1 ICESat-2 cycle), minus the first elevation at time=0. The cool thing about this function is that pint units are used, with standard deviation uncertainties included! Added one quick and dirty doctest for this function just to keep things simple.
Fixing some inconsistencies in the use of "normalized" height, should be height "anomalies" instead. The df_th (time and height dataframe) is now sorted by time prior to running any processing operations, so the crossover height anomaly over time plots should all start right at 0 now. Still need to work on adding the one sigma uncertainty error bars, and find a way to parallelize the whole script on many lakes.
Chucking lots of code from atlxi_xover.py into our Behavioural Driven Development integration test suite. Not very DRY, but will refactor later. Should work by running `poetry run pytest --verbose --doctest-modules -k anomalies -n 2 deepicedrain/`. Dropped all the lake_ids from all the examples in subglacial_lakes.feature as they're listed in atlas_catalog.yaml now, one source of truth! Also made the `df_lake` function into a reusable fixture in conftest.py, setting it up for shaing across the test_subglacial_lakes_*.py tests.
One local dask cluster client to run them all! Also a minor tweak to the boolean 'draining' variable.
757a033
to
e56fe76
Compare
Like, actually calculate and save (!!) ice volume displacement (dvol), so that we can aggregrate the dvol values from several lakes into one plot later on, or share the data with other people. Both the nominal values and standard deviations are saved, though this requires the pint and uncertainties package. Also did some hacking to ensure pint unit registries are the same to avoid a "ValueError: Cannot operate with Quantity and Quantity of different registries."
e56fe76
to
cbb88f8
Compare
Ice volume displacements (a proxy for subglacial lake volume discharge) did not seem right, and it's because the geographical subsetting was done using a bounding box rather than an actual polygon. Using geopandas (CPU-based) for this since there's only a few hundred points involved. Also decided I might as well randomly commit an enhancement to the point_in_polygon_gpu code, with a new poly_limit parameter for conserving GPU memory.
Not to be confused with waterfall plots, nor anything really. This is still a fairly basic graph showing an inferred cascade of Whillans 7 -> Whillans IX -> Subglacial Lake Whillans -> Whillans 12. The numbers don't quite sum up perfectly on the chart, so I might need to look at a few more adjacent lakes. This should do for now though!
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 1.99%.
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. |
Multiply lake area by mean height displacement to get ice volume displacement! Sounds easy, but try implementing it in a robust way with pint units and standard deviation uncertainties too! This PR extends the work done in #212.
TODO:
References: