@@ -70,53 +70,6 @@ def get_range(platform, collection, level):
7070 return range_dict
7171
7272
73- # def convert_range(dataset, from_platform, from_collection, from_level,
74- # to_platform, to_collection, to_level):
75- # """
76- # Converts an xarray.Dataset's range from its product's range
77- # to that of another product's range.
78-
79- # Parameters
80- # ----------
81- # dataset: xarray.Dataset
82- # The dataset to convert to another range.
83- # from_platform, from_collection, from_level: string
84- # The dataset's product's platform, collection, and level.
85- # For example, ('LANDSAT_8', 'c2', 'l2').
86- # to_platform, to_collection, to_level: string
87- # The platform, collection, and level to convert the
88- # dataset's range to.
89- # For example, ('LANDSAT_7', 'c1', 'l2').
90- # """
91- # # Get the original and destination ranges.
92- # from_rng = get_range(from_platform, from_collection, from_level)
93- # if from_rng is None:
94- # raise ValueError(
95- # f'The original range is not recorded '\
96- # f'(platform: {from_platform}, collection: {from_collection}, level: {from_level}).')
97- # to_rng = get_range(to_platform, to_collection, to_level)
98- # if to_rng is None:
99- # raise ValueError(
100- # f'The destination range is not recorded '\
101- # f'(platform: {to_platform}, collection: {to_collection}, level: {to_level}).')
102-
103- # # Determine the data variables with ranges in both
104- # # the original and destination range information.
105- # data_vars_both = list(set(from_rng.keys()) & set(to_rng.keys()))
106- # out_dataset = dataset.copy(deep=True)
107- # for data_var_name in data_vars_both:
108- # from_rng_cur = from_rng[data_var_name]
109- # to_rng_cur = to_rng[data_var_name]
110- # out_dataset[data_var_name].data = np.interp(out_dataset[data_var_name], from_rng_cur, to_rng_cur)
111-
112- # # Temporary approximate corrections - range scaling is often very inaccurate.
113- # if (from_platform, from_collection, from_level) == ('LANDSAT_8', 'c2', 'l2') and \
114- # to_platform in ['LANDSAT_7', 'LANDSAT_8'] and \
115- # (to_collection, to_level) == ('c1', 'l2'):
116- # out_dataset[data_var_name] = out_dataset[data_var_name] * 0.1
117-
118- # return out_dataset
119-
12073def convert_range (dataset , from_platform , from_collection , from_level ,
12174 to_platform , to_collection , to_level ):
12275 """
0 commit comments