def _write(self, session, openFile, maskMap):
        FIRST_VALUE_INDEX = 12
        openFile.write('DATASET\r\n')
        if self.type == self.SCALAR_TYPE:
            openFile.write('OBJTYPE {0}\r\n'.format(self.objectType))
            openFile.write('BEGSCL\r\n')
        elif self.type == self.VECTOR_TYPE:
            openFile.write('VECTYPE {0}\r\n'.format(self.vectorType))
            openFile.write('BEGVEC\r\n')
        openFile.write('OBJID {0}\r\n'.format(self.objectID))
        openFile.write('ND {0}\r\n'.format(self.numberData))
        openFile.write('NC {0}\r\n'.format(self.numberCells))
        openFile.write('NAME {0}\r\n'.format(self.name))
        statusString = ''
        if isinstance(maskMap, RasterMapFile):
            statusGrassRasterString = maskMap.getAsGrassAsciiGrid(session)
            if statusGrassRasterString is not None:
                statusValues = statusGrassRasterString.split()
            else:
                statusValues = maskMap.rasterText.split()
            for i in range(FIRST_VALUE_INDEX, len(statusValues)):
                statusString += statusValues[i] + '\r\n'
        for timeStepRaster in self.rasters:
            openFile.write('TS {0} {1}\r\n'.format(timeStepRaster.iStatus, timeStepRaster.timestamp))
            if timeStepRaster.iStatus == 1:
                openFile.write(statusString)
            valueString = timeStepRaster.getAsWmsDatasetString(session)
            if valueString is not None:
                openFile.write(valueString)
            else:
                openFile.write(timeStepRaster.rasterText)
        openFile.write('ENDDS\r\n')