Skip to content

Commit 41c18b3

Browse files
fixed problem when masking snow variable
1 parent ad6b837 commit 41c18b3

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

sice_lib.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def prepare_processing(OLCI_scene):
236236
OLCI_scene['sza'] = OLCI_scene.sza.where(mask)
237237
OLCI_scene['vza'] = OLCI_scene.vza.where(mask)
238238
OLCI_scene['elevation'] = OLCI_scene.elevation.where(mask)
239+
239240
return OLCI_scene, snow
240241

241242

@@ -299,22 +300,19 @@ def snow_properties(OLCI_scene, angles, snow):
299300
# snow specific area ( dimension: m*m/kg)
300301
area = 6./D/0.917
301302

302-
snow['diameter'] = D
303-
snow['area'] = area
304-
snow['al'] = al
305-
snow['r0'] = r0
306-
snow['bal'] = bal
307-
308303
# filtering small D
309304
diameter_thresh = 0.01
310305

311-
valid = snow.diameter >= diameter_thresh
312-
306+
valid = D >= diameter_thresh
313307
snow.isnow[~valid & np.isnan(snow.isnow)] = 104
314308
OLCI_scene['toa'] = OLCI_scene.toa.where(valid)
315-
snow = snow.where(valid)
309+
snow['diameter'] = D.where(valid)
310+
snow['area'] = area.where(valid)
311+
snow['al'] = al.where(valid)
312+
snow['r0'] = r0.where(valid)
313+
snow['bal'] = bal.where(valid)
316314
angles = angles.where(valid)
317-
return OLCI_scene, angles, snow
315+
return OLCI_scene, angles, snow
318316

319317

320318
def prepare_coef(aerosol, angles):
@@ -326,8 +324,8 @@ def prepare_coef(aerosol, angles):
326324
args = aerosol.tau, aerosol.g, aerosol.p, angles.cos_sza, angles.cos_vza, angles.inv_cos_za
327325
t1, t2, ratm, r = xr.apply_ufunc(prepare_coef_numpy, *args, input_core_dims=inputdims, output_core_dims=outputdims)
328326

329-
atmosphere= xr.Dataset()
330-
atmosphere['t1'] =t1
327+
atmosphere = xr.Dataset()
328+
atmosphere['t1'] = t1
331329
atmosphere['t2'] = t2
332330
atmosphere['ratm'] = ratm
333331
atmosphere['r'] = r

0 commit comments

Comments
 (0)