def __check_depth()

in parquet_flask/io_logic/parquet_query_condition_management_v4.py [0:0]


    def __check_depth(self):
        if self.__query_props.min_depth is None and self.__query_props.max_depth is None:
            return
        depth_conditions = []
        include_subsurface = None
        if self.__query_props.min_depth is not None:
            LOGGER.debug(f'setting depth min condition: {self.__query_props.min_depth}')
            depth_conditions.append(f"{CDMSConstants.depth_col} >= {self.__query_props.min_depth}")
            include_subsurface = True if self.__query_props.min_depth <= 0 else False
        if self.__query_props.max_depth is not None:
            LOGGER.debug(f'setting depth max condition: {self.__query_props.max_depth}')
            depth_conditions.append(f"{CDMSConstants.depth_col} <= {self.__query_props.max_depth}")
            if include_subsurface is None or include_subsurface is True:
                include_subsurface = True if self.__query_props.max_depth >= 0 else False
        append_conditions = f"({' AND '.join(depth_conditions) })"
        if include_subsurface is True:
            append_conditions = f"( {append_conditions} OR {CDMSConstants.depth_col} == {self.__missing_depth_value} )"
        self.__conditions.append(append_conditions)
        return