Example #1
0
 def create(spec):
     return PreselectedScenesMosaic(
         aoi=Aoi.create(spec['aoi']),
         target_day_of_year=int(spec['targetDayOfYear']),
         target_day_of_year_weight=float(spec['targetDayOfYearWeight']),
         bands=spec['bands'],
         sceneIds=spec['sceneIds'],
         strategy=spec.get('strategy', Mosaic.default_strategy),
         fmask_threshold=int(spec.get('fmaskThreshold', Mosaic.default_fmask_threshold)))
Example #2
0
 def create(spec):
     return AutomaticSceneSelectingMosaic(
         aoi=Aoi.create(spec['aoi']),
         target_day_of_year=int(spec['targetDayOfYear']),
         target_day_of_year_weight=float(spec['targetDayOfYearWeight']),
         bands=spec['bands'],
         sensors=spec['sensors'],
         from_date=spec['fromDate'],
         to_date=spec['toDate'],
         strategy=spec.get('strategy', Mosaic.default_strategy),
         fmask_threshold=int(spec.get('fmaskThreshold', Mosaic.default_fmask_threshold)))
Example #3
0
 def __init__(self, spec):
     super(MosaicSpec, self).__init__()
     self.spec = spec
     self.aoi = Aoi.create(spec['aoi'])
     self.target_day = int(spec.get('targetDayOfYear', 1))
     self.target_day_weight = float(spec.get('targetDayOfYearWeight', 0))
     self.shadow_tolerance = float(spec.get('shadowTolerance', 1))
     self.haze_tolerance = float(spec.get('hazeTolerance', 0.05))
     self.greenness_weight = float(spec.get('greennessWeight', 0))
     self.bands = spec.get('bands', [])
     self.median_composite = spec.get('median_composite', False)
     self.mask_clouds = spec.get('maskClouds', False)
     self.mask_snow = spec.get('maskSnow', False)
     self.brdf_correct = bool(spec.get('brdfCorrect', False))
     self.from_date = spec.get('fromDate', None)
     self.to_date = spec.get('toDate', None)
     self.surface_reflectance = bool(spec.get('surfaceReflectance', False))
     self.masked_on_analysis = self.surface_reflectance
     self.pan_sharpen = bool(spec.get('panSharpening', False))
Example #4
0
    assert AoiList[10][10] == 0


def testFineArea(aoi):
    u4 = Unit(15, 15, 4)
    u5 = Unit(16, 16, 5)
    u6 = Unit(14, 14, 6)
    # aoi中任何公开方法都会返回radius参数指定范围内节点数量以及具体的unit
    aoi.enter(u4)
    num, units = aoi.enter(u5, 1)
    assert units[0] == u4
    aoi.enter(u6)
    num, units = aoi.inRange(u4, 2)  # 也可以使用inRange方法直接返回参数节点附近的节点
    assert num == 2
    uTemp = Unit(15, 15, 9999)
    aoi.enter(uTemp)
    num, units = aoi.inRange(uTemp, 2)  # 可以通过创建临时节点的方式获取范围内的节点
    aoi.leave(uTemp)
    assert num == 3


if __name__ == "__main__":
    '''
    本aoi算法支持unit重叠坐标,但难以通过print体现
    '''
    aoi = Aoi(20, 20)  # 创建一个大小是20*20的aoi

    testEnter(aoi)
    testMove(aoi)
    testLeave(aoi)
    testFineArea(aoi)
Example #5
0
def scene_areas():
    aoi = Aoi.create(json.loads(request.values['aoi']))
    areas = aoi.scene_areas('wrs-2')
    return Response(json.dumps(areas), mimetype='application/json')