Created
May 11, 2025 17:09
-
-
Save amoodie/3ba1b3e2867ca0913e25c1527ea1d15f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my answer | |
from tqdm import tqdm | |
subaerial = np.zeros(golfcube.shape[0]) | |
topset = np.zeros(golfcube.shape[0]) | |
for T in tqdm(range(golfcube.shape[0])): | |
# do it with just pixels above sea level | |
Land_A = golfcube['eta'][T,:,:] > golfcube.meta['H_SL'][T] | |
Land_C = np.count_nonzero(Land_A) | |
subaerial[T] = Land_C * golfcube.meta["dx"] * golfcube.meta["dx"] | |
# do it with Opening Angle method | |
lm = spl.mask.LandMask( | |
golfcube['eta'][T, :, :], | |
elevation_threshold=golfcube.meta['H_SL'][T]) | |
topset[T] = np.sum(lm.mask) * golfcube.meta["dx"] * golfcube.meta["dx"] | |
fig, ax = plt.subplots() | |
ax.plot(golfcube.t, subaerial / 1e6, label="subaerial") | |
ax.plot(golfcube.t, topset / 1e6, label="topset") | |
ax.set_ylabel("area [km$^2$]") | |
ax.set_xlabel("time [elapsed seconds]") | |
ax.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment