Skip to content

Commit

Permalink
Merge pull request #60 from SnowEx/retrieval_wet_params
Browse files Browse the repository at this point in the history
Retrieval wet params
  • Loading branch information
ZachHoppinen authored Sep 5, 2023
2 parents 7838905 + 7b81b6e commit d95cae1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spicy_snow/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,13 @@ def retrieve_snow_depth(area: shapely.geometry.Polygon,

return ds

def retrieval_from_parameters(dataset: xr.Dataset, A: float, B: float, C: float):
def retrieval_from_parameters(dataset: xr.Dataset,
A: float,
B: float,
C: float,
wet_SI_thresh: float = 0,
freezing_snow_thresh: float = 2,
wet_snow_thres: float = -2):
"""
Retrieve snow depth with varied parameter set from an already pre-processed
dataset.
Expand All @@ -201,7 +207,10 @@ def retrieval_from_parameters(dataset: xr.Dataset, A: float, B: float, C: float)
dataset: xarray dataset with snow_depth variable calculated from parameters
"""

dataset = dataset[['s1','deltaVV','ims','fcf','lidar-sd']]
# dataset = dataset[['s1','deltaVV','ims','fcf','lidar-sd']]

# load datast to index
dataset = dataset.load()

# calculate delta CR and delta VV
dataset = calc_delta_cross_ratio(dataset, A = A)
Expand All @@ -219,11 +228,11 @@ def retrieval_from_parameters(dataset: xr.Dataset, A: float, B: float, C: float)
dataset = calc_snow_index_to_snow_depth(dataset, C = C)

# find newly wet snow
dataset = id_newly_wet_snow(dataset)
dataset = id_wet_negative_si(dataset)
dataset = id_newly_wet_snow(dataset, wet_thresh = wet_snow_thres)
dataset = id_wet_negative_si(dataset, wet_SI_thresh = wet_SI_thresh)

# find newly frozen snow
dataset = id_newly_frozen_snow(dataset)
dataset = id_newly_frozen_snow(dataset, freeze_thresh = freezing_snow_thresh)

# make wet_snow flag
dataset = flag_wet_snow(dataset)
Expand Down

0 comments on commit d95cae1

Please sign in to comment.