File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
descarteslabs/_dl_modules/catalog Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -147,11 +147,41 @@ class ProcessingStepAttribute(MappingAttribute):
147
147
the coefficients for the processing function. Required.
148
148
index : int
149
149
Optional index into the named parameter (an array) for the band.
150
+ data_type : str or DataType
151
+ Optional data type for pixel values in this band.
152
+ data_range : tuple(float, float)
153
+ Optional normal range of pixel values stored in the band.
154
+ display_range : tuple(float, float)
155
+ Optional normal range of pixel values stored in the band for display purposes.
156
+ physical_range : tuple(float, float)
157
+ Optional normal range of physical values stored in the band.
158
+ physical_range_units : str
159
+ Optional unit of the physical range.
150
160
"""
151
161
152
162
function = TypedAttribute (str )
153
163
parameter = TypedAttribute (str )
154
164
index = TypedAttribute (int )
165
+ data_type = EnumAttribute (DataType )
166
+ data_range = TupleAttribute (
167
+ min_length = 2 ,
168
+ max_length = 2 ,
169
+ coerce = True ,
170
+ attribute_type = float ,
171
+ )
172
+ display_range = TupleAttribute (
173
+ min_length = 2 ,
174
+ max_length = 2 ,
175
+ coerce = True ,
176
+ attribute_type = float ,
177
+ )
178
+ physical_range = TupleAttribute (
179
+ min_length = 2 ,
180
+ max_length = 2 ,
181
+ coerce = True ,
182
+ attribute_type = float ,
183
+ )
184
+ physical_range_unit = Attribute ()
155
185
156
186
157
187
class ProcessingLevelsAttribute (ModelAttribute , MutableMapping ):
Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ Guide <catalog_v2_guide>`.
96
96
~descarteslabs.catalog.DataType
97
97
~descarteslabs.catalog.BandType
98
98
~descarteslabs.catalog.Colormap
99
+ ~descarteslabs.catalog.ProcessingStepAttribute
100
+ ~descarteslabs.catalog.ProcessingLevelsAttribute
99
101
~descarteslabs.catalog.Resolution
100
102
~descarteslabs.catalog.ResolutionUnit
101
103
~descarteslabs.catalog.File
Original file line number Diff line number Diff line change 15
15
MicrowaveBand ,
16
16
ProcessingStepAttribute ,
17
17
DerivedParamsAttribute ,
18
+ DataType ,
18
19
)
19
20
from ..product import Product
20
21
@@ -286,6 +287,43 @@ def test_processing_levels_create(self):
286
287
},
287
288
)
288
289
290
+ b = SpectralBand (
291
+ id = band_id ,
292
+ processing_levels = {
293
+ "default" : "toa_reflectance" ,
294
+ "toa_reflectance" : [
295
+ {
296
+ "function" : "fun" ,
297
+ "parameter" : "param" ,
298
+ "index" : 0 ,
299
+ "data_type" : "Float64" ,
300
+ "data_range" : [0 , 1 ],
301
+ "display_range" : [0 , 0.4 ],
302
+ "physical_range" : [0 , 1 ],
303
+ "physical_range_unit" : "reflectance" ,
304
+ }
305
+ ],
306
+ },
307
+ )
308
+ self .assertEqual (
309
+ b .processing_levels ,
310
+ {
311
+ "default" : "toa_reflectance" ,
312
+ "toa_reflectance" : [
313
+ ProcessingStepAttribute (
314
+ function = "fun" ,
315
+ parameter = "param" ,
316
+ index = 0 ,
317
+ data_type = DataType ("Float64" ),
318
+ data_range = (0.0 , 1.0 ),
319
+ display_range = (0 , 0.4 ),
320
+ physical_range = (0.0 , 1.0 ),
321
+ physical_range_unit = "reflectance" ,
322
+ )
323
+ ],
324
+ },
325
+ )
326
+
289
327
with pytest .raises (AttributeValidationError ):
290
328
SpectralBand (id = band_id , processing_levels = {"default" : 1 })
291
329
You can’t perform that action at this time.
0 commit comments