Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass-addons/grass7/imagery/i.sentinel.mask/i.sentinel.mask.py

    r72816 r72992  
    110110#% description: name of output vector shadow mask
    111111#% required : no
     112#% guisection: Output
     113#%end
     114#%option
     115#% key: cloud_threshold
     116#% type: integer
     117#% description: threshold for cleaning small areas from cloud mask
     118#% required : yes
     119#% answer: 50000
     120#% guisection: Output
     121#%end
     122#%option
     123#% key: shadow_threshold
     124#% type: integer
     125#% description: threshold for cleaning small areas from shadow mask
     126#% required : yes
     127#% answer: 10000
    112128#% guisection: Output
    113129#%end
     
    219235    f_bands = {}
    220236    scale_fac = options['scale_fac']
    221     cloud_clean_T = 50000
    222     shadow_clean_T = 10000
     237    cloud_threshold = options['cloud_threshold']
     238    shadow_threshold = options['shadow_threshold']
    223239    raster_max = {}
    224240    cloud_mask = options['cloud_mask']
     
    264280        gscript.warning(_('Any rescale factor has been applied'))
    265281        for key, b in bands.items():
    266             if gscript.raster_info(b)['datatype'] != "DCELL":
    267                 gscript.fatal("Raster maps must be double")
     282            if gscript.raster_info(b)['datatype'] != "DCELL" and gscript.raster_info(b)['datatype'] != "FCELL":
     283                gscript.fatal("Raster maps must be DCELL o FCELL")
    268284            else:
    269285                f_bands = bands
     
    310326        fourth_rule,
    311327        fifth_rule)
    312     expr_c = '{} = if({}, 0, null( ))'.format(
     328    expr_c = '{} = if({}, 0, null())'.format(
    313329        tmp["cloud_def"],
    314330        cloud_rules)
     
    325341        output=cloud_mask,
    326342        tool='rmarea',
    327         threshold=cloud_clean_T)
     343        threshold=cloud_threshold)
    328344    gscript.message(_('--- Finish cloud detection procedure ---'))
    329345    ### end of Clouds detection ####
     
    354370            sixth_rule,
    355371            seventh_rule)
    356         expr_s = '{} = if({}, 0, null( ))'.format(
     372        expr_s = '{} = if({}, 0, null())'.format(
    357373            tmp["shadow_temp"],
    358374            shadow_rules)
     
    370386            output=tmp["shadow_temp_mask"],
    371387            tool='rmarea',
    372             threshold=shadow_clean_T)
     388            threshold=shadow_threshold)
    373389        gscript.message(_('--- Finish Shadows detection procedure ---'))
    374390        ### end of shadows detection ###
Note: See TracChangeset for help on using the changeset viewer.