From b1aa9732e1c4bf77f0cdc6f518e3c51d967c5392 Mon Sep 17 00:00:00 2001 From: Zach Keskinen Date: Tue, 5 Sep 2023 14:34:36 -0600 Subject: [PATCH] alternative wet flag for nans --- spicy_snow/processing/wet_snow.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spicy_snow/processing/wet_snow.py b/spicy_snow/processing/wet_snow.py index ca512f7..94a2364 100644 --- a/spicy_snow/processing/wet_snow.py +++ b/spicy_snow/processing/wet_snow.py @@ -41,6 +41,9 @@ def id_newly_wet_snow(dataset: xr.Dataset, wet_thresh: int = -2, inplace: bool = # identify possible newly wet snow in regions FCF > 0.5 with deltaVV dataset['wet_flag'] = dataset['wet_flag'].where(((dataset['fcf'] < 0.5) | (dataset['deltaVV'] > wet_thresh)), 1) + # mask nans from Sentinel-1 data + dataset['wet_flag'] = dataset['wet_flag'].where(~dataset['deltaVV'].isnull()) + if not inplace: return dataset @@ -73,6 +76,9 @@ def id_newly_frozen_snow(dataset: xr.Dataset, freeze_thresh: int = 2, inplace: b # identify possible re-freezing by increases of deltaGammaNaught of 2dB dataset['freeze_flag'] = dataset['freeze_flag'].where(dataset['deltaGamma'] < freeze_thresh, 1) + # mask nans from Sentinel-1 data + dataset['freeze_flag'] = dataset['freeze_flag'].where(~dataset['deltaVV'].isnull()) + if not inplace: return dataset @@ -105,6 +111,9 @@ def id_wet_negative_si(dataset: xr.Dataset, wet_SI_thresh = 0, inplace: bool = F # identify wetting of snow by negative snow index with snow present dataset['alt_wet_flag'] = dataset['alt_wet_flag'].where(((dataset['ims'] != 4) | (dataset['snow_index'] > wet_SI_thresh)), 1) + # mask nans from Sentinel-1 data + dataset['alt_wet_flag'] = dataset['alt_wet_flag'].where(~dataset['deltaVV'].isnull()) + if not inplace: return dataset