Skip to content

Commit

Permalink
feat: add mass change for Greenland
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanker committed Jun 14, 2024
1 parent a8d0af5 commit 56bd01a
Show file tree
Hide file tree
Showing 5 changed files with 293 additions and 27 deletions.
94 changes: 77 additions & 17 deletions docs/datasets/antarctica/mass_change.ipynb

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions docs/datasets/greenland/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ geoid
modis_mog
```

## Geophysically-derived data

```{nbgallery}
---
---
mass_change
```

## Shapefiles and Misc.

```{nbgallery}
Expand Down
178 changes: 178 additions & 0 deletions docs/datasets/greenland/mass_change.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/datasets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ greenland/modis_mog
greenland/groundingline
greenland/bedmachine
greenland/geoid
greenland/mass_change
```
39 changes: 29 additions & 10 deletions src/polartoolkit/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,19 @@ def sample_shp(name: str) -> str:


def mass_change(
version: str = "ais_dhdt_floating",
version: str | None = None,
hemisphere: str | None = None,
) -> typing.Any:
"""
Ice-sheet height and thickness changes from ICESat to ICESat-2.
Ice-sheet height and thickness changes from ICESat to ICESat-2 for both Antarctica
and Greenland
from :footcite:t:`smithpervasive2020`.
Choose a version of the data to download with the format: "ais_VERSION_TYPE" where
VERSION is "dhdt" for total thickness change or "dmdt" for corrected for firn-air
content.
TYPE is "floating" or "grounded"
Choose a version of the data to download with the format: "ICESHEET_VERSION_TYPE"
where ICESHEET is "ais" or "gris", for Antarctica or Greenland, which is
automatically set via the hemisphere variable. VERSION is "dhdt" for total thickness
change or "dmdt" for corrected for firn-air content. For Antarctica data, TYPE is
"floating" or "grounded".
add "_filt" to retrieve a filtered version of the data.
Expand All @@ -315,8 +318,12 @@ def mass_change(
Parameters
----------
version : str, optional
choose which version to retrieve, by default "ais_dhdt_floating"
version : str, optional,
choose which version to retrieve, by default is "dhdt_grounded" for Antarctica
and "dhdt" for Greenland.
hemisphere : str, optional
choose which hemisphere to retrieve data for, "north" or "south", by default
None
Returns
-------
Expand All @@ -327,6 +334,7 @@ def mass_change(
----------
.. footbibliography::
"""
hemisphere = utils.default_hemisphere(hemisphere)

# This is the path to the processed (magnitude) grid
url = (
Expand All @@ -337,9 +345,20 @@ def mass_change(

zip_fname = "ICESat1_ICESat2_mass_change_updated_2_2021.zip"

if "dhdt" in version:
if version is None:
if hemisphere == "south":
version = "dhdt_grounded"
elif hemisphere == "north":
version = "dhdt"

if hemisphere == "south":
version = f"ais_{version}"
elif hemisphere == "north":
version = f"gris_{version}"

if "dhdt" in version: # type: ignore[operator]
fname = f"dhdt/{version}.tif"
elif "dmdt" in version:
elif "dmdt" in version: # type: ignore[operator]
fname = f"dmdt/{version}.tif"

path = pooch.retrieve(
Expand Down

0 comments on commit 56bd01a

Please sign in to comment.