Skip to content

Commit

Permalink
feat: add water thickness layer to bedmap2 fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanker committed Feb 17, 2024
1 parent 4ce3d8d commit 8f26e46
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/polartoolkit/fetch.py
Expand Up @@ -1828,7 +1828,8 @@ def bedmap2(
choose which layer to fetch:
"bed", "coverage", "grounded_bed_uncertainty", "icemask_grounded_and_shelves",
"lakemask_vostok", "rockmask", "surface", "thickness",
"thickness_uncertainty_5km", "gl04c_geiod_to_WGS84", "icebase"
"thickness_uncertainty_5km", "gl04c_geiod_to_WGS84", "icebase",
"water_thickness"
reference : str
choose whether heights are referenced to the 'eigen-6c4' geoid, the WGS84
ellipsoid, 'ellipsoid', or by default the 'eigen-gl04c' geoid.
Expand Down Expand Up @@ -1887,6 +1888,7 @@ def bedmap2(
"thickness",
"gl04c_geiod_to_WGS84",
"icebase",
"water_thickness",
]:
initial_region = (-3333000, 3333000, -3333000, 3333000)
initial_spacing = 1e3
Expand Down Expand Up @@ -1970,13 +1972,19 @@ def preprocessing(fname: str, action: str, _pooch2: typing.Any) -> str:
# load zarr as a dataarray
thickness = xr.open_zarr(fname)[layer]

# calculate icebase with the resampled surface and thickness
# calculate icebase
grid = surface - thickness

# reset layer variable
layer = "icebase"
logging.info("calculating icebase from surface and thickness grids")
elif layer == "water_thickness":
icebase = bedmap2(layer="icebase")
bed = bedmap2(layer="bed")

# calculate water thickness
grid = icebase - bed
logging.info("calculating water thickness from bed and icebase grids")
elif layer in [
"bed",
"coverage",
Expand Down

0 comments on commit 8f26e46

Please sign in to comment.