Changeset 806

Show
Ignore:
Timestamp:
06/29/11 11:08:36 (23 months ago)
Author:
jjr8
Message:

Continued to work on FEET.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/FisheryAnalysis/FEET.py

    r805 r806  
    295295 
    296296                    fisheryID = cursor.GetValue(fisheryIDField) 
    297                     Logger.Debug(_(u'')) 
    298                     Logger.Debug(_(u'Processing fishery %(id)s:') % {u'id': str(fisheryID)}) 
    299                     Logger.Debug(_(u'')) 
     297                    Logger.Info(_(u'Creating envelopes for fishery %(id)s.') % {u'id': cls._GetFisheryDisplayName(fisheryID)}) 
    300298 
    301299                    # Start by projecting the geographic fishing zone 
     
    555553            if minDist is not None: 
    556554                minDist = float(minDist) 
    557             Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': str(fisheryID), u'field': minDistField, u'value': repr(minDist)}) 
     555            Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': minDistField, u'value': repr(minDist)}) 
    558556            if minDist is not None and minDist <= 0: 
    559557                minDist = None 
     
    565563            if maxDist is not None: 
    566564                maxDist = float(maxDist) 
    567             Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': str(fisheryID), u'field': maxDistField, u'value': repr(maxDist)}) 
     565            Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': maxDistField, u'value': repr(maxDist)}) 
    568566            if maxDist is not None and maxDist <= 0: 
    569567                maxDist = None 
    570568            if maxDist is not None and minDist is not None and maxDist <= minDist: 
    571                 Logger.Warning(_(u'For fishery %(id)s, the value of the %(f2)s field (%(v2)s) is less than or equal to the value of the %(f1)s field (%(v1)s). This is not allowed. As a consequence, the fishery will not be constrained by distance to %(dn)s.') % {u'id': str(fisheryID), u'f1': minDistField, u'v1': repr(cursor.GetValue(minDistField)), u'f2': maxDistField, u'v2': repr(cursor.GetValue(maxDistField)), u'dn': featureDisplayName}) 
     569                Logger.Warning(_(u'For fishery %(id)s, the value of the %(f2)s field (%(v2)s) is less than or equal to the value of the %(f1)s field (%(v1)s). This is not allowed. As a consequence, the fishery will not be constrained by distance to %(dn)s.') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'f1': minDistField, u'v1': repr(cursor.GetValue(minDistField)), u'f2': maxDistField, u'v2': repr(cursor.GetValue(maxDistField)), u'dn': featureDisplayName}) 
    572570                return None, None 
    573571        else: 
     
    575573 
    576574        if minDist is None and assumeZeroMinDist: 
    577             Logger.Debug(_(u'Fishery %(id)s: Assuming minimum distance to %(dn)s is 0.') % {u'id': str(fisheryID), u'dn': featureDisplayName}) 
     575            Logger.Debug(_(u'Fishery %(id)s: Assuming minimum distance to %(dn)s is 0.') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'dn': featureDisplayName}) 
    578576            minDist = 0. 
    579577 
    580578        if minDist is None and maxDist is None: 
    581             Logger.Debug(_(u'Fishery %(id)s: Not constrained by distance to %(dn)s') % {u'id': str(fisheryID), u'dn': featureDisplayName}) 
     579            Logger.Debug(_(u'Fishery %(id)s: Not constrained by distance to %(dn)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'dn': featureDisplayName}) 
    582580            return None, None 
    583581 
     
    589587            idFieldValue = cursor.GetValue(idFieldInTable) 
    590588            if idFieldValue is None or isinstance(idFieldValue, basestring) and len(idFieldValue.strip()) <= 0: 
    591                 Logger.Debug(_(u'Fishery %(id)s contains a NULL or empty value for the %(field)s field. It will not be constrained by distance to %(dn)s.') % {u'id': str(fisheryID), u'field': idFieldInTable, u'dn': featureDisplayName}) 
     589                Logger.Debug(_(u'Fishery %(id)s contains a NULL or empty value for the %(field)s field. It will not be constrained by distance to %(dn)s.') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': idFieldInTable, u'dn': featureDisplayName}) 
    592590                return None, None 
    593591             
     
    673671            if minValue is not None: 
    674672                minValue = float(minValue) 
    675             Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': str(fisheryID), u'field': minField, u'value': repr(minValue)}) 
     673            Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': minField, u'value': repr(minValue)}) 
    676674        else: 
    677675            minValue = None 
     
    681679            if maxValue is not None: 
    682680                maxValue = float(maxValue) 
    683             Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': str(fisheryID), u'field': maxField, u'value': repr(maxValue)}) 
     681            Logger.Debug(_(u'Fishery %(id)s: %(field)s = %(value)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': maxField, u'value': repr(maxValue)}) 
    684682            if maxValue is not None and minValue is not None and maxValue <= minValue: 
    685                 Logger.Warning(_(u'For fishery %(id)s, the value of the %(f2)s field (%(v2)s) is less than or equal to the value of the %(f1)s field (%(v1)s). This is not allowed. As a consequence, the fishery will not be constrained by %(dn)s.') % {u'id': str(fisheryID), u'f1': minField, u'v1': repr(cursor.GetValue(minField)), u'f2': maxField, u'v2': repr(cursor.GetValue(maxField)), u'dn': rasterDisplayName}) 
     683                Logger.Warning(_(u'For fishery %(id)s, the value of the %(f2)s field (%(v2)s) is less than or equal to the value of the %(f1)s field (%(v1)s). This is not allowed. As a consequence, the fishery will not be constrained by %(dn)s.') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'f1': minField, u'v1': repr(cursor.GetValue(minField)), u'f2': maxField, u'v2': repr(cursor.GetValue(maxField)), u'dn': rasterDisplayName}) 
    686684                return None 
    687685        else: 
     
    689687 
    690688        if minValue is None and maxValue is None: 
    691             Logger.Debug(_(u'Fishery %(id)s: Not constrained by %(dn)s') % {u'id': str(fisheryID), u'dn': rasterDisplayName}) 
     689            Logger.Debug(_(u'Fishery %(id)s: Not constrained by %(dn)s') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'dn': rasterDisplayName}) 
    692690            return None 
    693691 
     
    698696            raster = cursor.GetValue(rasterField) 
    699697            if unclippedRaster is None or isinstance(rasterField, basestring) and len(unclippedRaster.strip()) <= 0: 
    700                 Logger.Debug(_(u'Fishery %(id)s contains a NULL or empty value for the %(field)s field. It will not be constrained by %(dn)s.') % {u'id': str(fisheryID), u'field': rasterField, u'dn': rasterDisplayName}) 
     698                Logger.Debug(_(u'Fishery %(id)s contains a NULL or empty value for the %(field)s field. It will not be constrained by %(dn)s.') % {u'id': cls._GetFisheryDisplayName(fisheryID), u'field': rasterField, u'dn': rasterDisplayName}) 
    701699                return None 
    702700 
     
    800798        return s 
    801799 
     800    @classmethod 
     801    def _GetFisheryDisplayName(cls, fisheryID): 
     802        if isinstance(fisheryID, float): 
     803            s = str(fisheryID) 
     804            if s.endswith('.0'): 
     805                s = s[:-2] 
     806            else: 
     807                s.replace('+', '') 
     808            return s 
     809         
     810        return str(fisheryID) 
     811 
    802812 
    803813############################################################################### 
     
    10691079    typeMetadata=BooleanTypeMetadata(), 
    10701080    description=_( 
    1071 u"""If true, edges of the envelope polygons that are constrained by 
    1072 bathymetry will be "simplified" according to the rules described in 
     1081u"""If true, edges of fishing envelope polygons that are constrained 
     1082by bathymetry will be "simplified" according to the rules described in 
    10731083the documentation of the ArcGIS's Raster To Polygon tool. 
    10741084 
     
    10771087"blocky". 
    10781088 
    1079 The choice of this parameter depends on research goals and personal 
    1080 preference. If the envelope encloses many cells of the bathymetry 
    1081 raster (i.e. the bathymetry is fairly high resolution relative to the 
    1082 size of the fishing zones), then the simplified edges might be 
    1083 smoother than the blocky unsimplified edges. But if the envelope only 
    1084 encloses a few cells of the bathymetry raster, the simplified edges 
    1085 might be too jagged, with too many acute angles."""), 
    1086     arcGISDisplayName=_(u'Simplify bathymetry-constrained edges of the envelope'), 
     1089The choice of this parameter depends on your research goals and 
     1090personal preference. If the envelope encloses many cells of the 
     1091bathymetry raster (i.e. the bathymetry is fairly high resolution 
     1092relative to the size of the fishing zones), then the simplified edges 
     1093might be smoother than the blocky unsimplified edges. But if the 
     1094envelope only encloses a few cells of the bathymetry raster, the 
     1095simplified edges might be too jagged, with too many acute angles."""), 
     1096    arcGISDisplayName=_(u'Simplify bathymetry-constrained edges of fishing envelopes'), 
    10871097    arcGISCategory=_(u'Constrain fishing envelopes by bathymetry')) 
    10881098