@@ -687,6 +687,22 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user)
687687 }
688688 )
689689
690+ if (
691+ model .mp_height is not None
692+ and model .measuring_point_height_ft is not None
693+ and model .mp_height != model .measuring_point_height_ft
694+ ):
695+ raise ValueError (
696+ "Conflicting values for measuring point height: mp_height and measuring_point_height_ft"
697+ )
698+
699+ if model .measuring_point_height_ft is not None :
700+ universal_mp_height = model .measuring_point_height_ft
701+ elif model .mp_height is not None :
702+ universal_mp_height = model .mp_height
703+ else :
704+ universal_mp_height = None
705+
690706 data = CreateWell (
691707 location_id = loc .id ,
692708 group_id = group .id ,
@@ -695,7 +711,7 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user)
695711 well_depth = model .total_well_depth_ft ,
696712 well_depth_source = model .depth_source ,
697713 well_casing_diameter = model .casing_diameter_ft ,
698- measuring_point_height = model . measuring_point_height_ft ,
714+ measuring_point_height = universal_mp_height ,
699715 measuring_point_description = model .measuring_point_description ,
700716 well_completion_date = model .date_drilled ,
701717 well_completion_date_source = model .completion_source ,
@@ -839,7 +855,7 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user)
839855 value = model .depth_to_water_ft ,
840856 unit = "ft" ,
841857 observation_datetime = model .measurement_date_time ,
842- measuring_point_height = model . mp_height ,
858+ measuring_point_height = universal_mp_height ,
843859 groundwater_level_reason = (
844860 model .level_status .value
845861 if hasattr (model .level_status , "value" )
0 commit comments