diff --git a/src/cm95pbf/csp.py b/src/cm95pbf/csp.py index a35bac2..570fda3 100644 --- a/src/cm95pbf/csp.py +++ b/src/cm95pbf/csp.py @@ -448,7 +448,8 @@ def resolve_udwhaz03_instruction( associated_depth_ranges: list[dict[str, Any]] | None = None, ) -> tuple[str, dict[str, Any]]: danger = False - expsou = _int_attr(attrs, "EXPSOU", 0) + # Fixed OpenCPN reads EXPSOU only when the derived depth is UNKNOWN. + expsou = _int_attr(attrs, "EXPSOU", 0) if depth_value is None else 0 if depth_value is None and expsou != 1: danger = True if not danger and ( diff --git a/web/s52_runtime_executor.js b/web/s52_runtime_executor.js index 0d3c6f0..3427c40 100644 --- a/web/s52_runtime_executor.js +++ b/web/s52_runtime_executor.js @@ -44,7 +44,7 @@ class LightLabelState{ this.lastDescription=description;return {emit:Boolean(description),yoff:1}; } } -function hazardIsolated(props,settings){const depth=numberValue(props,"s52_hazard_depth_m",null),expsou=numberValue(props,"s52_expsou_code",0);let danger=depth===null&&expsou!==1;if(!danger&&(expsou===1||(depth!==null&&depth<=settings.safetyContourM))){const surrounding=numberValue(props,"s52_surrounding_max_drval1_m",null);if(surrounding!==null&&surrounding>=settings.safetyContourM&&expsou!==1)danger=true;}return danger;} +function hazardIsolated(props,settings){const depth=numberValue(props,"s52_hazard_depth_m",null),expsou=depth===null?numberValue(props,"s52_expsou_code",0):0;let danger=depth===null&&expsou!==1;if(!danger&&(expsou===1||(depth!==null&&depth<=settings.safetyContourM))){const surrounding=numberValue(props,"s52_surrounding_max_drval1_m",null);if(surrounding!==null&&surrounding>=settings.safetyContourM&&expsou!==1)danger=true;}return danger;} function hazardRules(props,settings){ const csp=String(props.s52_runtime_csp||""),geom=String(props.s52_source_geometry||"POINT").toUpperCase(),objectClass=String(props.s52_source_object_class||""); const watlev=numberValue(props,"s52_watlev_code",-9),quapos=numberValue(props,"s52_quapos_code",0),valsouPresent=numberValue(props,"s52_valsou_present",0)===1,valsou=valsouPresent?numberValue(props,"s52_valsou_m",null):null,quasou7=listValue(props.s52_quasou_codes).includes(7);