Changeset 806
- Timestamp:
- 06/29/11 11:08:36 (23 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
MGET/Branches/Jason/PythonPackage/src/GeoEco/FisheryAnalysis/FEET.py
r805 r806 295 295 296 296 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)}) 300 298 301 299 # Start by projecting the geographic fishing zone … … 555 553 if minDist is not None: 556 554 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)}) 558 556 if minDist is not None and minDist <= 0: 559 557 minDist = None … … 565 563 if maxDist is not None: 566 564 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)}) 568 566 if maxDist is not None and maxDist <= 0: 569 567 maxDist = None 570 568 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}) 572 570 return None, None 573 571 else: … … 575 573 576 574 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}) 578 576 minDist = 0. 579 577 580 578 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}) 582 580 return None, None 583 581 … … 589 587 idFieldValue = cursor.GetValue(idFieldInTable) 590 588 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}) 592 590 return None, None 593 591 … … 673 671 if minValue is not None: 674 672 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)}) 676 674 else: 677 675 minValue = None … … 681 679 if maxValue is not None: 682 680 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)}) 684 682 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}) 686 684 return None 687 685 else: … … 689 687 690 688 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}) 692 690 return None 693 691 … … 698 696 raster = cursor.GetValue(rasterField) 699 697 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}) 701 699 return None 702 700 … … 800 798 return s 801 799 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 802 812 803 813 ############################################################################### … … 1069 1079 typeMetadata=BooleanTypeMetadata(), 1070 1080 description=_( 1071 u"""If true, edges of the envelope polygons that are constrained by1072 b athymetry will be "simplified" according to the rules described in1081 u"""If true, edges of fishing envelope polygons that are constrained 1082 by bathymetry will be "simplified" according to the rules described in 1073 1083 the documentation of the ArcGIS's Raster To Polygon tool. 1074 1084 … … 1077 1087 "blocky". 1078 1088 1079 The choice of this parameter depends on research goals and personal1080 p reference. If the envelope encloses many cells of the bathymetry1081 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 en closes a few cells of the bathymetry raster, the simplified edges1085 might be too jagged, with too many acute angles."""),1086 arcGISDisplayName=_(u'Simplify bathymetry-constrained edges of the envelope'),1089 The choice of this parameter depends on your research goals and 1090 personal preference. If the envelope encloses many cells of the 1091 bathymetry raster (i.e. the bathymetry is fairly high resolution 1092 relative to the size of the fishing zones), then the simplified edges 1093 might be smoother than the blocky unsimplified edges. But if the 1094 envelope only encloses a few cells of the bathymetry raster, the 1095 simplified edges might be too jagged, with too many acute angles."""), 1096 arcGISDisplayName=_(u'Simplify bathymetry-constrained edges of fishing envelopes'), 1087 1097 arcGISCategory=_(u'Constrain fishing envelopes by bathymetry')) 1088 1098
