Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieval wet params #60

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions spicy_snow/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,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 @@ -200,7 +206,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 @@ -218,11 +227,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