def map_height_diff(map_features, target=10):
        """Compute the height difference in a map.

        Args:
            map_features: The map feature dict of a scenario.
            target: The target height difference, default to 10. If we find height difference > 10, we will return 10
                immediately. This can be used to accelerate computing if we are filtering a batch of scenarios.

        Returns:
            (float) The height difference in the map feature, or the target height difference if the diff > target.
        """
        max = -math.inf
        min = math.inf
        for feature in map_features.values():
            if not MetaDriveType.is_road_line(feature[ScenarioDescription.TYPE]):
                continue
            polyline = feature[ScenarioDescription.POLYLINE]
            if len(polyline[0]) == 3:
                z = np.asarray(polyline)[..., -1]
                z_max = np.max(z)
                if z_max > max:
                    max = z_max
                z_min = np.min(z)
                if z_min < min:
                    min = z_min
            if max - min > target:
                break
        return float(max - min)
Compute the height difference in a map.

        Args:
            map_features: The map feature dict of a scenario.
            target: The target height difference, default to 10. If we find height difference > 10, we will return 10
                immediately. This can be used to accelerate computing if we are filtering a batch of scenarios.

        Returns:
            (float) The height difference in the map feature, or the target height difference if the diff > target.
        
metadrive/scenario/scenario_description.py