def METHOD_NAME(self, data, lats, lons, valid_time, init_time):
    """
    """
    # Check if required data is available.
    self.data_units = self.driver.data_units.copy()
    for datatype, dataitem, dataunit in self.required_datafields:
        if dataitem not in data:
            raise KeyError(f"required data field '{dataitem}' not found")
        origunit = self.driver.data_units[dataitem]
        if dataunit is not None:
            data[dataitem] = convert_to(data[dataitem], origunit, dataunit)
            self.data_units[dataitem] = dataunit
        else:
            logging.debug("Please add units to plot variables")
    # Copy parameters to properties.
    self.data = data
    self.lats = lats
    self.lons = lons
    self.valid_time = valid_time
    self.init_time = init_time
    # Derive additional data fields and make the plot.
    self._prepare_datafields()
    impl = getDOMImplementation()
    xmldoc = impl.createDocument(None, "MSS_LinearSection_Data", None)
    # Title of this section.
    node = xmldoc.createElement("Title")
    node.appendChild(xmldoc.createTextNode(self.title))
    xmldoc.documentElement.appendChild(node)
    # Time information of this section.
    if self.valid_time is not None:
        node = xmldoc.createElement("ValidTime")
        node.appendChild(xmldoc.createTextNode(self.valid_time.strftime("%Y-%m-%dT%H:%M:%SZ")))
        xmldoc.documentElement.appendChild(node)
    if self.init_time is not None:
        node = xmldoc.createElement("InitTime")
        node.appendChild(xmldoc.createTextNode(self.init_time.strftime("%Y-%m-%dT%H:%M:%SZ")))
        xmldoc.documentElement.appendChild(node)
    # Longitude data.
    node = xmldoc.createElement("Longitude")
    node.setAttribute("num_waypoints", f"{len(self.lons)}")
    data_str = ",".join([str(lon) for lon in self.lons])
    node.appendChild(xmldoc.createTextNode(data_str))
    xmldoc.documentElement.appendChild(node)
    # Latitude data.
    node = xmldoc.createElement("Latitude")
    node.setAttribute("num_waypoints", f"{len(self.lats)}")
    data_str = ",".join([str(lat) for lat in self.lats])
    node.appendChild(xmldoc.createTextNode(data_str))
    xmldoc.documentElement.appendChild(node)
    # Variable data.
    node = xmldoc.createElement("Data")
    node.setAttribute("num_waypoints", f"{len(self.y_values)}")
    node.setAttribute("unit", self.unit)
    if isinstance(self.y_values[0], Quantity):
        data_str = ",".join([str(val.magnitude) for val in self.y_values])
    else:
        data_str = ",".join([str(val) for val in self.y_values])
    node.appendChild(xmldoc.createTextNode(data_str))
    xmldoc.documentElement.appendChild(node)
    # Return the XML document as formatted string.
    return xmldoc.toprettyxml(indent="  ")