Skip to content

Commit fea39e5

Browse files
committed
Merge branch 'end_to_end' of https://github.com/HYPERNETS/hypernets_processor into include_plots
� Conflicts: � hypernets_processor/data_io/dataset_util.py � hypernets_processor/data_io/format/variables.py � hypernets_processor/etc/processor.config � hypernets_processor/main_processor.py � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1A_IRR_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1A_RAD_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1B_IRR_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1B_RAD_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1B_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L1D_v0.0.nc � hypernets_processor/out/BSBE/2020/3/12/HYPERNETS_W_VFFR_L2A_REF_v0.0.nc � hypernets_processor/test.txt
2 parents aac6351 + 93afc6f commit fea39e5

File tree

14 files changed

+1283
-619
lines changed

14 files changed

+1283
-619
lines changed
Binary file not shown.
Binary file not shown.

hypernets_processor/calibration/calibrate.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,20 @@ def preprocess_l0(self, datasetl0, datasetl1a):
241241

242242
flagval = 2 ** (self.context.get_config_value("outliers"))
243243

244+
print(np.where(mask > 0))
245+
246+
break
247+
datasetl0["quality_flag"].values = [
248+
flagval + datasetl0["quality_flag"].values[i] if mask[i] == 1 else
249+
datasetl0["quality_flag"].values[i] for i in range(len(mask))]
250+
251+
252+
244253
datasetl0["quality_flag"].values = [
245254
flagval + datasetl0["quality_flag"].values[i] if mask[i] == 1 else
246255
datasetl0["quality_flag"].values[i] for i in range(len(mask))]
247256

257+
248258
datasetl1a["quality_flag"].values = [
249259
flagval + datasetl1a["quality_flag"].values[i] if mask[i] == 1 else
250260
datasetl1a["quality_flag"].values[i] for i in range(len(mask))]

hypernets_processor/data_io/dataset_util.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from hypernets_processor.version import __version__
66
import string
7-
from xarray import Variable, DataArray, Dataset
7+
from xarray import Variable, DataArray
88
import numpy as np
99

1010

@@ -224,13 +224,10 @@ def get_default_fill_value(dtype):
224224
def _get_flag_encoding(da):
225225
"""
226226
Returns flag encoding for flag type data array
227-
228227
:type da: xarray.DataArray
229228
:param da: data array
230-
231229
:return: flag meanings
232230
:rtype: list
233-
234231
:return: flag masks
235232
:rtype: list
236233
"""
@@ -247,10 +244,8 @@ def _get_flag_encoding(da):
247244
def unpack_flags(da):
248245
"""
249246
Breaks down flag data array into dataset of boolean masks for each flag
250-
251247
:type da: xarray.DataArray
252248
:param da: dataset
253-
254249
:return: flag masks
255250
:rtype: xarray.Dataset
256251
"""
@@ -268,13 +263,10 @@ def unpack_flags(da):
268263
def set_flag(da, flag_name, error_if_set=False):
269264
"""
270265
Sets named flag for elements in data array
271-
272266
:type da: xarray.DataArray
273267
:param da: dataset
274-
275268
:type flag_name: str
276269
:param flag_name: name of flag to set
277-
278270
:type error_if_set: bool
279271
:param error_if_set: raises error if chosen flag is already set for any element
280272
"""
@@ -295,13 +287,10 @@ def set_flag(da, flag_name, error_if_set=False):
295287
def unset_flag(da, flag_name, error_if_unset=False):
296288
"""
297289
Unsets named flag for specified index of dataset variable
298-
299290
:type da: xarray.DataArray
300291
:param da: data array
301-
302292
:type flag_name: str
303293
:param flag_name: name of flag to unset
304-
305294
:type error_if_unset: bool
306295
:param error_if_unset: raises error if chosen flag is already set at specified index
307296
"""
@@ -322,10 +311,8 @@ def unset_flag(da, flag_name, error_if_unset=False):
322311
def get_set_flags(da):
323312
"""
324313
Return list of set flags for single element data array
325-
326314
:type da: xarray.DataArray
327315
:param da: single element data array
328-
329316
:return: set flags
330317
:rtype: list
331318
"""
@@ -346,13 +333,10 @@ def get_set_flags(da):
346333
def check_flag_set(da, flag_name):
347334
"""
348335
Returns if flag for single element data array
349-
350336
:type da: xarray.DataArray
351337
:param da: single element data array
352-
353338
:type flag_name: str
354339
:param flag_name: name of flag to set
355-
356340
:return: set flags
357341
:rtype: list
358342
"""
@@ -367,5 +351,7 @@ def check_flag_set(da, flag_name):
367351
return False
368352

369353

354+
355+
370356
if __name__ == "__main__":
371357
pass
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FLAG_MEANINGS = ["saturation", "nonlinearity", "bad_pointing", "placeholder1", "lon_default", "lat_default", "outliers",
2-
"angles_missing", "lu_eq_missing", "fresnel_angle_missing", "fresnel_default", "temp_variability_ed",
1+
FLAG_COMMON = ["saturation", "nonlinearity", "bad_pointing", "placeholder1", "lon_default", "lat_default", "outliers"]
2+
3+
FLAG_WATER = ["angles_missing", "lu_eq_missing", "fresnel_angle_missing", "fresnel_default", "temp_variability_ed",
34
"temp_variability_lu", "min_nbred", "min_nbrlu", "min_nbrlsky", "def_wind_flag", "simil_fail"]
45

6+
FLAG_LAND = []

hypernets_processor/data_io/format/variables.py

Lines changed: 417 additions & 507 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)